Create Chat Completion
Send a chat completion request. Find your API Key.
Headers
AuthorizationstringrequiredAPI Key of the from Bearer <api_key>, you can get it from here.
On an Enterprise plan? Just use enterprise.blackbox.ai instead of api.blackbox.ai for your endpoint.
Request
modelstringrequiredThe model ID to use. See the LLM Pricing page
messagesarrayrequiredArray of message objects containing the conversation history.
modelsarrayAlternate list of models for routing overrides.
providerobjectPreferences for provider routing.
streambooleanEnable streaming of results via Server-Sent Events.
max_tokensintegerMaximum number of tokens to generate (range: [1, context_length)).
temperaturenumberSampling temperature (range: [0, 2]).
seedintegerSeed for deterministic outputs.
top_pnumberTop-p sampling value (range: (0, 1]).
top_kintegerTop-k sampling value (range: [1, Infinity)).
frequency_penaltynumberFrequency penalty (range: [-2, 2]).
presence_penaltynumberPresence penalty (range: [-2, 2]).
repetition_penaltynumberRepetition penalty (range: (0, 2]).
logit_biasobjectMapping of token IDs to bias values.
top_logprobsintegerNumber of top log probabilities to return.
min_pnumberMinimum probability threshold (range: [0, 1]).
top_anumberAlternate top sampling parameter (range: [0, 1]).
stoparrayStop sequences - generation will stop if any of these strings are encountered.
toolsarrayTool definitions following OpenAI's tool calling format.
tool_choicestring | objectControls which (if any) tool is called by the model.
none- Model will not call any toolauto- Model can pick between generating a message or calling toolsrequired- Model must call one or more tools- Or specify a particular tool via
{"type": "function", "function": {"name": "function_name"}}
response_formatobjectEnforce structured output format.
userstringA stable identifier for your end-users. Used to help detect and prevent abuse.
Response
idstringUnique identifier for the chat completion.
createdintegerUnix timestamp when the completion was created.
modelstringThe model used for the completion.
objectstringObject type, always chat.completion or chat.completion.chunk for streaming.
system_fingerprintstring | nullSystem fingerprint for the model configuration.
choicesarrayArray of completion choices.
usageobjectToken usage information.
providerstringThe provider that served the request.
# Public api users: use https://api.blackbox.ai/chat/completions
curl -X POST https://enterprise.blackbox.ai/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "blackboxai/openai/gpt-5.5",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
],
"temperature": 0.7,
"max_tokens": 256,
"stream": false
}'const API_KEY = "YOUR_API_KEY";
// Public api users: use "https://api.blackbox.ai/chat/completions"
const API_URL = "https://enterprise.blackbox.ai/chat/completions";
const data = {
"model": "blackboxai/openai/gpt-5.5",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
],
"temperature": 0.7,
"max_tokens": 256,
"stream": false
};
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
const responseData = await response.json();
console.log(responseData);import requests
API_KEY = "YOUR_API_KEY"
# Public api users: use "https://api.blackbox.ai/chat/completions"
API_URL = "https://enterprise.blackbox.ai/chat/completions"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"model": "blackboxai/openai/gpt-5.5",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
],
"temperature": 0.7,
"max_tokens": 256,
"stream": False
}
response = requests.post(API_URL, headers=headers, json=data)
print(response.json()){
"id":"gen-...",
"created":1757140020,
"model":"blackboxai/openai/gpt-5.5",
"object":"chat.completion",
"system_fingerprint":"None",
"choices":[
{
"finish_reason":"stop",
"index":0,
"message":{
"content":"The capital of France is Paris.",
"role":"assistant",
"tool_calls":"None",
"function_call":"None"
},
"provider_specific_fields":{
"native_finish_reason":"stop"
}
}
],
"usage":{
"completion_tokens":7,
"prompt_tokens":14,
"total_tokens":21,
"completion_tokens_details":{
"accepted_prediction_tokens":"None",
"audio_tokens":"None",
"reasoning_tokens":0,
"rejected_prediction_tokens":"None"
},
"prompt_tokens_details":{
"audio_tokens":0,
"cached_tokens":0
}
},
"provider":"OpenAI"
}