Skip to main content
With one Capriole AI API key, you can run GPT-6.2 Astra, Claude Fable 5.2, Opus 5.5, and Gemini 4 Carbon in Qwen Code at up to 90% less than official API prices.

What is Qwen Code

Qwen Code is an open-source coding agent for the terminal. Its modelProviders setting lists the models you can use and the API protocol of each. This setup adds Capriole AI models to that list.

Prerequisites

Before you begin, make sure you have:
  • A Capriole AI account (Sign up here)
  • A Premium plan (USD 9 per month, also includes unlimited web chat) or a Team plan, required for an API key (Subscribe)
  • A Capriole AI API key (Get your key)

Installation

Install Qwen Code with npm (Node.js 22 or later):
Or install it with Homebrew:
Verify the install:

Connect with one command

On the API page, select Connect agent, choose Qwen Code and macOS or Linux, and paste your API key. Run the command it shows in Terminal. It adds the models below to ~/.qwen/settings.json, saves your key in ~/.qwen/.env, and makes openai-latest the default model. The script lists every change and asks before it writes anything. It backs up the files it changes, sends one test request, and puts every file back if that request fails. To undo it, choose disconnect in the same dialog and run that command. It removes the Capriole AI models and key and restores the settings the script changed, except any you have edited since. To set up Qwen Code yourself, follow the steps below.

Configuration

Model validation

Qwen Code 0.25.3 passes a file-read, file-write, and final-answer check through Capriole AI with every model in Supported models, using the configuration below. Put your key in ~/.qwen/.env:
Create or update ~/.qwen/settings.json:
What each setting does:
  • Models under openai use Chat Completions. GPT models add wireApi: "responses" to use the Responses API.
  • Models under anthropic use Anthropic Messages. Their baseUrl has no /v1.
  • capabilities.reasoning tells Qwen Code that claude-latest takes adaptive thinking. Without it, Qwen Code sends a thinking budget, and the request fails with requires adaptive thinking.
  • envKey names the environment variable that holds your key. Qwen Code sends the key as a Bearer token to Capriole AI.
  • contextWindowSize tells Qwen Code each model’s context window.
  • security.auth.selectedType and model.name set the default model. /model updates both when you switch.

Run Qwen Code

Start Qwen Code from your project directory:
Switch models with /model. For a one-shot run, pass the prompt, the model, and the auth type of its group:

Supported models

openai-latest, claude-latest, and google-latest always point to our latest flagship in each family, currently GPT-6.2 Astra, Claude Fable 5.2, and Gemini 4 Carbon.

Troubleshooting

Why does Qwen Code return an authentication error?

Confirm that ~/.qwen/.env sets CAPRIOLE_AI_API_KEY, or export the variable in the same shell.

Why does a model fail with a protocol error?

Run the model with the auth type of its group: --auth-type openai for models under openai, and --auth-type anthropic for models under anthropic. /model sets this for you.

Why do Claude requests fail with Unsupported Claude Messages model?

Claude models under anthropic need the bare Claude IDs, such as claude-opus-5-5.

Notes

  • Keep your key in ~/.qwen/.env, not in settings.json.
  • To add another Capriole AI model, copy the entry of a model from the same family and change the ID. GET https://api.caprioletech.com/v1/models lists every model ID.
  • Gemini 4 Carbon thinks longer than Gemini 4 Argon, so its turns can take longer and use more tokens. For quicker turns, use google/gemini-4-argon.
  • To use the same key with your other coding agents, see Use one API key with coding agents.
  • Official references: Qwen Code and Qwen Code model providers.
Last modified on December 4, 2026