Qwen Code is an open-source, AI-powered terminal coding assistant optimized for the Qwen3-Coder model. It helps you understand large codebases, automate tedious work, and ship faster — all from the command line.
Before integrating Qwen Code with TrueFoundry, ensure you have:
TrueFoundry Account: Create a TrueFoundry account with at least one model provider configured and generate a Personal Access Token by following the instructions in Generating Tokens. For a quick setup guide, see our Gateway Quick Start
Qwen Code Installation: Install Qwen Code CLI using one of the methods below:
Quick Install (curl)
Homebrew
npm
Windows
The recommended one-line installer for Linux and macOS:
{GATEWAY_BASE_URL} → Your TrueFoundry AI Gateway Base URL
your-truefoundry-api-key → Your TrueFoundry Personal Access Token
openai-main/gpt-4o → Your desired model in provider-name/model-name format
The id and model.name fields should use the fully qualified model name from TrueFoundry (e.g., openai-main/gpt-4o, anthropic/claude-4-sonnet). You can find the exact model name in the TrueFoundry AI Gateway playground.
Use the -p flag to run Qwen Code without the interactive UI — ideal for scripts, automation, and CI/CD:
# Generate code with a promptqwen -p "Write a hello world HTTP server in Python using Flask, keep it minimal"# Output as plain text (useful for piping)qwen -p "Write a hello world HTTP server in Python using Flask, keep it minimal" -o text
Qwen Code CLI headless mode output showing a generated Flask server
# Understand your project> What does this project do?# Code generation> Write unit tests for the auth module# Refactoring> Refactor this function to use async/await# Debugging> Why is this test failing?
All requests routed through TrueFoundry AI Gateway are automatically logged and available for monitoring. You can view request traces, latencies, token usage, and full request/response details in the TrueFoundry dashboard.
TrueFoundry trace view showing Qwen Code CLI requests routed through the AI Gateway
This gives you full visibility into:
Request traces: See every request made by Qwen Code, including the model used and response times
Token usage: Track input and output token consumption across sessions
Cost monitoring: Monitor spend across different models and providers
Governance: Enforce policies, rate limits, and access controls on all AI requests
Gateway config: per user. Qwen Code has a system settings file, /etc/qwen-code/settings.json (Linux), C:\ProgramData\qwen-code\settings.json (Windows), or /Library/Application Support/QwenCode/settings.json (macOS), that overrides user and project settings and can set modelProviders and security.auth.enforcedType. But OPENAI_BASE_URL / OPENAI_API_KEY environment variables and CLI flags rank above it, so the base URL can’t be hard-locked; push the values through MDM and use network policy. See Qwen Code’s settings doc.MCP servers: enforceable. Remote servers are mcpServers.<name> with httpUrl (Streamable HTTP) or url (SSE), headers, or an oauth block; point them at the MCP Gateway. In the system settings file, mcpServers defined there can’t be overridden by users, and mcp.allowed / mcp.excluded allowlist or block servers by name (mcp.excluded wins). Matching is by name string, so it’s policy rather than a hard boundary. See Qwen Code’s MCP doc.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"TrueFoundry Docs","description":"TrueFoundry documentation — enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways to connect, monitor, and govern agentic AI applications across providers from a unified control plane.","colors":{"primary":"#4f46e5","light":"#4f46e5","dark":"#4f46e5"},"logo":{"light":"https://mintcdn.com/truefoundry/e2uUimEwX30qkWxc/logo/light.svg?fit=max\u0026auto=format\u0026n=e2uUimEwX30qkWxc\u0026q=85\u0026s=6068d83664aeda0239bec2422657dd20","dark":"https://mintcdn.com/truefoundry/e2uUimEwX30qkWxc/logo/dark.svg?fit=max\u0026auto=format\u0026n=e2uUimEwX30qkWxc\u0026q=85\u0026s=c1cb26554a546d84500b40f7057bece8"},"favicon":"https://mintcdn.com/truefoundry/6bbtTt95c1iCcyph/favicon.svg?fit=max\u0026auto=format\u0026n=6bbtTt95c1iCcyph\u0026q=85\u0026s=f55bde34214b38034126d05b08ea16c7","appearance":{"default":"light"},"background":{"decoration":"grid"},"navbar":{"links":[{"href":"https://www.truefoundry.com/book-demo","label":"Book Demo"},{"href":"https://www.truefoundry.com/blog","label":"Blog"}],"primary":{"type":"button","label":"Sign Up","href":"https://www.truefoundry.com/register"}},"footer":{"socials":{"x":"https://twitter.com/truefoundry","linkedin":"https://in.linkedin.com/company/truefoundry"}},"seo":{"metatags":{"og:type":"website","og:site_name":"TrueFoundry Docs","og:image":"https://assets.production.truefoundry.com/logo.svg","og:description":"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane.","description":"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane."}},"icons":{"library":"fontawesome"},"styling":{"codeblocks":"dark","latex":true},"contextual":{"options":["copy","view","chatgpt","claude","mcp","cursor","vscode"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"truefoundry","hasAudioNarration":false,"actualSubdomain":"truefoundry","customDomains":["www.truefoundry.com"],"gitSource":{"type":"github","owner":"truefoundry","repo":"docs-mintlify","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6af2a2579784a471662323ac","clientVersion":"0.0.4094","searchFilterCounts":[{"language":"default","tag":"AI Gateway","count":233},{"language":"default","tag":"API Reference","count":202},{"language":"default","tag":"Platform","count":198},{"language":"default","tag":"Integrations","count":132},{"language":"default","tag":"AI Deployment","count":108},{"language":"default","tag":"LLM Gateway","count":100},{"language":"default","tag":"Integrate Models","count":50},{"language":"default","tag":"Observability","count":47},{"language":"default","tag":"Guardrails and Security","count":46},{"language":"default","tag":"Installation Guides","count":44}]},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@truefoundry.com","showHelpButton":true}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".line-highlight{background:rgb(var(--primary-light)/.7)!important}.tfy-cat-anchor{scroll-margin-top:6rem;margin-block:1.75rem}.line-highlight:before{background:rgb(var(--primary-light)/.7)!important}.line-highlight:after{background:rgb(var(--primary-light)/.7)!important}"}],"page":{"pagePath":"docs/ai-gateway/qwen-cli","slug":"/docs/ai-gateway/qwen-cli","pageMetadata":{"title":"Qwen Code CLI","sidebarTitle":"Qwen Code","description":"Use Qwen Code CLI with TrueFoundry AI Gateway to interact with AI models from your terminal.","href":"/docs/ai-gateway/qwen-cli"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Use Qwen Code CLI with TrueFoundry AI Gateway to interact with AI models from your terminal.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Frame,Heading,Note,OptimizedImage,Tab,Tabs,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`This guide provides instructions for integrating `,_jsx(_components.a,{href:`https://github.com/QwenLM/qwen-code`,children:`Qwen Code CLI`}),` with the TrueFoundry AI Gateway.`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-is-qwen-code`,children:`What is Qwen Code?`}),`\n`,_jsxs(_components.p,{children:[`Qwen Code is an open-source, AI-powered terminal coding assistant optimized for the `,_jsx(_components.a,{href:`https://github.com/QwenLM/Qwen3-Coder`,children:`Qwen3-Coder`}),` model. It helps you understand large codebases, automate tedious work, and ship faster — all from the command line.`]}),`\n`,_jsx(Heading,{level:`3`,id:`key-features`,children:`Key Features`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Terminal-Native AI Agent`}),`: Chat with AI models, edit files, and run commands directly from your terminal without switching contexts`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Repository-Scale Understanding`}),`: Analyzes codebases beyond traditional AI context limits with intelligent context management`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Multi-Protocol Support`}),`: Works with OpenAI, Anthropic, and Google GenAI compatible APIs — making it easy to route through TrueFoundry`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Agentic Workflow`}),`: Built-in Skills and SubAgents for a full agentic coding experience`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsx(_components.p,{children:`Before integrating Qwen Code with TrueFoundry, ensure you have:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`TrueFoundry Account`}),`: Create a `,_jsx(_components.a,{href:`https://www.truefoundry.com/register`,children:`TrueFoundry account`}),` with at least one model provider configured and generate a Personal Access Token by following the instructions in `,_jsx(_components.a,{href:`/docs/ai-gateway/authentication`,children:`Generating Tokens`}),`. For a quick setup guide, see our `,_jsx(_components.a,{href:`https://docs.truefoundry.com/gateway/quick-start`,children:`Gateway Quick Start`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Qwen Code Installation`}),`: Install Qwen Code CLI using one of the methods below:`]}),`\n`]}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Quick Install (curl)`,id:`quick-install-curl`,children:[_jsx(_components.p,{children:`The recommended one-line installer for Linux and macOS:`}),_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -fsSL`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` | `}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`bash`})]}),`\n`]})})}),_jsx(Frame,{caption:`Installing Qwen Code CLI via curl`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.06.42.png?fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=6d53df33bda78d1c5793e6d11aaca266`,alt:`Terminal showing curl command to install Qwen Code CLI`,\"data-og-width\":`1702`,width:`1702`,\"data-og-height\":`978`,height:`978`,\"data-path\":`images/2026-02-17_19.06.42.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.06.42.png?w=280\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=2c8621e932c033fcdbcefedd00fc5ecd 280w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.06.42.png?w=560\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=827a68000b70d38fc9e536c5f04c3a73 560w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.06.42.png?w=840\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=7e80085f44c1e966f5dff9b4bb05ba04 840w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.06.42.png?w=1100\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=0db5e56bcf57058d280be7a27e3e82c1 1100w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.06.42.png?w=1650\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=72ff1ddf5c0be665bbb39a2953d226a1 1650w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.06.42.png?w=2500\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=aaa9fe91c9cb4eaa8e27bc3f476788db 2500w`})}),_jsx(Note,{children:_jsx(_components.p,{children:`Restart your terminal after installation to ensure environment variables take effect.`})})]}),_jsxs(Tab,{title:`Homebrew`,id:`homebrew`,children:[_jsx(_components.p,{children:`On macOS or Linux with Homebrew:`}),_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`brew`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` qwen-code`})]}),`\n`]})})}),_jsx(Frame,{caption:`Installing Qwen Code CLI via Homebrew`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.09.09.png?fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=a07b38f9db8ff342ee02328d72d79504`,alt:`Terminal showing brew install qwen-code fetching packages`,\"data-og-width\":`1694`,width:`1694`,\"data-og-height\":`980`,height:`980`,\"data-path\":`images/2026-02-17_19.09.09.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.09.09.png?w=280\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=c2cf6d92070fab10a60dcd05a3c5877e 280w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.09.09.png?w=560\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=df9b239feb3370764e9e4749a823078d 560w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.09.09.png?w=840\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=9c06272d9d9aad56360fdf4d68f77886 840w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.09.09.png?w=1100\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=ec048082c82ec54ba132e7a4c16aa1e9 1100w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.09.09.png?w=1650\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=cba94379fb0d62c54ecba65f064d8928 1650w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_19.09.09.png?w=2500\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=bf8495d55325adc41559f19349ac9c44 2500w`})})]}),_jsxs(Tab,{title:`npm`,id:`npm`,children:[_jsx(_components.p,{children:`If you already have Node.js 20+ installed:`}),_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -g`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` @qwen-code/qwen-code@latest`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`See the `,_jsx(_components.a,{href:`https://www.npmjs.com/package/@qwen-code/qwen-code`,children:`npm package page`}),` for additional options and version history.`]})]}),_jsxs(Tab,{title:`Windows`,id:`windows`,children:[_jsx(_components.p,{children:`Run as Administrator in CMD:`}),_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`1`,language:`bat`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`bat`,children:_jsxs(_components.code,{language:`bat`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`curl -fsSL -o `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`%TEMP%`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`\\\\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat \u0026\u0026 `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`%TEMP%`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`\\\\install-qwen.bat`})]}),`\n`]})})})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`setup-process`,children:`Setup Process`}),`\n`,_jsx(Heading,{level:`3`,id:`1-get-configuration-details`,children:`1. Get Configuration Details`}),`\n`,_jsxs(_components.p,{children:[`Get the `,_jsx(_components.code,{children:`base URL`}),` and `,_jsx(_components.code,{children:`model name`}),` from your TrueFoundry AI Gateway playground using the unified code snippet:`]}),`\n`,_jsx(Frame,{caption:`Get Base URL and Model Name from Unified Code Snippet`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?fit=max\u0026auto=format\u0026n=n3EuZuJ0K8wBFp1G\u0026q=85\u0026s=3634c2dc8c3565fd77ab896d3fd07ed9`,alt:`TrueFoundry playground showing unified code snippet with base URL and model name highlighted for Qwen Code CLI integration`,\"data-og-width\":`2940`,width:`2940`,\"data-og-height\":`1664`,height:`1664`,\"data-path\":`images/new-code-snippet.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?w=280\u0026fit=max\u0026auto=format\u0026n=n3EuZuJ0K8wBFp1G\u0026q=85\u0026s=c1028503600d952de860bd85236e0183 280w, https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?w=560\u0026fit=max\u0026auto=format\u0026n=n3EuZuJ0K8wBFp1G\u0026q=85\u0026s=dea2ecbbb7429c14234eb1791b35844b 560w, https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?w=840\u0026fit=max\u0026auto=format\u0026n=n3EuZuJ0K8wBFp1G\u0026q=85\u0026s=3e74375d1e1a5d3113504716f3d97c01 840w, https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?w=1100\u0026fit=max\u0026auto=format\u0026n=n3EuZuJ0K8wBFp1G\u0026q=85\u0026s=ccc2e26e0f61d30353f981cfa356cc0b 1100w, https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?w=1650\u0026fit=max\u0026auto=format\u0026n=n3EuZuJ0K8wBFp1G\u0026q=85\u0026s=feb9186257b79178a9d2e35408855f70 1650w, https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?w=2500\u0026fit=max\u0026auto=format\u0026n=n3EuZuJ0K8wBFp1G\u0026q=85\u0026s=461cd11ef1c8d97c527f878c3203c367 2500w`})}),`\n`,_jsx(Heading,{level:`3`,id:`2-configure-qwen-code`,children:`2. Configure Qwen Code`}),`\n`,_jsxs(_components.p,{children:[`Qwen Code uses a `,_jsx(_components.code,{children:`settings.json`}),` file for configuration. Edit (or create) the file at `,_jsx(_components.code,{children:`~/.qwen/settings.json`}),` to route requests through TrueFoundry:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`24`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`24`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"modelProviders\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"openai\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"openai-main/gpt-4o\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"GPT-4o via TrueFoundry\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"baseUrl\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"{GATEWAY_BASE_URL}\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"GPT-4o routed through TrueFoundry AI Gateway\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"envKey\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"TFY_API_KEY\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"env\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"TFY_API_KEY\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"your-truefoundry-api-key\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"security\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"auth\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"selectedType\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"openai-main/gpt-4o\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Replace the placeholders:`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`{GATEWAY_BASE_URL}`}),` → Your TrueFoundry AI Gateway Base URL`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`your-truefoundry-api-key`}),` → Your TrueFoundry Personal Access Token`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`openai-main/gpt-4o`}),` → Your desired model in `,_jsx(_components.code,{children:`provider-name/model-name`}),` format`]}),`\n`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`id`}),` and `,_jsx(_components.code,{children:`model.name`}),` fields should use the fully qualified model name from TrueFoundry (e.g., `,_jsx(_components.code,{children:`openai-main/gpt-4o`}),`, `,_jsx(_components.code,{children:`anthropic/claude-4-sonnet`}),`). You can find the exact model name in the TrueFoundry AI Gateway playground.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`3-configure-multiple-models-optional`,children:`3. Configure Multiple Models (Optional)`}),`\n`,_jsx(_components.p,{children:`You can configure multiple models from different providers to switch between them during a session:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`31`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`31`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"modelProviders\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"openai\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"openai-main/gpt-4o\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"GPT-4o via TrueFoundry\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"baseUrl\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"{GATEWAY_BASE_URL}\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"GPT-4o routed through TrueFoundry AI Gateway\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"envKey\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"TFY_API_KEY\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"openai-main/gpt-5\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"GPT-5 via TrueFoundry\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"baseUrl\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"{GATEWAY_BASE_URL}\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"GPT-5 routed through TrueFoundry AI Gateway\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"envKey\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"TFY_API_KEY\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"env\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"TFY_API_KEY\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"your-truefoundry-api-key\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"security\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"auth\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"selectedType\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"openai-main/gpt-4o\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Use the `,_jsx(_components.code,{children:`/model`}),` command inside Qwen Code to switch between all configured models during a session.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`usage-examples`,children:`Usage Examples`}),`\n`,_jsx(Heading,{level:`3`,id:`interactive-mode`,children:`Interactive Mode`}),`\n`,_jsx(_components.p,{children:`Launch the interactive terminal UI in your project directory:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`cd`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` your-project/`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`qwen`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Once inside the session, you can ask questions about your codebase, generate code, and run commands using natural language.`}),`\n`,_jsx(Heading,{level:`3`,id:`headless-mode`,children:`Headless Mode`}),`\n`,_jsxs(_components.p,{children:[`Use the `,_jsx(_components.code,{children:`-p`}),` flag to run Qwen Code without the interactive UI — ideal for scripts, automation, and CI/CD:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`5`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A9955`,\"--shiki-dark\":`#6A9955`},children:`# Generate code with a prompt`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`qwen`}),_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -p`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"Write a hello world HTTP server in Python using Flask, keep it minimal\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A9955`,\"--shiki-dark\":`#6A9955`},children:`# Output as plain text (useful for piping)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`qwen`}),_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -p`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"Write a hello world HTTP server in Python using Flask, keep it minimal\"`}),_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -o`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` text`})]}),`\n`]})})}),`\n`,_jsx(Frame,{caption:`Qwen Code CLI headless mode output showing a generated Flask server`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/truefoundry/RZf3mUTs07au5PFx/images/qwen-cli-output.png?fit=max\u0026auto=format\u0026n=RZf3mUTs07au5PFx\u0026q=85\u0026s=80cd200f42a243e72ba31ee2cd34857d`,alt:`Qwen Code CLI terminal output showing a prompt to generate a Flask HTTP server and the resulting code`,\"data-og-width\":`1502`,width:`1502`,\"data-og-height\":`772`,height:`772`,\"data-path\":`images/qwen-cli-output.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/truefoundry/RZf3mUTs07au5PFx/images/qwen-cli-output.png?w=280\u0026fit=max\u0026auto=format\u0026n=RZf3mUTs07au5PFx\u0026q=85\u0026s=bd9e459341adbaee0cf2c51948167d94 280w, https://mintcdn.com/truefoundry/RZf3mUTs07au5PFx/images/qwen-cli-output.png?w=560\u0026fit=max\u0026auto=format\u0026n=RZf3mUTs07au5PFx\u0026q=85\u0026s=fa1a05f13e7a9c021195c7fb46355bf6 560w, https://mintcdn.com/truefoundry/RZf3mUTs07au5PFx/images/qwen-cli-output.png?w=840\u0026fit=max\u0026auto=format\u0026n=RZf3mUTs07au5PFx\u0026q=85\u0026s=6f274e4953b9e98328128ff613e4622d 840w, https://mintcdn.com/truefoundry/RZf3mUTs07au5PFx/images/qwen-cli-output.png?w=1100\u0026fit=max\u0026auto=format\u0026n=RZf3mUTs07au5PFx\u0026q=85\u0026s=d5a62ffe14e6afe80280c4c7b247367b 1100w, https://mintcdn.com/truefoundry/RZf3mUTs07au5PFx/images/qwen-cli-output.png?w=1650\u0026fit=max\u0026auto=format\u0026n=RZf3mUTs07au5PFx\u0026q=85\u0026s=01f418d4956aa266677833e03517c169 1650w, https://mintcdn.com/truefoundry/RZf3mUTs07au5PFx/images/qwen-cli-output.png?w=2500\u0026fit=max\u0026auto=format\u0026n=RZf3mUTs07au5PFx\u0026q=85\u0026s=f61bacbf7452a8b6581f166633d38af6 2500w`})}),`\n`,_jsx(Heading,{level:`3`,id:`common-prompts`,children:`Common Prompts`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`# Understand your project`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`> What does this project do?`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`# Code generation`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`> Write unit tests for the auth module`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`# Refactoring`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`> Refactor this function to use async/await`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`# Debugging`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`> Why is this test failing?`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`observability`,children:`Observability`}),`\n`,_jsx(_components.p,{children:`All requests routed through TrueFoundry AI Gateway are automatically logged and available for monitoring. You can view request traces, latencies, token usage, and full request/response details in the TrueFoundry dashboard.`}),`\n`,_jsx(Frame,{caption:`TrueFoundry trace view showing Qwen Code CLI requests routed through the AI Gateway`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_18.58.26.png?fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=397b672a59df18af6ddf90fe5ff878a8`,alt:`TrueFoundry observability dashboard showing traced requests from Qwen Code CLI with model details, latencies, and response content`,\"data-og-width\":`1735`,width:`1735`,\"data-og-height\":`772`,height:`772`,\"data-path\":`images/2026-02-17_18.58.26.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_18.58.26.png?w=280\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=d8acc2e98d34ac0920a76b6413e471d1 280w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_18.58.26.png?w=560\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=58f2692b73818d1f6983baa8474f04c7 560w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_18.58.26.png?w=840\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=d54d2c8571df6225864daad9f1e2b794 840w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_18.58.26.png?w=1100\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=eb094a41ac7675a5e9ff95b07afb62e2 1100w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_18.58.26.png?w=1650\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=314e6e81fbd39c2a7001472c8eca7fb9 1650w, https://mintcdn.com/truefoundry/2l_WTJi9lAa_WJYj/images/2026-02-17_18.58.26.png?w=2500\u0026fit=max\u0026auto=format\u0026n=2l_WTJi9lAa_WJYj\u0026q=85\u0026s=15649d6c505d56c4ba09645e4ef8ca69 2500w`})}),`\n`,_jsx(_components.p,{children:`This gives you full visibility into:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Request traces`}),`: See every request made by Qwen Code, including the model used and response times`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Token usage`}),`: Track input and output token consumption across sessions`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Cost monitoring`}),`: Monitor spend across different models and providers`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Governance`}),`: Enforce policies, rate limits, and access controls on all AI requests`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`fleet-wide-enforcement`,children:`Fleet-wide enforcement`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Gateway config: per user.`}),` Qwen Code has a system settings file, `,_jsx(_components.code,{children:`/etc/qwen-code/settings.json`}),` (Linux), `,_jsx(_components.code,{children:`C:\\\\ProgramData\\\\qwen-code\\\\settings.json`}),` (Windows), or `,_jsx(_components.code,{children:`/Library/Application Support/QwenCode/settings.json`}),` (macOS), that overrides user and project settings and can set `,_jsx(_components.code,{children:`modelProviders`}),` and `,_jsx(_components.code,{children:`security.auth.enforcedType`}),`. But `,_jsx(_components.code,{children:`OPENAI_BASE_URL`}),` / `,_jsx(_components.code,{children:`OPENAI_API_KEY`}),` environment variables and CLI flags rank above it, so the base URL can’t be hard-locked; push the values through MDM and use network policy. See Qwen Code’s `,_jsx(_components.a,{href:`https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/`,children:`settings`}),` doc.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`MCP servers: enforceable.`}),` Remote servers are `,_jsx(_components.code,{children:`mcpServers.\u003cname>`}),` with `,_jsx(_components.code,{children:`httpUrl`}),` (Streamable HTTP) or `,_jsx(_components.code,{children:`url`}),` (SSE), `,_jsx(_components.code,{children:`headers`}),`, or an `,_jsx(_components.code,{children:`oauth`}),` block; point them at the MCP Gateway. In the system settings file, `,_jsx(_components.code,{children:`mcpServers`}),` defined there can’t be overridden by users, and `,_jsx(_components.code,{children:`mcp.allowed`}),` / `,_jsx(_components.code,{children:`mcp.excluded`}),` allowlist or block servers by name (`,_jsx(_components.code,{children:`mcp.excluded`}),` wins). Matching is by name string, so it’s policy rather than a hard boundary. See Qwen Code’s `,_jsx(_components.a,{href:`https://qwenlm.github.io/qwen-code-docs/en/users/features/mcp/`,children:`MCP`}),` doc.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"dark","config":{},"pageMetadata":{"title":"Qwen Code CLI","sidebarTitle":"Qwen Code","description":"Use Qwen Code CLI with TrueFoundry AI Gateway to interact with AI models from your terminal.","href":"/docs/ai-gateway/qwen-cli"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"What is Qwen Code?","slug":"what-is-qwen-code","depth":2,"children":[{"title":"Key Features","slug":"key-features","depth":3,"children":[]}]},{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"Setup Process","slug":"setup-process","depth":2,"children":[{"title":"1. Get Configuration Details","slug":"1-get-configuration-details","depth":3,"children":[]},{"title":"2. Configure Qwen Code","slug":"2-configure-qwen-code","depth":3,"children":[]},{"title":"3. Configure Multiple Models (Optional)","slug":"3-configure-multiple-models-optional","depth":3,"children":[]}]},{"title":"Usage Examples","slug":"usage-examples","depth":2,"children":[{"title":"Interactive Mode","slug":"interactive-mode","depth":3,"children":[]},{"title":"Headless Mode","slug":"headless-mode","depth":3,"children":[]},{"title":"Common Prompts","slug":"common-prompts","depth":3,"children":[]}]},{"title":"Observability","slug":"observability","depth":2,"children":[]},{"title":"Fleet-wide enforcement","slug":"fleet-wide-enforcement","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/truefoundry/9e0085f7ed271180/scripts.js"],"subdomain":"truefoundry","siteName":"TrueFoundry Docs","title":"Qwen Code CLI - TrueFoundry Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-12T16:19:55.260Z","originalFileLocation":"docs/ai-gateway/qwen-cli.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Use Qwen Code CLI with TrueFoundry AI Gateway to interact with AI models from your terminal.\">\u003cmeta data-mint-head name=\"application-name\" content=\"TrueFoundry Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Qwen Code CLI - TrueFoundry Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"TrueFoundry Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://assets.production.truefoundry.com/logo.svg\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Qwen Code CLI - TrueFoundry Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"TrueFoundry offers an enterprise-grade AI Gateway combining LLM, MCP, and Agent Gateways—empowering businesses to connect, monitor, and govern agentic AI applications across providers from a unified control plane.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://assets.production.truefoundry.com/logo.svg\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/truefoundry/DMuq4kzeTciVEGUc/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"TrueFoundry Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#4f46e5\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/ai-gateway/qwen-cli.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.truefoundry.com/#organization\",\"name\":\"TrueFoundry Docs\",\"url\":\"https://www.truefoundry.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/truefoundry/e2uUimEwX30qkWxc/logo/light.svg?fit=max\u0026auto=format\u0026n=e2uUimEwX30qkWxc\u0026q=85\u0026s=6068d83664aeda0239bec2422657dd20\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.truefoundry.com#website\",\"name\":\"TrueFoundry Docs\",\"url\":\"https://www.truefoundry.com\",\"publisher\":{\"@id\":\"https://www.truefoundry.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli#webpage\",\"url\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli\",\"name\":\"Qwen Code CLI\",\"description\":\"Use Qwen Code CLI with TrueFoundry AI Gateway to interact with AI models from your terminal.\",\"dateModified\":\"2026-10-12T16:19:55.260Z\",\"isPartOf\":{\"@id\":\"https://www.truefoundry.com#website\"},\"breadcrumb\":{\"@id\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\" \",\"item\":\"https://www.truefoundry.com/docs/ai-gateway/ecosystem\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Other IDEs\",\"item\":\"https://www.truefoundry.com/docs/ai-gateway/cline\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Qwen Code CLI\",\"item\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli#article\",\"headline\":\"Qwen Code CLI\",\"name\":\"Qwen Code CLI\",\"description\":\"Use Qwen Code CLI with TrueFoundry AI Gateway to interact with AI models from your terminal.\",\"url\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli\",\"mainEntityOfPage\":{\"@id\":\"https://www.truefoundry.com/docs/ai-gateway/qwen-cli#webpage\"},\"image\":\"https://assets.production.truefoundry.com/logo.svg\",\"dateModified\":\"2026-10-12T16:19:55.260Z\",\"publisher\":{\"@id\":\"https://www.truefoundry.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.truefoundry.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"TrueFoundry Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"TrueFoundry Docs","nav":{"global":null,"tabs":[{"tab":"AI Gateway","pages":[{"title":"AI Gateway","href":"/docs/ai-gateway/intro-to-llm-gateway"}]},{"tab":"Agent Platform","pages":[{"title":"Agent Platform","href":"/docs/agent-platform/agent-harness/overview"}]},{"tab":"Platform","pages":[{"title":"Platform","href":"/docs/platform/overview"}]},{"tab":"AI Deployment","pages":[{"title":"AI Deployment","href":"/docs/ai-deployment-overview"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/docs/truefoundry_sdk"}]},{"tab":"Integrations","groups":[{"group":" ","pages":[{"title":"Ecosystem \u0026 Integrations","href":"/docs/ai-gateway/ecosystem"},{"title":"Coding agents and AI apps: what the gateway governs","sidebarTitle":"Integration with IDEs","href":"/docs/ai-gateway/coding-agents-governance"},{"title":"Connect your coding agents to TrueFoundry","sidebarTitle":"Personal setup","href":"/docs/ai-gateway/personal-setup"},{"group":"Claude","pages":[{"title":"Claude on TrueFoundry","sidebarTitle":"Overview","href":"/docs/ai-gateway/claude"},{"title":"Claude quick start","sidebarTitle":"Quick start","href":"/docs/ai-gateway/claude-quick-start"},{"title":"Claude Code","href":"/docs/ai-gateway/claude-code"},{"title":"Claude Desktop \u0026 Cowork","sidebarTitle":"Claude Desktop \u0026 Cowork","href":"/docs/ai-gateway/claude-desktop"},{"title":"Claude Web","href":"/docs/ai-gateway/claude-web"},{"title":"Govern Claude's MCP traffic","sidebarTitle":"Govern MCP traffic","href":"/docs/ai-gateway/claude-mcp-governance"},{"title":"Enforce Claude settings with MDM","sidebarTitle":"Enforce with MDM","href":"/docs/ai-gateway/claude-mdm"},{"group":"Guardrails","pages":[{"title":"Guardrails using Claude Code Hooks","href":"/docs/ai-gateway/claude-code-hooks"},{"title":"Guardrails using Anthropic Inference Hooks","href":"/docs/ai-gateway/anthropic-inference-hooks"}]},{"title":"Claude on TrueFoundry: FAQ","sidebarTitle":"FAQ","href":"/docs/ai-gateway/claude-faq"}]},{"group":"Other IDEs","pages":[{"title":"Cline","href":"/docs/ai-gateway/cline"},{"title":"Cursor","href":"/docs/ai-gateway/cursor"},{"title":"Gemini CLI","href":"/docs/ai-gateway/gemini-cli"},{"title":"GitHub Copilot","href":"/docs/ai-gateway/github-copilot"},{"title":"Goose","href":"/docs/ai-gateway/goose"},{"title":"Grok Build","sidebarTitle":"Grok Build","href":"/docs/ai-gateway/grok-build"},{"title":"OpenCode","href":"/docs/ai-gateway/opencode"},{"title":"OpenAI Codex CLI","sidebarTitle":"Codex CLI","href":"/docs/ai-gateway/openai-codex-cli"},{"title":"Securing OpenAI Codex with TrueFoundry","sidebarTitle":"Codex Security with MDM","href":"/docs/ai-gateway/mcp/enterprise-security-codex"},{"title":"Pi","description":"Route the Pi terminal coding agent through TrueFoundry AI Gateway with a custom provider in models.json, and connect MCP Gateway servers with pi mcp add.","href":"/docs/ai-gateway/pi"},{"title":"Qwen Code CLI","sidebarTitle":"Qwen Code","href":"/docs/ai-gateway/qwen-cli"},{"title":"Roo Code","description":"Learn how to use roo code with TrueFoundry AI Gateway, including setup steps, use cases, and production-ready examples.","href":"/docs/ai-gateway/roo-code"},{"title":"VS Code","href":"/docs/ai-gateway/vscode"}]},{"group":"Frameworks \u0026 Apps","pages":[{"title":"Agno AI","href":"/docs/ai-gateway/agno"},{"title":"CrewAI","href":"/docs/ai-gateway/crewai"},{"title":"DSPy","href":"/docs/ai-gateway/dspy"},{"title":"Instructor","href":"/docs/ai-gateway/instructor"},{"title":"LangChain","href":"/docs/ai-gateway/langchain"},{"title":"Langroid","href":"/docs/ai-gateway/langroid"},{"title":"OpenAI Agents SDK","href":"/docs/ai-gateway/openai-agents-sdk"},{"title":"OpenAI Swarm","href":"/docs/ai-gateway/openai-swarm"},{"title":"Phidata","href":"/docs/ai-gateway/phidata"},{"title":"Pydantic AI","href":"/docs/ai-gateway/pydantic-ai"},{"title":"Strands Agents","href":"/docs/ai-gateway/strands"},{"title":"AnythingLLM","href":"/docs/ai-gateway/anythingllm"},{"title":"Dify","href":"/docs/ai-gateway/dify"},{"title":"Flowise","href":"/docs/ai-gateway/flowise"},{"title":"Jan AI","href":"/docs/ai-gateway/jan"},{"title":"Langflow","href":"/docs/ai-gateway/langflow"},{"title":"LibreChat","href":"/docs/ai-gateway/librechat"},{"title":"LiveKit","href":"/docs/ai-gateway/livekit"},{"title":"n8n","href":"/docs/ai-gateway/n8n"},{"title":"Open WebUI","href":"/docs/ai-gateway/open-webui"}]},{"group":"Observability","pages":[{"title":"Arize","sidebarTitle":"Arize","href":"/docs/ai-gateway/arize"},{"title":"Axiom","sidebarTitle":"Axiom","href":"/docs/ai-gateway/axiom"},{"title":"Braintrust","href":"/docs/ai-gateway/braintrust"},{"title":"Coralogix","sidebarTitle":"Coralogix","href":"/docs/ai-gateway/coralogix"},{"title":"ClickStack","sidebarTitle":"ClickStack","href":"/docs/ai-gateway/clickstack"},{"title":"Confident AI","sidebarTitle":"Confident AI","href":"/docs/ai-gateway/confident-ai"},{"title":"CoreWeave Weave OTEL","sidebarTitle":"CoreWeave Weave OTEL","href":"/docs/ai-gateway/coreweave"},{"title":"Dash0","sidebarTitle":"Dash0","href":"/docs/ai-gateway/dash0"},{"title":"Dynatrace","sidebarTitle":"Dynatrace","href":"/docs/ai-gateway/dynatrace"},{"title":"Elastic","sidebarTitle":"Elastic","href":"/docs/ai-gateway/elastic"},{"title":"Honeycomb","sidebarTitle":"Honeycomb","href":"/docs/ai-gateway/honeycomb"},{"title":"HoneyHive","sidebarTitle":"HoneyHive","href":"/docs/ai-gateway/honeyhive"},{"title":"Langfuse","href":"/docs/ai-gateway/langfuse"},{"title":"LangWatch","sidebarTitle":"LangWatch","href":"/docs/ai-gateway/langwatch"},{"title":"Laminar","sidebarTitle":"Laminar","href":"/docs/ai-gateway/laminar"},{"title":"LangSmith","sidebarTitle":"LangSmith","href":"/docs/ai-gateway/langsmith"},{"title":"Last9","sidebarTitle":"Last9","href":"/docs/ai-gateway/last9"},{"title":"Lunary","sidebarTitle":"Lunary","href":"/docs/ai-gateway/lunary"},{"title":"Middleware","sidebarTitle":"Middleware","href":"/docs/ai-gateway/middleware"},{"title":"New Relic","sidebarTitle":"New Relic","href":"/docs/ai-gateway/newrelic"},{"title":"Oodle","sidebarTitle":"Oodle","href":"/docs/ai-gateway/oodle"},{"title":"OpenLIT","sidebarTitle":"OpenLIT","href":"/docs/ai-gateway/openlit"},{"title":"PromptLayer","sidebarTitle":"PromptLayer","href":"/docs/ai-gateway/promptlayer"},{"title":"Pydantic Logfire","sidebarTitle":"Pydantic Logfire","href":"/docs/ai-gateway/pydantic-logfire"},{"title":"SigNoz","sidebarTitle":"SigNoz","href":"/docs/ai-gateway/signoz"},{"title":"Comet Opik","sidebarTitle":"Comet Opik","href":"/docs/ai-gateway/comet-opik"},{"title":"Splunk Observability Cloud","sidebarTitle":"Splunk","href":"/docs/ai-gateway/splunk"},{"title":"Traceloop","sidebarTitle":"Traceloop","href":"/docs/ai-gateway/traceloop"}]},{"group":"MCP Servers","pages":[{"title":"Set up Tavily MCP Server","sidebarTitle":"Tavily MCP Server","href":"/docs/ai-gateway/mcp/tavily-mcp-server"},{"title":"Set up Exa MCP Server","sidebarTitle":"Exa MCP Server","href":"/docs/ai-gateway/mcp/exa-mcp-server"},{"title":"Set up Parallel MCP Server","sidebarTitle":"Parallel MCP Server","href":"/docs/ai-gateway/mcp/parallel-mcp-server"},{"title":"Set up Browserbase MCP Server","sidebarTitle":"Browserbase MCP Server","href":"/docs/ai-gateway/mcp/browserbase-mcp-server"},{"title":"Set up Linear MCP Server","sidebarTitle":"Linear MCP Server","href":"/docs/ai-gateway/mcp/linear-mcp-server"},{"title":"Set up Notion MCP Server","sidebarTitle":"Notion MCP Server","href":"/docs/ai-gateway/mcp/notion-mcp-server"},{"title":"Set up Firecrawl MCP Server","sidebarTitle":"Firecrawl MCP Server","href":"/docs/ai-gateway/mcp/firecrawl-mcp-server"},{"title":"Set up Slack MCP Server","sidebarTitle":"Slack MCP Server","href":"/docs/ai-gateway/mcp/slack-mcp-server"},{"title":"Set up Slack Managed MCP Server","sidebarTitle":"Slack Managed MCP Server","href":"/docs/ai-gateway/mcp/slack-managed-mcp-server"},{"title":"Set up Looker MCP Server","sidebarTitle":"Looker MCP Server","href":"/docs/ai-gateway/mcp/looker-mcp-server"},{"title":"Set up HubSpot MCP Server","sidebarTitle":"HubSpot MCP Server","href":"/docs/ai-gateway/mcp/hubspot-mcp-server"},{"title":"Set up Databricks MCP Server","sidebarTitle":"Databricks MCP Server","href":"/docs/ai-gateway/mcp/databricks-mcp-server"},{"title":"Set up Neo4j MCP Server","sidebarTitle":"Neo4j MCP Server","href":"/docs/ai-gateway/mcp/neo4j-mcp-server"},{"title":"Set up GitHub MCP Server","sidebarTitle":"GitHub MCP Server","href":"/docs/ai-gateway/mcp/github-mcp-server"},{"title":"Set up Smartsheet MCP Server","sidebarTitle":"Smartsheet MCP Server","href":"/docs/ai-gateway/mcp/smartsheet-mcp-server"},{"title":"Set up Atlassian Rovo MCP Server","sidebarTitle":"Atlassian Rovo MCP Server","href":"/docs/ai-gateway/mcp/atlassian-rovo-mcp-server"},{"title":"Set up Google Workspace MCP Servers","sidebarTitle":"Google Workspace MCP Servers","href":"/docs/ai-gateway/mcp/google-workspace-mcp-server"},{"title":"Set up Microsoft 365 MCP Server","sidebarTitle":"Microsoft 365 MCP Server","href":"/docs/ai-gateway/mcp/microsoft-365-mcp-server"},{"title":"Set up Microsoft Work IQ MCP Server","sidebarTitle":"Work IQ MCP Server","href":"/docs/ai-gateway/mcp/work-iq-mcp-server"},{"title":"Set up Microsoft Dataverse MCP Server","sidebarTitle":"Dataverse MCP Server","href":"/docs/ai-gateway/mcp/dataverse-mcp-server"},{"title":"Set up CrowdStrike Falcon MCP Server","sidebarTitle":"CrowdStrike Falcon MCP Server","href":"/docs/ai-gateway/mcp/crowdstrike-falcon-mcp-server"},{"title":"Set up Salesforce MCP Server","sidebarTitle":"Salesforce MCP Server","href":"/docs/ai-gateway/mcp/salesforce-mcp-server"},{"title":"Set up Zoom MCP Server","sidebarTitle":"Zoom MCP Server","href":"/docs/ai-gateway/mcp/zoom-mcp-server"},{"title":"Set up Honeycomb MCP Server","sidebarTitle":"Honeycomb MCP Server","href":"/docs/ai-gateway/mcp/honeycomb-mcp-server"},{"title":"Set up dbt MCP Server","sidebarTitle":"dbt MCP Server","href":"/docs/ai-gateway/mcp/dbt-mcp-server"},{"title":"Set up Gong MCP Server","sidebarTitle":"Gong MCP Server","href":"/docs/ai-gateway/mcp/gong-mcp-server"},{"title":"Set up PagerDuty MCP Server","sidebarTitle":"PagerDuty MCP Server","href":"/docs/ai-gateway/mcp/pagerduty-mcp-server"},{"title":"Set up Zendesk MCP Server","sidebarTitle":"Zendesk MCP Server","href":"/docs/ai-gateway/mcp/zendesk-mcp-server"},{"title":"Set up QuickBooks MCP Server","sidebarTitle":"QuickBooks MCP Server","href":"/docs/ai-gateway/mcp/quickbooks-mcp-server"},{"title":"Set up Snowflake MCP Server","sidebarTitle":"Snowflake MCP Server","href":"/docs/ai-gateway/mcp/snowflake-mcp-server"},{"title":"Set up Firebase Crashlytics MCP Server","sidebarTitle":"Firebase Crashlytics MCP Server","href":"/docs/ai-gateway/mcp/firebase-crashlytics-mcp-server"},{"title":"Set up Airtable MCP Server","sidebarTitle":"Airtable MCP Server","href":"/docs/ai-gateway/mcp/airtable-mcp-server"},{"title":"Set up incident.io MCP Server","sidebarTitle":"incident.io MCP Server","href":"/docs/ai-gateway/mcp/incident-io-mcp-server"},{"title":"Set up MongoDB MCP Server","sidebarTitle":"MongoDB MCP Server","href":"/docs/ai-gateway/mcp/mongodb-mcp-server"},{"title":"Set up DX MCP Server","sidebarTitle":"DX MCP Server","href":"/docs/ai-gateway/mcp/dx-mcp-server"},{"title":"Set up Omni Analytics MCP Server","sidebarTitle":"Omni Analytics MCP Server","href":"/docs/ai-gateway/mcp/omni-analytics-mcp-server"},{"title":"Set up NetSuite MCP Server","sidebarTitle":"NetSuite MCP Server","href":"/docs/ai-gateway/mcp/netsuite-mcp-server"},{"title":"Set up Datadog MCP Server","sidebarTitle":"Datadog MCP Server","href":"/docs/ai-gateway/mcp/datadog-mcp-server"},{"title":"Set up Ironclad MCP Server","sidebarTitle":"Ironclad MCP Server","href":"/docs/ai-gateway/mcp/ironclad-mcp-server"},{"title":"Set up Ramp MCP Server","sidebarTitle":"Ramp MCP Server","href":"/docs/ai-gateway/mcp/ramp-mcp-server"},{"title":"Set up AWS MCP Server","sidebarTitle":"AWS MCP Server","href":"/docs/ai-gateway/mcp/aws-mcp-server"},{"title":"Set up Collibra MCP Server","sidebarTitle":"Collibra MCP Server","href":"/docs/ai-gateway/mcp/collibra-mcp-server"},{"title":"Set up Oodle MCP Server","sidebarTitle":"Oodle MCP Server","href":"/docs/ai-gateway/mcp/oodle-mcp-server"}]}]}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/docs/changelog"}]}]},"basePath":"","title":"Qwen Code CLI - TrueFoundry Docs","buildId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","deploymentId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-5Xwp92K7.js","DynamicMarkdown-BoyYAA8K.js","zoom-image-lightbox-DkE6VzSN.js","lightbox-handle-r17bVUz3.js"]}