Open Router quickstart: your first API request
Looking for Open Router? Use OpenRouter’s official endpoint, create your own key, choose a model ID, and verify a first API request before adding a local gateway.
For AI model access, “Open Router” usually means OpenRouter at openrouter.ai. This guide walks through a direct hosted API request. You do not need to install 9Router for this path. If you want to place 9Router in front of the hosted service, read OpenRouter with 9Router instead.
Start with the official service
Open the OpenRouter quickstart and create an API key in your own account. Review the current billing and model-access requirements before making requests. A key copied from a blog or shared publicly is neither a dependable credential nor a substitute for your own account.
Select a model from the model catalog. Copy its API identifier, which may include a provider or organization prefix. A model’s display title is not necessarily the string accepted by the API. Check whether the selected endpoint supports the input and output you need.
Make a minimal request
Store your key in the environment variable OPENROUTER_API_KEY using your normal local secret-management method. Replace MODEL_ID_FROM_CATALOG below with the chosen identifier. This is a request template; it is not a recorded result and the placeholder will not resolve to a model.
curl https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID_FROM_CATALOG",
"messages": [{"role": "user", "content": "Reply with one short greeting."}],
"stream": false
}'
The model call may incur charges under the selected route’s current terms. Start with a short prompt and inspect both the HTTP response and account activity. A successful HTTP response containing a model answer is a better baseline than a client UI that merely accepts the key.
Read the response before adding more features
Check for an error object, the returned completion, model information, and usage fields where supplied. Save only a redacted response if you need to compare it later. Do not post the authorization header or your private conversation to a public issue.
Next, test one capability at a time: streaming, tool calls, structured output, or images. An ordinary text response does not prove support for all of those features. Use the selected model’s documentation and a client that sends the correct request format.
Configure an OpenAI-compatible client
Where the client accepts an OpenAI-compatible custom provider, set the base URL to https://openrouter.ai/api/v1, provide the OpenRouter key, and choose the same model ID you just verified. A field labeled “base URL” generally expects the prefix, not the full /chat/completions request URL; check the client’s own documentation.
Avoid adding /v1 twice. If your client uses the Responses API or Anthropic Messages rather than Chat Completions, follow its supported integration path instead of assuming the example above configures it.
If the first request fails
401 points to authentication: check the key and header at the hosted endpoint. 429 requires examining current request or quota limits. 400 often calls for checking the model ID and payload. Other errors can come from the selected provider or upstream availability; consult the documented error reference and retain the exact response.
Changing to a local router before fixing this direct baseline can hide the original problem behind another error wrapper. Once the hosted route works, you can decide whether local provider management adds value. The OpenRouter integration guide explains that decision and the two sets of credentials involved.
References for this guide
Steps were checked against the linked documentation and source. Provider access and model availability depend on your account. We do not claim a completed live model test unless explicitly stated.