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

# Chat Completions

> OpenAI-compatible chat completions endpoint with integrated security, PII masking, and web search.

The Chat Completions API allows you to interact with various AI models through a secure gateway. It supports streaming, secret detection, and PII masking.


## OpenAPI

````yaml POST /api/v1/chat/completions
openapi: 3.1.0
info:
  title: Secure AI Gateway API
  description: >-
    API for interacting with the Secure AI Gateway, including chat completions
    and management endpoints.
  version: 1.0.0
servers:
  - url: https://onefirewall.ai/
    description: Production API server
security: []
paths:
  /api/v1/chat/completions:
    post:
      tags:
        - Gateway
      summary: Chat Completions
      description: >-
        OpenAI-compatible chat completions endpoint with integrated security,
        PII masking, and web search.
      operationId: chatCompletions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  description: >-
                    Identifier for the model to use (e.g., `openai/gpt-4o`,
                    `grok/grok-beta`)
                  enum:
                    - openai/gpt-4o-mini
                    - openai/gpt-4o
                    - google/gemini-2.0-flash-exp
                    - xai/grok-beta
                    - deepseek/deepseek-chat
                    - deepseek/deepseek-reasoner
                  example: openai/gpt-4o
                messages:
                  type: array
                  description: A list of messages comprising the conversation so far.
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        description: The role of the messages author.
                        enum:
                          - system
                          - user
                          - assistant
                      content:
                        type: string
                        description: The contents of the message.
                stream:
                  type: boolean
                  description: >-
                    If set, partial message deltas will be sent as server-sent
                    events.
                  default: false
                web_search:
                  type: boolean
                  description: >-
                    Enables tools. Defaults to `true` unless a custom `system`
                    prompt is used.
                  default: true
                pii:
                  type: string
                  description: Security mode for PII scanning.
                  enum:
                    - disabled
                    - obfuscate
                    - block
                  default: disabled
                temperature:
                  type: number
                  description: What sampling temperature to use, between 0 and 2.
                  minimum: 0
                  maximum: 2
                  default: 0.7
                max_tokens:
                  type: integer
                  description: The maximum number of tokens to generate in the completion.
      responses:
        '200':
          description: Successful completion
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                    example: chat.completion
                  created:
                    type: integer
                  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: Unauthorized - Invalid or missing API key
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````