ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

CLIProxyAPI:一款可以统一OpenAI协议和Anthropic协议的代理工具

CLIProxyAPI:一款可以统一OpenAI协议和Anthropic协议的代理工具

代码仓路径:https://github.com/router-for-me/CLIProxyAPI

1. 把已有的各种协议的API KEY配置上去

  1. 配置介绍-官方版:https://help.router-for.me/cn/hands-on/tutorial-0.html
  2. 懒人版:
git clone https://github.com/router-for-me/CLIProxyAPI.git
cd CLIProxyAPI
cp config.example.yaml config.yaml

打开config.yaml文件,找到下方关键字段配置即可:

...  省略很多  ....# API keys for authentication
api-keys:- "proxy_001"    ##### 重点填这个:可以设置多个api-keys,这个key就用到你的claude code、opencode等工具中,配置中把这行注释删掉# Gemini API keys
gemini-api-key:   #--- 如果有谷歌的key,可以在这边配置,主要配置api_key即可;如果没有,就把整段删掉- api-key: "AI........."    ##### 重点填这个base-url: "https://generativelanguage.googleapis.com"headers:X-Custom-Header: "custom-value"models:- name: "gemini-3-flash-preview"alias: "gemini-3-flash"- name: "gemini-3-pro-preview"alias: "gemini-3"# Claude API keys
claude-api-key:           ##### 如果有自己买的z.ai的GLM4.7,可以配置在这- api-key: "c4ba....."   ##### 重点填这个base-url: "https://open.bigmodel.cn/api/anthropic"headers:X-Custom-Header: "custom-value"models:- name: "glm-4.7"         ##### 重点填这个alias: "glm4.7"             ##### 重点填这个cloak: mode: "auto"strict-mode: false sensitive-words: - "API"- "proxy"# OpenAI compatibility providers
openai-compatibility:  - name: "huoshan"   ##### 如果有火山引擎买的OpenAI协议的,可以在这填,主要是下方的base-url、api-key和name。base-url: "https://ark.cn-beijing.volces.com/api/v3"    ##### 重点填这个headers:X-Custom-Header: "custom-value"api-key-entries:- api-key: "db6e0ad7-6362-43e8-b246-f544e6a6a32d"      ##### 重点填这个models: # The models supported by the provider.- name: "ep-20260212220515-6hmv6"                                ##### 重点填这个alias: "hs-glm4.7" # The alias used in the API.

2. 安装

  1. 直接安装使用:https://help.router-for.me/cn/introduction/quick-start.html
  2. 自己源码编译,docker部署:https://help.router-for.me/cn/hands-on/tutorial-5.html
cd CLIProxyAPI
bash docker-build.sh
选择1  或者 docker compose up -d

3. 集成使用

添加URL和API KEY就可以用了。
Claude Code:https://help.router-for.me/cn/agent-client/claude-code.html
其他的:就在上边的文档中,自己找

4. 效果演示

配置效果
image
使用效果
image

返回列表