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

# OpenAI Chat Completions

> OpenAI-compatible Chat Completions endpoint. Any LinkModel chat model can be
called here with the native OpenAI request/response shape — point an OpenAI
SDK at this base URL and set `model` to one of the supported names.

Set `stream: true` to receive the response as Server-Sent Events
(`text/event-stream`): a sequence of `data: {chunk}` lines whose deltas
accumulate into the final message, terminated by `data: [DONE]`.

### Supported models

| Model | Provider | Details |
| --- | --- | --- |
| `claude-opus-4-7` | Claude | <a href="https://linkmodel.ai/en/models/claude-opus-4-7" target="_blank" rel="noopener">Pricing & specs</a> |
| `deepseek-v4-pro` | DeepSeek | <a href="https://linkmodel.ai/en/models/deepseek-v4-pro" target="_blank" rel="noopener">Pricing & specs</a> |
| `kimi-k2.6` | Moonshot | <a href="https://linkmodel.ai/en/models/kimi-k2.6" target="_blank" rel="noopener">Pricing & specs</a> |




## OpenAPI

````yaml /openapi/chat/_openai-chat-completions.yaml post /chat/completions
openapi: 3.0.3
info:
  title: OpenAI Chat Completions
  version: 1.0.0
  description: OpenAI-compatible Chat Completions endpoint for LinkModel chat models.
servers:
  - url: https://api.linkmodel.ai/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: chat
paths:
  /chat/completions:
    post:
      tags:
        - chat
      summary: OpenAI Chat Completions
      description: >
        OpenAI-compatible Chat Completions endpoint. Any LinkModel chat model
        can be

        called here with the native OpenAI request/response shape — point an
        OpenAI

        SDK at this base URL and set `model` to one of the supported names.


        Set `stream: true` to receive the response as Server-Sent Events

        (`text/event-stream`): a sequence of `data: {chunk}` lines whose deltas

        accumulate into the final message, terminated by `data: [DONE]`.


        ### Supported models


        | Model | Provider | Details |

        | --- | --- | --- |

        | `claude-opus-4-7` | Claude | <a
        href="https://linkmodel.ai/en/models/claude-opus-4-7" target="_blank"
        rel="noopener">Pricing & specs</a> |

        | `deepseek-v4-pro` | DeepSeek | <a
        href="https://linkmodel.ai/en/models/deepseek-v4-pro" target="_blank"
        rel="noopener">Pricing & specs</a> |

        | `kimi-k2.6` | Moonshot | <a
        href="https://linkmodel.ai/en/models/kimi-k2.6" target="_blank"
        rel="noopener">Pricing & specs</a> |
      operationId: openai-chat-completions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  description: >-
                    ID of the chat model to use. Must be one of the supported
                    models listed above.
                  example: claude-opus-4-7
                  enum:
                    - claude-opus-4-7
                    - deepseek-v4-pro
                    - kimi-k2.6
                messages:
                  type: array
                  description: The conversation so far, as an ordered list of messages.
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        description: The role of the message author.
                        enum:
                          - system
                          - user
                          - assistant
                        example: user
                      content:
                        type: string
                        description: The message content.
                        example: Hello, who are you?
                stream:
                  type: boolean
                  description: If true, partial deltas are streamed as Server-Sent Events.
                  default: false
                max_tokens:
                  type: integer
                  description: Maximum number of tokens to generate in the completion.
                  example: 1024
                stop:
                  type: array
                  description: >
                    Up to 4 sequences where the API stops generating further
                    tokens. The generated

                    text will not contain the stop sequence.
                  items:
                    type: string
      responses:
        '200':
          description: >-
            Chat completion result. When `stream` is true, the body is an SSE
            stream instead.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: chatcmpl-abc123
                  object:
                    type: string
                    example: chat.completion
                  created:
                    type: integer
                    description: >-
                      Unix timestamp (seconds) of when the completion was
                      created.
                    example: 1716000000
                  model:
                    type: string
                    example: claude-opus-4-7
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                          example: 0
                        message:
                          type: object
                          properties:
                            role:
                              type: string
                              example: assistant
                            content:
                              type: string
                              example: I'm an AI assistant. How can I help you today?
                        finish_reason:
                          type: string
                          enum:
                            - stop
                            - length
                            - content_filter
                          example: stop
                  usage:
                    type: object
                    properties:
                      prompt_tokens:
                        type: integer
                        example: 12
                      completion_tokens:
                        type: integer
                        example: 18
                      total_tokens:
                        type: integer
                        example: 30
            text/event-stream:
              schema:
                type: string
                description: >
                  SSE stream of `data:` lines. Each line is a JSON chunk with an
                  `object: chat.completion.chunk` and a `choices[].delta`
                  carrying incremental content. The stream ends with `data:
                  [DONE]`.
        '400':
          description: Bad request — invalid or missing parameter.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 400
                  msg:
                    type: string
                    example: model is required
                  request_id:
                    type: string
                    format: uuid
                    example: 96be7a7d-3e81-4916-a6b8-19b32773a693
        '401':
          description: Unauthorized — missing or invalid API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 401
                  msg:
                    type: string
                    example: invalid api key
                  request_id:
                    type: string
                    format: uuid
                    example: bff4c295-c7da-4507-9708-4627cb6373ba
        '500':
          description: >-
            Internal error — completion failed (e.g. insufficient balance or
            upstream error).
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 500
                  msg:
                    type: string
                    example: >-
                      chat completion failed: billing: code=100601: insufficient
                      balance
                  request_id:
                    type: string
                    format: uuid
                    example: 3409f6fb-fa9a-4534-b530-195b5f6f4e32
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````