Chat Completions

The standard OpenAI Chat Completions API on every catalog model, with what is honored, dropped or refused.

このページはまだ翻訳されていません。英語版を表示しています。

Send a request

Standard OpenAI body; model must be a slug from GET /v1/models. The response adds usage.cost (USD charged), usage.is_byok, and a top-level provider naming who served it.

POST/v1/chat/completionsGET/v1/models/{model}
curl https://api.experientiallabs.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "messages": [
      {"role": "system", "content": "Be brief."},
      {"role": "user", "content": "Name three prime numbers."}
    ],
    "max_tokens": 256
  }'

Fields: honored, dropped, refused

Every field gets one of three treatments. Nothing is rewritten silently.

TreatmentWhenSignal
HonoredThe serving provider supports itnone
Dropped with disclosureThe provider cannot honor it but the request is servable (top_p on a non-sampling route)top-level x-experiential-ignored-parameters array in the body (on a stream, in the finishing chunk)
RefusedNo route serves it, or it is malformed400 unsupported_parameter or invalid_parameter, param names the field; nothing charged

Refused on every route today: audio, modalities, logit_bias, moderation, prediction. seed and prompt_cache_retention are dropped with disclosure. The deprecated functions / function_call are rewritten to tools / tool_choice with disclosure.

{
  "id": "chatcmpl-...",
  "provider": "openai",
  "x-experiential-ignored-parameters": ["web_search->dropped(search_unavailable)"],
  "choices": [...]
}

Reasoning effort

reasoning_effort passes through when the route supports it. An unsupported level may move down (never up) to the closest supported one when the route's policy allows; otherwise 400. none means reasoning off and can be refused; minimal still reasons; max is the top tier. Substitutions appear in x-experiential-ignored-parameters.

curl https://api.experientiallabs.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-astra", "reasoning_effort": "high", "max_tokens": 4096,
       "messages": [{"role": "user", "content": "Prove there are infinitely many primes."}]}'

Works on every model. Ask with web_search_options, OpenRouter's plugins: [{"id": "web"}], or a :online model suffix. Routes with native search use it; elsewhere the gateway runs one search for the latest user turn and cites sources as url_citation annotations. Each gateway-run search costs a flat fee (default $0.007, up to 10 results, never on BYOK), included in usage.cost; the count is usage.server_tool_use_details.web_search_requests.

curl https://api.experientiallabs.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-luna", "web_search_options": {},
       "messages": [{"role": "user", "content": "What changed in the latest Node.js release?"}]}'
# citations: choices[0].message.annotations[] with type "url_citation"

Safe retries with Idempotency-Key

Delivery is at least once: retrying an ambiguous failure can bill twice. Send an Idempotency-Key header and an exact retry replays the original bytes instead of running again. Same key with a different body: 409 idempotency_conflict. Replay lives in the serving worker's memory, so it is not guaranteed after a restart. Keyed responses carry no usage.cost; read cost from usage. Not honored on embeddings or Messages.

curl https://api.experientiallabs.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: 7c1d6a3e-order-1234" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-luna", "messages": [{"role": "user", "content": "Summarize order 1234"}]}'

Attribute requests to your users

Set safety_identifier (or user) to your end customer's id. It becomes attribution_label in the request log and the usage export, filterable per customer. Retries, fallback and route pinning per request are on Model selection.

GET/api/v1/usage
client.chat.completions.create(
    model="gpt-6-luna",
    safety_identifier="customer-42",
    messages=[{"role": "user", "content": "Hi"}],
)