# Connect FastGPT to Router One through one AI Proxy model channel

> Markdown mirror of https://router.one/integrations/fastgpt for AI assistants and crawlers. Router One is an OpenAI-compatible LLM API gateway.
> Last updated: 2026-09-11

FastGPT is an open-source knowledge-base and agent platform: apps are built as workflows whose AI chat, tool-call, classification and extraction nodes all need a language model. FastGPT reaches models through its bundled AI Proxy — mandatory since V4.17.0 — so Router One is added there as one OpenAI-protocol channel that serves the GPT, Claude, Gemini, Grok and DeepSeek families on a single key, with a cost trace per request in Dashboard → Logs. This guide covers the channel values, registering the exact model ID in FastGPT's model configuration, the channel test, and where the embedding, rerank and speech models must come from instead.

## Confirm the deployment is on AI Proxy and create a dedicated key

This guide assumes a self-hosted FastGPT from the official Docker Compose template, which ships AI Proxy as a required service. The FastGPT container carries AIPROXY_API_ENDPOINT — the AI Proxy root address with no /v1 appended, because FastGPT adds each interface path itself — and AIPROXY_API_TOKEN, which must equal the ADMIN_KEY set on the AI Proxy service; the V4.17.0 notes make both mandatory and state that the older OPENAI_BASE_URL and CHAT_API_KEY variables are deprecated, removed, and no longer take effect. The excerpt below shows those lines as they appear in the official template; the token is a YAML anchor the template generates, not a Router One value. Then create a Router One key for this deployment with a maxSpend cap. It goes only into the channel form, never into these environment variables.

`docker-compose.yml (excerpt)`

```yaml
# Excerpt from the official FastGPT docker-compose template
x-aiproxy-token: &x-aiproxy-token 'token'
services:
  fastgpt-app:
    environment:
      # AI Proxy address: host root, no /v1
      AIPROXY_API_ENDPOINT: http://fastgpt-aiproxy:3000
      # AI Proxy admin token: equals ADMIN_KEY on the aiproxy service
      AIPROXY_API_TOKEN: *x-aiproxy-token
```

## Configure FastGPT to use the Router One base URL

Open Admin → Model provider, switch to the Model Channels tab and click Add Channel; the form maps to the block below. Protocol Type is OpenAI: AI Proxy then posts every request for this channel to the base URL plus /chat/completions, which is why the base URL field — Proxy URL in the English docs, Base url in the UI — takes https://api.router.one/v1 with /v1; the field's own placeholder is an OpenAI default that ends in /v1 too. API key is the Router One key. Models lists the catalog IDs this channel serves; the dropdown only offers models that already exist in Model Configuration, so for an ID that is not built in, click Add Model (or use the Model Configuration tab) and enter the exact catalog ID as the Model ID — it is the value FastGPT puts in the request's model field, and the channel forwards that same value. Leave Model Mapping empty when the two IDs are identical; use it only to map a local name onto the exact catalog ID. Save, then click Model Test → Start Test: it sends a real request per model and shows the result and latency, and each test also appears in Dashboard → Logs. Finally enable the model and pick it in an app's AI settings or in a workflow's AI chat node:

`fastgpt-model-channel`

```text
# FastGPT → 管理员 → 模型提供商 → 模型渠道 → 新增渠道
# FastGPT → Admin → Model provider → Model Channels → Add Channel
渠道名（Channel）:          Router One
协议类型（Protocol Type）:   OpenAI
代理地址（Base url）:        https://api.router.one/v1
API 密钥（API key）:         sk-your-router-one-key
模型（Models）:              <exact-model-id-from-/models>
模型映射（Model Mapping）:   留空 / leave empty（模型 ID 与目录 ID 完全一致时）

# 模型配置 → 新增模型（Model Configuration → Add Model）
模型ID（Model ID）:          <exact-model-id-from-/models>
别名（Alias）:               任意展示名 / any display name
最大上下文 / 支持工具调用 / 支持图片识别:  按 /models 模型详情页填写

# 保存后：模型测试 → 开始测试（Model Test → Start Test）
```

## Which value goes where, and how to verify it

Everything Router One needs sits in one channel plus the matching model entry. The other model types FastGPT asks for on first login are configured in the same admin page but must point at another provider:

| FastGPT field | Value | What to verify |
| --- | --- | --- |
| Model Channels → Protocol Type | OpenAI | AI Proxy joins /chat/completions onto the base URL; every chat model in the catalog is served there |
| Model Channels → Base url (Proxy URL) | https://api.router.one/v1 | Model Test passes; a 404 not_found on the test means /v1 is missing |
| Model Channels → API key | A Router One key created for this deployment, with maxSpend | The test request appears in Dashboard → Logs under that key |
| Model Channels → Models / Model Mapping | Exact catalog IDs; mapping only from a local name to the exact ID | The model in each Logs trace matches /models character for character |
| Model Configuration → Model ID | The same exact ID; context, tool calling and image input from the model page | Tool-call, classification and extraction nodes need Supports tool calling on, and a model whose page lists tool calling |
| Model Configuration → Custom URL / Key | Marked for deprecation; if used, the full path https://api.router.one/v1/chat/completions | Bypasses the channel and its Call Logs; the docs say to move to channels |
| Embedding, rerank, TTS and STT models | A channel from another provider | Router One has no embeddings or rerank endpoint; FastGPT needs at least one embedding model to index a dataset |

## Budget one deployment and reconcile its model calls

