3,672 prompts from top AI collections
← Back to Market
[UNTESTED] [84634E1A607A/claude-code-router-py] 1 endpoint(s)
ChatGPT API Proxy/ChatGPT
2,137 characters
Status: [UNTESTED] Endpoints found: http://provider/v1/chat/completions Source: https://github.com/84634E1A607A/claude-code-router-py # ccr-py 看上去目前 https://github.com/vllm-project/router 已经足够好, Claude Code 也支持了 Agent Session 标识. 本 Repo 没啥大用了. `ccr-py` 是一个 FastAPI 代理服务。它接收 Anthropic Messages API 请求,路由到 OpenAI 兼容后端,并在 Anthropic 与 OpenAI 两种格式之间做双向转换。 ```text Anthropic client -> Anthropic Messages API ccr-py -> OpenAI-compatible Chat Completions API provider ``` ## What It Serves | Method | Path | Purpose | |---|---|---| | `POST` | `/v1/messages` | Anthropic Messages API,支持流式和非流式 | | `POST` | `/v1/messages/count_tokens` | 基于 tokenizer 的 token 计数 | | `POST` | `/v1/complete` | Anthropic text completion 兼容接口 | | `GET` | `/v1/models` | 透传 provider 模型列表 | | `GET` | `/v1/models/{id}` | 透传单个模型信息 | | `POST` | `/v1/messages/batches` | 创建 batch | | `GET` | `/v1/messages/batches` | 列出 batch | | `GET` | `/v1/messages/batches/{id}` | 查询 batch | | `POST` | `/v1/messages/batches/{id}/cancel` | 取消 batch | | `DELETE` | `/v1/messages/batches/{id}` | 删除 batch | | `GET` | `/v1/messages/batches/{id}/results` | 返回 Anthropic JSONL batch 结果 | | `POST` | `/tokens/clear` | 转发到 provider 的 `/tokens/clear` | | `GET` | `/health` | 健康检查 | ## Request Flow 非流式请求: ```text Anthropic request -> route model from config -> convert to OpenAI payload -> apply provider params -> send to provider with retries -> convert response to Anthropic format -> return JSON response ``` 流式请求: ```text Anthropic request with stream=true -> route model from config -> convert to OpenAI payload -> open upstream SSE stream -> convert chunks to Anthropic SSE events -> emit message_delta and message_stop ``` ## Quick Start Local development in this repo uses the `ccr-py` conda environment. ```bash ~/miniconda3/bin/conda run -n ccr-py pip install -r requirements.txt ``` 设置 Anthropic 客户端
Download .txt