docs · quickstart

five minutes, most of it reading

If your code talks to the OpenAI, Anthropic or Gemini API, it can talk to inferhub. Change the base URL and the key, pick a model from the pool, done.

base url

The OpenAI-compatible base URL is https://api.inferhub.sh/v1. Authenticate with your ih_ key as a bearer token, the same way you'd use an OpenAI key.

from openai import OpenAI

client = OpenAI(base_url="https://api.inferhub.sh/v1", api_key="ih_...")
client.chat.completions.create(
    model="groq/llama-3.3-70b-versatile",
    messages=[{"role": "user", "content": "hello"}],
)
# that's the whole migration

The other dialects live next to it:

# OpenAI-compatible
https://api.inferhub.sh/v1
# Anthropic-compatible (the SDK appends /v1/messages)
https://api.inferhub.sh/anthropic
# Gemini-compatible (the SDK appends /v1beta/models/...)
https://api.inferhub.sh/gemini

model ids

Models are named platform/model, where the second half is the platform's own id. For example groq/llama-3.3-70b-versatile is Groq's llama-3.3-70b-versatile. The full list, with health and dialect support, is on /models, or ask the API: GET /v1/models.

When your SDK's dialect matches the platform's, the request is passed through untouched. Otherwise it's translated, which can drop features like thinking blocks, prompt caching or citations. The models table says which is which.

secret tags

Before a request leaves inferhub, secrets are swapped for tags. The model sees ⟦db_url⟧, can use it (in a tool call, say), and we put the real value back in the response before it reaches you. Three ways a secret gets tagged:

  1. Inline markup. Write ⟦name=value⟧ anywhere in a message. The provider receives ⟦name⟧; the value never leaves.
  2. Detectors. Common API key formats, DSNs, JWTs, PEM blocks and password=-style assignments are tagged automatically.
  3. Your vault. Secrets you save in your vault are matched by exact value in every request from your account, and tagged with the name you gave them. If the vault can't be loaded, the request fails rather than going out unmasked.
client.chat.completions.create(
    model="groq/llama-3.3-70b-versatile",
    messages=[{"role": "user",
               "content": "run the migration against ⟦db_url=postgres://admin:hunter2@db/app⟧"}],
)

What the provider gets: run the migration against ⟦db_url⟧

Detectors miss things. Anything that isn't a tag reaches the provider, and the contributor's provider dashboard, exactly as written. If it matters, mark it. See trust.

pools

A pool is a set of shared keys plus the rules for using them. With no pool specified, requests route through every pool your account can use. To pin one, send its slug in the X-IH-Pool header:

curl https://api.inferhub.sh/v1/chat/completions \
  -H "Authorization: Bearer ih_..." \
  -H "X-IH-Pool: 3am-gang" \
  -H "Content-Type: application/json" \
  -d '{"model": "groq/llama-3.3-70b-versatile", "messages": [{"role": "user", "content": "hello"}]}'

open pools

Open pools need no inferhub account. Each has its own base URL, https://api.inferhub.sh/p/{pool}/v1, with per-IP limits on top of whatever the contributors set.

client = OpenAI(
    base_url="https://api.inferhub.sh/p/3am-gang/v1",
    api_key="none",  # no inferhub key needed; the SDK just insists on a value
)