> ## Documentation Index
> Fetch the complete documentation index at: https://evo-0136956d.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Completion

> 基于给定提示创建文本补全



## OpenAPI

````yaml /en/openapi/relay-api.mintlify.json post /v1/completions
openapi: 3.0.1
info:
  title: AI Relay API
  description: 统一的 AI Model 调用接口，支持 OpenAI、Claude、Gemini、Kling、即梦等多种格式
  version: 1.0.0
  license:
    name: Proprietary
    url: https://example.com/license
servers:
  - url: https://token.nusabase.com/silver
    description: API Base URL
security:
  - BearerAuth: []
tags:
  - name: Models
    description: Models endpoints
  - name: Chat
    description: Chat endpoints
  - name: Responses
    description: Responses endpoints
  - name: Realtime
    description: Realtime endpoints
  - name: Claude
    description: Claude endpoints
  - name: Gemini
    description: Gemini endpoints
  - name: Images
    description: Images endpoints
  - name: Video
    description: Video endpoints
  - name: Video / Kling
    description: Video / Kling endpoints
  - name: Video / Jimeng
    description: Video / Jimeng endpoints
  - name: Audio
    description: Audio endpoints
  - name: Embeddings
    description: Embeddings endpoints
  - name: Rerank
    description: Rerank endpoints
  - name: Moderations
    description: Moderations endpoints
  - name: Not Implemented
    description: Not Implemented endpoints
paths:
  /v1/completions:
    post:
      tags:
        - Chat
      summary: Create Completion
      description: 基于给定提示创建文本补全
      operationId: post_v1_completions
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompletionRequest'
        required: true
      responses:
        '200':
          description: Response created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompletionResponse'
          headers: {}
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    CompletionRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
        prompt:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        max_tokens:
          type: integer
        temperature:
          type: number
        top_p:
          type: number
        'n':
          type: integer
        stream:
          type: boolean
        stop:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        suffix:
          type: string
        echo:
          type: boolean
        frequency_penalty:
          type: number
          description: 频率惩罚 (-2.0 到 2.0)
        presence_penalty:
          type: number
          description: 存在惩罚 (-2.0 到 2.0)
        seed:
          type: number
          description: 随机种子
        user:
          type: string
          description: User 标识
    CompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: text_completion
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              text:
                type: string
              index:
                type: integer
              finish_reason:
                type: string
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: 错误 Profile
            type:
              type: string
              description: 错误类型
            param:
              type: string
              description: 相关参数
              nullable: true
            code:
              type: string
              description: 错误代码
              nullable: true
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
          description: Prompt Token 数
        completion_tokens:
          type: integer
          description: 补全 Token 数
        total_tokens:
          type: integer
          description: 总 Token 数
        prompt_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
            text_tokens:
              type: integer
            audio_tokens:
              type: integer
            image_tokens:
              type: integer
        completion_tokens_details:
          type: object
          properties:
            text_tokens:
              type: integer
            audio_tokens:
              type: integer
            reasoning_tokens:
              type: integer
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.