Claude Code — OpenRouter via y-router
How to run Claude Code with non-Anthropic models (via OpenRouter) using y-router as a protocol bridge.
Why / When to Use
Claude Code uses Anthropic API format; OpenRouter uses OpenAI format. y-router converts between them, enabling models like GLM-4.5, Gemini, or other OpenRouter-hosted models inside Claude Code — including GitHub Actions.
Core Concept / Commands
GitHub Actions setup
- name: Run Claude Code
uses: anthropics/claude-code-action@v1
env:
ANTHROPIC_BASE_URL: "https://cc.yovy.app" # y-router hosted
ANTHROPIC_AUTH_TOKEN: ${{ secrets.OPENROUTER_API_KEY }}
ANTHROPIC_API_KEY: "" # blank explicitly
ANTHROPIC_MODEL: z-ai/glm-4.5
ANTHROPIC_SMALL_FAST_MODEL: z-ai/glm-4.5-air
with:
anthropic_api_key: ${{ secrets.OPENROUTER_API_KEY }}
prompt: |
Your prompt hereLocal y-router
# Self-hosted via Docker
docker-compose up -d
# Repo: github.com/luohy15/y-routerKey Options / Variants
- Hosted (free):
https://cc.yovy.app— zero setup, good for GitHub Actions - Cloudflare Workers: Easy self-hosted alternative
- OpenRouter base URL: Use
https://openrouter.ai/api(NOT/api/v1— Claude Code needs Anthropic-compatible endpoint)
Gotchas
- Always blank
ANTHROPIC_API_KEYwhen usingANTHROPIC_AUTH_TOKEN+ OpenRouter base URL. - OpenRouter only guarantees Claude Code compatibility with Anthropic first-party provider. Non-Anthropic routing is not reliable for production — tool calls, long context, and agent loops may break.
- GLM-4.5 via
z-ai/glm-4.5andz-ai/glm-4.5-airhave a direct precedent from the author.
Source
Conversation: “CC-Autonomous” — 2026-05-30