Run a chat completion from the apex OpenAI base URL.
POST
/v1/chat/completions
Identical contract to
/v1/api/chat/completions, served at the apex so
https://b3iq.org/v1 is the corresponding OpenAI SDK base URL. The
Authorization header is forwarded to the control plane verbatim; auth,
quotas and rate limits are enforced there.Authentication
Bearer Token (b3iq_key)
Request Body required
application/jsonmodel
string
REQUIRED
messages
object[]
REQUIRED
Min items
1
Array of:
role
string
REQUIRED
Values
system user assistant toolcontent
string | object[]
REQUIRED
One of:
Option 1string
Option 2
Array of:
object
max_tokens
integer
Min
1temperature
number
top_p
number
stop
string | string[]
One of:
Option 1string
Option 2
Array of:
string
stream
boolean
Default
falsen
integer
B3IQ currently rejects
n > 1.Min
1Max 1b3iq
object
Router policy metadata consumed by B3IQ and stripped before node dispatch.
model_profile_id
string
dispatch_mode
string
Values
pooled_syncmixture
object
Mixture of Experts: fan the prompt out to several expert models and return one combined answer. Experts run in parallel and each is routed through normal B3IQ policy; experts cannot pin nodes.
strategy
string
REQUIRED
synthesize combines expert answers with an aggregator model; vote returns the weighted-plurality answer; weighted returns the highest-weight successful expert answer.
Values
synthesize vote weightedexperts
object[]
REQUIRED
Capped by an operator-configured limit (default 4 experts; the aggregator is not counted).
Min items
1
Array of:
model
string
REQUIRED
Model id from GET /v1/api/models.
weight
number
Vote pooling / selection weight.
Default
1Greater than 0aggregator
object
Required for the synthesize strategy; ignored otherwise.
model
string
REQUIRED
min_experts
integer
Quorum of experts that must succeed. Defaults to half the experts, rounded up, for vote; otherwise 1.
Min
1Responses
200
Chat completion response, or SSE stream when
stream is true and allowed.
application/jsonid
string
REQUIRED
object
string
REQUIRED
created
integer
REQUIRED
model
string
REQUIRED
choices
object[]
REQUIRED
usage
object
prompt_tokens
integer
completion_tokens
integer
total_tokens
integer
b3iq
object
runtime_id
string
runtime_kind
string
latency_ms
integer
ttft_ms
integer
request_id
string
mixture
object
Present when the request carried b3iq.mixture. Metadata-only trace of the fan-out — never expert or aggregator text.
strategy
string
degraded
boolean
True when the mixture completed with a partial failure — one or more sub-calls did not succeed, or the synthesize aggregator failed and the answer fell back to the top-weighted surviving expert.
experts
object[]
Array of:
role
string
Values
expert aggregatormodel
string
status
string
ok, no_node, upstream_error, or (defensively) error.
node_id
string
usage
object
total_tokens
integer
default
OpenAI-compatible error with B3IQ metadata.
curl -X POST 'https://b3iq.org/v1/chat/completions' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "model": "string", "messages": [ { "role": "system", "content": "string" } ], "max_tokens": 1, "temperature": 0, "top_p": 0, "stop": "string", "stream": false, "n": 1, "b3iq": { "model_profile_id": "string", "dispatch_mode": "pooled_sync", "mixture": { "strategy": "synthesize", "experts": [ { "model": "string", "weight": 1 } ], "aggregator": { "model": "string" }, "min_experts": 1 } }}'
const response = await fetch('https://b3iq.org/v1/chat/completions', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "string", "messages": [ { "role": "system", "content": "string" } ], "max_tokens": 1, "temperature": 0, "top_p": 0, "stop": "string", "stream": false, "n": 1, "b3iq": { "model_profile_id": "string", "dispatch_mode": "pooled_sync", "mixture": { "strategy": "synthesize", "experts": [ { "model": "string", "weight": 1 } ], "aggregator": { "model": "string" }, "min_experts": 1 } } })});const data = await response.json();console.log(data);
200
Response
{ "id": "<string>", "object": "<string>", "created": 123, "model": "<string>", "choices": [ "<object>" ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123 }, "b3iq": { "runtime_id": "<string>", "runtime_kind": "<string>", "latency_ms": 123, "ttft_ms": 123, "request_id": "<string>", "mixture": { "strategy": "<string>", "degraded": true, "experts": [ { "role": "expert", "model": "<string>", "status": "<string>", "node_id": "<string>", "usage": { "total_tokens": {} } } ] } }}
API Playground
Try this endpoint
POST
/v1/chat/completions

