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

# Chat Completion Endpoint

> OpenAI-compatible chat completion endpoint for LLM interactions.



## OpenAPI

````yaml POST /v1/chat/completions
openapi: 3.0.1
info:
  title: Heurist API
  description: One Unified API for Heurist's serverless inference and AI Agents
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: '{server}'
    variables:
      server:
        enum:
          - http://sequencer.heurist.xyz
          - https://llm-gateway.heurist.xyz
          - https://sequencer-v2.heurist.xyz
        default: http://sequencer.heurist.xyz
security:
  - bearerAuth: []
paths:
  /v1/chat/completions:
    post:
      summary: Create Chat Completion
      description: OpenAI-compatible chat completion endpoint for LLM interactions.
      operationId: createChatCompletion
      requestBody:
        description: Chat completion request parameters
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  description: ID of the model to use
                  enum:
                    - hermes-3-llama3.1-8b
                    - meta-llama/llama-3.3-70b-instruct
                    - mistralai/mistral-7b-instruct
                    - mistralai/mixtral-8x22b-instruct
                    - mistralai/mixtral-8x7b-instruct
                    - nvidia/llama-3.1-nemotron-70b-instruct
                    - qwen/qwen-2.5-coder-32b-instruct
                messages:
                  type: array
                  description: A list of messages comprising the conversation so far
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                          - assistant
                        description: The role of the message author
                      content:
                        type: string
                        description: The content of the message
                max_tokens:
                  type: integer
                  description: The maximum number of tokens to generate
                  example: 1024
                  default: 1024
                temperature:
                  type: number
                  format: float
                  description: Sampling temperature between 0 and 1
                  minimum: 0
                  maximum: 1
                stream:
                  type: boolean
                  description: Whether to stream back partial progress
                  default: false
      responses:
        '200':
          description: Successful completion response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                type: string
                description: >-
                  Server-sent events stream for partial completions when
                  stream=true
        '400':
          description: Bad request, invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized access, invalid or missing authentication token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      servers:
        - url: https://llm-gateway.heurist.xyz
components:
  schemas:
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the completion
        object:
          type: string
          enum:
            - chat.completion
        created:
          type: integer
          description: Unix timestamp of when the completion was created
        model:
          type: string
          description: Model ID used
        choices:
          type: array
          items:
            type: object
            properties:
              message:
                type: object
                properties:
                  role:
                    type: string
                    enum:
                      - assistant
                    description: Message role
                  content:
                    type: string
                    description: Message content
              finish_reason:
                type: string
                enum:
                  - stop
                  - length
                description: Reason for stopping the generation
              index:
                type: integer
                description: Index of the message choice
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
          format: int32
          description: Error code
        message:
          type: string
          description: Error message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````