technical

How to Use Claude Code CLI with Any AI Model (Gemini 2.5 Pro, Qwen, Deepseek, Kim K2, GPT5) via Ridvay's Anthropic API Bridge

The Claude Code CLI by Anthropic is a phenomenal tool for developers who love to stay in their terminal. Its seamless workflow and powerful code-generation capabilities have made it a fan favorite. But what if you want the slick interface of Claude Code but the power of a different AI model, like Google's Gemini 2.5 Pro, Qwen's new coder model, or a fast, lightweight model from Deepseek?

Historically, you were locked into the Anthropic ecosystem. Today, that changes.

This guide will walk you through a simple yet powerful technique to use any Ridvay-supported AI model directly within the Claude Code CLI. By using the Ridvay API, which offers an Anthropic-compatible API endpoint, you can route Claude Code's requests to the model of your choice.

Why Reroute Claude Code Through the Ridvay API?

Before we dive into the "how," let's cover the "why." This integration offers several key advantages for developers, engineers, and coders:

  • Total Model Freedom: Access a massive list of models, including giants like Gemini 2.5 Pro, specialized coding models like qwen/qwen3-coder, or fast models like deepseek-chat.
  • Keep Your Workflow: You don't have to abandon the elegant and efficient Claude Code CLI. You get to keep the tool you love while upgrading the engine that powers it.
  • Simplified API Key Management: Instead of juggling multiple API keys and environments for different models, you only need one Ridvay API key to access them all.
  • Future-Proof Your Tools: As new and better models are released, you can instantly switch to them by simply changing an environment variable, without waiting for the official Claude Code client to add support.

The Complete Step-by-Step Integration Guide

Follow these four simple steps to configure your system. This process involves installing the CLI, getting a universal API key, and setting a few environment variables.

Step 1: Install the Claude Code CLI

If you haven't already, the first step is to install the official @anthropic-ai/claude-code package globally using npm. Open your terminal and run the following command:

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

Step 2: Get Your Universal API Key from Ridvay

To connect to models like Gemini or Qwen, you need an API key that can access them.

  1. Navigate to https://ridvay.com/api to get your API key.
  2. Securely copy this key. You will use it as your ANTHROPIC_AUTH_TOKEN in the next step.

Step 3: Configure Your Environment Variables

This is the core of the integration. You will set environment variables to tell the Claude Code CLI to send its requests to the Ridvay API endpoint instead of the default Anthropic URL.

Open your terminal profile file (.bashrc, .zshrc, .profile, etc.) or simply export these variables in your current terminal session.

# Point Claude Code to the Ridvay API endpoint
export ANTHROPIC_BASE_URL=https://api.ridvay.com/anthropic 

# Use your Ridvay API key for authentication
export ANTHROPIC_AUTH_TOKEN=${YOUR_API_KEY}

# --- CHOOSE YOUR MODEL ---
# Select a powerful large model (e.g., Qwen Coder or Gemini 2.5 Pro)
export ANTHROPIC_MODEL=qwen/qwen3-coder

# Select a smaller, faster model for quick tasks
export ANTHROPIC_SMALL_FAST_MODEL=deepseek-chat

Important: Replace ${YOUR_API_KEY} with the actual key you obtained from Ridvay. You can change the model IDs to any other model supported by the Ridvay platform. You can find the complete list of available model IDs at https://ridvay.com/models.

Step 4: Enter Your Project and Run Claude Code

With the configuration complete, the final step is to use it.

  1. Navigate to your project's directory in the terminal:
    cd my-project
    
  2. Launch the Claude Code CLI:
    claude
    

That's it! The claude command will now use the Ridvay endpoint, forwarding your prompts to the model you specified (e.g., qwen/qwen3-coder). You are now successfully using the Claude Code CLI with the AI model of your choice.

Share this post