Qwen Code can use SoAI as an OpenAI-compatible model provider and as a remote Streamable HTTP MCP server.
Configure model access
- In the SoAI WebUI, select the Settings button at the right of the header, choose Settings, and open
OpenAI. This tab appears only to an Administrator with API key management
(
OPENAI_API_ADMIN). Select Create key and copy the key when it is shown. - Open MCP > MCP tokens. The MCP tab appears only to an Administrator with
MCP administration (
MCP_ADMIN), and creating a personal token also requires MCP usage (MCP_USE). Changing server mode or its exposed tools also requires Configuration changes (CONFIG_PATCH). - Open Models and copy the exact ID of a Chat Completions model. This requires
Model read access (
MODEL_READ).
Configure the model provider
Merge this provider into ~/.qwen/settings.json:
{
"security": {
"auth": { "selectedType": "openai" }
},
"modelProviders": {
"openai": [
{
"id": "YOUR_MODEL_ID",
"name": "SoAI model",
"envKey": "OPENAI_API_KEY",
"baseUrl": "https://SOAI_HOST:5090/v1"
}
]
}
}
export OPENAI_API_KEY='YOUR_SOAI_API_KEY' export NODE_EXTRA_CA_CERTS='/path/to/soai-ca.pem' qwen --model YOUR_MODEL_ID
Select SoAI in Qwen Code
Start qwen, enter /model, and select openai > YOUR_MODEL_ID. The picker reads
the provider entry from settings.json; it does not create the base URL. Send a short prompt after
selection to verify the model connection.
Configure MCP and troubleshoot the connection
export SOAI_MCP_TOKEN='YOUR_MCP_TOKEN' qwen mcp add --scope user --transport http \ --header "Authorization: Bearer $SOAI_MCP_TOKEN" \ soai https://SOAI_HOST:5090/mcp qwen mcp list
The add command writes the resolved header to the selected Qwen settings scope, so protect that file as a secret.
Start Qwen Code in a trusted workspace, enter /mcp, and confirm that the interactive MCP dialog reports
soai as connected and exposes its tools.
Troubleshooting
Trust the workspace through Qwen Code's normal trust prompt; do not globally disable workspace security. Model
failures use the SoAI API key and /v1 URL, while MCP failures use the separate token and
/mcp URL. For either TLS path, trust the server CA with NODE_EXTRA_CA_CERTS.