For AI agents, the documentation index lists all pages. Append .md to a documentation URL for Markdown, or request text/markdown.

Skip to Content

Authentication

Authenticate Cloud and local API requests, distinguish caller credentials from provider keys, and check required permissions.

3 min readEdit this page

Use a credential for the BitRouter deployment receiving the request. Keep caller authentication separate from the credentials BitRouter uses to reach an upstream provider.

CredentialSent toPurpose
Cloud API keyhttps://api.bitrouter.aiApplication access to authorized Cloud operations
Local virtual keyYour self-hosted BitRouter endpointCaller authentication when local authentication is enabled
Provider API key or subscription credentialConfigured through BitRouter's provider setupAuthenticate BitRouter's upstream inference connection

A Cloud key does not automatically authenticate a local daemon. Provider keys are configured through BYOK & Subscriptions; they are not substitutes for the caller credential in these examples.

Cloud API keys

Create a key with the required scope through CLI Cloud Management. Inference applications use inference:invoke; management operations have their own scope requirements.

Store the plaintext key when it is issued, then supply it to the application through secret storage or an environment variable:

export BITROUTER_API_KEY='paste-your-cloud-key-here'

Send it in the request header:

Authorization: Bearer <cloud-api-key>

The documented Cloud endpoints also accept x-api-key. Use that header for clients configured to send an API key directly:

x-api-key: <cloud-api-key>

Use the documented BitRouter authentication mechanism for the chosen endpoint. A compatible request body does not imply support for every upstream vendor's authentication mechanism. The OpenAPI schema describes the accepted security schemes per endpoint.

Local virtual keys

The default loopback setup can run with local authentication skipped. An authenticated deployment sets server.skip_auth: false and uses a local virtual key:

Authorization: Bearer <local-virtual-key>

Provision the key against the same database used by the daemon. Self-hosting documents configuration, bro key sign, database selection, and restart requirements. It also owns TLS and network exposure.

For examples that use a local key, set BITROUTER_VIRTUAL_KEY to the issued value. Omit the authentication header only when using a deployment intentionally configured to skip caller authentication.

Permissions and authentication failures

TaskRequired scopeContract
Invoke inferenceinference:invokeCloud API
Read aggregate account usageusage:readUsage aggregate
Read the account balancebilling:readBilling balance
Create an API keykeys:writeMint API key

Requested key scopes must be a subset of the caller's effective permissions. Resource ownership and namespace checks still apply. Consult each endpoint for its complete requirements and response contract.

When authentication or authorization fails, confirm the destination host, credential type, expiry if configured, namespace, and required scope. A missing scope requires a credential with that permission; changing the model selector does not grant it. Cloud Management covers CLI re-login and key management.

A successful public discovery or health request does not test inference authentication. See API Getting Started for an authenticated inference request and inspect its actual result.

How is this guide?

On this page