GPTRouter Python Client
This is a Python client for the GPTRouter APIs.
Installation
Use the package manager pip to install gpt-router.
pip install gpt-router
Usage
from gpt_router.client import GPTRouterClient
from gpt_router.models import ModelGenerationRequest, GenerationParams
from gpt_router.enums import ModelsEnum, ProvidersEnum
client = GPTRouter(base_url='your_base_url', api_key='your_api_key')
messages = [
{"role": "user", "content": "Write me a short poem"},
]
prompt_params = GenerationParams(messages=messages)
claude_request = ModelGenerationRequest(
model_name=ModelsEnum.CLAUDE_4_5_HAIKU.value,
provider_name=ProvidersEnum.CHAT_ANTHROPIC.value,
order=1,
prompt_params=prompt_params,
)
response = client.generate(ordered_generation_requests=[claude_request])
print(response.choices[0].text)
Remember to replace 'your_base_url' and 'your_api_key' with your actual base URL and API key when using the client.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gptrouter-1.0.9.tar.gz
(22.3 kB
view details)
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
gptrouter-1.0.9-py3-none-any.whl
(22.4 kB
view details)
File details
Details for the file gptrouter-1.0.9.tar.gz.
File metadata
- Download URL: gptrouter-1.0.9.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3d6aa9af67cdf2386a1f362474b9259830ed094620ea089cfc780beb378f40a
|
|
| MD5 |
35838256b424ab4d8292478279c69767
|
|
| BLAKE2b-256 |
924a4ca0ba2c08e6f9b412403db2cdb554cf8f63e4d1f069c93bd9bcfc0e34e2
|
File details
Details for the file gptrouter-1.0.9-py3-none-any.whl.
File metadata
- Download URL: gptrouter-1.0.9-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7751fec3c6cf775573850806467ded886f99f9c45cac10328de68124fb3bb7ab
|
|
| MD5 |
792ecaddf64d9ea01cb6aa1bfc8ccfdb
|
|
| BLAKE2b-256 |
e6f6abae8cb14134bcdaa96be189029b3145c102ba1f10c26788925c1b224c90
|