Skip to content

Add Router One as a channel in New API

Add Router One in New API with a Built-in OpenAI channel (type 1) using host root https://api.router.one — no /v1 — and a dedicated Router One key; that channel sends Chat Completions and, for Codex CLI, /v1/responses requests to the same paths on Router One. For Anthropic /v1/messages clients such as Claude Code, add a Built-in Anthropic channel (type 14) with the same https://api.router.one. Checked 2026-11-30 against New API v1.0.0-rc.52 source and docs.newapi.ai.

Create a dedicated Router One API key first

In Dashboard → API Keys, create a dedicated key for New API with a cumulative maxSpend cap so the channel has a hard wallet ceiling and stays isolated in Dashboard → Logs. A key can also carry a daily or monthly budget. It limits what that key can charge to your wallet in the period, resets at midnight Beijing time (UTC+8; monthly budgets on the 1st), and works alongside maxSpend: whichever runs out first stops the key's wallet-billed requests with HTTP 402. Requests covered by your plan's quota do not count toward it. A key can be limited to a model allowlist: it can only call the models you list, model="auto" is refused with HTTP 403, and channel ids such as aws/ or azure/ have to be added separately. If you split downstream groups or customers across channels, create one Router One key per channel, kept in that channel and never handed out, with its own period budget and model allowlist (/llm-api-key-budgets).

Add an OpenAI channel in New API (host root, without /v1)

In New API (v1.0.0-rc.52), open Admin → Channels → Create Channel and pick Built-in → OpenAI (type 1). Avoid deprecated Custom (type 8) and Gateway New API (type 60, whose balance check calls the New API-only /api/usage/token/ and /api/status). Under Connection & Models, set Name, Groups (default is default), API URL to https://api.router.one (no /v1, no trailing slash), and Key to your Router One key (sent as Authorization: Bearer). Click Fetch Models (GET https://api.router.one/v1/models) or paste exact case-sensitive IDs from /models (such as openai/gpt-6.2-sol, anthropic/claude-sonnet-5, deepseek-v4.1-flash, google/gemini-3.8-flash, grok-4.7). Under Routing & Mapping, set Test Model to a listed catalog ID. Finished settings:

