> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hhw31.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create FIM Completion (Beta)

> The FIM (Fill-In-the-Middle) Completion API. User must set `base_url="https://api.deepseek.com/beta"` to use this feature.



## OpenAPI

````yaml post /beta/completions
openapi: 3.1.0
info:
  title: DeepSeek API
  description: ''
  version: 1.0.0
servers:
  - url: https://api.deepseek.com/
    description: Prod Env
security: []
paths:
  /beta/completions:
    post:
      summary: Create FIM Completion (Beta)
      description: >-
        The FIM (Fill-In-the-Middle) Completion API. User must set
        `base_url="https://api.deepseek.com/beta"` to use this feature.
      parameters:
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: ''
          required: true
          example: Bearer {{API_KEY}}
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                prompt:
                  type: string
                echo:
                  type: boolean
                frequency_penalty:
                  type: integer
                logprobs:
                  type: integer
                max_tokens:
                  type: integer
                presence_penalty:
                  type: integer
                stop:
                  type: 'null'
                stream:
                  type: boolean
                stream_options:
                  type: 'null'
                suffix:
                  type: 'null'
                temperature:
                  type: integer
                top_p:
                  type: integer
              required:
                - model
                - prompt
                - echo
                - frequency_penalty
                - logprobs
                - max_tokens
                - presence_penalty
                - stop
                - stream
                - stream_options
                - suffix
                - temperature
                - top_p
            example:
              model: deepseek-chat
              prompt: 'Once upon a time, '
              echo: false
              frequency_penalty: 0
              logprobs: 0
              max_tokens: 1024
              presence_penalty: 0
              stop: null
              stream: false
              stream_options: null
              suffix: null
              temperature: 1
              top_p: 1
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        finish_reason:
                          type: string
                        index:
                          type: integer
                        logprobs:
                          type: object
                          properties:
                            text_offset:
                              type: array
                              items:
                                type: integer
                            token_logprobs:
                              type: array
                              items:
                                type: integer
                            tokens:
                              type: array
                              items:
                                type: string
                            top_logprobs:
                              type: array
                              items:
                                type: object
                                properties: {}
                          required:
                            - text_offset
                            - token_logprobs
                            - tokens
                            - top_logprobs
                        text:
                          type: string
                  created:
                    type: integer
                  model:
                    type: string
                  system_fingerprint:
                    type: string
                  object:
                    type: string
                  usage:
                    type: object
                    properties:
                      completion_tokens:
                        type: integer
                      prompt_tokens:
                        type: integer
                      prompt_cache_hit_tokens:
                        type: integer
                      prompt_cache_miss_tokens:
                        type: integer
                      total_tokens:
                        type: integer
                      completion_tokens_details:
                        type: object
                        properties:
                          reasoning_tokens:
                            type: integer
                        required:
                          - reasoning_tokens
                    required:
                      - completion_tokens
                      - prompt_tokens
                      - prompt_cache_hit_tokens
                      - prompt_cache_miss_tokens
                      - total_tokens
                      - completion_tokens_details
                required:
                  - id
                  - choices
                  - created
                  - model
                  - system_fingerprint
                  - object
                  - usage
              example:
                id: string
                choices:
                  - finish_reason: stop
                    index: 0
                    logprobs:
                      text_offset:
                        - 0
                      token_logprobs:
                        - 0
                      tokens:
                        - string
                      top_logprobs:
                        - {}
                    text: string
                created: 0
                model: string
                system_fingerprint: string
                object: text_completion
                usage:
                  completion_tokens: 0
                  prompt_tokens: 0
                  prompt_cache_hit_tokens: 0
                  prompt_cache_miss_tokens: 0
                  total_tokens: 0
                  completion_tokens_details:
                    reasoning_tokens: 0
          headers: {}
      deprecated: false
      security:
        - bearer: []
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````