Create chat completion
curl https://api.waibee.com/v1/chat/completions \ -H "Authorization: Bearer $WAIBEE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic/claude-sonnet-4.6", "messages": [{ "role": "user", "content": "Hello!" }] }'from openai import OpenAI
client = OpenAI(base_url="https://api.waibee.com/v1", api_key="sk_live_...")resp = client.chat.completions.create( model="anthropic/claude-sonnet-4.6", messages=[{"role": "user", "content": "Hello!"}],)print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.waibee.com/v1", apiKey: process.env.WAIBEE_API_KEY,});const resp = await client.chat.completions.create({ model: "anthropic/claude-sonnet-4.6", messages: [{ role: "user", content: "Hello!" }],});console.log(resp.choices[0].message.content);OpenAI-compatible chat completion. Send messages, receive a model
response. Set stream: true for a Server-Sent Events stream terminated
by data: [DONE].
Authorizations
Заголовок раздела «Authorizations»Request Bodyrequired
Заголовок раздела «Request Bodyrequired»object
<provider>/<model> from GET /v1/models. waibee/auto lets the router pick.
object
Stream the response as Server-Sent Events.
Maximum tokens to generate. max_completion_tokens is also accepted.
Function/tool definitions (max 256).
Function/tool definition for function calling.
object
object
JSON Schema of the tool arguments.
object
Tool selection: auto | none | required, or an object {type: function, function: {name}}.
Ask the router to run a web search for this request. An empty object
is enough. Each executed search is billed on top of tokens, and the
sources come back as message.annotations[].url_citation.
object
Structured output format.
object
Schema used when type is json_schema.
object
Reasoning depth. max is NOT supported here, use /v1/messages with output_config.effort.
Per-request plugins.
object
Data-loss-prevention scan, mask or block. Optional: a DLP policy set for your API key applies as a floor of strictness even when this object is absent, and this object can only make the check stricter. entity_types is unioned with the policy’s categories, so the scan may be wider than the list you send.
object
Applies to the rules you declare yourself. Where the key’s policy declares the same rule, the stricter of the two modes wins; the policy’s own categories keep the mode the administrator set.
Unioned with the categories of the key’s policy, never narrowing them.
Which messages’ findings come back to you. Narrowing it does not narrow the scan: every message is still scanned, and the block decision counts every finding.
Values that are a finding on their own, whatever the categories say. Unioned with the key’s policy.
object
Exceptions, matched on the whole value only. They reach your own rules only: an exception never lifts a finding raised by a rule of the key’s policy. Within your own config a stop word beats an exception on the same value.
object
Exact only. A substring exception would exempt every lookalike containing it.
Named patterns, run by RE2. Unioned with the key’s policy.
object
Marks a message as inserted by the platform rather than typed by a person, by the value of its name field, and takes it out of the scan. Ignored while a policy applies to your key: on this path the same caller supplies both the marker and the content, so it would be a way to opt out of the check.
Reserved, and currently changes nothing: alert reports the findings and forwards the request, so there is no hold to confirm.
Responses
Заголовок раздела «Responses»Model response.
object
object
object
object
object
Example
{ "id": "gen-...", "object": "chat.completion", "created": 1784025392, "model": "anthropic/claude-sonnet-4.6", "choices": [ { "index": 0, "finish_reason": "stop", "message": { "role": "assistant", "content": "Paris" } } ], "usage": { "prompt_tokens": 22, "completion_tokens": 6, "total_tokens": 28 }}Invalid request. Codes: invalid_model, validation_error, feature_not_supported.
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "invalid_model", "message": "Model 'foo' is not available", "extra": {} }}Missing or invalid API key.
object
Example
{ "error": "unauthorized"}Not enough credits for the request (insufficient_funds).
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "insufficient_funds", "message": "Insufficient credits", "extra": {} }}Request blocked by an access policy (policy_violation) or by DLP (dlp_violation). A DLP block is about the content of the request, not about the key’s permissions: branch on error.code, not on the status alone.
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Examples
Model not allowed for this group
{ "error": { "code": "policy_violation", "message": "Request blocked by policy", "extra": {} }}Sensitive data detected in block mode
{ "error": { "code": "dlp_violation", "message": "Request blocked: sensitive data detected", "extra": { "dlp": [ { "category": "pii", "entity_type": "EMAIL", "message_index": 0, "location": "messages[0].content", "start": 12, "end": 28, "confidence": 0.98 } ], "findings_count": 1, "block_scope": "in_report_scope" } }}Model not in the catalog (model_not_found).
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "model_not_found", "message": "Model 'nonexistent/model' is not available. Check the model name and try again.", "extra": {} }}Upstream took too long, including a stream that went silent (provider_timeout).
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "provider_timeout", "message": "Provider timed out", "extra": {} }}Request body, a file or the aggregate text exceeds the limit: payload_too_large, file_too_large, text_content_too_large.
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "payload_too_large", "message": "Request body too large", "extra": {} }}Request failed validation (validation_error): model not in <provider>/<model> form, or a missing field.
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "validation_error", "message": "Invalid request", "extra": { "errors": [ { "type": "value_error", "loc": [ "body", "model" ], "msg": "model must be in format <provider>/<model>" } ] } }}Rate limit exceeded (provider_rate_limited).
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "provider_rate_limited", "message": "Rate limit exceeded", "extra": {} }}Upstream model unavailable (provider_unavailable).
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Example
{ "error": { "code": "provider_unavailable", "message": "Provider unavailable", "extra": {} }}Temporarily unavailable. service_unavailable and circuit_breaker_open mean load or overload protection; dlp_policy_unavailable means the DLP policy for the key could not be resolved, and the request was refused rather than run unscanned. service_unavailable and dlp_policy_unavailable carry Retry-After; circuit_breaker_open does not, because the router does not know when the backend it fenced off will be back. dlp_unavailable also lands here and carries no header either: it says the router is not enforcing DLP, so a retry returns the same answer.
OpenAI-format error envelope.
object
object
Additional error data; fields depend on the error code.
object
Examples
Router under load
{ "error": { "code": "service_unavailable", "message": "Service temporarily unavailable due to high load", "extra": {} }}DLP policy could not be resolved (retryable)
{ "error": { "code": "dlp_policy_unavailable", "message": "DLP policy is temporarily unavailable; retry the request", "extra": {} }}plugins.dlp sent where DLP is not enforced
{ "error": { "code": "dlp_unavailable", "message": "DLP plugin config was provided, but router DLP enforcement is disabled", "extra": {} }}Headers
Заголовок раздела «Headers»Seconds to wait before retrying.