No project description provided
Project description
Rotor
Rotor is an API-only LLM gateway. It exposes OpenAI-compatible, Anthropic-compatible, and OpenAI Responses-compatible endpoints over the models and provider keys configured as channels.
Rotor includes a minimal browser admin page at /. Management can also be
done directly through HTTP admin APIs.
Run
cd /Users/whoami/research/apirouter/rotor
pip install -e .
rotor serve --host 0.0.0.0 --port 8000
Open the admin page:
http://localhost:8000
By default, Rotor stores runtime files in ~/.cache/rotor:
~/.cache/rotor/
rotor.db
conversations/
Important Environment
# Optional. Defaults to sqlite+aiosqlite:///~/.cache/rotor/rotor.db
DATABASE_URL=
# Optional. Defaults to ~/.cache/rotor/conversations
CONVERSATION_STORE_DIR=
Configure Channels
Each channel stores one provider base URL, provider API key, supported models, priority, and weight.
curl -X POST http://localhost:8000/api/admin/channels \
-H "Content-Type: application/json" \
-d '{
"name": "zhipu-main",
"type": "zhipu",
"key": "provider-api-key",
"base_url": "https://open.bigmodel.cn/api/paas/v4",
"models": ["glm-4.7"],
"model_mapping": {},
"priority": 10,
"weight": 1,
"enabled": true,
"protocol": "openai"
}'
base_url is the upstream provider API root. key is that provider's API key.
Different providers or different keys should be configured as separate
channels. Channels serving the same model are distributed by priority and
weight.
Set protocol to openai_responses for an upstream that exposes native
POST /responses. Native Responses channels preserve hosted tools, multimodal
items, background jobs, response state, resource lifecycle calls, input-token
counting, compaction, and Responses SSE events. Rotor persistently binds each
native response ID to its originating channel and API token, so retrieval,
cancellation, deletion, input-item listing, and previous_response_id requests
return to the correct upstream account. Function tools can also be converted
across openai, openai_responses, and anthropic channels.
Channel connectivity tests use GET /models and do not consume model tokens.
An administrator can explicitly run a generation capability probe (which may
be billable):
curl -X POST \
"http://localhost:8000/api/admin/channels/1/test?capability=function_call&test_model=your-model"
Generate User API Key
curl -X POST "http://localhost:8000/api/admin/tokens/generate?name=demo"a=1000000" \
Use the returned key against Rotor:
curl -X POST http://localhost:8000/v1/chat/completions \
-H "Authorization: Bearer $ROTOR_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Conversation-Id: conv_demo" \
-d '{
"model": "glm-4.7",
"messages": [{"role": "user", "content": "hello"}]
}'
Codex CLI、Claude Code 和 OpenCode 的配置模板与冒烟命令见 客户端接入指南。
Endpoints
GET /GET /apiPOST /v1/chat/completionsPOST /v1/responsesGET/DELETE /v1/responses/{response_id}POST /v1/responses/{response_id}/cancelGET /v1/responses/{response_id}/input_itemsPOST /v1/responses/input_tokensPOST /v1/responses/compactPOST /anthropic/v1/messagesPOST /anthropic/v1/messages/count_tokensGET /v1/modelsGET/POST/PUT/DELETE /api/admin/channelsGET/POST/PUT/DELETE /api/admin/tokensGET /api/admin/logs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rotor_gateway-0.2.1.tar.gz.
File metadata
- Download URL: rotor_gateway-0.2.1.tar.gz
- Upload date:
- Size: 95.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.12.12 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ecf2091fd3f1307233a664e0fc8e022d2f8ea8156d6e76c051bdce72148d11a
|
|
| MD5 |
6220eae3a1db56e8478c706a5c3b5488
|
|
| BLAKE2b-256 |
57c422548c7ef727e29e81c63ed88bebb7a722e1849954209a8a9056de015ce3
|
File details
Details for the file rotor_gateway-0.2.1-py3-none-any.whl.
File metadata
- Download URL: rotor_gateway-0.2.1-py3-none-any.whl
- Upload date:
- Size: 125.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.12.12 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d83c00d21b48509a195c28e958a3e8c335941bf65d2e28843767a7222d4f789
|
|
| MD5 |
b54794927d2ee11566c9f9b4e8be5526
|
|
| BLAKE2b-256 |
b9f46a4831bbc234860fd503c6936b8dc104afde366a759238191e7d3def0bbd
|