Skip to main content

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.

Metadata

Release files for GPTRouter 1.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GPTRouter 1.0.14
File Size Uploaded Provenance Actions
gptrouter-1.0.14.tar.gz 23.5 kB Without provenance Details for gptrouter-1.0.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for GPTRouter 1.0.14
File Interpreter ABI Platform Actions
gptrouter-1.0.14-py3-none-any.whl Python 3 none any Details for gptrouter-1.0.14-py3-none-any.whl

Total release size: 47.2 kB

Release files / gptrouter-1.0.14.tar.gz

Download URL gptrouter-1.0.14.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
109fea5880fcee95e5d81136ecb4a5b984a253577ea5adc2032a25a622470284
BLAKE2b-256 checksum
How to use checksums
7bd5ecd42618677ae55f895cab7a3ccb9bdceaa4ba0d96724929af9cb8d83822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / gptrouter-1.0.14-py3-none-any.whl

Download URL gptrouter-1.0.14-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
510fd6eb7d8762f0a5982f2333c7d40b637a4b759d43164c0a7432abd8c4d8ac
BLAKE2b-256 checksum
How to use checksums
68ef37213fc545d9c842de9b9b01e4c2ff0960305a4f02ca29207a85ec2a7b63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for GPTRouter 1.0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.14 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page