Claude Code

Claude Code speaks Anthropic's Messages API (/v1/messages) and is pointed at a backend with ANTHROPIC_BASE_URL. EmberCloud exposes only OpenAI-compatible endpoints (/v1/chat/completions, /v1/responses) — there is no /v1/messages route.

So you need a translation proxy. Pointing ANTHROPIC_BASE_URL straight at EmberCloud will 404. Run a small proxy that converts Anthropic ↔ OpenAI and forwards to https://api.embercloud.ai/v1. Two maintained options below.

Prefer a zero-proxy setup? Codex runs on EmberCloud natively via the Responses API.

Option A: LiteLLM (recommended)

The LiteLLM proxy exposes a native Anthropic /v1/messages route and translates it to any OpenAI-compatible backend.

1. Create config.yaml mapping Claude Code's model aliases to EmberCloud's model:

config.yaml
model_list:
  # Claude Code asks for opus/sonnet/haiku — map them all to Ember's model
  - model_name: opus
    litellm_params:
      model: openai/glm-4.7
      api_base: "https://api.embercloud.ai/v1"   # base only, not /chat/completions
      api_key: os.environ/EMBER_API_KEY
  - model_name: sonnet
    litellm_params:
      model: openai/glm-4.7
      api_base: "https://api.embercloud.ai/v1"
      api_key: os.environ/EMBER_API_KEY
  - model_name: haiku
    litellm_params:
      model: openai/glm-4.7
      api_base: "https://api.embercloud.ai/v1"
      api_key: os.environ/EMBER_API_KEY

2. Install the proxy, set your EmberCloud key, and start it:

Start the proxy
pip install "litellm[proxy]"

export EMBER_API_KEY="YOUR_API_KEY"   # your real EmberCloud key (stays in the proxy)
litellm --config ./config.yaml        # serves Anthropic /v1/messages on :4000

3. In another shell, point Claude Code at the proxy and map every alias to glm-4.7:

Point Claude Code at the proxy
export ANTHROPIC_BASE_URL="http://localhost:4000"   # no /v1 — LiteLLM adds /v1/messages
export ANTHROPIC_AUTH_TOKEN="local-proxy-token"     # authenticates you to the LOCAL proxy

# Make Claude Code's model aliases resolve to Ember's model:
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-4.7"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-4.7"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.7"      # also the small/background model

claude

ANTHROPIC_AUTH_TOKEN authenticates Claude Code to your local proxy — your real EmberCloud key never leaves the proxy config.

Option B: Claude Code Router

claude-code-router is a lightweight npm tool that runs a local Anthropic-compatible server and forwards to OpenAI-compatible providers.

1. Configure ~/.claude-code-router/config.json — note the api_base_url here is the full chat-completions URL:

~/.claude-code-router/config.json
{
  "Providers": [
    {
      "name": "ember",
      "api_base_url": "https://api.embercloud.ai/v1/chat/completions",
      "api_key": "YOUR_API_KEY",
      "models": ["glm-4.7"]
    }
  ],
  "Router": {
    "default": "ember,glm-4.7",
    "background": "ember,glm-4.7",
    "think": "ember,glm-4.7",
    "longContext": "ember,glm-4.7"
  }
}

2. Install and launch Claude Code through the router:

Run
npm install -g @musistudio/claude-code-router

ccr code        # launches Claude Code wired to the router
# after editing config.json:  ccr restart

Notes & Troubleshooting

  • Map the model aliases. Claude Code sends its own names (opus/sonnet/haiku), never glm-4.7 directly. Map all of them (including haiku, which also drives the background model for titles and summaries) or those requests will fail with model-not-found.
  • Mind the base URLs. LiteLLM's api_base wants the base (.../v1) with the openai/ model prefix; ANTHROPIC_BASE_URL is the proxy with no /v1; claude-code-router's api_base_url wants the full /v1/chat/completions path.
  • Tool calls / streaming live in the proxy. If you hit tool_use errors or stalled output, that's the Anthropic ↔ OpenAI translation layer (the fragile part), not EmberCloud — try the other proxy or a newer release.
  • Pin your proxy version. Install a current, known-good LiteLLM release from PyPI and review its release notes / security advisories before installing, as you would for any third-party gateway.