# Create FIM Completion (Beta)

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /beta/completions:
    post:
      summary: Create FIM Completion (Beta)
      deprecated: false
      description: >-
        The FIM (Fill-In-the-Middle) Completion API. User must set
        `base_url="https://api.deepseek.com/beta"` to use this feature.
      tags:
        - API Reference
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: ID of the model to use.
                prompt:
                  type: string
                  description: The prompt to generate completions for.
                echo:
                  type: boolean
                  description: Echo back the prompt in addition to the completion
                  nullable: true
                frequency_penalty:
                  type: number
                  description: >-
                    Number between -2.0 and 2.0. Positive values penalize new
                    tokens based on their existing frequency in the text so far,
                    decreasing the model's likelihood to repeat the same line
                    verbatim.
                  nullable: true
                logprobs:
                  type: integer
                  description: >-
                    Include the log probabilities on the logprobs most likely
                    output tokens, as well the chosen tokens. For example, if
                    logprobs is 20, the API will return a list of the 20 most
                    likely tokens. The API will always return the logprob of the
                    sampled token, so there may be up to logprobs+1 elements in
                    the response.


                    The maximum value for logprobs is 20.
                  nullable: true
                max_tokens:
                  type: integer
                  description: >-
                    The maximum number of tokens that can be generated in the
                    completion.
                  nullable: true
                presence_penalty:
                  type: integer
                  description: >-
                    Number between -2.0 and 2.0. Positive values penalize new
                    tokens based on whether they appear in the text so far,
                    increasing the model's likelihood to talk about new topics.
                  nullable: true
                stop:
                  type: 'null'
                stream:
                  type: boolean
                  nullable: true
                stream_options:
                  type: 'null'
                suffix:
                  type: string
                  nullable: true
                temperature:
                  type: number
                  nullable: true
                top_p:
                  type: number
                  nullable: true
              required:
                - model
                - prompt
              x-apidog-orders:
                - 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: {}
                                x-apidog-orders: []
                          required:
                            - text_offset
                            - token_logprobs
                            - tokens
                            - top_logprobs
                          x-apidog-orders:
                            - text_offset
                            - token_logprobs
                            - tokens
                            - top_logprobs
                        text:
                          type: string
                      x-apidog-orders:
                        - finish_reason
                        - index
                        - logprobs
                        - text
                  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
                        x-apidog-orders:
                          - reasoning_tokens
                    required:
                      - completion_tokens
                      - prompt_tokens
                      - prompt_cache_hit_tokens
                      - prompt_cache_miss_tokens
                      - total_tokens
                      - completion_tokens_details
                    x-apidog-orders:
                      - 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
                x-apidog-orders:
                  - 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: {}
          x-apidog-name: Success
      security:
        - bearer: []
          x-apidog:
            required: true
            schemeGroups:
              - id: n8qJSdwi83VLcgtIOHMrr
                schemeIds:
                  - bearer
            use:
              id: n8qJSdwi83VLcgtIOHMrr
      x-apidog-folder: API Reference
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/806570/apis/api-13759436-run
components:
  schemas: {}
  securitySchemes:
    bearer:
      type: bearer
      scheme: bearer
servers:
  - url: https://api.deepseek.com
    description: Prod Env
security:
  - bearer: []
    x-apidog:
      required: true
      schemeGroups:
        - id: n8qJSdwi83VLcgtIOHMrr
          schemeIds:
            - bearer
      use:
        id: n8qJSdwi83VLcgtIOHMrr

```
