Quickstart
Use a HanRouter API key to access configured manufacturers through a unified API.
https://api.hanrouter.ai/v1Manage API keysPrepare your API key
Sign in at /login, then create or copy a HanRouter API key at /keys. Your password and browser session token are not API keys. Check key validity, model group permissions and Dashboard balance.
Store the complete key in the server environment variable HANROUTER_API_KEY. Keep it out of browser code, public repositories and URL parameters.
URL and authentication
Use https://api.hanrouter.ai/v1 as the OpenAI-compatible Base URL and Authorization: Bearer $HANROUTER_API_KEY. Do not duplicate /v1. All manufacturers use your HanRouter key, not an upstream vendor key.
For the Anthropic SDK and Claude Code, use https://api.hanrouter.ai without /v1; the client appends /v1/messages. Use the OpenAI-compatible interface for Google models.
Verify available models
List models available to your key first, then copy data[].id exactly into requests. Names, case and aliases come from this response. The public plaza hides unpriced models; backend availability is unchanged.
curl "https://api.hanrouter.ai/v1/models" \
-H "Authorization: Bearer $HANROUTER_API_KEY"OpenAI SDK
Set HANROUTER_MODEL before running.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["HANROUTER_API_KEY"],
base_url="https://api.hanrouter.ai/v1",
)
model_id = os.environ["HANROUTER_MODEL"]
result = client.chat.completions.create(
model=model_id,
messages=[{"role": "user", "content": "Hello"}],
)
print(result.choices[0].message.content)