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

# Create Chat Completion

> Create a chat completion for the provided messages

Generate AI responses using Comput3's language models.

## Authentication Required

This endpoint requires a valid API key in the Authorization header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Example Request

```bash curl theme={null}
curl -X POST "https://api.comput3.ai/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.1",
    "messages": [
      {"role": "user", "content": "Hello, world!"}
    ],
    "max_tokens": 100,
    "temperature": 0.7
  }'
```

## Request Body

* `model` (string, required): The model ID to use (e.g., "hermes4:70b", "hermes4:405b", "deepseek-v3.1", "kimi-k2", "qwen3-coder:480b", "qwen3-max", "grok-code-fast-1", "claude-sonnet-4")
* `messages` (array, required): Array of message objects with role and content
* `max_tokens` (integer): Maximum number of tokens to generate
* `temperature` (float): Sampling temperature (0.0 to 2.0)

## Response

Returns the chat completion with the AI-generated response.

```json theme={null}
{
  "id": "chatcmpl-123abc",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "deepseek-v3.1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}
```


## OpenAPI

````yaml POST /chat/completions
openapi: 3.1.0
info:
  title: Comput3 Network API
  description: >-
    API for the Comput3 Network - distributed GPU computing platform for AI
    workloads
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.comput3.ai/v1
security:
  - bearerAuth: []
paths:
  /chat/completions:
    post:
      description: Create a chat completion for the provided messages
      requestBody:
        description: Chat completion request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
        required: true
      responses:
        '200':
          description: Chat completion response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: The model to use for completion
          enum:
            - hermes4:70b
            - hermes4:405b
            - deepseek-v3.1
            - kimi-k2
            - qwen3-coder:480b
            - qwen3-max
            - grok-code-fast-1
            - claude-sonnet-4
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
          description: The messages to complete
        max_tokens:
          type: integer
          description: Maximum number of tokens to generate
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: Sampling temperature
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
        content:
          type: string
    Choice:
      type: object
      properties:
        index:
          type: integer
        message:
          $ref: '#/components/schemas/Message'
        finish_reason:
          type: string
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````