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

# Proxy chat completion

> Forwards an OpenAI Chat Completions request to the selected provider. Proxy plane route: /{consumer_slug}/v1/chat/completions. Other fixed routes include /v1/messages (Anthropic) and /v1/responses (OpenAI Responses). Inline consumers may authenticate with an api key via X-AG-API-Key, x-api-key, or Authorization: Bearer ag_….



## OpenAPI

````yaml /trustgate/api/openapi.json post /{consumer_slug}/v1/chat/completions
openapi: 3.0.0
info:
  description: >-
    Administrative API for managing gateways and their registries, policies,
    consumers, roles and auth credentials.
  title: TrustGate Admin API
  contact:
    name: NeuralTrust
    url: https://neuraltrust.ai/contact
    email: support@neuraltrust.ai
  version: '1.0'
servers:
  - url: /
security: []
paths:
  /{consumer_slug}/v1/chat/completions:
    post:
      tags:
        - proxy
      summary: Proxy chat completion
      description: >-
        Forwards an OpenAI Chat Completions request to the selected provider.
        Proxy plane route: /{consumer_slug}/v1/chat/completions. Other fixed
        routes include /v1/messages (Anthropic) and /v1/responses (OpenAI
        Responses). Inline consumers may authenticate with an api key via
        X-AG-API-Key, x-api-key, or Authorization: Bearer ag_….
      parameters:
        - description: Consumer slug
          name: consumer_slug
          in: path
          required: true
          schema:
            type: string
        - description: API key for inline consumers
          name: X-AG-API-Key
          in: header
          schema:
            type: string
        - description: API key for inline consumers (Anthropic-compatible clients)
          name: x-api-key
          in: header
          schema:
            type: string
        - description: >-
            Bearer ag_… for inline api-key auth, or Bearer JWT for OAuth2/OIDC
            consumers
          name: Authorization
          in: header
          schema:
            type: string
        - description: Gateway slug when using header-based gateway discovery
          name: X-AG-Gateway-Slug
          in: header
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
        description: OpenAI Chat Completions request body
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
components:
  schemas:
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody:
      type: object
      properties:
        error:
          type: string
        message:
          type: string

````