Skip to main content

Command Palette

Search for a command to run...

Claude Code + OpenRouter + Open Model [DeepSeek V4 Flash] — Complete Setup Guide

Updated
2 min readView as Markdown
Claude Code + OpenRouter + Open Model [DeepSeek V4 Flash] — Complete Setup Guide
V
Highly skilled Data Test Automation professional with over 10 years of experience in data quality assurance and software testing. Proven ability to design, execute, and automate testing across the entire SDLC (Software Development Life Cycle) utilizing Agile and Waterfall methodologies. Expertise in End-to-End DWBI project testing and experience working in GCP, AWS, and Azure cloud environments. Proficient in SQL and Python scripting for data test automation.

If you’ve been wanting to run Claude Code using any cost-effective open-source model OpenRouter is the best choice — and specifically, route all your coding prompts to the ultra‑fast open-source model— this guide gives you a clean, reliable setup that works instantly.

Claude Code is an excellent CLI coding assistant, but by default it connects to Anthropic’s API. With OpenRouter, you can redirect Claude Code to any model you want, including DeepSeek’s latest high‑performance offerings.

Why Use Claude Code with OpenRouter?

Using Claude Code through OpenRouter unlocks several advantages:

  • Access to DeepSeek V4 Flash, one of the fastest coding‑optimized models available

  • Unified API routing across multiple AI providers

  • Lower cost compared to traditional Anthropic usage

  • Ability to swap models without changing your workflow

Price comparison of Claude Fable Model Vs DeepSeek V4?

Step 1: Install Claude Code Install the CLI globally:

To install Claude Code, use following command in Mac:

curl -fsSL https://claude.ai/install.sh | bash

Step 2: Create an OpenRouter API Key Create an account at OpenRouter.ai

  • Generate an API key (it will look like sk-or-v1-...)

  • Add credits if you plan to use paid models

  • Keep this key safe — you’ll use it in your environment variables.

Step 3: Configure Claude Code to Use OpenRouter and select any open model

export OPENROUTER_API_KEY="<Open router API Key>"
export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"
export ANTHROPIC_API_KEY=""
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek/deepseek-v4-flash"

Step 4: Connection Test