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.4.tar.gz (75.1 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.4-py3-none-any.whl (103.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rotor_gateway-0.1.4.tar.gz
  • Upload date:
  • Size: 75.1 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.4.tar.gz
Algorithm Hash digest
SHA256 097f3648c6cf8fdbf4300d1bb263a2664f734d8b8f0111b7acefcb1149f28ea1
MD5 576fd7d920824c7cc96ec959f68ad293
BLAKE2b-256 6c0c2866954aa302e1287c875c76a4fa0c95f6a5760995b0429beedc34552a7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rotor_gateway-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 103.8 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 15cc63785f32be8c7defdefea1518d99fc538ea9c3519e03a4fab056b5f8ff61
MD5 3c1ad17e69d23f77bc630b51553e3aca
BLAKE2b-256 3066f1833e8adae77ada608e8aa8da3cde74d7a24629df0f60595454e0eb92a3

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