Use GLM-4.7 in Claude Code: Cost-Effective Agentic Coding via Novita AI

Use GLM-4.7 in Claude Code: Cost-Effective Agentic Coding via Novita AI

GLM-4.7 is one of the strongest open-weight model families for coding right now. It is often described by its creators as tracking the Claude Sonnet line on key real-world coding benchmarks, while remaining significantly more accessible in cost and deployment flexibility.

In this guide, you’ll run GLM-4.7 inside Claude Code by routing Claude Code’s requests through Novita AI’s Anthropic-compatible endpoint. This gives you a “Claude Code–style” agent workflow including planning, editing files, running terminal commands while choosing GLM-4.7 as the underlying model.

Start Exploring

The Introduction of Claude Code and GLM-4.7

What is Claude Code?

Claude Code is an agentic command‑line interface (CLI) that transforms natural language into working code and multi‑step development workflows. Unlike traditional autocomplete plugins, it behaves like an intelligent coding agent that is capable of:

  • Codebase analysis: mapping and explaining entire codebases, including architecture and dependencies.
  • File management: creating, editing, and organizing project files autonomously.
  • Terminal execution: running commands, installing packages, and managing build or deployment processes.
  • Complex workflows; handling advanced tasks such as converting GitHub issues into pull requests.
  • Contextual understanding: maintaining awareness of your project structure across interactions.

This agentic approach means Claude Code does not just respond to queries. It participates in your development process, makes decisions, and takes actions to move your project toward your goals.

GLM-4.7: What It’s Good At

GLM4.7, released by Z.ai in December 2025, is the result of several iterations focused on coding, agentic reasoning, and tool use. It uses a 355‑billion‑parameter Mixture‑of‑Experts architecture with sparse activation; this achieves frontier‑level performance while preserving throughput suitable for real‑time workflows.

  • Technical Specifications:
FeatureSpecification
Architecture355B parameter MoE
Context Window200,000 tokens input
Output Capacity128,000 tokens
Equivalent Capacity~600 pages of documentation or 150,000 lines of code
  • Adaptive Reasoning Modes:
ModeDescriptionBest For
Interleaved ThinkingModel pauses between actions to verify logic before generating codeReducing hallucinated function calls
Preserved ThinkingMaintains reasoning context across conversation turnsMulti-hour debugging sessions without context degradation
Turn-Level ThinkingToggle deep reasoning on/off per requestQuick syntax queries (off) vs. complex architectural decisions (on)

GLM-4.7 demonstrates strong coding and agentic performance across multiple benchmarks such as LiveCodeBench v6 and SWE-bench Verified, surpassing or closely matching Claude Sonnet 4.5 in several key tasks. In reasoning-heavy agent benchmarks like GPQA-Diamond and τ²-Bench, GLM-4.7 also maintains competitive scores, reflecting solid planning and tool-use capabilities. Overall, these results position GLM-4.7 as one of the most capable open-weight alternatives to Claude for real-world coding workflows.

GLM4.7 performance: Agentic, Reasoning,Coding

artificial analysis intelligence index

Why Novita AI for GLM-4.7?

GLM4.7' benchmark in OpenRputer

We have optimized the deployment of GLM-4.7 to ensure the smoothest coding experience. Key benefits include:

  1. Highest Throughput: 44.45 tokens per second—17% faster than the next competitor
  2. Reliability: 99.5% uptime with bf16 precision for good output quality
  3. Full Caching Support: One of the few providers supporting both cache read AND cache write functionality
  4. Large Context: 204.8K context window for analyzing entire codebases

Use GLM-4.7 via Novita AI

Step 1: Getting Your API Key on Novita AI

  • Create or Login to Your Account

