Run LobeChat on a custom OpenAI-compatible endpoint.
Updated 2026-07-16
LobeChat's provider module accepts any OpenAI-compatible service: create a custom provider with the OpenAI SDK type, set the endpoint to https://api.apisrouter.com/v1, paste one key, and fetch the model list. Claude, GPT, Gemini, and DeepSeek ids land in every assistant's model picker.
Quick answer: one custom provider, one endpoint, one key.
Open LobeChat settings and go to the AI service provider section (labeled AI Service Provider or Language Model depending on release). Since the provider-management module landed in v1.44, you can create a custom provider rather than piggybacking on the built-in OpenAI entry: add a provider, give it an id and a display name (apisrouter / APIsRouter), choose the OpenAI SDK type, then fill the API key and the endpoint proxy URL with https://api.apisrouter.com/v1. In the provider's model list, use the fetch-models action to pull every id the endpoint serves through /v1/models, enable the ones you want, and run the built-in connectivity check. From then on, any assistant or conversation can select those ids from the model picker. The project now lives at lobehub/lobehub on GitHub (the lobe-chat repo name redirects there), and menu labels shift between releases, so treat the flow, provider entry, SDK type, URL, key, fetch, as the stable part rather than the exact wording.
Provider ID: apisrouter
Provider Name: APIsRouter
SDK Type: OpenAI
API Key: sk-YOUR-APISROUTER-KEY
API Proxy URL: https://api.apisrouter.com/v1
Model List → Fetch models → enable ids → checkHow LobeChat routes requests to a provider.
LobeChat (around 80K GitHub stars, now under the LobeHub name) is one of the most deployed open-source chat frameworks: a polished web client, assistants with their own prompts and models, a plugin system, and knowledge-base features, deployable in a browser session or self-hosted with a database. Each provider entry describes where requests go and which SDK dialect to speak. A custom provider on the OpenAI SDK type sends standard chat-completions requests to your proxy URL with the model id as a plain string, which is exactly the shape a multi-vendor gateway expects. One entry therefore carries the whole catalog: assistants can pin claude-sonnet-4-6 for careful work while quick conversations run gemini-3.5-flash, without a second account anywhere. The endpoint URL has one documented nuance worth quoting: whether the URL needs a /v1 suffix depends on the service behind it. LobeChat appends route paths like /chat/completions to the base you give it, so for APIsRouter the correct value is https://api.apisrouter.com/v1. The documented symptom of a missing suffix is the model returning an empty reply on the test; if you see that, add /v1 and retry.
Self-hosting: the environment-variable path.
If you deploy LobeChat yourself, the same routing can ship in the container instead of being clicked into the UI. The classic pair overrides the built-in OpenAI provider: OPENAI_API_KEY takes the gateway key and OPENAI_PROXY_URL takes https://api.apisrouter.com/v1. Every user of that deployment then inherits the endpoint without touching settings. Model visibility is controlled with the model-list syntax: OPENAI_MODEL_LIST accepts +id to add, -id to hide, and id=Display Name to relabel, with entries comma-separated. Starting the value with -all clears the built-in list so only your explicit ids show, which is the clean shape for a curated deployment. Newer server builds also document a CUSTOM_PROVIDER_* family (count, id, name, type, base URL, keys) for declaring full custom providers at deploy time, matching what the UI module does. Check the current environment-variable reference for your version before relying on it, since this surface is newer than the OPENAI_* pair and still evolving.
OPENAI_API_KEY=sk-YOUR-APISROUTER-KEY
OPENAI_PROXY_URL=https://api.apisrouter.com/v1
OPENAI_MODEL_LIST=-all,+claude-sonnet-4-6=Claude Sonnet 4.6,+gpt-5.5,+gemini-3.5-flash,+deepseek-v4-proChoosing models for assistants.
Because all assistants bill through one key, model comparison is an assistant-settings change. Pin two candidates on two duplicate assistants, run your real prompts for a week, and read the per-model spend in the APIsRouter console next to the answer quality you observed.
- Assistants are per-role model pins. A writing assistant on claude-sonnet-4-6, a quick-answer assistant on claude-haiku-4-5-20251001, and a research assistant on gpt-5.5 all coexist behind one provider entry.
- gemini-3.5-flash is the responsiveness pick for the default conversation model; most turns in a chat framework are short and fast models keep the UI feeling instant.
- deepseek-v4-pro earns a slot for long multilingual conversations and heavy summarization, where its long-context behavior per token spent is the draw.
- Vision conversations need a vision-capable id with the capability enabled in the provider's model config; LobeChat exposes per-model capability toggles in the provider module.
- Enable a two-tier picker deliberately, one fast id and one frontier id, and add more only when a real assistant needs them; every enabled model is a row users scroll.
Pay-as-you-go · transparent per-model pricing
Selected models are priced below official list prices. Exact input, output, cache, and per-request prices are shown for each model.
| Model | Official Price | Our Price |
|---|---|---|
| Claude Sonnet 4.6 | $3.00 / $15.00 per M | $2.40 / $12.00 per M |
| GPT-5.5 | $5.00 / $30.00 per M | $4.00 / $24.00 per M |
| Gemini 3.5 Flash | $1.50 / $9.00 per M | $1.20 / $7.20 per M |
| DeepSeek V4 Pro | $0.43 / $0.87 per M | $0.39 / $0.78 per M |
| Claude Haiku 4.5 20251001 | $1.00 / $5.00 per M | $0.80 / $4.00 per M |
Failure modes specific to LobeChat.
An empty reply on the connectivity check is the documented signature of a base-URL suffix problem. Add or remove the /v1 (for APIsRouter it must be present) and retry before debugging anything deeper. Models missing from an assistant's picker usually means they were fetched but not enabled in the provider's model list, or the provider toggle itself is off. Both live in the same settings screen as the fetch action. On self-hosted deployments, remember precedence: environment variables configure the server-side defaults, while users can still enter their own provider settings client-side depending on your deployment's auth and feature flags. If a deployment ignores your OPENAI_PROXY_URL, confirm the container actually restarted with the new environment and that the client session is not overriding it locally. Version drift is real here: the settings tree has been reorganized more than once (Language Model, then AI Service Provider, with the provider module arriving in v1.44), and screenshots from older tutorials will not match current menus. The fields themselves, id, name, SDK type, URL, key, have stayed stable.
Who routes LobeChat through a gateway.
- Self-hosters running LobeChat for a team who want one endpoint in the container and one usage log for everyone, instead of per-user vendor keys.
- Assistant power users who pin different vendors per role, Claude for writing, GPT for analysis, DeepSeek for volume, without maintaining accounts for each.
- Users who want models the built-in provider list does not carry, enabled by fetching the gateway catalog rather than waiting on upstream releases.
- Developers without access to a given vendor's billing. Top-up based access with no card requirement removes the per-provider sign-up dependency.
- People already routing their editor, launcher, or CLI tools through a gateway who want their chat framework on the same key.
Verify the endpoint and debug the first conversation.
Curl the models listing first and keep the output open; it is the authoritative spelling for every id you enable, whether by fetch or by hand. Then run one chat completion against the id you plan to make default. Inside LobeChat, work the connectivity check before real conversations. Authentication failures point at the key field. An empty reply points at the /v1 suffix. Not-found errors on a specific model mean the enabled id does not match the listing, which mostly happens after hand-editing display names and ids together. Once conversations flow, the APIsRouter console shows per-request model, token counts, and spend. A chat framework with assistants generates traffic across several models at once, and the per-key usage view is where each assistant's habit becomes a cost you can see per model, per day.
curl -s https://api.apisrouter.com/v1/models \
-H "Authorization: Bearer $APISROUTER_API_KEY" | head -50
curl -s https://api.apisrouter.com/v1/chat/completions \
-H "Authorization: Bearer $APISROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini-3.5-flash",
"messages":[{"role":"user","content":"ping"}]}'FAQ
How do I add a custom OpenAI-compatible provider to LobeChat?
In settings, open the AI service provider section and create a custom provider: id and display name, SDK type OpenAI, endpoint https://api.apisrouter.com/v1, and your key. Fetch the model list, enable the ids you want, and run the connectivity check.
Does the endpoint URL need /v1?
For APIsRouter, yes: https://api.apisrouter.com/v1. LobeChat appends routes like /chat/completions to the base you give it, and its docs note that a wrong suffix typically shows up as an empty reply on the test. If you see that, fix the suffix and retry.
What is OPENAI_PROXY_URL and when do I use it?
It is the self-hosting environment variable that repoints LobeChat's built-in OpenAI provider at another base URL. Set it with OPENAI_API_KEY in the container and every user of that deployment inherits the endpoint; use OPENAI_MODEL_LIST to curate which ids show.
Can different assistants use different vendors through one provider?
Yes. Each assistant pins its own model, and the id travels to the endpoint as a plain string per request. One provider entry can serve a Claude assistant, a GPT assistant, and a DeepSeek assistant side by side, all billed through the same key.
Is LobeChat the same project as LobeHub?
Yes. The project rebranded and the GitHub repo now lives at lobehub/lobehub, with the old lobe-chat name redirecting. Docs and menus mix both names during the transition, which is also why settings labels vary between releases.
Why do my fetched models not appear in conversations?
Fetching lists ids; enabling them is a separate toggle per model in the provider's model list, and the provider itself has an enable switch. Check both, then reopen the model picker. If an enabled id still errors, compare its spelling against the /v1/models output.