Inference Router Quickstart
The Inference Router exposes OpenAI-compatible and Anthropic-compatible endpoints at https://api.you.com. Point an existing SDK at that base URL and authenticate with your You.com API key.
1. Get an API key
Get an API key at you.com/platform and send it as a bearer token:
The Web Search, Contents, Answer, and Research APIs read the key from X-API-Key. The Inference Router reads it from Authorization, the header the OpenAI and Anthropic SDKs already send. The samples below read the key from YDC_API_KEY.
2. List your models
GET /v1/models returns the models your key can call. Access is set per account, so two keys can see different lists.
Each model reports two token limits:
A limit is published only when it holds for every request to the model. A model with no published limit omits the field in the OpenAI format, and reports null in the Anthropic format, which you get by sending an anthropic-version header. The Anthropic format also adds display_name and paging fields.
3. Send a request
Use a model id from the previous step. To try a request without code, open the Playground.
The same model through the Anthropic-compatible endpoint:
4. Stream the response
Set stream to true on /v1/chat/completions to receive the reply as server-sent events. Each data: line is a chat.completion.chunk, and the stream ends with data: [DONE].
Set stream_options.include_usage to true to receive the token counts on one more chunk before [DONE]. That chunk has an empty choices list, so check chunk.choices before reading delta.
/v1/messages streams Anthropic server-sent events when stream is true. When a request declares a web tool, the stream also carries progress events; see Web Tools.