No project description provided
Project description
Rotor
Rotor is an API-only LLM gateway. It exposes OpenAI-compatible, Anthropic-compatible, and basic 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.
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"}]
}'
Endpoints
GET /GET /apiPOST /v1/chat/completionsPOST /v1/responsesPOST /anthropic/v1/messagesGET /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.1.6.tar.gz.
File metadata
- Download URL: rotor_gateway-0.1.6.tar.gz
- Upload date:
- Size: 78.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.0 CPython/3.13.11 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca179898837e873391526032a2e184e26f4cb506a3d1585800c61c0720bea9ae
|
|
| MD5 |
fa00d7484e6ed143af7d8e389a9d38cc
|
|
| BLAKE2b-256 |
e879d6c968c223cf69f4acbf9c05d0b2a15f548d38e51eae9eedfa723dc93ac8
|
File details
Details for the file rotor_gateway-0.1.6-py3-none-any.whl.
File metadata
- Download URL: rotor_gateway-0.1.6-py3-none-any.whl
- Upload date:
- Size: 108.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.0 CPython/3.13.11 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85f27baa8d94080a303352275829981aa4f57cd28565f82e7cb62da400b726fc
|
|
| MD5 |
19ab776ca820cebe02f70768f700d362
|
|
| BLAKE2b-256 |
46c495a314b8918499d17ce15f66889a8169e965c816e8a7dd0fc49ea027fce5
|