docs.emix.ai
language
language
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡¨πŸ‡³ Chinese
language
language
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡¨πŸ‡³ Chinese
Market
File Upload API
Market
File Upload API
  1. Claude
  • Getting Started with Emix API (Important)
  • Market
  • Image Models
    • Seedream
      • Seedream4.5 - Text to Image
      • Seedream4.5 - Edit
      • Seedream5.0 Lite - Text to Image
      • Seedream5.0 Lite - Image to Image
      • Seedream5.0 Pro - Text to Image
      • Seedream5.0 Pro - Image to Image
    • Google
      • Google - Nano Banana
      • Google - Nano Banana Pro
      • Google - Nano Banana 2
      • Google - Nano Banana 2 Lite
    • Grok Imagine
      • Grok Imagine - Text to Image
      • Grok Imagine - image to image
    • GPT Image
      • GPT Image-1.5 - Text to Image
      • GPT Image-1.5 - Image to Image
      • GPT Image-2 - Text to Image
      • GPT Image 2 - Image To Image
    • Wan
      • Wan 2.7 Image
      • Wan 2.7 Image Pro
  • Video Models
    • Grok Imagine
      • Grok Imagine Text to Video
      • Grok Imagine Image to Video
      • Grok Imagine - Video Upscale
      • Grok Imagine - Video Extend
      • Grok Imagine Video 1.5 Preview
    • Kling
      • Kling 2.6 Text to Video
      • Kling 2.6 Image to Video
      • Kling AI Avatar Standard
      • Kling AI Avatar Pro
      • Kling V2.1 Master Image to Video
      • Kling V2.1 Master Text to Video
      • Kling V2.1 Pro
      • Kling V2.1 Standard
      • Kling 2.6 motion-control
      • Kling-3.0 motion-control
      • Kling 3.0
    • Bytedance
      • Bytedance Seedance 2.0
      • Bytedance Seedance 2.0 Fast
      • Bytedance Seedance 2.0 Mini
    • Veo3.1 API
      • VEO 3.1 Text to video
      • VEO 3.1 Image to video
      • VEO 3.1 Reference to vidoe
    • Wan
      • Wan 2.6 - Image to Video
      • Wan 2.6 - Text to Video
      • Wan 2.6 - Video to Video
      • Wan 2.7 - Text to Video
      • Wan 2.7 - Image to Video
      • Wan 2.7 - Video Edit
      • Wan 2.7 - Reference to Video
    • HappyHorse
      • HappyHorse-1-1 image-to-video
      • HappyHorse-1-1 text-to-video
      • HappyHorse-1-1 reference-to-video
    • Gemini Omni
      • Gemini Omni Video
      • Gemini Omni Audio
      • Gemini Omni Character
  • Chat Models
    • Claude
      • Claude Code + emix.ai Integration Guide
      • Claude Sonnet 5
        POST
    • Gemini
      • Gemini 3.5 Flash (openai)
    • Grok
      • Grok 4.5
      • Grok 4.3
  • Get Task Details
    GET
  1. Claude

Claude Code + emix.ai Integration Guide

With a simple environment variable setup, you can route your local Claude Code through emix.ai's proxy and use your emix.ai account credits. Takes about 3 minutes.

Prerequisites: Configuration Values You Need#

VariableValue
ANTHROPIC_BASE_URLhttps://api.emix.ai/claude
ANTHROPIC_API_KEYBearer <your emix.ai API Key>
ANTHROPIC_AUTH_TOKEN<your emix.ai API Key> (alternative to ANTHROPIC_API_KEY β€” no Bearer prefix needed)
Important Notes
Set ANTHROPIC_BASE_URL to https://api.emix.ai/claude only β€” do not append /v1/messages. Claude Code appends that automatically.
There are two ways to provide your API Key β€” choose one:
Option 1: Use ANTHROPIC_API_KEY. The value must start with Bearer (note the space after Bearer). Example: Bearer sk-emix-abc123xxx
Option 2: Use ANTHROPIC_AUTH_TOKEN. Set it directly to the Key value β€” no Bearer prefix. Example: sk-emix-abc123xxx

