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

# kimi-k3

> Creates a Kimi K3 response for a conversation. K3 supports a 1M-token context window, text/image input, always-on reasoning, streaming, structured output, Partial Mode, and function tools. Configure reasoning with reasoning_effort. The K2.x thinking object has no effect. Do not send fixed sampling parameters.

Kimi K3 supports a 1M-token context window, text/image input, always-on reasoning with configurable effort, streaming, structured output, Partial Mode, and function tools.

<Note>
  Use top-level `reasoning_effort`; the K2.x `thinking` object has no effect. Sampling values are fixed, so omit `temperature`, `top_p`, `n`, `presence_penalty`, and `frequency_penalty`.
</Note>


## OpenAPI

````yaml api-reference/model-api/moonshot/openapi/kimi-k3/openapi.yaml POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Kimi K3
  description: Kimi K3 flagship multimodal model through the AnyFast OpenAI-compatible API.
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /v1/chat/completions:
    post:
      summary: Create chat completion
      description: >-
        Creates a Kimi K3 response for a conversation. K3 supports a 1M-token
        context window, text/image input, always-on reasoning, streaming,
        structured output, Partial Mode, and function tools. Configure reasoning
        with reasoning_effort. The K2.x thinking object has no effect. Do not
        send fixed sampling parameters.
      operationId: createChatCompletionKimiK3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  enum:
                    - kimi-k3
                  default: kimi-k3
                  description: Model ID. Must be kimi-k3.
                messages:
                  type: array
                  minItems: 1
                  description: >-
                    Conversation history. Return complete assistant messages,
                    including reasoning, reasoning_details, and tool_calls, in
                    later turns.
                  items:
                    $ref: '#/components/schemas/Message'
                reasoning_effort:
                  type: string
                  enum:
                    - low
                    - high
                    - max
                  default: max
                  description: >-
                    Controls reasoning effort. K3 always reasons with Preserved
                    Thinking enabled; reasoning cannot be disabled.
                max_completion_tokens:
                  type: integer
                  minimum: 1
                  maximum: 1048576
                  default: 131072
                  description: >-
                    Maximum output tokens. Input plus output must fit the
                    1M-token context window. max_tokens is deprecated.
                response_format:
                  $ref: '#/components/schemas/ResponseFormat'
                stop:
                  oneOf:
                    - type: string
                    - type: array
                      maxItems: 5
                      items:
                        type: string
                  description: >-
                    Up to 5 stop strings; each string must not exceed 32 bytes.
                    A stop string can terminate reasoning before final content
                    is produced.
                stream:
                  type: boolean
                  default: false
                  description: Stream partial deltas using Server-Sent Events.
                stream_options:
                  type: object
                  description: Options for streaming responses.
                  properties:
                    include_usage:
                      type: boolean
                      default: false
                      description: Include total token usage in the final stream chunk.
                tools:
                  type: array
                  description: Function tools available to the model.
                  items:
                    $ref: '#/components/schemas/ToolDefinition'
                tool_choice:
                  type: string
                  enum:
                    - auto
                    - none
                    - required
                  default: auto
                  description: >-
                    Let the model decide, disable tool calls, or require at
                    least one tool call.
                prompt_cache_key:
                  type: string
                  description: >-
                    Stable session or task ID used to improve prefix-cache hit
                    rates.
                safety_identifier:
                  type: string
                  description: >-
                    Stable identifier for the end user. Use a hash instead of
                    directly identifying information.
            examples:
              basic:
                summary: Basic request
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content: Explain Kimi K3 in one sentence.
                  reasoning_effort: max
              vision:
                summary: Image input
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content:
                        - type: image_url
                          image_url:
                            url: data:image/png;base64,iVBORw0KGgo...
                        - type: text
                          text: Describe this image.
              structured:
                summary: Strict JSON Schema
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content: Lin is 28 years old. Extract the name and age.
                  response_format:
                    type: json_schema
                    json_schema:
                      name: person
                      strict: true
                      schema:
                        type: object
                        properties:
                          name:
                            type: string
                          age:
                            type: integer
                        required:
                          - name
                          - age
                        additionalProperties: false
      responses:
        '200':
          description: >-
            Completion generated successfully. When stream is true, the endpoint
            returns chat.completion.chunk objects using SSE and ends with data:
            [DONE].
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletion'
              example:
                id: cmpl-kimi-k3-example
                object: chat.completion
                created: 1784736000
                model: moonshotai/kimi-k3
                choices:
                  - index: 0
                    message:
                      role: assistant
                      reasoning: The user requested a concise introduction.
                      reasoning_details:
                        - type: reasoning.text
                          text: The user requested a concise introduction.
                          format: unknown
                          index: 0
                      content: >-
                        Kimi K3 is Moonshot AI's flagship multimodal reasoning
                        model with a 1M-token context window.
                    finish_reason: stop
                usage:
                  prompt_tokens: 18
                  completion_tokens: 32
                  total_tokens: 50
                  prompt_tokens_details:
                    cached_tokens: 0
        '400':
          description: Invalid request or unsupported parameter value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit or quota exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Message:
      type: object
      required:
        - role
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
          description: Message author.
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentPart'
            - type: 'null'
          description: Plain text or an array of text/image parts.
        name:
          type: string
          description: Optional participant name.
        partial:
          type: boolean
          description: >-
            Set true on the final assistant message to continue from its content
            prefix.
        reasoning:
          type: string
          description: >-
            Reasoning returned by K3. Preserve it unchanged in multi-turn
            history.
        reasoning_details:
          type: array
          description: Structured reasoning details returned with the response.
          items:
            $ref: '#/components/schemas/ReasoningDetail'
        tool_calls:
          type: array
          description: Tool calls returned by an assistant message.
          items:
            $ref: '#/components/schemas/ToolCall'
        tool_call_id:
          type: string
          description: Required for a tool result; must match the tool call ID.
    ResponseFormat:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
            - json_object
            - json_schema
          default: text
        json_schema:
          type: object
          description: Required when type is json_schema.
          required:
            - name
            - schema
          properties:
            name:
              type: string
            strict:
              type: boolean
              default: true
            schema:
              type: object
              additionalProperties: true
    ToolDefinition:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
        function:
          type: object
          required:
            - name
            - parameters
          properties:
            name:
              type: string
              pattern: ^[a-zA-Z_][a-zA-Z0-9-_]{2,63}$
            description:
              type: string
            parameters:
              type: object
              description: Function parameters expressed as JSON Schema.
              additionalProperties: true
    ChatCompletion:
      type: object
      required:
        - id
        - object
        - created
        - model
        - choices
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - chat.completion
        created:
          type: integer
          description: Unix timestamp.
        model:
          type: string
          description: The response may use the upstream canonical model ID.
          example: moonshotai/kimi-k3
        provider:
          type: string
          example: Moonshot AI
        system_fingerprint:
          type:
            - string
            - 'null'
        service_tier:
          type:
            - string
            - 'null'
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                type: object
                properties:
                  role:
                    type: string
                    enum:
                      - assistant
                  content:
                    type:
                      - string
                      - 'null'
                  refusal:
                    type:
                      - string
                      - 'null'
                  reasoning:
                    type:
                      - string
                      - 'null'
                  reasoning_details:
                    type: array
                    items:
                      $ref: '#/components/schemas/ReasoningDetail'
                  tool_calls:
                    type: array
                    items:
                      $ref: '#/components/schemas/ToolCall'
              finish_reason:
                type:
                  - string
                  - 'null'
                enum:
                  - stop
                  - length
                  - tool_calls
                  - content_filter
                  - null
              native_finish_reason:
                type:
                  - string
                  - 'null'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            message:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type:
                - string
                - 'null'
    ContentPart:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
        text:
          type: string
          description: Required when type is text.
        image_url:
          oneOf:
            - type: string
            - type: object
              required:
                - url
              properties:
                url:
                  type: string
          description: Public image URL or Base64 data URI.
    ReasoningDetail:
      type: object
      properties:
        type:
          type: string
          example: reasoning.text
        text:
          type: string
        format:
          type: string
          example: unknown
        index:
          type: integer
    ToolCall:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          type: object
          properties:
            name:
              type: string
            arguments:
              type: string
              description: JSON-encoded function arguments.
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
        prompt_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: Tokens served from the automatic context cache.
            cache_write_tokens:
              type: integer
            audio_tokens:
              type: integer
            video_tokens:
              type: integer
        completion_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
            image_tokens:
              type: integer
            audio_tokens:
              type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````