The hosted gateway exposes OpenAI-compatible HTTP endpoints backed by B3IQ router policy. Inference is free: your keys route to the machines on your own account, the gateway enforces customer policy and quotas, and it records receipt metadata without storing raw prompts or outputs in the control plane.

Use https://b3iq.org/v1/api as the public gateway base URL for application traffic.

Using the OpenAI SDK?

The endpoints below are also reachable through the official openai Python/JavaScript SDK with a base_url/api_key swap — no raw HTTP required. See the OpenAI SDK Quickstart.

Endpoints

MethodPathPurpose
GET/v1/api/modelsList models — the public network-wide catalog anonymously, or only the models your machines serve when called with your gateway key
GET/v1/api/statsRead public aggregate network stats without auth
GET/v1/api/pricingRead legacy settlement-policy metadata without auth (inference itself is unbilled)
POST/v1/api/chat/completionsRun a hosted OpenAI-compatible chat completion through B3IQ route policy
GET/v1/api/receipts/{receipt_hash}Read public-safe receipt evidence
Modality endpoints are local for now

Embeddings, image generation, audio, and rerank are OpenAI-compatible endpoints on the local host-agent API when your machine's runtime serves that modality. The hosted gateway facade above is chat-only today.

Pick a model id from your machines

The model field takes an id returned by GET /v1/api/models. Called with your gateway key, that list is exactly the models the machines on your account serve right now — anything on it can dispatch, and anything missing would fail with no_eligible_nodes. The examples below use a representative id (qwen3-8b); always list the live models first, since the set changes as your machines come and go.

List Models

bash
: "${B3IQ_GATEWAY_BASE_URL:?set B3IQ_GATEWAY_BASE_URL}"cfg="$(mktemp)"chmod 600 "$cfg"trap 'rm -f "$cfg"' EXIT{ printf 'url = "%s/models"\n' "${B3IQ_GATEWAY_BASE_URL%/}"} > "$cfg"curl --fail --silent --show-error --config "$cfg"

/v1/api/models has two views. Anonymous calls return the public network-wide catalog: models with at least one live, route-eligible profile on a public machine. Calls that send a valid customer-owned gateway key return only the models the machines on that account serve right now — the key's node scope is respected, any machine you've switched to Earn mode is excluded, and the account's model and route-tier policy still filters the result. The key-scoped list is served uncached, so it always reflects the current state of your machines.

Public Stats And Pricing

bash
curl --fail --silent --show-error "${B3IQ_GATEWAY_BASE_URL%/}/stats"curl --fail --silent --show-error "${B3IQ_GATEWAY_BASE_URL%/}/pricing"

These metadata endpoints do not require a gateway key and do not expose customer identity, prompts, outputs, raw tokens, node-local URLs, or private routes.

Chat Completion

bash
: "${B3IQ_GATEWAY_BASE_URL:?set B3IQ_GATEWAY_BASE_URL}": "${B3IQ_GATEWAY_KEY_FILE:?set B3IQ_GATEWAY_KEY_FILE}"cfg="$(mktemp)"chmod 600 "$cfg"trap 'rm -f "$cfg"' EXIT{ printf 'url = "%s/chat/completions"\n' "${B3IQ_GATEWAY_BASE_URL%/}" printf 'request = "POST"\n' printf 'header = "Authorization: Bearer %s"\n' "$(sed -n '1p' "$B3IQ_GATEWAY_KEY_FILE")" printf 'header = "Content-Type: application/json"\n'} > "$cfg"curl --fail --silent --show-error --config "$cfg" --data-binary @- <<'JSON'{ "model": "qwen3-8b", "messages": [{ "role": "user", "content": "Say hello from B3IQ." }], "max_tokens": 64}JSON
Blend several models in one request

The same endpoint can fan a prompt out to several models and return one combined answer — attach a b3iq.mixture object. See Mixture of Experts.

Streaming

Set stream: true to request SSE streaming. Hosted streaming proxies the selected node stream while parsing final usage and b3iq.receipt_hash metadata for usage metering and receipt settlement.

json
{ "model": "qwen3-8b", "messages": [{ "role": "user", "content": "Stream a short response." }], "stream": true}

Routing And Policy

A request passes three gates, in order, before it runs:

  1. Key validity — the gateway key must be active, unexpired, and carry the required scope and a usable customer identity.
  2. Rate limits and quota — per-key and per-account rate limits, and the account's daily token quota (default uncapped), are enforced next.
  3. Own-account routing — the request dispatches only to a machine on your account that is online and serving the requested model. When none can serve it, the request fails closed with no_eligible_nodes.

Hosted chat can also fail closed when the model or route tier is outside your policy, or when an incident control pauses a route class, node, or payout path.

See Errors for stable machine codes, and Usage & Quotas for metering, rate limits, and the token quota.

Headers

HeaderDirectionDescription
AuthorizationRequestBearer hosted gateway key
Idempotency-KeyRequestAccepted for compatibility; requests are not currently deduplicated.
X-B3IQ-Router-Dispatch-ModeResponseRouted response dispatch mode
X-B3IQ-Router-Node-IDResponseSelected node ID when policy exposes it
X-B3IQ-Receipt-HashResponseReceipt hash returned by the selected node
Do not mix customer credentials

Customer-owned gateway keys carry account ownership and usage attribution. Do not also send raw customer headers with those keys unless an operator smoke path explicitly requires it.

Ask a question... ⌘I