Qwen Code
Connect Qwen Code to HeyEly by adding an OpenAI-compatible provider entry in settings.json.
Qwen Code loads custom endpoints from the modelProviders block inside settings.json. Its openai provider speaks Chat Completions, so point baseUrl at the root https://heyely.si/v1 rather than a full endpoint path.
Set up
- Create a key in Developers and either export
HEYELY_API_KEYin your shell or addHEYELY_API_KEY=sk-df-...to~/.qwen/.env. - Add the HeyEly provider configuration to
~/.qwen/settings.json(or%USERPROFILE%\on Windows).. qwen\ settings. json
{
"modelProviders": {
"openai": [
{
"id": "anthropic/claude-sonnet-5.5",
"name": "Claude Sonnet 5.5 (HeyEly)",
"baseUrl": "https://heyely.si/v1",
"envKey": "HEYELY_API_KEY",
"generationConfig": {
"contextWindowSize": 1000000,
"samplingParams": { "max_tokens": 128000 }
}
}
]
},
"security": { "auth": { "selectedType": "openai" } },
"model": { "name": "anthropic/claude-sonnet-5.5" }
}
- Launch
qwen.
Avoid placing raw secrets inside settings.json's env block or passing --openai-api-key on the command line where they can leak into history or logs. Using envKey keeps the credential safely in your environment.
Verify
- Start a session and run
/doctorto check auth and environment loading. - Run
/modelto confirm your HeyEly model is listed. - Fire off a quick CLI smoke test:
qwen -m anthropic/claude-sonnet-5.5 -p "Reply with exactly: gateway-ok"
- Check Credit and usage to see the request at the top of Spend under your selected model.
Pick a model
- Select your active model via
/model,-m, ormodel.nameinsettings.json. - Always nest token limits inside each entry's
generationConfig; top-levelmodel.generationConfigsettings do not apply to custom providers. - Want to route an entry to
POST /v1/responsesinstead of the defaultchat-completions? Add"wireApi": "responses"to that model object. - Updates to
modelProviderstake effect live without restarting Qwen Code.
Troubleshooting
| You see | Cause | Fix |
|---|---|---|
401 invalid_api_key | HEYELY_API_KEY is missing in Qwen Code's environment | Export it in the launch shell or save it in ~/.qwen/.env |
Model missing from /model | Wrong provider key or entry wrapped in an object instead of an array | Place entries directly in an array under modelProviders.openai |
| Qwen Code prompts for Qwen sign-in | selectedType was not switched | Set security. to "openai" |
404 | baseUrl includes an extra path or omits /v1 | Set baseUrl to https://heyely.si/v1 |
404 model_not_found | id does not match HeyEly's catalog | Copy the exact ID from the Models page |