Skip to main content

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&quota=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 /api
  • POST /v1/chat/completions
  • POST /v1/responses
  • POST /anthropic/v1/messages
  • GET /v1/models
  • GET/POST/PUT/DELETE /api/admin/channels
  • GET/POST/PUT/DELETE /api/admin/tokens
  • GET /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

rotor_gateway-0.1.3.tar.gz (74.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rotor_gateway-0.1.3-py3-none-any.whl (103.2 kB view details)

Uploaded Python 3

File details

Details for the file rotor_gateway-0.1.3.tar.gz.

File metadata

  • Download URL: rotor_gateway-0.1.3.tar.gz
  • Upload date:
  • Size: 74.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.12 Darwin/25.2.0

File hashes

Hashes for rotor_gateway-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9f977634d3e80cbf6e4a827a9c160beb0ca8fd1a581070ff416987b9eec6bf21
MD5 8d83908d8cb68c154ea4942ae98b9b4d
BLAKE2b-256 9eff05557fba4f9b3d73ab16401b4d3f2546f98cc6282c8d080704e502418211

See more details on using hashes here.

File details

Details for the file rotor_gateway-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: rotor_gateway-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 103.2 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

Hashes for rotor_gateway-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 09cf6af6279b1e409bb47436060614d3c8fbf11ec6e02e025258f1b2834131c0
MD5 d6b217c2e35ecc8b00667269ee897fc8
BLAKE2b-256 bcadc8109f943470d3ae53d803541434f983bd9d1d3a6987b60e571ea8d1b3e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page