SoCLaaS

Home / Setup Guides / Qwen Code

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

SettingValue
Base URLhttps://soclaas-api.comp.nus.edu.sg/v1
API keyFrom the SoCLaaS portal, stored in SOCLAAS_API_KEY
ModelA chat-capable ID from GET /v1/models

Manual setup

Use these steps if you prefer not to download the generated config.

  1. 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.env file that sets SOCLAAS_API_KEY for you.

  2. Export the key

    export SOCLAAS_API_KEY="YOUR_API_KEY"
  3. Find a model ID

    curl https://soclaas-api.comp.nus.edu.sg/v1/models \
      -H "Authorization: Bearer $SOCLAAS_API_KEY"

    Copy the id of a chat-capable model.

  4. Install Qwen Code

    Follow the installation instructions at qwen.ai/qwencode, then confirm the command is available.

    qwen --version
  5. Add the provider

    Create or edit ~/.qwen/settings.json. Replace YOUR_MODEL_ID with 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"
    }
  6. Run Qwen Code

    qwen

    If you saved the generated settings instead, the model list and default are already populated.

Troubleshooting