Stop Paying Anthropic $200/Month for Claude Code
How to Use Cheaper Models in Claude Code CLI
Introduction to Claude Code and Pricing
- Claude Code is a powerful coding tool for both novice and experienced developers, but its pricing is considered high.
- The video aims to demonstrate how to utilize more affordable models within the Claude Code CLI, maintaining access to all features at a significantly reduced cost.
Overview of ZAI's GLM4.7 Models
- ZAI, a Chinese-based company, offers impressive models like GLM4.7 at much lower prices compared to competitors such as Claude Sonnet or Opus models.
- According to the Code Arena leaderboard, GLM 4.7 is comparable in performance to Opus 4.5, although personal experience may vary.
Cost Comparison
- ZAI's light package costs only $6 per month, providing three times the usage of Claude's pro plan priced at $20 per month.
- Even ZAI’s max plan is only $30 per month compared to Claude's max plan which ranges from $100 to $200 monthly. This represents significant savings for users looking for alternatives.
Community Recommendations and Discounts
- The speaker began exploring these models due to recommendations from their community and viewers who found them valuable for their price point.
- A promotional offer allowed the speaker to sign up for just $3 per month initially; potential new users might find similar deals available now.
Developer Showcase Examples
- Users have created impressive projects using these models, including a "Plants vs Zombies" clone that showcases sound effects and gameplay mechanics despite being in Chinese language content.
Integrating ZAI Models into Claude Code CLI
- These models can be integrated into various environments including cursor code and open code alongside claude code itself, allowing flexibility in usage across platforms.
Setting Up Your Project with Settings.json
- To use these models in your project, create a folder named 'cla' containing a settings.json file; if it doesn't exist yet, you can create it manually or download it from the community resources provided by the speaker.
Understanding Environment Object Usage
- The environment object allows larger companies or enterprise clients to route inference calls through their infrastructure (e.g., AWS) instead of directly calling an API endpoint like Anthropic’s API endpoint; this ensures data security via unique API keys specific to organizations.
Routing Traffic Through Z AI
- Instead of using traditional cloud providers’ APIs directly, users can route traffic through Z AI which has developed an anthropic wrapper mimicking expected behaviors while generating an API key from their service for integration purposes.
Mapping Models Between Providers
- Users will need variables that map CLAUDE model names (like Sonnet) onto corresponding ZAI model names (like GLM4.7), ensuring compatibility between different systems during implementation processes.
For example:
- Sonnet maps to GLM4.7
- Haiku maps downwards to GLM4.5 air version instead of higher-tier options not supported by Z AI.
Scoping Settings: Project vs Global Level
- Settings can be scoped either locally (project-specific) or globally (across all projects). For global settings on Windows:
- Navigate user folder > Open 'cla' folder > Edit settings file accordingly.
- This protects sensitive information like API keys when deploying projects publicly.
Configuring Local Project-Level Settings
- Create
settings.local.jsonwithin your project directory.
- Copy necessary structures into this file while removing sensitive lines.
- Add
.gitignoreentry forsettings.local.jsonso it's excluded from public repositories upon deployment.
This ensures secure handling of sensitive information during development cycles without exposing critical credentials online.
Obtaining Your API Key from Z AI
To finalize setup:
- Visit z.ai/subscribe and follow prompts after signing up.
2 . Choose subscription option then navigate under “API Keys” section where you can create new keys securely with designated names before utilizing them within your applications effectively!
How to Access GLM 4.7 Models in Claude Code
Setting Up the API Key
- The process begins by confirming and copying the API key, which is then replaced in the necessary configuration. This allows access to the Z AI models, specifically GLM 4.7.
Running Claude Without Subscription
- After setting up, running Claude initiates a setup process that should ideally be skipped due to an existing API key. However, a bug currently requires users to sign in again.
Bypassing Onboarding Steps
- To avoid repeated onboarding steps, users can modify the
cla.jsonfile located in their user folder (for Windows). This involves changing a specific property related to onboarding completion.
- Users need to add or modify a property called
has_completed_onboarding, changing its value from false to true for seamless access without re-signing.
Accessing GLM Models
- Once modifications are made, opening Claude will skip onboarding and provide access to GLM 4.7 models while still displaying Opus and Haiku in the model selector.
- The GLM models offer significant cost savings compared to Claw models while retaining all functionalities of the Claw Code CLI, including sub-agents and custom commands.
Monitoring Usage
- Users can track their current usage by visiting the API management screen where they created their API key; this includes checking subscription details under the usage tag.