Quickstart
Your first request in five minutes
InferMesh is an OpenAI- and Anthropic-compatible gateway paid in credits. If your code already talks to either API, you change the base URL and the key — nothing else.
1. Get credits and a key
- Connect a Solana wallet (Phantom, Solflare, Backpack or any Wallet Standard wallet) and sign the one-time sign-in message. Your wallet is your account.
- Buy credits on Compute with USDC. Your first purchase creates an API key instantly. Stakers can instead claim earned credits on Mesh.
- Create more keys — with scopes, spend caps and rate limits — on Developers. Each key is shown once; only a salted hash is stored.
2. Point your client at InferMesh
OpenAI-compatible base URL
https://infermesh.dev/v1Anthropic SDK base URL (the SDK adds /v1)
https://infermesh.devAuthenticate with Authorization: Bearer sk-infer-YOUR_KEY. The x-api-key header used by Anthropic SDKs works too.
export OPENAI_BASE_URL="https://infermesh.dev/v1"
export OPENAI_API_KEY="sk-infer-YOUR_KEY"
export ANTHROPIC_BASE_URL="https://infermesh.dev"
export ANTHROPIC_API_KEY="sk-infer-YOUR_KEY"3. Make a request
curl https://infermesh.dev/v1/chat/completions \
-H "Authorization: Bearer sk-infer-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5.5",
"messages": [{ "role": "user", "content": "Explain proof of history in one sentence." }]
}'Model ids are lab/model (for example anthropic/claude-sonnet-5.5); each lab's native id is accepted as an alias. See Models & pricing.
Streaming
Set stream: true to receive server-sent events exactly as the OpenAI or Anthropic API sends them. To receive token usage in the final chunk of an OpenAI-style stream, set stream_options: { include_usage: true }. If your balance runs out mid-stream, the stream ends with an insufficient_credits error event; you are charged for the tokens delivered and never more than your balance.
Response headers
Check your balance from code
curl https://infermesh.dev/v1/account/credits \
-H "Authorization: Bearer sk-infer-YOUR_KEY"1 credit = $1 of compute