三家定位差异

维度LiteLLMOpenRouterPortkey
形式开源库 + 自托管SaaS 平台SaaS / 自托管
手续费0%(仅 VPS)+5-10%$99+/月
模型数100+(手动接)300+ 自动100+ 自动
DX中(需配 yaml)极简(OpenAI 兼容)中(需 SDK)
Observability基础日志基础 dashboard★★★★★
数据隔离★★★★★★★★★★★★
运维自己不需要不需要
目标客户重度 / 自托管派Indie / SaaS企业团队

价格对比

方式input $/Moutput $/M备注
Anthropic 直连$15$75需外卡 + 美国实体
OpenRouter$15.75$78.75+5%,免外卡
Portkey$15$75 + 月费$99/月起
LiteLLM(自托管)$15$75 + VPS自己接
商业中转站$5-10$25-40-30 至 -50%

商业中转站价格最低(独立开发者用得起的 Claude 4.7 / GPT-5.5 中转)。

LiteLLM 实战

# 安装
pip install litellm

# 调用(OpenAI 兼容接口)
from litellm import completion

response = completion(
    model="anthropic/claude-opus-4-7",
    messages=[{"role": "user", "content": "Hello"}],
    api_key=ANTHROPIC_API_KEY
)

print(response.choices[0].message.content)

自托管 proxy

# litellm_config.yaml
model_list:
  - model_name: claude-opus
    litellm_params:
      model: anthropic/claude-opus-4-7
      api_key: ${ANTHROPIC_API_KEY}
  - model_name: gpt-5-5
    litellm_params:
      model: openai/gpt-5.5
      api_key: ${OPENAI_API_KEY}

general_settings:
  master_key: sk-1234
# 启动 proxy
litellm --config litellm_config.yaml --port 4000

# 客户端用
curl http://localhost:4000/v1/chat/completions \
  -H "Authorization: Bearer sk-1234" \
  -d '{"model": "claude-opus", "messages": [...]}'

OpenRouter 实战

// 完全 OpenAI 兼容
import OpenAI from 'openai'

const openai = new OpenAI({
  baseURL: 'https://openrouter.ai/api/v1',
  apiKey: process.env.OPENROUTER_KEY
})

const response = await openai.chat.completions.create({
  model: 'anthropic/claude-opus-4-7',
  messages: [{ role: 'user', content: 'Hello' }]
})

OpenRouter 优势

  • 300+ 模型一站接(Claude / GPT / Gemini / Llama / Mistral / DeepSeek / Qwen)
  • 自动 routing:选最便宜可用版本
  • 模型 fallback:A 失败自动切 B
  • 单一计费 + USD 充值
  • 30 秒接入

Portkey 实战

import { Portkey } from 'portkey-ai'

const portkey = new Portkey({
  apiKey: process.env.PORTKEY_KEY,
  virtualKey: 'vk_anthropic_xxx'  // 在 Portkey Dashboard 配
})

const response = await portkey.chat.completions.create({
  model: 'claude-opus-4-7',
  messages: [{ role: 'user', content: 'Hello' }],
  config: {
    cache: { mode: 'semantic' },
    fallback: ['claude-sonnet-4-6'],
    retry: { count: 3 }
  }
})

Portkey 独家能力

  • Semantic Caching(语义缓存,命中率 30-50%)
  • PII 自动 detect + redact
  • Prompt template 版本管理(A/B test)
  • 按团队成员审计
  • SOC2 + HIPAA 合规

indie 实战推荐

场景 A:MVP 阶段(0-100 用户)

推荐:OpenRouter

  • 30 分钟接入
  • 模型自由切换
  • 单一账单
  • $20-50 月预算够用

场景 B:增长阶段(100-1000 用户)

推荐:LiteLLM 自托管 + 商业中转站

  • 降本 30-50%
  • 数据完全隔离
  • 自由路由策略

场景 C:团队 SaaS(1000+ 用户、多人协作)

推荐:Portkey 或自托管 LiteLLM + Sentry

  • Observability 完整
  • 团队协作
  • 合规审计

场景 D:极致省钱 + 国内访问

推荐:商业中转站直接调用

  • 价格降 30-50%
  • 国内可访问
  • 免外卡

如果你需要绕开外卡 + 模型选择灵活,最实操的做法是配独立开发者可用的 Claude / OpenAI API 中转作为应用的统一端点。配好后所有模型用同一个 API key、月预算可控。

性能实测

模拟 100 次 Claude Opus 4.7 调用:

网关平均延迟P95失败率
Anthropic 直连(美国)1.5s3.2s0.2%
OpenRouter1.7s3.8s0.4%
Portkey1.6s3.5s0.3%
LiteLLM(self-host)1.6s3.5s0.5%
商业中转(国内 IP)0.8s1.8s0.5%

中转站在国内 IP 下延迟最低(因为节点在亚洲)。

迁移成本

从 → 到难度注意
直连 Anthropic → OpenRouter极低仅改 baseURL
OpenRouter → Portkey加 virtualKey
直连 → LiteLLM 自托管部署 + 配 yaml
OpenRouter → 中转站极低仅改 baseURL

OpenRouter / Portkey / 中转站都是 OpenAI 兼容协议,互相迁移 5 分钟。

跨境访问

LiteLLM / OpenRouter / Portkey Dashboard 在国内访问普遍稳定,但调用源 IP(如 Cloudflare Workers / Railway)对各家 LLM 后端的稳定性不同。

如果你需要稳定调用 Claude / GPT / Gemini 跨家 + 同时管 Stripe / Mercury / Wise,配一条主推 GPT-5.5 / Claude 4.7 的低价 API 中转能保证多模型调用 + 海外账户操作不中断,月预算降低 30-50%。

相关阅读