Skip to content

Getting started

InferBridge speaks the OpenAI Chat Completions protocol, so after a two-step registration you can keep using your existing SDK code. This walkthrough assumes you already have an OpenAI (or Anthropic, Together, or Sarvam) API key.

The key is shown exactly once — save it somewhere before you close the terminal.

Terminal window
curl -X POST https://inferbridge.dev/v1/users \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com"}'
# → {"user_id":"...","email":"...","api_key":"ib_...","shown_once":true}

BYOK: InferBridge encrypts your provider key at rest and forwards requests on your behalf. No markup, no proxying of your bill.

Terminal window
curl -X POST https://inferbridge.dev/v1/keys \
-H 'Authorization: Bearer ib_...' \
-H 'Content-Type: application/json' \
-d '{"provider":"openai","api_key":"sk-..."}'

Supported provider values: openai, anthropic, together, sarvam, self_hosted. Self-hosted keys need a base_url and a declared_region. See Users & provider keys for the full schema.

3. Point your existing OpenAI SDK at InferBridge

Section titled “3. Point your existing OpenAI SDK at InferBridge”

Python, before:

from openai import OpenAI
client = OpenAI(api_key="sk-...")

Python, after:

from openai import OpenAI
client = OpenAI(
api_key="ib_...",
base_url="https://inferbridge.dev/v1",
)
resp = client.chat.completions.create(
model="ib/balanced",
messages=[{"role": "user", "content": "Hello"}],
)

That’s it. Streaming works unchanged (stream=True). InferBridge picks the cheapest healthy provider for your tier, falls back if one errors, caches repeated prompts on request (header: X-InferBridge-Cache: true), and logs every call with tokens, cost, and latency.

Full Python / Node / cURL walkthrough with every response field explained: Migrating from OpenAI.

  • Route by tier — pick ib/cheap, ib/balanced, or ib/premium in the model field. Or override per-request with X-InferBridge-Override-Model: provider:model.
  • Watch your spendGET /v1/stats for aggregates, GET /v1/logs for per-request rows. Both scoped to your user.
  • Go India-only — send X-InferBridge-Residency: india to filter routing to Sarvam + self-hosted India endpoints.

Full API reference: /docs/api/authentication/.