Make Qwen Code route by provider, base URL and model identity.
When users add multiple OpenAI-compatible endpoints, Qwen Code can fail in a subtle way: the saved model entry looks right, but runtime routing collapses different endpoints into one provider or falls back to a default host.
Buyer-intent signal: if someone is asking about custom providers, shared baseUrl, provider identity or Qwen Code free-tier migration, they already have model demand. The first useful commercial step is a tiny paid endpoint test, not a broad migration pitch.
1. Treat endpoint identity as more than the model id
A model id such as qwen3-coder-plus or deepseek-v4-flash is not enough to identify a route. The same id can exist behind different vendors, regions, API keys, proxies or prepaid gateways.
route identity = protocol + baseUrl + apiKey/envKey + model id
If the UI or config stores only the model id as the unique key, two valid routes can overwrite each other or display as the same model while sending requests to different hosts.
2. Keep each OpenAI-compatible route explicit
Until Qwen Code fully decouples provider identity from SDK protocol, avoid relying on one shared global OPENAI_BASE_URL for multiple routes. Put the route on each entry that must survive auth refresh or model switching.
{
"$version": 3,
"env": {
"BLACK_EAGLE_API_KEY": "sk-your-token"
},
"security": {
"auth": { "selectedType": "openai" }
},
"modelProviders": {
"openai": [
{
"id": "deepseek-v4-flash",
"name": "Black Eagle DeepSeek Flash",
"envKey": "BLACK_EAGLE_API_KEY",
"baseUrl": "https://api.blackeaglecambodia.com/v1"
},
{
"id": "deepseek-v4-pro",
"name": "Black Eagle DeepSeek Pro",
"envKey": "BLACK_EAGLE_API_KEY",
"baseUrl": "https://api.blackeaglecambodia.com/v1"
}
]
}
}
The important test is not whether the config file contains the right value. The important test is whether the final request host is the one you intended.
3. Debug path for Qwen Code issues
- Run one raw request against the exact target
baseUrl. - Save one provider entry with an explicit
baseUrl,envKeyand model id. - Switch models once and inspect whether the final request host changed.
- Repeat with a second endpoint only after the first route is proven.
4. Common issue patterns
| Thread symptom | Likely routing problem | Useful reply angle |
|---|---|---|
Shared baseUrl is ignored |
Auth refresh or provider registration bakes in the default host. | Ask for final request host, not only settings JSON. |
| Custom provider loses model 1 when adding model 2 | Model id is acting as the unique key instead of route identity. | Suggest explicit names and separate route entries. |
| Same model needs China and global endpoint keys | Provider identity is coupled to SDK protocol or enum name. | Separate protocol from route and ask which endpoint should win. |
5. Where Black Eagle AI fits
Black Eagle AI is not a Qwen Code replacement. It is the endpoint side of the test: a prepaid OpenAI-compatible route for Chinese models when the blocker is provider signup, China phone verification or payment setup.