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

# Create a chat completion



## OpenAPI

````yaml /openapi.json post /v1/chat/completions
openapi: 3.0.0
info:
  description: >-
    High-performance AI gateway routing requests to multiple LLM providers
    (OpenAI, Anthropic, Gemini, Groq, OpenRouter, DeepSeek, Z.ai, xAI, MiniMax,
    Oracle, Ollama). Drop-in OpenAI-compatible API.
  title: GoModel API
  contact: {}
  version: '1.0'
servers:
  - url: '{base_url}'
    description: Edit the base URL to point at your GoModel deployment.
    variables:
      base_url:
        default: http://localhost:8080
        description: Your GoModel deployment URL
security: []
paths:
  /v1/chat/completions:
    post:
      tags:
        - chat
      summary: Create a chat completion
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/core.ChatRequest'
        description: Chat completion request
        required: true
      responses:
        '200':
          description: JSON response or SSE stream when stream=true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.ChatResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/core.ChatResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/core.OpenAIErrorEnvelope'
      security:
        - BearerAuth: []
components:
  schemas:
    core.ChatRequest:
      type: object
      properties:
        max_tokens:
          type: integer
        messages:
          type: array
          items:
            $ref: '#/components/schemas/core.Message'
        model:
          type: string
        parallel_tool_calls:
          type: boolean
        provider:
          description: Gateway routing hint; stripped before upstream execution.
          type: string
        reasoning:
          $ref: '#/components/schemas/core.Reasoning'
        stream:
          type: boolean
        stream_options:
          $ref: '#/components/schemas/core.StreamOptions'
        temperature:
          type: number
        tool_choice:
          description: string or object
        tools:
          type: array
          items:
            type: object
            additionalProperties: {}
    core.ChatResponse:
      type: object
      properties:
        choices:
          type: array
          items:
            $ref: '#/components/schemas/core.Choice'
        created:
          type: integer
        id:
          type: string
        model:
          type: string
        object:
          type: string
        provider:
          type: string
        system_fingerprint:
          type: string
        usage:
          $ref: '#/components/schemas/core.Usage'
    core.OpenAIErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/core.OpenAIErrorObject'
    core.Message:
      type: object
      properties:
        content:
          description: |-
            ContentSchema documents that `content` accepts either a plain string
            or an array of ContentPart values.
          type: array
          items:
            $ref: '#/components/schemas/core.ContentPart'
          x-oneof: >-
            [{"type":"null"},{"type":"string"},{"type":"array","items":{"$ref":"#/definitions/core.ContentPart"}}]
        role:
          type: string
        tool_call_id:
          type: string
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/core.ToolCall'
    core.Reasoning:
      type: object
      properties:
        effort:
          description: |-
            Effort controls how much reasoning effort the model should use.
            Valid values are "low", "medium", and "high".
          type: string
    core.StreamOptions:
      type: object
      properties:
        include_usage:
          description: >-
            IncludeUsage requests token usage information in streaming
            responses.

            When true, the final streaming chunk will include usage statistics.
          type: boolean
    core.Choice:
      type: object
      properties:
        finish_reason:
          type: string
        index:
          type: integer
        logprobs:
          type: object
        message:
          $ref: '#/components/schemas/core.ResponseMessage'
    core.Usage:
      type: object
      properties:
        completion_tokens:
          type: integer
        completion_tokens_details:
          $ref: '#/components/schemas/core.CompletionTokensDetails'
        prompt_tokens:
          type: integer
        prompt_tokens_details:
          $ref: '#/components/schemas/core.PromptTokensDetails'
        raw_usage:
          type: object
          additionalProperties: {}
        total_tokens:
          type: integer
    core.OpenAIErrorObject:
      type: object
      required:
        - code
        - message
        - param
        - type
      properties:
        code:
          type: string
          nullable: true
        message:
          type: string
        param:
          type: string
          nullable: true
        type:
          $ref: '#/components/schemas/core.ErrorType'
    core.ContentPart:
      type: object
      properties:
        image_url:
          $ref: '#/components/schemas/core.ImageURLContent'
        input_audio:
          $ref: '#/components/schemas/core.InputAudioContent'
        text:
          type: string
        type:
          type: string
    core.ToolCall:
      type: object
      properties:
        function:
          $ref: '#/components/schemas/core.FunctionCall'
        id:
          type: string
        type:
          type: string
    core.ResponseMessage:
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/core.ContentPart'
          x-oneof: >-
            [{"type":"null"},{"type":"string"},{"type":"array","items":{"$ref":"#/definitions/core.ContentPart"}}]
        role:
          type: string
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/core.ToolCall'
    core.CompletionTokensDetails:
      type: object
      properties:
        accepted_prediction_tokens:
          type: integer
        audio_tokens:
          type: integer
        reasoning_tokens:
          type: integer
        rejected_prediction_tokens:
          type: integer
    core.PromptTokensDetails:
      type: object
      properties:
        audio_tokens:
          type: integer
        cached_tokens:
          type: integer
        image_tokens:
          type: integer
        text_tokens:
          type: integer
    core.ErrorType:
      type: string
      enum:
        - provider_error
        - rate_limit_error
        - invalid_request_error
        - authentication_error
        - not_found_error
      x-enum-varnames:
        - ErrorTypeProvider
        - ErrorTypeRateLimit
        - ErrorTypeInvalidRequest
        - ErrorTypeAuthentication
        - ErrorTypeNotFound
    core.ImageURLContent:
      type: object
      properties:
        detail:
          type: string
        media_type:
          type: string
        url:
          type: string
    core.InputAudioContent:
      type: object
      properties:
        data:
          type: string
        format:
          type: string
    core.FunctionCall:
      type: object
      properties:
        arguments:
          type: string
        name:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````