How to Use OpenAI Compatible API in Qwen Code (60s Setup!)

Qwen Code + Novita AI

Qwen Code is revolutionizing the way developers interact with AI-powered coding assistants through command-line interfaces. Unlike traditional web-based tools, it brings AI directly to your terminal environment.

With support for OpenAI-compatible APIs, you can leverage powerful language models including Qwen3-Coder, Kimi K2, DeepSeek R1 from providers like Novita AI for enhanced coding experiences. This guide will walk you through setting up Qwen Code with Novita AI’s top coding models in under a minute.

Get ready to supercharge your development workflow with cutting-edge AI assistance.

What is Qwen Code?

qwen3-coder-main

Qwen Code is a command-line AI workflow tool adapted from Gemini CLI, specifically optimized for Qwen3-Coder models with enhanced parser support and tool functionality. It brings the power of large language models directly to your terminal, enabling developers to interact with AI models for code generation, debugging, refactoring, and explanation without leaving their development environment.

The tool supports multiple programming languages and integrates seamlessly with existing development workflows.

Unlike web-based alternatives, Qwen Code operates entirely through command-line interfaces, making it ideal for developers who prefer terminal-based workflows. Building upon the foundation of Gemini CLI, it offers improved functionality specifically tailored for coding tasks and supports OpenAI-compatible APIs, allowing integration with various AI providers and models beyond the default Qwen models.

Qwen Code VS Claude Code VS Gemini CLI

These three command-line AI assistants each serve different purposes and offer unique advantages:

Qwen Code is adapted from Gemini CLI and specifically optimized for Qwen3-Coder models with enhanced parser support and tool functionality. It focuses on flexibility and model diversity, supporting multiple AI providers through OpenAI-compatible APIs.

This gives developers the freedom to choose the best model for their specific coding tasks while benefiting from optimizations tailored for coding workflows.

Claude Code, developed by Anthropic, is specifically designed to work with Claude models and offers deep integration with Anthropic’s AI systems. It provides a streamlined experience for users who prefer Claude’s reasoning capabilities and safety features.

However, it’s limited to Anthropic’s model ecosystem but excels in complex reasoning tasks.

Gemini CLI is the original foundation that serves as a command-line interface for Google’s Gemini models. It excels at coding tasks with features like fixing bugs, creating new features, improving test coverage, and uses a reason and act (ReAct) loop with built-in tools for complex coding use cases.

Gemini CLI is integrated with Gemini Code Assist and provides powerful AI capabilities including code understanding, file manipulation, command execution, and dynamic troubleshooting.

The choice between them depends on your priorities: coding-specific optimizations with model flexibility (Qwen Code), deep reasoning integration (Claude Code), or general-purpose Gemini model access (Gemini CLI).

Top LLM Models for Code on Novita AI

Novita AI offers several high-performance coding models that work excellently with Qwen Code. Here are the top options with their specifications and pricing:

Qwen3 Coder 480B (qwen/qwen3-coder-480b-a35b-instruct)

  • Context Length: 262,144 tokens
  • Pricing: $2/1M input tokens, $2/1M output tokens
  • Best for: Complex coding tasks requiring extensive context

Qwen3 235B Instruct (qwen/qwen3-235b-a22b-instruct-2507)

  • Context Length: 262,144 tokens
  • Pricing: $0.15/1M input tokens, $0.8/1M output tokens
  • Best for: Cost-effective general coding assistance

Kimi K2 Instruct (moonshotai/kimi-k2-instruct)

  • Context Length: 131,072 tokens
  • Pricing: $0.57/1M input tokens, $2.3/1M output tokens
  • Best for: Balanced performance and context length

DeepSeek V3 (deepseek/deepseek-v3-0324)

  • Context Length: 163,840 tokens
  • Pricing: $0.28/1M input tokens, $1.14/1M output tokens
  • Best for: Efficient coding with good reasoning

DeepSeek R1 (deepseek/deepseek-r1-0528)

  • Context Length: 163,840 tokens
  • Pricing: $0.7/1M input tokens, $2.5/1M output tokens
  • Best for: Advanced reasoning and complex problem-solving

You can test which models are best suited for your needs directly in Qwen Code by switching between different models and comparing their performance on your specific coding tasks.

How to Use OpenAI Compatible API in Qwen Code

Setting up Qwen Code with Novita AI takes just a few simple steps:

Step 1: Get Your Novita AI Credentials

First, sign in and obtain your Novita AI API key

model api key

Choose your preferred model and copy the model name from the model list.

Step 2: Install Qwen Code

Prerequisites: Ensure you have Node.js version 20 or higher installed. You can download it from the official Node.js website.

Install the package globally:

bash

npm install -g @qwen-code/qwen-code

Step 3: Configure Environment Variables

For Windows (Command Prompt):

cmd

set OPENAI_API_KEY=Your_Novita_API_Key
set OPENAI_BASE_URL=https://api.novita.ai/v3/openai
set OPENAI_MODEL=qwen/qwen3-coder-480b-a35b-instruct

For Linux and Mac (Bash):

bash

export OPENAI_API_KEY="Your_Novita_API_Key"
export OPENAI_BASE_URL="https://api.novita.ai/v3/openai"
export OPENAI_MODEL="qwen/qwen3-coder-480b-a35b-instruct"

Step 4: Start Coding

Once configured, you can start using Qwen Code with your chosen Novita AI model. The tool will now utilize the specified model for all coding assistance tasks.

cd <your-project-directory>
qwen .
One Diary Demo built by Qwen Code. Start buiding your own app!
One Diary Demo, built with Qwen Code. Start building your own app today!

Conclusion

Integrating Qwen Code with Novita AI’s OpenAI-compatible API opens up a world of possibilities for developers seeking powerful AI coding assistance. With multiple high-performance models to choose from, you can optimize for cost, performance, or specific coding requirements.

The setup process is straightforward and takes less than a minute to complete. Whether you choose the powerful Qwen3 Coder 480B for complex tasks or the cost-effective DeepSeek models for everyday coding, you’ll have access to cutting-edge AI assistance right in your terminal.

Start experimenting with different models to find the perfect fit for your development workflow.

Trae + Novita AI: Step-by-Step Guide to Access AI Models in Your IDE

Qwen3-Coder-480B-A35B-Instruct Available Now on Novita AI

How to Use Kimi-K2 in Claude Code on Windows, Mac, and Linux

Novita AI is an AI cloud platform that offers developers an easy way to deploy AI models using our simple API, while also providing the affordable and reliable GPU cloud for building and scaling.


Discover more from Novita

Subscribe to get the latest posts sent to your email.

Leave a Comment

Scroll to Top

Discover more from Novita

Subscribe now to keep reading and get access to the full archive.

Continue reading