Visit [https://novita.ai](https://novita.ai) and sign up or log in to your existing account

  • Navigate to Key Management

After logging in, find “API Keys”

  • Create a New Key

Click the “Add New Key” button.

  • Save Your Key Immediately

Copy and store the key as soon as it is generated; it is usually shown only once and cannot be retrieved later. Keep the key in a secure location such as a password manager or encrypted notes

Step 2: Installing Claude Code

  • Check Node.js version:

First, verify that Node.js 18 or higher is installed on your system:

node -v
# Expected output: v18.x.x or higher (e.g.v20.10.0)

If Node.js is missing or older than v18, download and install a recent version from [https://nodejs.org](https://nodejs.org)

  • Installation Command:

Install Claude Code globally using npm:

npm install -g @anthropic-ai/claude-code
  • Verify Installation:
claude --version

Step 3: Setting Up Environment Variables

On Windows

Set the variables for the current CMD session:

set ANTHROPIC_BASE_URL=https://api.novita.ai/anthropic
set ANTHROPIC_AUTH_TOKEN=<Your_Novita_API_Key>
set ANTHROPIC_MODEL=zai-org/glm-4.7
set ANTHROPIC_SMALL_FAST_MODEL=zai-org/glm-4.7

On macOS and Linux

Export the variables in your shell:

export ANTHROPIC_BASE_URL="https://api.novita.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="<Your_Novita_API_Key>"
export ANTHROPIC_MODEL="zai-org/glm-4.7"
export ANTHROPIC_SMALL_FAST_MODEL="zai-org/glm-4.7"

Step 4: Starting Claude Code

  • Navigate to Your Project Directory
cd <path_to_your_project>
  • Launch Claude Code
claude .

The dot (.) tells Claude Code to operate on the current directory, scanning and working within this project.

After startup, you will see an interactive Claude Code prompt with access to commands such as /init, /model, /review, and more.

Common session‑level commands include:

  • /init – Initialize Claude Code in the current directory.
  • /login – Authenticate with an API provider if needed.
  • /logout – Clear stored credentials.
  • /memory – View or edit persistent memory.
  • /model – View or switch the current model.
  • /permissions – Manage file and command permissions.
  • /review – Review pending changes before applying them.
  • /status – Show current session status.
  • /terminal-setup – Configure terminal integration.
  • /vim – Toggle Vim keybindings.

Building Your First Project

Claude Code excels at transforming detailed project descriptions into functional applications. After entering your prompt, press Enter to begin the task. Claude Code will analyze your requirements, create the necessary files, implement the functionality, and provide a complete project structure with documentation.

using claude code to build a project

Using Claude Code in VSCode or Cursor

Claude Code integrates seamlessly with popular development environments. It enhances your existing workflow rather than replacing it.

You can use Claude Code directly in the terminal within VSCode or Cursor. This maintains access to your familiar development tools while leveraging AI assistance.

Additionally, Claude Code plugins are available for both VSCode and Cursor. These plugins provide deeper integration with these editors, offering inline AI assistance, code suggestions, and project management features directly within your IDE interface.

using claude code in vscode

using claude code in cursor

Help and Documentation Resources

  • Novita AI Resources:
ResourceLinkDescription
API Documentationnovita.ai/docsComplete API reference, parameters, and examples
Model Catalognovita.ai/modelsAll available models including GLM4.7
Pricing Calculatornovita.ai/pricingEstimate costs for your usage
  • Anthropic/Claude Code Resources:
ResourceLinkDescription
Claude Code Documentationdocs.anthropic.com/claude-codeOfficial usage guide and tutorials
GitHub Repositorygithub.com/anthropics/claude-codeSource code, issues, and discussions

GLM4.7 Resources:

ResourceLinkDescription
Z.AI Officialhttps://docs.z.ai/guides/llm/glm-4.7Model documentation and research papers
Model Cardhttps://huggingface.co/zai-org/GLM-4.7Technical specifications and benchmarks

Quick Reference Card

CategoryItem/CommandValue/Description

Environment Setup
ANTHROPIC_BASE_URLhttps://api.novita.ai/v3/openai
ANTHROPIC_API_KEYyour-novita-api-key
ANTHROPIC_MODELzai-org/glm-4.7

Quick Start
Installnpm install -g @anthropic-ai/claude-code
Navigatecd your-project
Runclaude .

Useful Commands
/helpShow all commands
/doctorDiagnose issues
/costCheck token usage
/clearReset conversation

Support
Novita AI Docsnovita.ai/docs
Claude Code Docsdocs.anthropic.com/claude-code

Conclusion

Throughout this guide, you’ve discovered how to:

  • Understand GLM4.7’s advanced architecture and reasoning capabilities
  • Set up a Novita AI account and generate API keys
  • Install and configure Claude Code for custom model integration
  • Configure environment variables across different operating systems
  • Build real-world projects using natural language commands
  • Integrate Claude Code into VS Code and Cursor for seamless workflows
  • Access help resources and documentation for continued learning

Start exploring GLM 4.7 today by signing up at Novita AI, getting your API key, and following this guide to enhance your development workflow with exceptional coding support.

Start Exploring

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.

Frequently Asked Questions

Is GLM-4.7 free?

On Novita AI, GLM-4.7 is pay-per-token: $0.6/M tokens (input), $0.11/M tokens (cache read), and $2.2/M tokens (output)
On Z.ai, access is commonly packaged via a paid Coding Plan (starting at $3/month).
Some platforms may offer limited trials/quotas, but GLM-4.7 itself isn’t universally “free.”

Is GLM-4.7 really good?

For coding + agentic workflows, it’s positioned as a top-tier open model by its publisher. Z.ai reports strong results on coding and agent benchmarks (e.g., LiveCodeBench v6, SWE-bench Verified, BrowseComp, τ²-Bench), and frames it as competitive with Claude Sonnet 4.5 on several measurements

Does GLM-4.7 have vision?

GLM-4.7 is text-only. If you need vision, use a GLM-V variant instead (e.g. GLM-4.6V or GLM-4.5V, which support image inputs depending on the provider)