Coding Agent
Connect Qwen Code to SoCLaaS
Use Qwen Code from your terminal with a SoCLaaS API key. Qwen Code talks to the gateway through an OpenAI-compatible model provider.
Recommended: download a ready-made config. Open Portal → Client Setup, download the Qwen Code config, and save it as ~/.qwen/settings.json. Merge it first if you already have Qwen Code settings. Then run qwen.
The generated file already lists the models available to your key and sets a default. The portal also provides a soclaas.env file for loading SOCLAAS_API_KEY.
The API key portal is available from the NUS network, while the API gateway itself is reachable from the Internet. Qwen Code changes often, so confirm the settings shape against your installed version.
What you need
| Setting | Value |
|---|---|
| Base URL | https://soclaas-api.comp.nus.edu.sg/v1 |
| API key | From the SoCLaaS portal, stored in SOCLAAS_API_KEY |
| Model | A chat-capable ID from GET /v1/models |
Manual setup
Use these steps if you prefer not to download the generated config.
-
Get an API key
Sign in to the SoCLaaS portal from the NUS network and create a personal key. The portal can also download a
soclaas.envfile that setsSOCLAAS_API_KEYfor you. -
Export the key
export SOCLAAS_API_KEY="YOUR_API_KEY" -
Find a model ID
curl https://soclaas-api.comp.nus.edu.sg/v1/models \ -H "Authorization: Bearer $SOCLAAS_API_KEY"Copy the
idof a chat-capable model. -
Install Qwen Code
Follow the installation instructions at qwen.ai/qwencode, then confirm the command is available.
qwen --version -
Add the provider
Create or edit
~/.qwen/settings.json. ReplaceYOUR_MODEL_IDwith the ID from step 3.{ "modelProviders": { "openai": [ { "id": "YOUR_MODEL_ID", "name": "YOUR_MODEL_ID via SoCLaaS", "baseUrl": "https://soclaas-api.comp.nus.edu.sg/v1", "envKey": "SOCLAAS_API_KEY" } ] }, "security": { "auth": { "selectedType": "openai" } }, "model": "YOUR_MODEL_ID" } -
Run Qwen Code
qwenIf you saved the generated settings instead, the model list and default are already populated.
Troubleshooting
- 401 or 403: confirm
SOCLAAS_API_KEYis exported before launching Qwen Code. - Provider not listed: validate the JSON and confirm the file is at
~/.qwen/settings.json. - Unknown model: re-run the
/v1/modelsrequest and use the exactidvalue. - Timeout: check your network connection and the gateway status.