Chat

Create chat completion

Create a chat completion, optionally streamed as SSE. Native dispatch preserves provider-specific JSON fields when the destination supports the caller’s format. Cross-format routing converts through the Gateway’s shared representation: provider-only features are not guaranteed to survive. Support for reasoning, images, built-in tools and structured outputs depends on the destination model.

post/v1/chat/completions

Request

  • Base URL: https://edgee.io
  • URL: https://edgee.io/v1/chat/completions
  • Auth: HTTP bearer

Headers

X-Edgee-Tagsstring

Comma-separated analytics tags. Trimmed and merged with body tags.

X-Edgee-Debug'true' | '1'

Enable debug capture for this request. Does not add a debug object to the API response.

X-Edgee-Compression-Tool-Result-Trimming'true' | 'false' | '1' | '0' | 'on' | 'off'

Turn tool-result trimming on or off. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.

X-Edgee-Compression-Tool-Surface-Reduction'true' | 'false' | '1' | '0' | 'on' | 'off'

Turn MCP tool surface reduction on or off. The threshold and resolver mode still come from the API key. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.

X-Edgee-Compression-Brevity'true' | 'false' | '1' | '0' | 'on' | 'off'

Turn output brevity on or off. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.

X-Edgee-Session-Idstring

Session identifier used to group request usage.

Request body

modelstring required

Model identifier from GET /v1/models, in author/model format, or a configured global alias. Append :provider to request a specific provider route. Available models and providers depend on your key and organization policies.

max_tokensinteger

The maximum number of tokens that can be generated in the chat completion.

streamboolean

If set, partial message deltas will be sent, as in OpenAI. Streamed chunks are sent as Server-Sent Events (SSE).

tagsstring[]

Optional tags to categorize and label the request. Useful for filtering and grouping requests in analytics and logs. Can also be sent via the x-edgee-tags header as a comma-separated string.

enable_debugboolean

Enable request debug capture. Gateway-only field; does not add debug information to the response.

max_completion_tokensinteger

Alias of max_tokens. Use one spelling, not both.

temperaturenumber

Sampling temperature; supported range depends on the destination model.

top_pnumber

Nucleus sampling probability; support depends on the destination model.

reasoning_effortstring

Requested effort; common values include none, minimal, low, medium, high, xhigh and max. The supported vocabulary is model-specific. Cross-format routing maps supported values and can omit unrepresentable levels.

reasoning_summarystring

Gateway reasoning-display override. Common values: auto, concise, detailed. For Chat Completions, positive reasoning effort normally exposes reasoning_content unless overridden.

reasoning_enabledboolean

Gateway override for reasoning intent on cross-format requests; false explicitly declines reasoning.

reasoning_budget_tokensinteger

Legacy Anthropic thinking budget, used only when translating to a compatible destination.

Example request

{
  "model": "openai/gpt-5.2",
  "messages": [
    {
      "cache_control": {
        "type": "ephemeral"
      }
    }
  ],
  "reasoning_effort": "high"
}

Response

Chat completion created successfully

idstring required

A unique identifier for the chat completion.

object'chat.completion' required

The object type, which is always chat.completion.

createdinteger required

The Unix timestamp (in seconds) of when the chat completion was created.

modelstring required

The model used for the chat completion.

Example response

{
  "id": "chatcmpl-123",
  "created": 1677652288,
  "model": "openai/gpt-5.2",
  "choices": [
    {
      "message": {
        "cache_control": {
          "type": "ephemeral"
        }
      }
    }
  ],
  "compression": {
    "saved_tokens": 450,
    "cost_savings": 27000000,
    "reduction": 48.99884991374353,
    "time_ms": 12
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.