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

# Chat completions

> Create a chat completion. Requests are served through the attested gateway, which retains no request bodies. A `phala/*` (confidential) response additionally runs on a verified upstream enclave — confirmed per response from the receipt's `upstream.verified` event — and returns an `x-receipt-id` header you can verify (see /confidential-ai/verify). OpenAI-compatible: tools, vision, and other chat parameters pass through for models that support them.

OpenAI-compatible — point any OpenAI SDK at `https://api.t2000.ai/v1`. Pick a model with [`GET /v1/models`](/api-reference/models); `phala/*` models are [confidential](/confidential-ai/how-it-works) and return an `x-receipt-id` you can [verify](/confidential-ai/verify).


## OpenAPI

````yaml POST /chat/completions
openapi: 3.1.0
info:
  title: t2000 Private & Confidential API
  description: >-
    OpenAI-compatible inference, private by default (zero data retention), with
    a verifiable confidential (GPU-TEE + Sui-anchored receipts) tier.
  version: 1.0.0
servers:
  - url: https://api.t2000.ai/v1
security:
  - bearerAuth: []
paths:
  /chat/completions:
    post:
      summary: Chat completions
      description: >-
        Create a chat completion. Requests are served through the attested
        gateway, which retains no request bodies. A `phala/*` (confidential)
        response additionally runs on a verified upstream enclave — confirmed
        per response from the receipt's `upstream.verified` event — and returns
        an `x-receipt-id` header you can verify (see /confidential-ai/verify).
        OpenAI-compatible: tools, vision, and other chat parameters pass through
        for models that support them.
      operationId: createChatCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  description: Model id — see GET /v1/models.
                  examples:
                    - zai/glm-5.2
                    - phala/glm-5.2
                messages:
                  type: array
                  description: OpenAI chat messages.
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                          - assistant
                      content:
                        type: string
                stream:
                  type: boolean
                  description: >-
                    Stream chat.completion.chunk SSE events, terminated by
                    `data: [DONE]`.
                  default: false
                max_tokens:
                  type: integer
                  description: Max output tokens.
                temperature:
                  type: number
                  description: Sampling temperature (0–2).
                  default: 1
      responses:
        '200':
          description: >-
            An OpenAI chat.completion object. Confidential responses also return
            an `x-receipt-id` header.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                    examples:
                      - chat.completion
                  model:
                    type: string
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                        message:
                          type: object
                          properties:
                            role:
                              type: string
                            content:
                              type: string
                        finish_reason:
                          type: string
                  usage:
                    type: object
                    properties:
                      prompt_tokens:
                        type: integer
                      completion_tokens:
                        type: integer
                      total_tokens:
                        type: integer
        '401':
          description: Missing or invalid API key.
        '402':
          description: Insufficient credit — add credit at agents.t2000.ai/manage.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your Private API key (`sk-…`) from agents.t2000.ai/manage. Agents can
        also call keyless over x402.

````