DeepSeek API
๐Ÿ‡บ๐Ÿ‡ธ English
  • ๐Ÿ‡บ๐Ÿ‡ธ English
  • ๐Ÿ‡ฏ๐Ÿ‡ต Japanese
  • ๐Ÿ‡ฐ๐Ÿ‡ท Korea
  • ๐Ÿ‡ต๐Ÿ‡น Portuguese
  1. API Guides
DeepSeek API
๐Ÿ‡บ๐Ÿ‡ธ English
  • ๐Ÿ‡บ๐Ÿ‡ธ English
  • ๐Ÿ‡ฏ๐Ÿ‡ต Japanese
  • ๐Ÿ‡ฐ๐Ÿ‡ท Korea
  • ๐Ÿ‡ต๐Ÿ‡น Portuguese
  • Start quickly
    • Your First API Call
    • Models & Pricing
    • The Temperature Parameter
    • Token & Token Usage
    • Rate Limit
    • Error Codes
  • API Reference
    • Introduction
    • Create Chat Completion
      POST
    • Create FIM Completion (Beta)
      POST
    • Lists Models
      GET
    • Get User Balance
      GET
  • API Guides
    • Reasoning Model (deepseek-reasoner)
    • Multiple rounds of conversations
    • Chat Prefix Completion (Beta)
    • FIM Completion (Beta)
    • JSON Output
    • Function Calling
    • Context Caching
  • FAQ
    • FAQ
  1. API Guides

FIM Completion (Beta)

In FIM (Fill In the Middle) completion, users can provide a prefix and a suffix (optional), and the model will complete the content in between. FIM is commonly used for content completionใ€code completion.

Notice#

1.
The max tokens of FIM completion is 4K.
2.
The user needs to set base_url=https://api.deepseek.com/beta to enable the Beta feature.

Sample Code#

Below is a complete Python code example for FIM completion. In this example, we provide the beginning and the end of a function to calculate the Fibonacci sequence, allowing the model to complete the content in the middle.

Integration With Continue#

Continue is a VSCode plugin that supports code completion. You can refer to this document to configure Continue for using the code completion feature.
Previous
Chat Prefix Completion (Beta)
Next
JSON Output
Built with