Skip to content
Sheet 02 · Docs

Quickstart

One key, two dialects: OpenAI-compatible at /v1/chat/completions and Anthropic-compatible at /v1/messages, plus OpenAI-compatible images, transcription and speech. Sign in for a free key, create one on the API keys page, and paste it where the snippets say sk-infero-....

01 · Chat

First request

curl
curl https://api.infero.xyz/v1/chat/completions \
  -H "Authorization: Bearer sk-infero-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
Python, OpenAI SDK
from openai import OpenAI

client = OpenAI(base_url="https://api.infero.xyz/v1", api_key="sk-infero-...")
r = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(r.choices[0].message.content)
JavaScript, OpenAI SDK
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.infero.xyz/v1", apiKey: "sk-infero-..." });
const r = await client.chat.completions.create({
  model: "deepseek-v4-flash",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(r.choices[0].message.content);
Python, Anthropic SDK
import anthropic

client = anthropic.Anthropic(base_url="https://api.infero.xyz", api_key="sk-infero-...")
r = client.messages.create(
    model="kimi-k2.6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(r.content[0].text)
02 · Agents

Coding agents

Claude Code
export ANTHROPIC_BASE_URL=https://api.infero.xyz
export ANTHROPIC_API_KEY=sk-infero-...
export ANTHROPIC_MODEL=qwen3-coder-480b
export ANTHROPIC_SMALL_FAST_MODEL=deepseek-v4-flash
claude
Codex CLI: ~/.codex/config.toml
model = "qwen3-coder-480b"
model_provider = "infero"

[model_providers.infero]
name = "infero"
base_url = "https://api.infero.xyz/v1"
env_key = "INFERO_API_KEY"
wire_api = "chat"   # infero serves chat completions, not the Responses API
OpenCode: opencode.json
{
  "provider": {
    "infero": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "https://api.infero.xyz/v1", "apiKey": "sk-infero-..." },
      "models": { "qwen3-coder-480b": {}, "kimi-k3": {}, "glm-5": {} }
    }
  }
}
03 · Media

Images, audio and speech

The OpenAI image and audio endpoints, with the same key, routing and prepaid billing. Each model is billed in its own unit: per image returned, per second of audio transcribed (rounded up; priced per minute) and per character spoken. Use a model of the matching kind; the pricing page lists them, and /v1/models marks each with its kind.

curl: image
curl https://api.infero.xyz/v1/images/generations \
  -H "Authorization: Bearer sk-infero-..." \
  -H "Content-Type: application/json" \
  -d '{"model": "stable-diffusion-3.5", "prompt": "a lighthouse at dawn"}'
# -> {"created": ..., "data": [{"b64_json": "..."}]}
curl: transcription
curl https://api.infero.xyz/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-infero-..." \
  -F model=whisper-large-v3-turbo \
  -F [email protected]
# -> {"text": "..."}
curl: speech
curl https://api.infero.xyz/v1/audio/speech \
  -H "Authorization: Bearer sk-infero-..." \
  -H "Content-Type: application/json" \
  -d '{"model": "kokoro", "input": "Hello!", "voice": "af_bella"}' \
  -o hello.mp3
Python, OpenAI SDK
import base64
from openai import OpenAI

client = OpenAI(base_url="https://api.infero.xyz/v1", api_key="sk-infero-...")

img = client.images.generate(model="stable-diffusion-3.5", prompt="a lighthouse at dawn")
open("lighthouse.png", "wb").write(base64.b64decode(img.data[0].b64_json))

with open("meeting.mp3", "rb") as f:
    print(client.audio.transcriptions.create(model="whisper-large-v3-turbo", file=f).text)

client.audio.speech.create(model="kokoro", input="Hello!", voice="af_bella").write_to_file("hello.mp3")
Media request fields

Images: prompt, n (1–4), size. Images come back as base64; ask for "response_format": "url" to get a data: URL instead.

Transcription: multipart upload up to 25 MB; response_format is json (default), text or verbose_json; optional language, prompt and temperature.

Speech: input, voice, speed; response_format is mp3 (default), opus, aac, flac, wav or pcm.

Other fields are not forwarded. Media models need a paid balance: they are not on the free tier.

04 · Reference

Good to know

Response headers & routing controls

x-infero-provider on every response tells you which upstream actually served the request.

Pin a provider or disable failover per request with a JSON body field: "provider": {"only": ["deepinfra"], "allow_fallbacks": false}. Transcription uploads (multipart) take no routing controls and always fail over.

Send an Idempotency-Key header to make retries billing-safe.

Tracker pricing: a chat model's price tracks the cheapest provider floor and only moves down. Provider price cuts pass through automatically and re-rate your current month. Image, audio and speech prices are set the same way but change only when we reprice them. Audit the history at /v1/pricing/history.

Verified serving: every chat endpoint is canaried (tool-call conformance, code, unicode); scores are public at /v1/quality, and requests with tools never route to a failing endpoint.

Manage child keys, budgets, and allowlists via /v1/keys; live prices at /pricing and measured uptime at /status.