Skip to main content
GonkaGate Docs

Qwen Code

Connect Qwen Code to GonkaGate with the official qwen-code-setup installer.

Connect an existing Qwen Code install to GonkaGate with the official installer. This guide uses the supported @gonkagate/qwen-code-setup path, so you do not have to hand-edit Qwen settings, export keys through shell profiles, or store secrets in a repository.

Quick setup with the official installer

Run the official installer:

Quick setup with the official installer
npx @gonkagate/qwen-code-setup

This tool configures an existing local qwen install. It does not install Qwen Code itself.

Use it if you want the safe default setup without hand-editing Qwen Code config:

  • keeps the secret out of repository-local files
  • preserves unrelated Qwen settings instead of rewriting whole files
  • checks GonkaGate /v1/models before writing config
  • writes the supported GonkaGate models into Qwen Code’s OpenAI-compatible provider catalog
  • verifies the durable local setup before returning you to plain qwen

Before you start

  • Qwen Code is already installed locally and available as qwen on PATH.
  • The audited Qwen Code baseline is @qwen-code/qwen-code 0.18.0.
  • Node >=22.14.0 is available for the npx installer.
  • You already have a GonkaGate API key in gp-... format.
  • The installer currently starts with qwen/qwen3-235b-a22b-instruct-2507-fp8.

Choose the right scope

The installer supports two scopes:

  • user: use GonkaGate on this machine in general.
  • project: make GonkaGate the default for the current repository.

Project scope keeps secrets out of repository files. The installer writes the GonkaGate provider catalog and GONKAGATE_API_KEY into the active user Qwen settings, then writes only activation settings into project Qwen settings.

One limit matters here: project modelProviders can hide user-managed providers in the audited Qwen Code baseline. If a trusted project already defines modelProviders, the installer blocks instead of writing a setup that would look correct but fail at runtime.

Non-interactive setup

Use this for scripts, automation, or repeatable local setup:

Non-interactive setup
npx @gonkagate/qwen-code-setup --scope user --yes

With a key from the environment:

With a key from the environment
GONKAGATE_API_KEY="$GONKAGATE_API_KEY" npx @gonkagate/qwen-code-setup --scope project --yes

With a key through stdin and JSON output:

With a key through stdin and JSON output
printf '%s' "$GONKAGATE_API_KEY" | npx @gonkagate/qwen-code-setup --api-key-stdin --scope project --yes --json

Use dry run when you want to inspect planned writes first:

Command
npx @gonkagate/qwen-code-setup --scope user --dry-run

Pass the key only through:

  • the hidden interactive prompt
  • GONKAGATE_API_KEY
  • --api-key-stdin

The installer intentionally does not accept plain --api-key, so secrets do not end up in shell history or process lists.

Verify the setup

If Qwen Code is already open, close it first. Then start a fresh session:

Verify the setup
qwen

Then:

  • confirm the active model is a GonkaGate model
  • switch models in Qwen Code if needed
  • send this prompt:

Reply with exactly: Qwen Code connected to GonkaGate

That confirms the provider, model selection, and request path before a longer coding session.

The installer verifies durable local settings by default. If you explicitly want a live model call during setup, use --verify-live. That can spend quota and depends on current provider and network availability, so it is not part of the default success check.

Where qwen-code-setup writes data

The installer keeps secrets out of the repository. It manages these Qwen Code surfaces:

  • user settings: ~/.qwen/settings.json
  • QWEN_HOME user settings: <QWEN_HOME>/settings.json
  • project activation settings: .qwen/settings.json
  • backups: ~/.gonkagate/qwen-code/backups/
  • install state: ~/.gonkagate/qwen-code/install-state.json

The managed Qwen settings use:

  • modelProviders.openai[] for GonkaGate models
  • security.auth.selectedType = "openai"
  • model.name for the selected GonkaGate model
  • settings.env.GONKAGATE_API_KEY for the durable key

The provider catalog includes all currently supported GonkaGate models for this setup flow:

  • qwen/qwen3-235b-a22b-instruct-2507-fp8
  • moonshotai/Kimi-K2.6
  • minimaxai/minimax-m2.7

Common first failures

If you seeWhat it usually meansWhat to do
qwen_not_foundQwen Code is missing or not on PATHInstall @qwen-code/qwen-code, then rerun the installer
qwen_version_unsupportedThe local Qwen Code version does not match the audited setup contractUse the supported baseline or rerun the compatibility audit before changing setup assumptions
secret_missingNo safe GonkaGate key source was providedUse the hidden prompt, GONKAGATE_API_KEY, or --api-key-stdin
required_models_unavailableGonkaGate /v1/models did not return every required model for this keyRecheck the key and model access, then retry
project_modelproviders_overrideTrusted project settings define modelProviders and would hide the user provider setRemove the project override or use user scope
secret_shadowed_by_process_envThe current shell has a different GONKAGATE_API_KEYUnset or align the current environment value before starting qwen
secret_shadowed_by_project_envA trusted project .qwen/.env or .env overrides the managed user keyRemove or align the project env value
live_verify_failed after --verify-liveLocal config can be correct while the live request fails for quota, model, or networkCheck balance, quota, selected model, and provider availability before retrying live verification

Current limits

  • This guide configures an existing Qwen Code install. It does not install Qwen Code itself.
  • The audited Qwen Code baseline is @qwen-code/qwen-code 0.18.0.
  • The current transport target is OpenAI-compatible chat/completions through https://api.gonkagate.com/v1.
  • The installer writes all three supported models into modelProviders.openai[], then selects one through model.name.
  • The installer does not accept arbitrary custom base URLs.
  • The installer does not accept arbitrary raw model IDs.
  • The installer does not accept plain --api-key.
  • The installer does not mutate shell profiles or store secrets in repository-local files.
  • Default setup success is based on local verification, not a live model call.

Official references

See also

Was this page helpful?