Create a chat completion
const url = 'https://api.bayle.ai/chat/completions';const options = { method: 'POST', headers: { 'Accept-Language': 'pt-BR', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"model":"qwen3-5-35b-a3b","messages":[{"role":"system","content":"You are a concise geography assistant. Answer in one sentence."},{"role":"user","content":"What is the capital of France?"}],"temperature":0.7,"max_tokens":30,"top_p":0.9,"stop":["\n\n"],"reasoning_effort":"none","stream":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.bayle.ai/chat/completions \ --header 'Accept-Language: pt-BR' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "qwen3-5-35b-a3b", "messages": [ { "role": "system", "content": "You are a concise geography assistant. Answer in one sentence." }, { "role": "user", "content": "What is the capital of France?" } ], "temperature": 0.7, "max_tokens": 30, "top_p": 0.9, "stop": [ "\n\n" ], "reasoning_effort": "none", "stream": false }'Generates a chat completion from a list of messages. model and messages are required; temperature, max_tokens, top_p, stop, reasoning_effort, and stream are optional. Function calling through tools and tool_choice is supported, as is vision, by sending image_url content parts inside a message, and document context — a document, presentation, spreadsheet, e-book, plain text, Markdown, CSV, JSON, or source-code file — by sending file content parts. Set stream to true to receive the completion as server-sent events instead of a single JSON body.
Fields Bayle does not name below are forwarded as sent, so a parameter your model supports that this document has not caught up with still reaches it.
Bayle adds no system message and no other instructions to your request: the model sees only the messages you send. To give the model instructions, send your own system message.
To control how much a reasoning model thinks before it answers, set reasoning_effort to one of none, minimal, low, medium, high, xhigh, or max. Higher levels think longer and use more of the output budget. GET /models publishes, for each model, the levels it lists as reasoningEffortOptions and the level it uses when you leave the field out as defaultReasoningEffort, both under model_spec.capabilities. Many models default to low, but not all: some default to medium, high, xhigh, or max, so check the model you call. A model whose supportsReasoningEffort is false does not take a level and may still think before it answers; a level sent to it is accepted, and Bayle does not promise it changes anything.
With none, the model does not show its thinking: reasoning_content is null. A level a model does not list is accepted rather than rejected, and the request still runs; this is observed behaviour, not a guarantee, so rely on reasoningEffortOptions for the levels a model is meant to take. A value outside the seven levels is rejected with 400 and the invalid_request code.
Thinking counts toward max_tokens. A small limit can be spent entirely on thinking, so the response ends with an empty content and a finish_reason of length. Leave room for the answer, or lower the level. When you stream, the thinking arrives first, as its own text in delta.reasoning_content, before any text in delta.content.
A completion that is not streamed must finish within 30 seconds. A long thinking run at a high level on a slower model can take longer, and is then reported as 502 with the api_error type. Send such requests with stream set to true: a streamed response can run for up to 60 minutes.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Example
pt-BRChooses the language of any error message in this request’s response. A tag beginning with the two letters pt, in any case, selects Brazilian Portuguese; anything else, including an absent header, selects English. The tag may appear anywhere in a multi-tag header, for example fr-FR;q=0.9,pt;q=0.5,en;q=0.3. Quality values are accepted but ignored, since this is a presence check rather than weighted negotiation.
Request Bodyrequired
Section titled “Request Bodyrequired”The chat completion request. Any field not listed here is forwarded as sent.
object
The text model to use, as returned by GET /models.
The conversation so far, oldest message first.
object
object
object
object
A data: URI holding the file’s media type and its base64-encoded bytes.
The name the file is presented under.
Sampling temperature. Higher values produce more varied output.
Upper bound on the number of tokens generated. For a reasoning model, the thinking counts toward this limit.
Nucleus sampling threshold.
How much the model thinks before it answers. Leave it out to get the model’s own default, published per model in GET /models as defaultReasoningEffort, next to the levels it lists in reasoningEffortOptions. A level the model does not list is accepted; a value outside the seven levels is rejected. Thinking counts toward max_tokens. See the operation description.
When true, the response is a text/event-stream rather than a single JSON body. See the streaming section of the 200 response below.
Tools the model may call. A function tool has the shape {"type": "function", "function": {"name": "...", "description": "...", "parameters": { /* JSON Schema */ }}}. Built-in tools are given by type alone, for example {"type": "web_search"}.
object
object
object
Examples
Basic completion with every sampling option
{ "model": "qwen3-5-35b-a3b", "messages": [ { "role": "system", "content": "You are a concise geography assistant. Answer in one sentence." }, { "role": "user", "content": "What is the capital of France?" } ], "temperature": 0.7, "max_tokens": 30, "top_p": 0.9, "stop": [ "\n\n" ], "reasoning_effort": "none", "stream": false}Reasoning model with a thinking level
{ "model": "qwen3-5-35b-a3b", "messages": [ { "role": "user", "content": "Is 91 a prime number?" } ], "max_tokens": 30, "reasoning_effort": "low"}Function calling
{ "model": "mistral-small-3-2-24b-instruct", "messages": [ { "role": "user", "content": "What is the weather in Lisbon right now?" } ], "max_tokens": 30, "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "Get the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string", "description": "City name, e.g. Lisbon" }, "unit": { "type": "string", "enum": [ "celsius", "fahrenheit" ] } }, "required": [ "city" ] }, "strict": false } } ], "tool_choice": "auto"}Sending a tool result back
{ "model": "mistral-small-3-2-24b-instruct", "messages": [ { "role": "user", "content": "What is the weather in Lisbon right now?" }, { "role": "assistant", "content": "", "tool_calls": [ { "id": "GmlaGIZnu", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"city\": \"Lisbon\"}" } } ] }, { "role": "tool", "tool_call_id": "GmlaGIZnu", "content": "{\"city\": \"Lisbon\", \"temperature\": 21, \"unit\": \"celsius\", \"conditions\": \"sunny\"}" } ], "max_tokens": 30, "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "Get the current weather for a city.", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": [ "city" ] } } } ], "tool_choice": "auto"}Vision, with an image content part
{ "model": "qwen3-5-35b-a3b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What color is this image? Answer in one word." }, { "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAT0lEQVR42u3PQQkAAAgEsItz/fMYxgi+hcEKLNO+FgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQGBywLzk8EPlvGqjQAAAABJRU5ErkJggg==" } } ] } ], "max_tokens": 10, "reasoning_effort": "none"}Document context, with a file content part
{ "model": "qwen3-5-35b-a3b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "How long does standard delivery take? Answer briefly." }, { "type": "file", "file": { "file_data": "data:text/plain;base64,QmF5bGUgc2hpcHBpbmcgbm90ZXMKCk9yZGVycyBvdmVyIDUwIFVTRCBzaGlwIGZyZWUuIFN0YW5kYXJkIGRlbGl2ZXJ5IHRha2VzIDMgdG8gNSBidXNpbmVzcyBkYXlzLgo=", "filename": "shipping-notes.txt" } } ] } ], "max_tokens": 20, "reasoning_effort": "none"}Streaming
{ "model": "mistral-small-3-2-24b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France? One short sentence." } ], "max_tokens": 12, "stream": true}Responses
Section titled “Responses”The completion. When the request set stream to true this is a text/event-stream; otherwise it is a single JSON body.
object
object
object
The model’s thinking, for a reasoning model. Null when reasoning_effort is none.
The tools the model asks to call, when it calls any. Send each result back as a tool message carrying the call’s id as tool_call_id.
object
object
The call’s arguments, as a JSON string.
Why generation stopped: stop, length when max_tokens ran out, or tool_calls.
object
Present for some models.
object
Present for some models.
object
How many of the completion tokens were thinking.
What the request cost, broken out by the balance it was drawn from.
object
The service tier that served the request.
Examples
Basic completion
{ "id": "chatcmpl-2cf2eb3069810852daeb1629601c1790", "object": "chat.completion", "created": 1793364272, "model": "qwen3-5-35b-a3b", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris.", "refusal": null, "annotations": null, "audio": null, "function_call": null, "reasoning_content": null, "reasoning_encrypted": false }, "logprobs": null, "finish_reason": "stop", "stop_reason": null, "token_ids": null, "routed_experts": null } ], "service_tier": null, "usage": { "prompt_tokens": 36, "completion_tokens": 8, "total_tokens": 44, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0 } }, "prompt_logprobs": null, "prompt_token_ids": null, "prompt_text": null, "kv_transfer_params": null, "ec_transfer_params": null, "metrics": null, "cost": { "usd": 0.0000134, "diem": 0 }}Reasoning: thinking used the whole `max_tokens` budget
{ "id": "chatcmpl-0be46d27e3b7469a6a5c7fa03c5ff0b0", "object": "chat.completion", "created": 1793364273, "model": "qwen3-5-35b-a3b", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "", "refusal": null, "annotations": null, "audio": null, "function_call": null, "reasoning_content": "Thinking Process:\n\n1. **Analyze the Request:** The user is asking whether the number 91 is a prime number.\n\n2" }, "logprobs": null, "finish_reason": "length", "stop_reason": null, "token_ids": null, "routed_experts": null } ], "service_tier": null, "usage": { "prompt_tokens": 18, "completion_tokens": 30, "total_tokens": 48, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 30 } }, "prompt_logprobs": null, "prompt_token_ids": null, "prompt_text": null, "kv_transfer_params": null, "ec_transfer_params": null, "metrics": null, "cost": { "usd": 0.0000327, "diem": 0 }}Function calling: the model asks for a tool
{ "service_tier": "default", "id": "chatcmpl-R7TFpcKHQ35TPhEoch9eN8Wb", "object": "chat.completion", "created": 1793364274, "model": "mistral-small-3-2-24b-instruct", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "", "reasoning_content": null, "name": null, "tool_calls": [ { "id": "GmlaGIZnu", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"city\": \"Lisbon\"}" } } ] }, "finish_reason": "tool_calls", "logprobs": null } ], "usage": { "prompt_tokens": 106, "completion_tokens": 15, "total_tokens": 121 }, "cost": { "usd": 0.0000136875, "diem": 0 }}Answer after a tool result
{ "service_tier": "default", "id": "chatcmpl-R9GuGmDhUm76fCC7ZqCwAgg5", "object": "chat.completion", "created": 1793364560, "model": "mistral-small-3-2-24b-instruct", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The current weather in Lisbon is sunny with a temperature of 21 degrees Celsius.", "reasoning_content": null, "name": null, "tool_calls": [] }, "finish_reason": "stop", "logprobs": null } ], "usage": { "prompt_tokens": 134, "completion_tokens": 18, "total_tokens": 152 }, "cost": { "usd": 0.0000170625, "diem": 0 }}Vision
{ "id": "chatcmpl-4230ee67290566cd5f4c5a1e8f35fc34", "object": "chat.completion", "created": 1793364300, "model": "qwen3-5-35b-a3b", "choices": [ { "index": 0, "message": { "role": "assistant", "content": " Red", "refusal": null, "annotations": null, "audio": null, "function_call": null, "reasoning_content": null, "reasoning_encrypted": false }, "logprobs": null, "finish_reason": "stop", "stop_reason": null, "token_ids": null, "routed_experts": null } ], "service_tier": null, "usage": { "prompt_tokens": 89, "completion_tokens": 2, "total_tokens": 91, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0 } }, "prompt_logprobs": null, "prompt_token_ids": null, "prompt_text": null, "kv_transfer_params": null, "ec_transfer_params": null, "metrics": null, "cost": { "usd": 0.00001535, "diem": 0 }}Document context
{ "id": "chatcmpl-3320015f8be0e012d51399bac1a4e102", "object": "chat.completion", "created": 1793364424, "model": "qwen3-5-35b-a3b", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Standard delivery takes 3 to 5 business days.", "refusal": null, "annotations": null, "audio": null, "function_call": null, "reasoning_content": null, "reasoning_encrypted": false }, "logprobs": null, "finish_reason": "stop", "stop_reason": null, "token_ids": null, "routed_experts": null } ], "service_tier": null, "usage": { "prompt_tokens": 54, "completion_tokens": 12, "total_tokens": 66, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0 } }, "prompt_logprobs": null, "prompt_token_ids": null, "prompt_text": null, "kv_transfer_params": null, "ec_transfer_params": null, "metrics": null, "cost": { "usd": 0.0000201, "diem": 0 }}Sent only when the request’s stream field is true. The body is a sequence of data: <json>\n\n events, one JSON object per event followed by a blank line, ending with a terminal data: [DONE]\n\n marker.
Each event carries OpenAI’s chat.completion.chunk fields: id, object, created, model, and choices[] with index, delta.role, delta.content, finish_reason, and logprobs. Bayle also sends fields beyond OpenAI’s published schema: service_tier, a cost object on the trailing usage event, and, for reasoning-capable models, reasoning_content and thought_signature inside delta, both null for models that do not reason.
For a reasoning model, the thinking arrives first, as text in delta.reasoning_content, in events before the first non-empty delta.content. reasoning_content is null when reasoning_effort is none.
A trailing usage event, with choices: [] and a populated usage object, precedes the terminal marker.
If generation fails part-way, Bayle sends one extra data: event carrying the standard error envelope before the terminal marker, rather than truncating the stream without explanation. Because the Content-Language header is committed alongside the 200 status before any outcome is known, it appears on the stream whichever way the stream ends.
A single streaming response can run for at most 60 minutes. A generation that would take longer is cut off at that point, with no error event and no terminal marker. A client should treat a stream that ends without data: [DONE], or whose last finish_reason is length, as an incomplete answer.
Examples
A streamed completion
data: {"service_tier":null,"id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":"The","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":" capital","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":" of","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":" France","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":" is","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":" Paris","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":".","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":"","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":"stop"}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[],"usage":{"prompt_tokens":14,"completion_tokens":8,"total_tokens":22},"cost":{"usd":0.0000033125,"diem":0}}
data: [DONE]A stream that fails part-way
data: {"service_tier":null,"id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":"The","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":" capital","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"service_tier":"default","id":"chatcmpl-RmY5gzYS4zKddlk99ExP1Cun","object":"chat.completion.chunk","created":1793364275,"model":"mistral-small-3-2-24b-instruct","choices":[{"index":0,"delta":{"role":null,"content":" of","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"error":{"message":"Bayle could not complete inference for this request.","type":"api_error","param":null,"code":"inference_failed"}}
data: [DONE]Headers
Section titled “Headers”Confirms which of the two supported locales, en or pt-BR, this response was rendered in, so a caller can detect it without reading the message text. Present on every response, success and error alike. On a chat completions stream it is committed together with the initial 200, so it appears whichever way the stream ends.
No credential was supplied, or the credential supplied is not valid. The request is rejected before any generation work begins. The body uses the shared error envelope, rendered in the negotiated locale.
Bayle’s OpenAI-shaped error envelope, shared by every error response this API returns.
object
object
A human-readable description of the failure, in the negotiated locale. See the Accept-Language request parameter for how that locale is chosen, and the Content-Language response header for which one was served.
OpenAI’s error type vocabulary, for example api_error, authentication_error, invalid_request_error, or rate_limit_error, matching the class of failure so an OpenAI SDK’s exception mapping keeps working.
The request field the failure names, when it names one. Null when the failure is not field-specific, as with authentication or rate limiting.
Bayle’s semantic error code, reusing OpenAI’s vocabulary where an equivalent exists, for example invalid_api_key or rate_limit_exceeded. Null when Bayle could not identify the specific failure; the envelope is still valid and carries a generic message. The full list lives in Bayle’s error reference rather than being enumerated here.
Examples
English (default)
{ "error": { "message": "Your Bayle API key is missing or could not be verified.", "type": "authentication_error", "param": null, "code": "invalid_api_key" }}Brazilian Portuguese (`Accept-Language: pt-BR`)
{ "error": { "message": "Sua chave de API da Bayle está ausente ou não pôde ser verificada.", "type": "authentication_error", "param": null, "code": "invalid_api_key" }}Headers
Section titled “Headers”Confirms which of the two supported locales, en or pt-BR, this response was rendered in, so a caller can detect it without reading the message text. Present on every response, success and error alike. On a chat completions stream it is committed together with the initial 200, so it appears whichever way the stream ends.
default
Section titled “default”The request failed before the response began. See the shared error envelope. For a streaming request, a failure after the stream has already started does not use this shape at all: it arrives as an event inside the stream, described under the text/event-stream schema above.
Bayle’s OpenAI-shaped error envelope, shared by every error response this API returns.
object
object
A human-readable description of the failure, in the negotiated locale. See the Accept-Language request parameter for how that locale is chosen, and the Content-Language response header for which one was served.
OpenAI’s error type vocabulary, for example api_error, authentication_error, invalid_request_error, or rate_limit_error, matching the class of failure so an OpenAI SDK’s exception mapping keeps working.
The request field the failure names, when it names one. Null when the failure is not field-specific, as with authentication or rate limiting.
Bayle’s semantic error code, reusing OpenAI’s vocabulary where an equivalent exists, for example invalid_api_key or rate_limit_exceeded. Null when Bayle could not identify the specific failure; the envelope is still valid and carries a generic message. The full list lives in Bayle’s error reference rather than being enumerated here.
Examples
400: an invalid parameter, such as an unknown `reasoning_effort` level or no `messages`
{ "error": { "message": "Bayle could not process this request because one or more parameters are invalid.", "type": "invalid_request_error", "param": null, "code": "invalid_request" }}404: a `model` that does not exist
{ "error": { "message": "The upstream model provider could not complete this request. Please try again.", "type": "api_error", "param": null, "code": null }}402: the key's balance is exhausted
{ "error": { "message": "Your Bayle account does not have enough balance to complete this request.", "type": "insufficient_quota", "param": null, "code": "insufficient_quota" }}429: too many requests
{ "error": { "message": "You have exceeded the rate limit for Bayle's API.", "type": "rate_limit_error", "param": null, "code": "rate_limit_exceeded" }}500: the model could not complete the request
{ "error": { "message": "Bayle could not complete inference for this request.", "type": "api_error", "param": null, "code": "inference_failed" }}Headers
Section titled “Headers”Confirms which of the two supported locales, en or pt-BR, this response was rendered in, so a caller can detect it without reading the message text. Present on every response, success and error alike. On a chat completions stream it is committed together with the initial 200, so it appears whichever way the stream ends.