How to Use CoBuddy in Claude Code via Novita AI

How to Use CoBuddy in Claude Code via Novita AI

CoBuddy is Baidu’s coding-specialized model available on Novita AI, offering function-calling, reasoning, a 128K context window, and low end-to-end latency for developer workflows. Because CoBuddy exposes an OpenAI-compatible chat/completions endpoint rather than an Anthropic-compatible one, setting it up in Claude Code requires pointing ANTHROPIC_BASE_URL at Novita AI’s OpenAI-compatible path. This guide walks through every step — from API key to first session.

What Is CoBuddy?

CoBuddy is a code generation model developed by Baidu and available through Novita AI’s LLM API. It is designed specifically for software development tasks: generating code, refactoring, writing tests, planning implementations, and supporting agent workflows.

SpecDetails
Model IDbaidu/cobuddy
Context window131,072 tokens (128K)
Max output65,536 tokens
Input price$2.80 / 1M tokens
Output price$11.30 / 1M tokens
Cache read$0.70 / 1M tokens
FeaturesFunction-calling, reasoning
EndpointOpenAI-compatible chat/completions only

The endpoint distinction matters for Claude Code setup. CoBuddy does not support the Anthropic-compatible endpoint, so the configuration uses Novita AI’s OpenAI-compatible base URL (https://api.novita.ai/v3/openai) instead of the anthropic path.

Why Use CoBuddy in Claude Code?

Claude Code is an agentic CLI that lets you delegate coding tasks in plain language — file edits, terminal commands, codebase analysis, and multi-step workflows. By default it runs on Claude models, but the ANTHROPIC_BASE_URL environment variable lets you route requests through a different provider and model.

Swapping in CoBuddy through Novita AI gives you:

  • Coding specialization. CoBuddy is built for software tasks rather than general conversation. It targets code generation, review, and agent workflows directly.
  • Cost difference vs. Claude Sonnet. Claude Sonnet 4.5 runs at $3.00/M input and $15.00/M output tokens. CoBuddy on Novita AI is $2.80/M input and $11.30/M output — meaningful savings at volume, with cache reads at $0.70/M.
  • High throughput and low E2E latency. Novita AI’s CoBuddy deployment is tuned for sustained throughput, which matters during long agent sessions that make many incremental requests.
  • 128K context window. Enough room to pass in substantial file excerpts, test output, and implementation notes in a single prompt.

For teams already using Claude Code who want to evaluate a coding-first alternative without changing their workflow tooling, CoBuddy is a practical starting point.

Step 1: Get Your Novita AI API Key

Create a Novita AI account — new accounts receive free trial credits. Once logged in, go to Key Management and click Create New Key. Copy the key immediately; it is shown only once.

Step 2: Install Claude Code

Claude Code requires Node.js 18 or higher. Verify your version:

node --version

If Node.js is missing or below v18, install it from nodejs.org.

Install Claude Code globally:

npm install -g @anthropic-ai/claude-code

Confirm the installation:

claude --version

Step 3: Configure Environment Variables

CoBuddy only supports the OpenAI-compatible endpoint. Set ANTHROPIC_BASE_URL to Novita AI’s OpenAI-compatible path so Claude Code forwards requests there.

macOS and Linux

export ANTHROPIC_BASE_URL="https://api.novita.ai/v3/openai"
export ANTHROPIC_AUTH_TOKEN="<Your Novita API Key>"
export ANTHROPIC_MODEL="baidu/cobuddy"
export ANTHROPIC_SMALL_FAST_MODEL="baidu/cobuddy"

Windows (Command Prompt)

set ANTHROPIC_BASE_URL=https://api.novita.ai/v3/openai
set ANTHROPIC_AUTH_TOKEN=<Your Novita API Key>
set ANTHROPIC_MODEL=baidu/cobuddy
set ANTHROPIC_SMALL_FAST_MODEL=baidu/cobuddy

Windows (PowerShell)

$env:ANTHROPIC_BASE_URL = "https://api.novita.ai/v3/openai"
$env:ANTHROPIC_AUTH_TOKEN = "<Your Novita API Key>"
$env:ANTHROPIC_MODEL = "baidu/cobuddy"
$env:ANTHROPIC_SMALL_FAST_MODEL = "baidu/cobuddy"

What each variable does:

  • ANTHROPIC_BASE_URL — redirects Claude Code’s requests to Novita AI’s OpenAI-compatible endpoint instead of Anthropic’s servers
  • ANTHROPIC_AUTH_TOKEN — your Novita AI API key used for authentication
  • ANTHROPIC_MODEL — the model used for primary (complex) tasks
  • ANTHROPIC_SMALL_FAST_MODEL — the model used for background and lightweight tasks

To make these persistent across terminal sessions on macOS/Linux, add the export lines to your ~/.zshrc or ~/.bashrc.

Step 4: Start Claude Code

Navigate to your project directory and launch Claude Code:

cd /path/to/your/project
claude .

The . tells Claude Code to operate in the current directory. You will see an interactive prompt where you can describe tasks in plain English.

Run /model to confirm which model is active, or /doctor to diagnose configuration issues.

CoBuddy Specs and Pricing

Here is the full comparison between CoBuddy on Novita AI and Claude Sonnet 4.5:

CoBuddy (Novita AI)Claude Sonnet 4.5
Input (per 1M tokens)$2.80$3.00
Output (per 1M tokens)$11.30$15.00
Cache read (per 1M tokens)$0.70$0.30
Context window131,072 tokens200,000 tokens
Max output65,536 tokens64,000 tokens
Function callingYesYes
ReasoningYesYes
Anthropic endpointNoNative

The main tradeoff: CoBuddy’s output token price is lower than Sonnet 4.5, and cache reads are cheaper in absolute terms for heavy agentic sessions that reuse context. Claude Sonnet 4.5 has a larger context window and is the native model for Claude Code. Choose CoBuddy when you want a coding-focused model at reduced output cost; stay on Sonnet when you need the full 200K context or broader reasoning tasks.

Practical Coding Workflow Tips

Keep prompts task-specific

CoBuddy is tuned for software tasks. Prompts that describe a concrete engineering outcome — “add input validation to this function”, “write a unit test for the checkout flow”, “refactor this module to remove the circular dependency” — get better results than open-ended exploration prompts.

Use the 128K context window deliberately

At 128K tokens, you can pass in relevant file excerpts, test output, style guides, and API contracts in a single request. That said, keep prompts structured: describe the task, provide selected context, list constraints, and ask for a bounded output. Long context does not replace clear instructions.

Verify function-call output

CoBuddy supports function-calling, which Claude Code uses for tool invocations. For tasks that modify files or run commands, review the planned actions before approving. Use /review in Claude Code to inspect changes before they are applied.

Cache-heavy sessions benefit from CoBuddy’s pricing

At $0.70/M cache read tokens, sessions with large system prompts or repeated context get meaningfully cheaper over time. If you run long agent sessions that reference the same codebase context repeatedly, cache reads add up — and CoBuddy’s cache read price is competitive.

Evaluate on real tasks before committing

The best way to assess CoBuddy for your team is to run it on your actual backlog: a bug ticket, a test generation task, a small refactor. Compare output quality against your current model on those specific tasks rather than relying on general benchmarks.

FAQ

What is the model ID for CoBuddy on Novita AI?

Use baidu/cobuddy in the ANTHROPIC_MODEL environment variable and in any direct API request body.

Why use https://api.novita.ai/v3/openai instead of the anthropic endpoint?

CoBuddy only supports the OpenAI-compatible chat/completions endpoint. Setting ANTHROPIC_BASE_URL to Novita AI’s OpenAI-compatible path (https://api.novita.ai/v3/openai) tells Claude Code to route requests through that endpoint. The anthropic-compatible path (https://api.novita.ai/anthropic) is for models that implement the Anthropic messages API natively — CoBuddy does not.

How much does CoBuddy cost on Novita AI?

As of June 2026: $2.80/M input tokens, $11.30/M output tokens, $0.70/M cache read tokens. Confirm current pricing on the CoBuddy model page before production planning.

Does CoBuddy support function calling?

Yes. CoBuddy supports function-calling and reasoning, which are both required for Claude Code’s agent loop.

Can I use CoBuddy in Cursor or other tools?

Yes. Any tool that accepts a custom OpenAI-compatible base URL can use CoBuddy via Novita AI. Set base URL to https://api.novita.ai/v3/openai and model to baidu/cobuddy.

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