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

# GPT-5.1 - Complete API Reference

> - Use OpenAI SDK format to call GPT-5.1 series models
- Synchronous processing mode, real-time response
- **Available models**: gpt-5.1 (base), gpt-5.1-chat (optimized for conversation), gpt-5.1-thinking (with reasoning output)
- **Text conversation**: Single or multi-turn contextual dialogue
- **System prompts**: Customize AI role and behavior
- **Multimodal input**: Supports text + image mixed input
- **Tool calling**: Supports Function Calling
- **Reasoning output**: gpt-5.1-thinking returns reasoning_content field showing thought process

<Note>
  **BaseURL**: The default BaseURL is `https://direct.evolink.ai`, which has better support for text models and long-lived connections. `https://api.evolink.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models.
</Note>


## OpenAPI

````yaml /en/api-manual/language-series/gpt-5-1/gpt-5-1-api.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: GPT-5.1 Complete API Reference
  description: >-
    Complete API reference for GPT-5.1 chat interface, including all parameters
    and advanced features
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (recommended)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Chat Completion
    description: AI chat completion related endpoints
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat Completion
      summary: GPT-5.1 Chat Interface
      description: >-
        - Use OpenAI SDK format to call GPT-5.1 series models

        - Synchronous processing mode, real-time response

        - **Available models**: gpt-5.1 (base), gpt-5.1-chat (optimized for
        conversation), gpt-5.1-thinking (with reasoning output)

        - **Text conversation**: Single or multi-turn contextual dialogue

        - **System prompts**: Customize AI role and behavior

        - **Multimodal input**: Supports text + image mixed input

        - **Tool calling**: Supports Function Calling

        - **Reasoning output**: gpt-5.1-thinking returns reasoning_content field
        showing thought process
      operationId: createChatCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple_text:
                summary: Single-turn text conversation
                value:
                  model: gpt-5.1
                  messages:
                    - role: user
                      content: Please introduce yourself
                  temperature: 1
              multi_turn:
                summary: Multi-turn conversation (context understanding)
                value:
                  model: gpt-5.1
                  messages:
                    - role: user
                      content: What is Python?
                    - role: assistant
                      content: Python is a high-level programming language...
                    - role: user
                      content: What are its advantages?
                  temperature: 1
              system_prompt:
                summary: Using system prompts
                value:
                  model: gpt-5.1
                  messages:
                    - role: system
                      content: >-
                        You are a helpful AI assistant. You provide safe,
                        helpful, and accurate answers.
                    - role: user
                      content: What is 1+1?
                  temperature: 1
              vision:
                summary: Multimodal input (text + image)
                value:
                  model: gpt-5.1
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: >-
                            Please describe the scene and main elements in this
                            image in detail.
                        - type: image_url
                          image_url:
                            url: >-
                              data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
                  temperature: 1
              tool_use:
                summary: Tool calling (Function Calling)
                value:
                  model: gpt-5.1
                  messages:
                    - role: user
                      content: What's the weather like in San Francisco?
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: Get the current weather in a given location
                        parameters:
                          type: object
                          properties:
                            location:
                              type: string
                              description: The city and state, e.g. San Francisco, CA
                          required:
                            - location
                  temperature: 1
      responses:
        '200':
          description: Chat completion successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: Unauthorized, invalid or expired token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: Insufficient quota, recharge required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: Insufficient quota
                  type: insufficient_quota_error
                  fallback_suggestion: https://evolink.ai/dashboard/billing
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  type: rate_limit_error
                  fallback_suggestion: retry after 60 seconds
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: Internal server error
                  type: internal_server_error
                  fallback_suggestion: try again later
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: >-
            Model name for chat completion


            - **gpt-5.1**: Base model for general tasks

            - **gpt-5.1-chat**: Optimized for conversational tasks

            - **gpt-5.1-thinking**: Features reasoning capabilities with
            thinking process output (returns reasoning_content)
          enum:
            - gpt-5.1
            - gpt-5.1-chat
            - gpt-5.1-thinking
          example: gpt-5.1
        messages:
          type: array
          description: >-
            List of messages for the conversation, supports multi-turn dialogue
            and multimodal input
          items:
            $ref: '#/components/schemas/Message'
          minItems: 1
        stream:
          type: boolean
          description: >-
            Whether to stream the response


            - `true`: Stream response, returns content chunk by chunk in
            real-time

            - `false`: Wait for complete response and return all at once
          default: false
          example: false
        max_tokens:
          type: integer
          description: Maximum number of tokens to generate in the response
          minimum: 1
          example: 2000
        temperature:
          type: number
          description: |-
            Sampling temperature, controls randomness of output

            - Lower values (e.g., 0.2): More deterministic and focused output
            - Higher values (e.g., 1.5): More random and creative output
          minimum: 0
          maximum: 2
          default: 1
          example: 1
        top_p:
          type: number
          description: >-
            Nucleus sampling parameter


            - Controls sampling from tokens with cumulative probability

            - For example, 0.9 means sampling from tokens with top 90%
            cumulative probability
          minimum: 0
          maximum: 1
          default: 1
          example: 0.9
        frequency_penalty:
          type: number
          description: >-
            Frequency penalty, number between -2.0 and 2.0


            - Positive values penalize new tokens based on their frequency in
            the text
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        presence_penalty:
          type: number
          description: >-
            Presence penalty, number between -2.0 and 2.0


            - Positive values penalize new tokens based on whether they appear
            in the text
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        stop:
          oneOf:
            - type: string
              description: Single stop word
            - type: array
              description: List of stop words, maximum 4
              items:
                type: string
              maxItems: 4
          description: Stop sequences, generation stops when these sequences are matched
        tools:
          type: array
          description: List of tools for Function Calling
          items:
            $ref: '#/components/schemas/Tool'
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the chat completion
          example: chatcmpl-abc123
        model:
          type: string
          description: The model used for completion
          example: gpt-5.1
        object:
          type: string
          enum:
            - chat.completion
          description: Response type
          example: chat.completion
        created:
          type: integer
          description: Unix timestamp when the completion was created
          example: 1698999496
        choices:
          type: array
          description: List of completion choices
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP status error code
            message:
              type: string
              description: Error message
            type:
              type: string
              description: Error type
            fallback_suggestion:
              type: string
              description: Suggestion for handling the error
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: |-
            Message role

            - `user`: User message
            - `assistant`: AI assistant message
            - `system`: System prompt
          enum:
            - user
            - assistant
            - system
          example: user
        content:
          oneOf:
            - type: string
              description: Plain text message content
              example: Please introduce yourself
            - type: array
              description: Multimodal message content, supports text and image mixed input
              items:
                $ref: '#/components/schemas/ContentPart'
          description: Message content
    Tool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
          description: Tool type
        function:
          type: object
          required:
            - name
            - description
            - parameters
          properties:
            name:
              type: string
              description: Function name
              example: get_weather
            description:
              type: string
              description: Function description
              example: Get the current weather in a given location
            parameters:
              type: object
              description: Function parameter definition
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: Index of this choice
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: Reason why the completion finished
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
          example: stop
    Usage:
      type: object
      description: Token usage statistics
      properties:
        prompt_tokens:
          type: integer
          description: Number of tokens in the input
          example: 8
        completion_tokens:
          type: integer
          description: Number of tokens in the output
          example: 292
        total_tokens:
          type: integer
          description: Total number of tokens used
          example: 300
    ContentPart:
      oneOf:
        - $ref: '#/components/schemas/TextContent'
        - $ref: '#/components/schemas/ImageContent'
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: Role of the message sender
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: AI's response content
          example: Hi there! How can I help you?
        reasoning_content:
          type: string
          description: |-
            Reasoning process content (only returned by gpt-5.1-thinking model)

            **Note**:
            - Shows the model's thinking and reasoning process
            - Helps understand how the model arrives at its final answer
          example: Let me think about this step by step...
    TextContent:
      title: Text content
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
          description: Content type
        text:
          type: string
          description: Text content
          example: Please describe this image in detail
    ImageContent:
      title: Image content
      type: object
      required:
        - type
        - image_url
      properties:
        type:
          type: string
          enum:
            - image_url
          description: Content type
        image_url:
          type: object
          required:
            - url
          properties:
            url:
              type: string
              format: uri
              description: |-
                Image URL or Base64 encoding

                **Format**:
                - URL format: `https://example.com/image.png`
                - Base64 format: `data:image/<format>;base64,<Base64 encoding>`
              example: data:image/png;base64,iVBORw0KGgo...
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All APIs require Bearer Token authentication


        **Get API Key:**


        Visit [API Key Management Page](https://evolink.ai/dashboard/keys) to
        get your API Key


        **Add to request header:**

        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````