DEV Community

Cover image for How to Set Up Claude Code with Multiple AI Models
Hállan Costa
Hállan Costa

Posted on • Edited on

How to Set Up Claude Code with Multiple AI Models

This tutorial is fully based on a Reddit post for broader reach. All proper credit goes to ThreeKiloZero.

Reddit post:
https://www.reddit.com/r/ClaudeCode/comments/1p27ly4/how_to_set_up_claude_code_with_multiple_ai_models/

Author:
https://www.reddit.com/user/ThreeKiloZero/


This guide provides a simplified approach to configuring your terminal using Fish Shell, allowing you to easily switch between different AI models when using Claude Code.
The setup is also highly adaptable for .bashrc and .zshrc, requiring only minor syntax adjustments for environment variables and functions.

What this does

Instead of being limited to a single AI model, you will be able to run
commands such as:

  • claude - Uses the default Claude AI
  • claudekimi - Uses Kimi for coding
  • claudeglm - Uses Z.AI GLM models
  • claudem25 - Uses MiniMax M2.5
  • claude m25 or claude kimi - Alternative way to switch models

Before you start

You will need:

  • Claude Code installed on your computer (CLI version)
  • API keys for the AI services you want to use
  • Fish Shell configured

Installing Claude Code

If you do not have Claude Code installed yet, run:

curl -fsSL https://claude.ai/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Step 2: Get your API keys

Create accounts on the AI services you want to use and obtain your API
keys:

  • Kimi for Coding: Get your key from the Kimi developer portal
  • Z.AI (GLM models): Get your key from Z.AI
  • MiniMax: Get your key from MiniMax

Store these keys in a safe place.

Step 3: Configure your API keys

Open your Fish configuration file:

nano ~/.config/fish/config.fish
Enter fullscreen mode Exit fullscreen mode

Add the following lines, replacing them with your real API keys:

# API keys for different AI services
set -x KIMI_API_KEY "your-kimi-api-key"
set -x ZAI_API_KEY "your-zai-api-key"
set -x MINIMAX_API_KEY "your-minimax-api-key"
Enter fullscreen mode Exit fullscreen mode

Step 4: Add model configurations

Run which claude to get directory of claude

Add these functions to your ~/.config/fish/config.fish and change directory of claude:

Kimi for Coding

function claudekimi
    if test -z "$KIMI_API_KEY"
        echo "Error: KIMI_API_KEY is not set. Add it to ~/.config/fish/config.fish"
        return 1
    end

    set -e ANTHROPIC_API_KEY

    set -x ANTHROPIC_BASE_URL "https://api.kimi.com/coding/"
    set -x ANTHROPIC_AUTH_TOKEN "$KIMI_API_KEY"
    set -x ANTHROPIC_MODEL "kimi-for-coding"
    set -x ANTHROPIC_SMALL_FAST_MODEL "kimi-for-coding"

    # Claude directory
    /home/{yourusername}/.local/bin/claude $argv
end
Enter fullscreen mode Exit fullscreen mode

Z.AI GLM models

function claudeglm
    if test -z "$ZAI_API_KEY"
        echo "Error: ZAI_API_KEY is not set. Add it to ~/.config/fish/config.fish"
        return 1
    end

    set -e ANTHROPIC_API_KEY

    set -x ANTHROPIC_BASE_URL "https://api.z.ai/api/anthropic"
    set -x ANTHROPIC_AUTH_TOKEN "$ZAI_API_KEY"
    set -x ANTHROPIC_DEFAULT_OPUS_MODEL "glm-4.6"
    set -x ANTHROPIC_DEFAULT_SONNET_MODEL "glm-4.6"
    set -x ANTHROPIC_DEFAULT_HAIKU_MODEL "glm-4.5-air"

    # Claude directory
    /home/{yourusername}/.local/bin/claude $argv
end
Enter fullscreen mode Exit fullscreen mode

MiniMax M2.5

function claudem25
    if test -z "$MINIMAX_API_KEY"
        echo "Error: MINIMAX_API_KEY is not set. Add it to ~/.config/fish/config.fish"
        return 1
    end

    set -e ANTHROPIC_API_KEY

    set -x ANTHROPIC_BASE_URL "https://api.minimax.io/anthropic"
    set -x ANTHROPIC_AUTH_TOKEN "$MINIMAX_API_KEY"
    set -x API_TIMEOUT_MS "3000000"
    set -x CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC 1

    set -x ANTHROPIC_MODEL "MiniMax-M2.5"
    set -x ANTHROPIC_SMALL_FAST_MODEL "MiniMax-M2.5"
    set -x ANTHROPIC_DEFAULT_SONNET_MODEL "MiniMax-M2.5"
    set -x ANTHROPIC_DEFAULT_OPUS_MODEL "MiniMax-M2.5"
    set -x ANTHROPIC_DEFAULT_HAIKU_MODEL "MiniMax-M2.5"

    # Claude directory
    /home/{yourusername}/.local/bin/claude $argv
end
Enter fullscreen mode Exit fullscreen mode

Dispatcher function (optional)

function claude
    set first_arg $argv[1]

    switch $first_arg
        case m25 M25
            set -e argv[1]
            claudem25 $argv

        case kimi K2
            set -e argv[1]
            claudekimi $argv

        case glm GLM
            set -e argv[1]
            claudeglm $argv

        case '*'
            /home/{yourusername}/.local/bin/claude $argv
    end
end

Enter fullscreen mode Exit fullscreen mode

Step 5: Reload configuration

source ~/.config/fish/config.fish
Enter fullscreen mode Exit fullscreen mode

Step 6: Test

claudekimi

# if used dispatcher function (optional)
claude kimi
Enter fullscreen mode Exit fullscreen mode

or

claudem25

# if used dispatcher function (optional)
claude m25
Enter fullscreen mode Exit fullscreen mode

If everything is configured correctly, Claude Code will start using the
selected AI model.

Troubleshooting

Command not found

  • Reload config
  • Verify function definitions

API key not defined

  • Check variables
  • Reload config

Connection error

  • Validate API key
  • Check internet connection
  • Confirm endpoint URL

How it works

Each function:

  1. Checks API key
  2. Configures connection
  3. Runs Claude Code

The dispatcher function selects the correct configuration automatically.

Adding more AI models

  1. Add API key
  2. Create function
  3. Set base URL
  4. Set auth token
  5. Configure models
  6. Add to dispatcher

Done! You now have a flexible setup to switch between AI models with
simple commands.

RELATED NOTES

How to configure Claude CLI ACP for other compatible models, such as MiniMax M2.5
https://dev.to/hallancosta/how-to-configure-claude-cli-acp-for-other-compatible-models-such-as-minimax-m25-3j4n

How to configure ACP agents in Zed
https://dev.to/hallancosta/how-to-configure-acp-agents-in-zed-521e

Top comments (0)