RequestBeam Docs
Common Chat Completions
Unified chat API for switching text models through the `model` parameter. The request format is compatible with OpenAI Chat Completions.
https://api.requestbeam.com/v1/chat-completionsUnified chat API for switching text models through the model parameter. The request format is compatible with OpenAI Chat Completions.
This endpoint returns one complete JSON response by default. Set stream: true explicitly when you need SSE streaming.
POST https://api.requestbeam.com/v1/chat-completionsAuthentication
All requests require Bearer Token authentication.
Authorization: Bearer YOUR_API_KEYIf authentication fails, check:
- Whether the API Key is correct
- Whether the key is valid for this API Base URL
- Whether the request header is spelled correctly
- Whether a proxy rewrites the authorization header
Body
modelstringrequiredDefault: gpt-5.4Current active text models:
- OpenAI:
gpt-5.4,gpt-5.5,gpt-5.6-sol,gpt-5.6-terra,gpt-6-astra - Anthropic:
claude-fable-5,claude-fable-5-1,claude-haiku-4-5,claude-opus-4-5,claude-opus-4-6,claude-opus-4-7,claude-opus-4-8,claude-opus-5,claude-opus-5-5,claude-sonnet-4-5,claude-sonnet-4-6,claude-sonnet-5 - DeepSeek:
deepseek-v4-flash,deepseek-v4-pro,deepseek-v4.1-flash
(V4.1 Flash is a distinct model ID, available only after deployment and enablement; check GET https://api.requestbeam.com/v1/models).
- Gemini:
gemini-3.6-flash,gemini-3.7-flash,gemini-3.8-flash,gemini-3.5-flash-lite - Kimi:
kimi-k3 - MiniMax:
minimax-m3
See the Model Catalog for the complete list and the models visible to the current API Key. Use your own GET https://api.requestbeam.com/v1/models response as the current source of availability. See the DeepSeek, Gemini, Kimi, and MiniMax guides for family-specific selection notes and examples.
messagesobject[]requiredChat messages. Each message should include:
role:system,user, orassistantcontent: message content
Example:
[
{"role": "system", "content": "You are a helpful Python tutor."},
{"role": "user", "content": "How should I learn programming?"}
]temperaturenumberDefault: 1.0Sampling temperature. OpenAI-compatible clients commonly use 0 through 2, but the selected model makes the final validation decision.
max_tokensintegerOptional maximum output tokens, as a positive integer. Omit this field to use the upstream default for the selected model; defaults and maximum limits vary by model and upstream configuration.
Depending on the model, the budget may include reasoning tokens as well as final text. A small budget can cause finish_reason: "length", truncate the answer, or be exhausted before final text. Increasing it may increase cost.
max_completion_tokensintegerOptional compatibility alternative to max_tokens, with the same budget considerations. A model may accept only one of these fields, so start with a minimal body when switching models. Omit both to use the upstream default.
streambooleanDefault: falseWhether to stream the response.
true: return Server-Sent Eventsfalse: return one complete response
top_pnumberDefault: 1.0Nucleus sampling parameter. OpenAI-compatible clients commonly use 0 through 1; the selected model performs final validation.
frequency_penaltynumberDefault: 0Frequency penalty. OpenAI-compatible clients commonly use -2.0 through 2.0; the selected model performs final validation.
presence_penaltynumberDefault: 0Presence penalty. OpenAI-compatible clients commonly use -2.0 through 2.0; the selected model performs final validation.
stopstring | arrayA stop sequence or array of stop sequences. The selected model determines the accepted count and behavior.
nintegerDefault: 1Number of responses to generate. Use a number such as 1, not a quoted string.
Model Parameter Differences
Current text models support minimal streaming and non-streaming Chat requests, but optional parameter acceptance and effects vary by the selected model and its compatibility implementation.
The latest recheck on 2026-09-26 accepted claude-fable-5 with temperature: 0 and returned text. The same recheck rejected claude-sonnet-5 with top_p: 0.9 with HTTP 400 and top_p is deprecated. Omit top_p for that model. Acceptance establishes neither an effect on sampling nor a guarantee for other models or later requests; do not assume that all sampling parameters are supported.
The OpenAI checks on 2026-09-26 accepted stop for gpt-5.6-sol and gpt-5.6-terra. Parameter acceptance can change with the upstream and does not prove that a stop sequence is effective.
Native OpenAI-compatible Chat forwarding preserves top_p and stop in the upstream request. A route that converts Chat to Responses preserves top_p but does not forward stop. Forwarding a field does not establish upstream support or its effect; neither field has a platform-wide guarantee across routes.
Start with a minimal request when switching models, then verify sampling, stop sequences, and advanced tool parameters separately. For stop sequences, inspect the actual text and stop reason, not only the HTTP status. HTTP 200 does not establish a sampling effect. Output budgets must cover both the model's thinking and its final text.
Request Example
{
"model": "gpt-5.4",
"messages": [
{
"role": "user",
"content": "Hello, introduce yourself briefly."
}
],
"stream": false
}Response
idstringUnique response identifier.
objectstringObject type, usually chat.completion or chat.completion.chunk for streaming.
createdintegerUnix creation timestamp.
modelstringModel identifier returned in the response.
choicesarrayGenerated choices, including message content, index, and finish reason.
usageobjectToken usage statistics.
Success Example
{
"id": "chatcmpl-9876543210",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-5.4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I am an AI assistant that can help with writing, coding, and analysis."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 42,
"total_tokens": 70
}
}Error Response
See Error Codes and Troubleshooting for the full code reference, protocol differences, and diagnostic steps.
Chat Completions HTTP errors use a flat JSON body, including upstream HTTP errors returned before an SSE stream starts. For example, HTTP 402 returns:
{
"code": 40000,
"message": "Insufficient credit. Required: 30000, Available: 20000",
"type": "api_error"
}code: numeric platform error code, separate from the HTTP status and not a stringmessage: human-readable error descriptiontype:api_errorrequestId: optional request identifier for troubleshooting
| HTTP status | code | Meaning |
|---|---|---|
| 400 | 10000 | Invalid request |
| 401 | 20000 | Missing or invalid authentication |
| 402 | 40000 | Insufficient credit |
| 403 | 20001 | Access denied or model unavailable to this key |
| 404 | 30000 | Model or resource not found |
| 409 | 30001 | Request conflict |
| 422 | 10001 | Validation error |
| 429 | 40001 | Rate limit exceeded |
| 500 | 50003 | Internal error |
| 502 | 50000 | Upstream provider error |
| 503 | 50001 | Service unavailable |
| 504 | 50002 | Gateway timeout |
Check the HTTP status first to determine whether the request succeeded, then compare the numeric code for application-specific handling. Do not compare code with strings such as "400", assume it equals the HTTP status, or parse message as a stable error identifier. Missing or incorrectly typed messages are rejected with HTTP 400 and code: 10000 before provider invocation.
This error format applies to Chat Completions HTTP responses, not errors within an already-started SSE stream or other API protocols. Model Catalog and native protocol endpoints have their own documented error formats.