Step 1: Install Claude Code#

Mac#

Open Terminal and paste:

Windows#

Open PowerShell from the Start menu and paste:
irm https://claude.ai/install.ps1 | iex
After installation, run claude --version. If you see a version number, the installation succeeded.
⚠️ If the claude command is not found, check that Claude Code was added to your PATH.
⚠️ After installing, do not log in with an Anthropic account. You will connect using your emix.ai credentials in the next step.

Step 2: Set Your Credentials (Choose One Method)#

Method A: System Environment Variables (Recommended)#

Configure once β€” every terminal session will automatically route through emix.ai.

Mac#

Open Terminal and paste one of the following (replace the key with your own):

Windows#

Open PowerShell and paste one of the following (replace the key with your own):
# Option 1: ANTHROPIC_API_KEY (Bearer prefix required)
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.emix.ai/claude", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "Bearer your_emix_API_Key", "User")
# Option 2: ANTHROPIC_AUTH_TOKEN (no Bearer prefix)
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.emix.ai/claude", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "your_emix_API_Key", "User")
After running these commands, close all open terminal windows and reopen them β€” new windows are required to pick up the variables.

Method B: Claude Code Settings File#

Takes effect only when running claude. Does not affect other programs on your system β€” a cleaner option if you prefer isolation.
Open the file below (create it if it doesn't exist), add the content, and replace the key:
Mac: ~/.claude/settings.json
Windows: C:\Users\<your-username>\.claude\settings.json
// Option 1: ANTHROPIC_API_KEY (Bearer prefix required)
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.emix.ai/claude",
    "ANTHROPIC_API_KEY": "Bearer your_emix_API_Key"
  }
}
// Option 2: ANTHROPIC_AUTH_TOKEN (no Bearer prefix)
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.emix.ai/claude",
    "ANTHROPIC_AUTH_TOKEN": "your_emix_API_Key"
  }
}

Method C: CC-SWITCH#

Installation Steps:
Download the CC-Switch-Windows.msi file.
https://github.com/farion1231/cc-switch/releases
Double-click to run the installer and follow the wizard to complete the installation.
After installation, find CC Switch in the Start Menu or on the desktop and launch it.
Enter the following information:
API KEY (No Bearer required)
Request URL 'https://api.emix.ai/claude' (It is recommended to disable the full URL)
Enter the corresponding model name from the Emix documentation in the advanced options.
Save and enable.

Step 3: Verify the Connection#

Open a terminal and run in any directory:
Once the interactive session starts, send any message (e.g. "Hello").
βœ… Gets a normal reply β†’ emix.ai is connected. You can also verify usage in the emix.ai logs page.
❌ Prompted to log in with an Anthropic account β†’ See FAQ item #1 below.

FAQ#

SymptomCause / Solution
Still prompted to log in with Anthropic accountEnvironment variables not loaded. Fully close all terminal windows (Mac: right-click Terminal β†’ Quit; Windows: close all PowerShell processes) and reopen.
401 Unauthorized errorAPI Key is wrong or expired. If using ANTHROPIC_API_KEY, confirm the Bearer prefix is present. If using ANTHROPIC_AUTH_TOKEN, set it to the raw Key with no prefix. Check your key in the emix.ai dashboard.
model not found errorInside Claude, run /model and switch to a model supported by emix.ai.
Windows β€” changes still not workingClose all terminals, including built-in terminals in VSCode, Cursor, and other editors. Fully quit those apps and relaunch.
To inspect the actual requests Claude Code sends, start with claude --debug and review the detailed logs.

Security Tips#

Keep your API Key private β€” never share it in screenshots, chat groups, or code repositories.
If the settings file lives inside a project directory, add .claude/settings.json to .gitignore. Files placed in your home directory (~/.claude/) are safe by default.
If your key is compromised, reset it immediately from the emix.ai dashboard.

If you have any questions, feel free to reach out.
Previous
Gemini Omni Character
Next
Claude Sonnet 5
Built with