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.2.tar.gz (73.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.2-py3-none-any.whl (102.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rotor_gateway-0.1.2.tar.gz
  • Upload date:
  • Size: 73.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.0 CPython/3.13.11 Darwin/25.2.0

File hashes

Hashes for rotor_gateway-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2aaf996870763345edf22e26ba4a6a423fe6736cc2c69d026e7e8cacf5ef7aa3
MD5 e76f824a56f94ee262132debf51e1d9a
BLAKE2b-256 79cd9932f67398b36fbee9f7bc733c1bd912790b7bdb5e560c646753c36a79f9

See more details on using hashes here.

File details

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

File metadata

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

Hashes for rotor_gateway-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ca6f0bc54f1fd30d538b60a1203c4ee189e9e81b27488ac69c96f3e5ecaeb9
MD5 f76d33b9c512c6ac5b1181a78b950cab
BLAKE2b-256 e1a8bbfb7379b7db3055238c893b732ab433e3cc8b2daee82a5f670e400939dc

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