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

# Chat Completions

> Sends a prompt to an OpenAI compatible chat completion model and returns a completion. Provides completions for open source models that are `text-generation`, `chat`, `audio-text-to-text`, `image-text-to-text`, `video-text-to-text`, and also supports closed source providers `openai`, `anthropic`, `mistral`, `cohere`, and `google`. To send a request to a closed source provider, prefix your model with their provider name, e.g. `openai/gpt-4`.



## OpenAPI

````yaml post /models/v2/openai/v1/chat/completions
openapi: 3.1.0
info:
  title: OpenAI Compatible Models API
  description: >-
    API endpoints compatible with OpenAI Chat Completions, Completions, and the
    newer Responses API for running models.
  version: 1.1.0
servers:
  - url: https://api.bytez.com
security: []
paths:
  /models/v2/openai/v1/chat/completions:
    post:
      summary: Chat Completions
      description: >-
        Sends a prompt to an OpenAI compatible chat completion model and returns
        a completion. Provides completions for open source models that are
        `text-generation`, `chat`, `audio-text-to-text`, `image-text-to-text`,
        `video-text-to-text`, and also supports closed source providers
        `openai`, `anthropic`, `mistral`, `cohere`, and `google`. To send a
        request to a closed source provider, prefix your model with their
        provider name, e.g. `openai/gpt-4`.
      operationId: runModel
      parameters:
        - name: Authorization
          in: header
          description: Token for authentication
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionsRequest'
      responses:
        '200':
          description: Successful model completion
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionsResponse'
        '400':
          description: Bad request
        '500':
          description: Internal server error
components:
  schemas:
    ChatCompletionsRequest:
      type: object
      properties:
        model:
          type: string
          description: The ID of the model to run (e.g., `Qwen/Qwen3-1.7B`, `openai/gpt-4`)
        messages:
          type: array
          description: Conversation messages (OpenAI chat format)
          items:
            $ref: '#/components/schemas/ChatMessage'
        max_completion_tokens:
          type: integer
          description: Maximum number of tokens to generate
          default: 256
        temperature:
          type: number
          description: Sampling temperature
          default: 0.7
        stream:
          type: boolean
          description: Whether to stream responses
          default: false
        top_p:
          type: number
          description: Nucleus sampling parameter
        presence_penalty:
          type: number
          description: Penalize new tokens based on whether they appear in the text so far
        frequency_penalty:
          type: number
          description: >-
            Penalize new tokens based on their existing frequency in the text so
            far
        logprobs:
          type: boolean
          description: Whether to return log probabilities of output tokens (if supported)
        top_logprobs:
          type: integer
          description: >-
            Number of most likely tokens to return at each position (if logprobs
            is true)
      required:
        - model
        - messages
    ChatCompletionsResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique ID for this completion
        object:
          type: string
          description: Type of returned object (usually `chat.completion`)
        created:
          type: integer
          description: Unix timestamp of completion
        choices:
          type: array
          description: Generated completions
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
              finish_reason:
                type: string
    ChatMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
          description: The role of the message sender
        content:
          type: string
          description: The message text
      required:
        - role
        - content

````