OpenRouter with 9Router: connect or use directly
Choose direct OpenRouter access or a 9Router provider connection, keep the two API keys separate, and check model IDs, routing, billing, and request failures.
Use OpenRouter directly if you only need its hosted models. Add it to 9Router when you want the same local client endpoint to reach OpenRouter and your other provider connections. This guide connects the two; the separate Open Router quickstart covers the first direct API request.
You need a running 9Router instance, an OpenRouter API key with access to your chosen model, and a router-issued key for local API authentication. Hosted requests can consume OpenRouter credits even though 9Router itself is free software.
Create the OpenRouter node, then save its key
In Providers → Custom Providers (OpenAI/Anthropic Compatible) → Add OpenAI Compatible, use these values. The form and persistence sequence were checked against upstream source on October 23, 2026; use your installed version’s equivalent labels if they differ.
| Field | Value | Why |
|---|---|---|
| Name | OpenRouter | Recognizable dashboard label |
| Prefix | or-local | Example local namespace; choose an unused prefix |
| API Type | Chat Completions | This recipe tests chat, not Responses |
| Base URL | https://openrouter.ai/api/v1 | Hosted API base, without /chat/completions |
| API Key (for Check) | Your OpenRouter key, if validating now | Validation only; this does not save the connection |
| Model ID | Exact OpenRouter catalog ID | Used for validation if model-list discovery is unavailable |
Choose API Type before Base URL: changing the type resets the URL in the reviewed form. The optional Check can fall back to an inference request and incur usage. You can skip Check and proceed to Create.
Open the new node, choose Add API Key, enter a connection Name and the upstream API Key, then set Default Model to the exact OpenRouter model ID and click Save. The key entered in the earlier check field is not carried into this saved connection.
Under the node’s models, use Import from /models, or enter that upstream ID and click Add if import fails. Click the model row’s Copy button for the client-facing ID. For an illustrative upstream ID vendor/model, the local ID is or-local/vendor/model; keep both slashes. Do not put or-local/ in the upstream Default Model field.
Verify the local route with one small request
These Bash/zsh examples require curl and jq. Set NINEROUTER_API_KEY locally to your router key and ROUTER_MODEL to the copied model ID. Neither value is the OpenRouter credential stored above.
curl --fail-with-body --noproxy '*' http://localhost:20128/v1/models \
-H "Authorization: Bearer $NINEROUTER_API_KEY"
jq -n --arg model "$ROUTER_MODEL" \
'{model:$model,messages:[{role:"user",content:"Reply with the word ready."}],stream:false}' \
> /tmp/openrouter-router-probe.json
curl --fail-with-body --noproxy '*' -i \
http://localhost:20128/v1/chat/completions \
-H "Authorization: Bearer $NINEROUTER_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @/tmp/openrouter-router-probe.json
The first request should return a model list containing your local ID. The second should return a successful chat response with choices, not an HTML login page. Match the request time and selected route in 9Router with activity in your OpenRouter account. A catalog entry alone does not prove the account can run the model. These are source-reviewed instructions, not a paid inference result from this Wiki.
Direct works, local fails: compare the changed fields
| Observation | Inspect and repair |
|---|---|
| Local 401 before any upstream request | Use the router key in curl; keep the OpenRouter key in the saved provider connection |
| Node exists but has no usable connection | Reopen it and complete Add API Key → Default Model → Save |
| Model not found | Copy the model row again; distinguish local prefix from the full upstream catalog ID |
| Upstream rejects authentication or usage | Check the saved OpenRouter credential and account activity; changing the local key cannot fund upstream usage |
| Basic chat works but an agent fails | Compare the agent’s API path, tools and optional parameters with this minimal chat payload |
Use the direct quickstart to isolate the hosted account. Do not start with a local combo and hosted automatic routing simultaneously: first prove one explicit model route, then add one routing rule at a time.
Decide whether to keep the extra gateway
Keep this setup when local provider management or fallback combos solve a real client need. Use direct OpenRouter access when you would otherwise maintain 9Router solely to forward an unchanged request. OpenRouter’s provider routing and 9Router’s local combos are different layers; inspect which provider actually served a fallback before comparing cost or quality.
A local gateway still sends hosted inference to OpenRouter and its selected provider. Review those providers’ data settings and current model prices before using sensitive content. To restore a direct client, return its saved OpenRouter base URL, key and upstream model together; replacing only the URL leaves the wrong credentials or model namespace.
References for this guide
- OpenRouter quickstart
- OpenRouter FAQ
- OpenRouter provider routing
- 9Router provider catalog
- 9Router compatible-provider form
- 9Router saved key and default model
- 9Router compatible model controls
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.