Dependency-free Python client for the RouterBase OpenAI-compatible API.
Project description
RouterBase Python Client
RouterBase provides an OpenAI-compatible API for calling many AI models through https://routerbase.com/v1.
routerbase-client is a small dependency-free Python client for chat completions and model listing. It uses the Python standard library, so it is easy to test in server, CLI, and notebook environments.
Install
After publishing to PyPI:
python -m pip install routerbase-client
For local testing:
python -m pip install -e .
Usage
from routerbase import RouterBase
client = RouterBase()
response = client.chat_completion(
messages=[{"role": "user", "content": "Write a short RouterBase tagline."}]
)
print(response["choices"][0]["message"]["content"])
CLI
export ROUTERBASE_API_KEY="sk-rb-..."
routerbase-chat "Write a five-word launch tagline"
Print the full JSON response:
routerbase-chat --json "List three product positioning ideas"
Configuration
| Variable | Purpose |
|---|---|
ROUTERBASE_API_KEY |
RouterBase API key used for requests |
ROUTERBASE_BASE_URL |
Optional base URL override; defaults to https://routerbase.com/v1 |
Links
- RouterBase
- RouterBase docs: https://docs.routerbase.com/
- Chat completions docs: https://docs.routerbase.com/api-reference/chat-completions
- npm quickstart package: https://www.npmjs.com/package/routerbase-quickstart
License
MIT
Project details
Release history Release notifications | RSS feed
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 routerbase_client-0.1.0.tar.gz.
File metadata
- Download URL: routerbase_client-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83b720ba4864b7aaa6cadd9de60a9a322c154ab98fdecb301ae92b0bc97f013e
|
|
| MD5 |
0b553216af8dd48748b982f3600bd085
|
|
| BLAKE2b-256 |
eeea61da14627e06ae95e1d62c9f8174d7b0410923d67e6e2fc11d981f39a468
|
File details
Details for the file routerbase_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: routerbase_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
595e5b93078669dcdc13c0afba4cb14117a8232b4be136ce0226f7c96fd2bb1a
|
|
| MD5 |
943fc45766f3ab51c6b083c721b4e0dd
|
|
| BLAKE2b-256 |
a9cc6f26f981e36d50b2934891651b3a04d775c6beb9eea20f9ba3cb45c32cd3
|