API URL (OpenAI #1 & Anthropic #14)
https://api.router.one
new-api-channel-settings
# New API (v1.0.0-rc.52): Admin -> Channels -> Create Channel
# 1) Built-in OpenAI channel (#1) — Chat Completions & Responses (Codex CLI)
Channel type:   OpenAI (Built-in #1)
API URL:        https://api.router.one
Key:            sk-your-router-one-key
Groups:         default
Models:         openai/gpt-6.2-sol, deepseek-v4.1-flash, grok-4.7 (or Fetch Models)
Test Model:     deepseek-v4.1-flash

# 2) Optional Built-in Anthropic channel (#14) — /v1/messages (Claude Code)
Channel type:   Anthropic (Built-in #14)
API URL:        https://api.router.one
Key:            sk-your-router-one-key
Models:         anthropic/claude-sonnet-5, anthropic/claude-opus-5 (not on #1 in this group)
Test Model:     anthropic/claude-sonnet-5

OpenAI vs Anthropic channels, Responses, and Claude Code

OpenAI channels join baseURL directly with /v1/... paths (relay/common/relay_utils.go) and Anthropic channels append /v1/messages (relay/channel/claude/adaptor.go), so both take https://api.router.one:

OpenAI vs Anthropic channels, Responses, and Claude Code
New API channelAPI URLAuth headerForwarded pathRouter One models
Built-in: OpenAI (#1)https://api.router.oneAuthorization: Bearer/v1/chat/completionsAny catalog chat model (GPT, Claude, Gemini, Grok, DeepSeek)
Built-in: OpenAI (#1)https://api.router.oneAuthorization: Bearer/v1/responsesGPT, DeepSeek, and Grok chat IDs (Codex CLI)
Built-in: Anthropic (#14)https://api.router.onex-api-key/v1/messagesClaude and DeepSeek IDs only (Claude Code)
  • Anthropic (#14, labeled Anthropic in v1.0.0-rc.52): sends x-api-key (accepted equivalently to Bearer), forwards anthropic-beta, and keeps ?beta=true when sent by the client or when Request & Response → Field passthrough controls → Allow Claude beta query passthrough is on. List only Claude and DeepSeek IDs (anthropic/claude-sonnet-5, anthropic/claude-opus-5, deepseek-v4.1-flash, deepseek-v4-flash).
  • Responses (#1): POST /v1/responses goes to Router One's /v1/responses. Claude IDs sent there return HTTP 400; Router One has no /v1/responses/compact route (404).
  • One model, one channel per group: New API picks a channel by group, model, priority and weight, not by endpoint (model/ability.go), and converts the request when the channel speaks another format. With both channels in one group, keep Claude IDs on #14 and the rest on #1, or give each channel its own group and downstream token.
  • GPT-6.x tool calls: per OpenAI docs (checked 2026-11-30), GPT-6.2 Sol, GPT-6.2 Astra, GPT-6 Astra, GPT-6.1 Sol, and GPT-6.1 Terra require /v1/responses for tool calls (GPT-6 Sol allows Chat Completions function calls only with reasoning_effort none). Route those tool workloads via /v1/responses, or use anthropic/claude-sonnet-5 or deepseek-v4.1-flash on Chat Completions.

Test Connection, Priority, Weight, and Auto-Disable

Run Test Connection with the matching endpoint type (OpenAI, OpenAI Responses, or Anthropic). In v1.0.0-rc.52 (controller/channel-test.go), a blank Test Model falls back to the first model in Models, then to gpt-4o-mini — unlisted in Router One's 2026-11-30 catalog (404) — so set Test Model explicitly. Under Routing & Mapping, Priority orders tiers (retries step down) and Weight drives weighted random selection within a tier (model/channel_cache.go). Auto-disable channel is on by default and acts only when the global Disable on failure setting is on as well; turn it off if this is the only channel for these models.

Common channel failures and fixes

Check these five causes first:

  • HTTP 404 on /v1/v1/...: remove /v1 and any trailing slash from API URL, then re-run Fetch Models.
  • Model price not configured (empty Router One Logs): New API checks local ratios before calling upstream (controller/channel-test.go, relay/helper/price.go). Set the model's price in System Settings → Billing & Payment → Model Pricing, or turn on Self-Use Mode (/api-billing-multiplier).
  • Test Connection 404 or 400: Test Model fell back to unlisted gpt-4o-mini, or a Claude ID was tested on OpenAI Responses. Set a valid catalog ID for that endpoint.
  • No available channel for model under group: match the token's group with the channel's Groups field and exact model ID.
  • Update Balance fails or says Not implemented yet: controller/channel-billing.go calls legacy OpenAI /v1/dashboard/billing paths on OpenAI channels and is unimplemented on Anthropic channels. Poll GET https://api.router.one/v1/balance via cron instead (/blog/llm-api-balance-monitoring).

Which model ID should New API send?

Copy the exact model ID from /models, preserving case, hyphens, and version suffixes; do not substitute a display name. Open its detail page and match the supported API endpoints, context window, and capabilities such as tool calling to the provider and features selected in New API. A catalog listing does not mean the client can use every feature of that model. Give each client or application a dedicated API key with a maxSpend cap. A key's spend cap (maxSpend) limits what that key can charge to your wallet: once its cumulative wallet charges reach the cap, its wallet-billed requests return HTTP 402. Requests covered by your plan's quota draw from the account's shared plan quota and do not count toward any key's cap.

Which API protocol is New API using?

OpenAI-compatible describes an interface format; it does not make Chat Completions (/v1/chat/completions), Responses (/v1/responses), and Anthropic Messages (/v1/messages) interchangeable. Check the installed client version, provider configuration, and actual request path against the model detail page and API compatibility fact sheet. A successful plain-text chat does not establish support for hosted tools, conversation state, or file-editing features.

Verify the New API call in your request trace

Send a simple text request from New API, then match its trace in Dashboard → Logs by time, model, and request_id: tokens, the wallet charge or plan quota it used, latency, and status. Next, test streaming, tool calls, and multi-turn history separately. For failures, retain the actual request path, full error message, and request_id. If there is no matching log, either the request never reached the gateway (client configuration or connectivity) or the gateway refused it before calling a model — a 401 for the key, a 402 for funds, a 429 from your key's or account's limits, or a 400 or 404 for the model ID or endpoint; a streamed request that failed before any output may have no log either. The status and error message the client received tell which, so check them before attributing the error to the gateway or upstream.

FAQ

Why must New API's OpenAI channel use https://api.router.one without /v1?

In New API v1.0.0-rc.52 (relay/common/relay_utils.go, controller/channel_upstream_update.go), Built-in OpenAI concatenates API URL directly with /v1/chat/completions, /v1/responses, and /v1/models, and Anthropic appends /v1/messages. Adding /v1 produces /v1/v1/... and returns HTTP 404.

How do I run Claude Code and Codex CLI through New API to Router One?

Create two Built-in channels on https://api.router.one: OpenAI (#1) with GPT, DeepSeek, and Grok IDs for Codex CLI (/v1/responses), and Anthropic (#14) with Claude IDs for Claude Code (/v1/messages; enable Allow Claude beta query passthrough under Request & Response → Field passthrough controls if needed). Keep the two model lists apart within a group, because New API picks a channel by group, model, priority and weight, not by endpoint. Router One has no /v1/responses/compact route (404).

Why does Test Connection say model price not configured with nothing in Router One Logs?

New API runs local pricing checks before sending any request upstream (controller/channel-test.go, relay/helper/price.go). Unpriced catalog IDs fail locally, so Dashboard → Logs stays empty. Set the model's price in System Settings → Billing & Payment → Model Pricing, or turn on Self-Use Mode.

Does New API's Update Balance button work with a Router One channel?

No. In v1.0.0-rc.52 (controller/channel-billing.go), OpenAI channels call legacy /v1/dashboard/billing paths that Router One does not serve, and Anthropic channels return Not implemented yet. Poll GET https://api.router.one/v1/balance from a scheduled script instead (/blog/llm-api-balance-monitoring).

Which models can New API use through the gateway?

Choose a current catalog model that supports both the endpoint and the features New API uses. Check /models and the model detail page for the exact ID, current rates, and capabilities; a family name such as GPT or Claude is not a compatibility guarantee. A client that lists a model has only read the ID, from its own configuration or from GET /v1/models; verify an actual request too.

Models are listed, but requests fail with 400 or 404. What should I check?

Record the actual request path and error message, then check the exact model ID. A 400 can indicate invalid parameters, unsupported tools, or a model/endpoint mismatch; a 404 can indicate an incorrect path or missing resource, so it does not by itself establish that a model was retired. If the error says must be called via, use the named endpoint or select a model supported on the current endpoint. Do not add or remove /v1 or /chat/completions across all clients indiscriminately.

Does this work from Mainland China?

Yes. The gateway is reachable from Mainland China without a VPN, and the configuration is identical to the global setup.

How do I debug a 401/402/403/429?

Start from what your client received: the status, the error body and the X-Request-ID header. A 401 (missing, unknown, revoked or expired key), a 402 (wallet balance, or the key's maxSpend cap) and a 429 from your key's or account's rate limits are refused before any model is called, so they never appear in Dashboard → Logs — nor does a 400 or 404 for a wrong model ID or endpoint. For 401, check that the full key is sent and still active in Dashboard → API Keys; for 402, top up or raise the key's maxSpend; for a 403, keep the full error body. For 429, back off and retry later; a 429 that does show up in Logs came back from upstream after the gateway's retries. Keep the request_id and follow the error-codes reference.