Skip to main content
Use RunInfra models in Qwen Code with an explicit OpenAI-compatible model selection. Support level: ready. Connect supports automatic setup.

Connect Qwen Code

Have Qwen Code installed, a workspace API key, and available RunInfra credits. The adapter targets Qwen Code 0.23.0 settings.
In an interactive terminal, Connect starts login if needed. Review and approve the proposed changes. Connect saves a snapshot, writes the provider settings and model selection, and makes a real Chat Completions request that uses credits. To choose a model during setup:
See Connect for status, diagnostics, and key replacement.

What Connect writes

An absolute QWEN_HOME replaces the .qwen directory directly. Connect writes settings.json inside it and refuses a relative override. Connect adds catalog entries to the modelProviders.openai array. It sets security.auth.selectedType to openai, model.name to the selected slug, and model.baseUrl to https://api.runinfra.ai/v1. Entries include catalog context and output limits. Unrelated provider entries and supported comments are preserved. Existing RunInfra models absent from the current catalog remain unchanged. Review them before selecting a model.

Key placement

By default, each managed model’s envKey names RUNINFRA_API_KEY. Literal mode stores the key once under env.RUNINFRA_API_KEY in settings.json. For an environment handoff:
Helper mode removes owned saved assignments that can be safely removed and keeps the envKey reference. Set RUNINFRA_API_KEY securely in the environment that launches Qwen Code; Connect does not write the key to settings.env in helper mode. Connect does not edit dotenv files or trust settings. If a retained provider entry still references an older credential variable, its saved assignment is kept unchanged. Review retained entries when replacing credentials. Restart GUI apps and background services with the required environment. On Windows, set RUNINFRA_API_KEY in the user environment and fully restart the app. A GUI or Start menu launch does not inherit a terminal-only assignment. A nonempty process environment takes precedence over discovered dotenv files, which take precedence over settings.env. Dotenv discovery walks from the current directory, preferring .qwen/.env over .env at each level, then checks home. When security.folderTrust.enabled is set, project dotenv candidates require a trusted workspace. Environment-name filters also apply; RUNINFRA_API_KEY passes the verified filters.

Verify

Qwen Code 0.23.0 produced a verified headless response through RunInfra with -p ... --output-format json, using the Connect-written settings.json. This manual verification template is docs-only. Connect does not execute it:
The template sets a zero-tool budget. Confirm the combined flags on your installed version in an authorized isolated scratch environment. A tool-budget error or timeout is not automatically an endpoint failure. Confirm the selected model and request destination separately.

Restart

Restart Qwen Code fully so the provider, selected model and credentials load together.

Troubleshooting

Save settings.json as UTF-8 without a BOM. Qwen Code 0.23.0 can copy a BOM-bearing file to settings.json.corrupted and overwrite settings.json with an empty object. Connect refuses a BOM-bearing file without changing it. Back up the file before correcting its encoding.
New or empty files receive numeric $version: 4. Without that version, Qwen can rewrite settings during startup. Connect refuses nonempty unversioned files and unsupported versions; review and migrate those settings in Qwen before connecting. Duplicate keys and trailing commas are not supported by this adapter. When workspace .qwen/settings.json or system settings define modelProviders or providerProtocol, they replace the corresponding user block as a whole rather than merging entries. Preserving an entry in your user file does not guarantee it remains visible. Connect refuses an active QWEN_CODE_SYSTEM_SETTINGS_PATH override. It also refuses a conflicting launch credential or a target credential variable shared by another provider. Resolve those conflicts before reconnecting. Runtime snapshots, startup migrations, and selection saves can rewrite files or retain secrets. Keep those copies private and verify restoration on your installed version. Restoring Connect’s managed file does not restore or remove external copies.

Revert

With intact state and snapshots, off restores the original bytes from before the first on in the active connection. If the file did not exist then, Connect removes it. Later on calls and key rotations keep that restore point. If Qwen or another editor changed the file, Connect refuses to overwrite it. Back up and review the edits before choosing to discard them:
Connect saves the current contents in a recovery snapshot and prints its id before restoring the origin. Keep the snapshots. If the origin snapshot is missing, cleanup does not guarantee original-byte restoration; see Connect recovery. Restore any manual environment changes separately. Connect does not restore workspace settings, system settings, or dotenv files.

Connect

Set up, inspect, and restore your coding agent.

Chat completions

Read the request contract.

Models

Find model ids and context windows.