Skip to main content
POST
Pass-through to the provider’s chat completions endpoint. Request and response bodies follow the standard OpenAI Chat Completions schema. The gateway infers the provider from the model name; override with X-Toolken-Provider.

Headers

string
required
Your Toolken API key. Validated by the gateway and stripped before forwarding.
string
required
Your provider key in Bearer format (BYOK), e.g. Bearer sk-.... Forwarded untouched, never stored.
string
Primary attribution channel. JSON object of key-value pairs (e.g. {"agent":"research-agent","customer_id":"cust_abc"}). Each key becomes a groupable dimension in the dashboard.
string
Flat-header shorthand. X-Toolken-Metadata-Agent: research-agent writes metadata key agent. Equivalent to sending the same key in X-Toolken-Metadata.
string
Sets the feature metadata key. Use to group costs by agent name, workflow, UI surface, or job type.
string
Sets the customer_id metadata key. Use to attribute costs to an end-customer, org slug, or account ID.

Body

string
required
Model identifier (e.g. gpt-4o).
array
required
Conversation messages, following the standard OpenAI messages schema.
boolean
If true, the gateway streams Server-Sent Events back from the provider.
integer
Maximum tokens to generate. Capped per workspace.
number
Sampling temperature. Forwarded verbatim.

Response

string
Unique completion ID.
string
Always chat.completion.
string
The model that produced the response.
array
The generated choices, each with message and finish_reason.
object
Token counts: prompt_tokens, completion_tokens, total_tokens.