集成
在 LiteLLM 中使用 Zurelay
用一套 OpenAI 风格的 API 调用所有服务商:包含 Python SDK 和代理服务器。 由 BerriAI 开发。
示例使用的模型:
开始配置
- 1
安装方式:Python SDK 用
pip install litellm,代理服务器用pip install 'litellm[proxy]'。 - 2
在 Zurelay 的模型 ID 前加上
openai/前缀,并把api_base设为带/v1的 base URL。 - 3
使用代理时,在
config.yaml中列出模型,然后运行litellm --config config.yaml。它会在http://localhost:4000上同时为 OpenAI 和 Anthropic 客户端提供服务。 - 4
请保持
use_chat_completions_api和use_chat_completions_url_for_anthropic_messages开启。否则 LiteLLM 会把 Responses 和 Anthropic Messages 请求(例如 Claude Code 发出的)转成对 OpenAI Responses API 的调用,而 Zurelay 不提供该 API。
配置
config.yaml
model_list: - model_name: claude-opus-5-5 litellm_params: model: openai/claude-opus-5-5 api_base: https://api.zurelay.com/v1 api_key: os.environ/ZURELAY_API_KEY use_chat_completions_api: true model_info: input_cost_per_token: 0.0000014 output_cost_per_token: 0.000007 cache_read_input_token_cost: 0.00000007 # Every other Zurelay model, as zurelay/<model ID> - model_name: zurelay/* litellm_params: model: openai/* api_base: https://api.zurelay.com/v1 api_key: os.environ/ZURELAY_API_KEY use_chat_completions_api: truelitellm_settings: use_chat_completions_url_for_anthropic_messages: true check_provider_endpoint: truegeneral_settings: master_key: os.environ/LITELLM_MASTER_KEYLiteLLM 按自己的价格表给请求计价:已知模型按官方标价计算,其余模型则完全不计价。
model_info 可以把 Zurelay 的价格写入它的支出统计。如果改用 LiteLLM 的 anthropic/ provider 调用 Claude,请使用 https://api.zurelay.com,不要加 /v1;LiteLLM 会自行补上 /v1/messages。我们用 DeepSeek 和 Claude 完整跑通了这套配置。LiteLLM 指南列出了我们遇到的每个报错、解决方法,以及每个测试任务的花费。
有疑问,或发现内容缺失?联系我们的支持团队,我们会通过邮件回复,通常只需一分钟。