One workflow run fans out into several model requests: the AI chat node, tool calls that loop back to the model, question classification and content extraction each cost a request, and AI Proxy retries failed attempts on its own (the official Compose template sets RETRY_TIMES: 3), so every attempt that reaches the gateway is its own request with its own trace and charge. Give each FastGPT deployment a dedicated Router One key with maxSpend, so a runaway workflow stops at the cap you set. Three ledgers exist and only one is money you pay: Dashboard → Logs is the charge per request with model, tokens, cost, latency, status and request_id; AI Proxy's Call Logs page shows input and output tokens, latency and the request URL per call — the quickest way to see the exact path that was hit — and keeps error details for one hour by default (LOG_DETAIL_STORAGE_HOURS); FastGPT's own points (the model price fields in the model form) meter your users inside FastGPT and are unrelated to the gateway's rates. Reconcile by time, model and token counts, and keep the gateway's request_id when reporting a failure. If the same model ID is also listed in another channel, AI Proxy balances across channels by priority, so a call missing from Router One's Logs may simply have been served elsewhere.

## Which model ID should FastGPT 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 FastGPT. A catalog listing does not mean the client can use every feature of that model. Give each tool a dedicated API key with a maxSpend cap.

## Which API protocol is FastGPT 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 FastGPT call in your request trace

Send a simple text request from FastGPT, then match its trace in Dashboard → Logs by time, model, and request_id: tokens, cost, 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, check client configuration and connectivity before attributing the error to the gateway or upstream.

## FAQ

### The channel test passes, but an app call fails with 400 or 404. What changed?

Two IDs must agree: the Model ID in Model Configuration is what FastGPT puts in the request's model field, and the channel forwards that same value unless Model Mapping rewrites it — so a model enabled under a spelling that differs from the catalog ID, or a mapping that points at a retired ID, fails only in real calls. Read the request URL in AI Proxy's Call Logs and the error message plus request_id in Dashboard → Logs. With Protocol Type OpenAI the path is /v1/chat/completions, which serves every chat model in the catalog; a 400 whose message says must be called via means the request left on another endpoint — for example a channel created with the Anthropic protocol type, which posts to /messages under the base URL and which the gateway serves only for the Claude-family and DeepSeek IDs it lists — so keep the Router One channel on OpenAI even for Claude-family IDs. A 400 that names a parameter is the model rejecting it: FastGPT's model form notes that an empty max temperature means the model does not support temperature, and its extra Body fields are merged into every request.

### Does the base URL need /v1? The one-api guides say to leave it off.

In FastGPT, yes. The channel lives in AI Proxy, whose OpenAI protocol type joins /chat/completions onto whatever you enter; the field's placeholder is an OpenAI default ending in /v1, and the FastGPT docs tell you to check whether /v1 must be added. Without it the request goes to https://api.router.one/chat/completions and the gateway answers 404 not_found with a message that OpenAI-compatible clients need a base URL ending in /v1. The opposite convention on the relay-station page is real but belongs to one-api and new-api, whose OpenAI channel type appends the whole /v1/chat/completions path itself. If a test fails, read the request URL in AI Proxy's Call Logs before adding or removing /v1 again; the connection troubleshooting page walks through that check.

### Can the dataset's embedding, rerank or speech models use Router One too?

No. FastGPT configures five model types separately — language, embedding, rerank, TTS and STT — and needs at least one language model and one embedding model to run. Router One serves chat models on /v1/chat/completions and has no embeddings, rerank or audio endpoint, so those models must come from another provider's channel, and only language-model rows belong in the Router One channel. One Router One key still covers every chat and agent node — GPT, Claude, Gemini, Grok and DeepSeek families — while the dataset's indexing stays on the other provider's bill.

### Which models can FastGPT use through the gateway?

Choose a current catalog model that supports both the endpoint and the features FastGPT 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. Seeing a model in the picker confirms discovery, so 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?

Match the request and error message in Dashboard → Logs. For 401, check whether the key was sent and is valid; for 402, check wallet balance and maxSpend; for 403, check key permissions and access restrictions. For 429, distinguish request/token limits from upstream throttling using the error details. Keep the request_id and follow the error-codes reference.

## See also

- All integration guides: https://router.one/integrations
- Debug API errors in FastGPT: https://router.one/llm-api-error-codes
- API compatibility: endpoints and supported features: https://router.one/facts/api-compatibility.md
- Responses API setup and limits: https://router.one/codex-responses-api
- Cline setup: https://router.one/integrations/cline
- Aider setup: https://router.one/integrations/aider
- Relay stations: the one-api / new-api base URL convention: https://router.one/llm-api-relay-station
- Connection and /v1 path troubleshooting: https://router.one/api-connection-troubleshooting
- Tool-calling API requirements: https://router.one/llm-tool-calling
- FastGPT: model configuration: https://doc.fastgpt.io/en/self-host/config/model/intro
- FastGPT: deploy with Docker Compose: https://doc.fastgpt.io/en/self-host/deploy/docker
- FastGPT: V4.17.0 upgrade notes: https://doc.fastgpt.io/en/self-host/upgrading/4-17/4170
- What the gateway layer does: https://router.one/llm-api-gateway
- OpenAI-compatible API: https://router.one/openai-compatible-api
- API docs: https://router.one/docs
- Canonical page: https://router.one/integrations/fastgpt
- Models and per-model token rates: https://router.one/models (markdown: https://router.one/models.md)
- Pricing: https://router.one/pricing
- API docs (markdown): https://router.one/docs.md
- Company facts: https://router.one/facts/company.md
