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.11

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.11
File Size Uploaded Provenance Actions
gptrouter-1.0.11.tar.gz 22.4 kB Without provenance Details for gptrouter-1.0.11.tar.gz

Built distribution (wheel)

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

Total release size: 44.8 kB

Release files / gptrouter-1.0.11.tar.gz

Download URL gptrouter-1.0.11.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c68ff0e60c887d530bfc9942c5004c0bc389ff5893f40cc26a68d17226ba5a8e
BLAKE2b-256 checksum
How to use checksums
83d1e5117c6e0d34d7d191aa5f57543f97c234a48b73083f6125cf4312fa057e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL gptrouter-1.0.11-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbf5fa58c7d3f52739a2a74c7fbc88fab6e11775e8f9ad4b6070b566efcb1f60
BLAKE2b-256 checksum
How to use checksums
6ba01ed4b2e70cf06d990f760dcb68eb9adaf8f09e5bd2b68999bc3b6a91d974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for GPTRouter 1.0.11

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.11 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