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

# Chat Completions

> OpenAI-compatible chat completion endpoint with streaming support.

Create chat completions with streaming, tool calls, and JSON mode using the fully OpenAI-compatible payload.


## OpenAPI

````yaml POST /v1/chat/completions
openapi: 3.1.0
info:
  title: GeneralCompute API
  version: 1.0.0
  description: OpenAI-compatible API surface for the GeneralCompute inference platform.
  contact:
    name: GeneralCompute
    url: https://www.generalcompute.com
servers:
  - url: https://api.generalcompute.com
    description: Production
  - url: http://localhost:3000
    description: Local
security: []
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat
      summary: Create chat completion
      description: OpenAI-compatible chat completion endpoint with streaming support.
      requestBody:
        required: true
        description: Chat completion request payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: Chat completion response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ChatCompletionChunk'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '401':
          description: API key missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ChatCompletionRequest:
      type: object
      properties:
        model:
          type: string
        messages:
          type: array
          items:
            type: object
            properties:
              role:
                type: string
                enum:
                  - system
                  - user
                  - assistant
                  - function
                  - tool
              content:
                anyOf:
                  - type: string
                  - type: array
                    items: {}
                  - type: 'null'
                  - type: 'null'
              name:
                type: string
              function_call: {}
              tool_calls: {}
            required:
              - role
          minItems: 1
        temperature:
          type: number
          minimum: 0
          maximum: 2
        top_p:
          type: number
          minimum: 0
          maximum: 1
        'n':
          type: integer
          exclusiveMinimum: 0
        stream:
          type: boolean
          default: false
        stop:
          anyOf:
            - type: string
            - type: array
              items:
                type: string
        max_tokens:
          type: integer
          exclusiveMinimum: 0
        presence_penalty:
          type: number
          minimum: -2
          maximum: 2
        frequency_penalty:
          type: number
          minimum: -2
          maximum: 2
        logit_bias:
          type: object
          additionalProperties:
            type: number
        user:
          type: string
        top_k:
          type: number
        repetition_penalty:
          type: number
      required:
        - model
        - messages
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - chat.completion
        created:
          type: number
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: number
              message:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type:
                      - string
                      - 'null'
                  function_call: {}
                  tool_calls: {}
                required:
                  - role
                  - content
              finish_reason:
                type:
                  - string
                  - 'null'
              logprobs: {}
            required:
              - index
              - message
              - finish_reason
        usage:
          type: object
          properties:
            prompt_tokens:
              type: number
            completion_tokens:
              type: number
            total_tokens:
              type: number
          required:
            - prompt_tokens
            - completion_tokens
            - total_tokens
        system_fingerprint:
          type: string
      required:
        - id
        - object
        - created
        - model
        - choices
    ChatCompletionChunk:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - chat.completion.chunk
        created:
          type: number
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: number
              delta:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
              finish_reason:
                type:
                  - string
                  - 'null'
            required:
              - index
              - delta
              - finish_reason
        usage:
          type: object
          properties:
            prompt_tokens:
              type: number
            completion_tokens:
              type: number
            total_tokens:
              type: number
          required:
            - prompt_tokens
            - completion_tokens
            - total_tokens
      required:
        - id
        - object
        - created
        - model
        - choices
    OpenAIError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type:
                - string
                - 'null'
          required:
            - message
            - type
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````