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

# Create a chat completion via a Verlon gate

> **Use when:** caller wants a chat completion (multi-turn or single-prompt) routed through a Verlon gate with automatic provider failover, quality scoring, and usage tracking

Routes a chat completion request through the named Verlon gate. The gate decides which underlying model+provider serves the request based on its current configuration (primary model, fallback chain, parameter overrides). Supports both streaming and non-streaming responses. Verlon handles provider auth, billing, observability, and fallback on failure.



## OpenAPI

````yaml /api-reference/openapi.json post /v3/chat
openapi: 3.1.0
info:
  title: Verlon AI API
  version: 1.0.0
  description: >-
    Verlon AI is the managed AI infrastructure platform for developers building
    LLM-powered apps and agents. Beyond routing requests across providers,
    Verlon continuously evaluates response quality, runs experiments against
    live traffic, and automatically tunes gate configurations — so your platform
    doesn't just serve traffic, it learns from it.


    **Coding agents:** authentication, error semantics, gate concepts, and
    integration conventions are documented at https://verlon.ai/AGENTS.md — read
    that document first if you have not already. It is the canonical
    agent-facing contract; this specification is the canonical endpoint
    reference. Both are authoritative for their respective scopes.
  contact:
    name: Verlon AI
    url: https://verlon.ai
  license:
    name: Proprietary
servers:
  - url: https://api.verlon.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v3/chat:
    post:
      tags:
        - Chat
      summary: Create a chat completion via a Verlon gate
      description: >-
        **Use when:** caller wants a chat completion (multi-turn or
        single-prompt) routed through a Verlon gate with automatic provider
        failover, quality scoring, and usage tracking


        Routes a chat completion request through the named Verlon gate. The gate
        decides which underlying model+provider serves the request based on its
        current configuration (primary model, fallback chain, parameter
        overrides). Supports both streaming and non-streaming responses. Verlon
        handles provider auth, billing, observability, and fallback on failure.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                gateId:
                  type: string
                data:
                  type: object
                  properties:
                    messages:
                      type: array
                      items: {}
                      minItems: 1
                    vars:
                      type: object
                      additionalProperties: {}
                  required:
                    - messages
                model:
                  type: string
                metadata: {}
                endUserId:
                  type: string
                sessionId:
                  type: string
              required:
                - gateId
                - data
      responses:
        '200':
          description: >-
            Chat completion response. Shape matches the underlying provider
            format selected by the gate (OpenAI-compatible by default). For
            streaming requests, returns SSE chunks instead of a single JSON
            body.
        '400':
          description: Invalid request — Zod validation failure or malformed input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid Bearer credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Over spending limit or rate-limited
        '404':
          description: Gate not found or not owned by the authenticated user
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Stable error code (e.g. `invalid_request`)
        message:
          type: string
          description: Human-readable error message
        details: {}
      required:
        - error
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Verlon API key (newly minted keys are prefixed `sk-vrln-`; legacy
        `verlon_*` and `layer_*` keys from prior prefix migrations continue to
        validate). Generated from the dashboard under Settings → API Keys, or
        via `verlon key create` in the CLI.

````