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

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

Built distribution (wheel)

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

Total release size: 44.8 kB

Release files / gptrouter-1.0.10.tar.gz

Download URL gptrouter-1.0.10.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dd6a838c7359a0c4ed66641259f1ff2a414e536746049796e4e27c264cf4c40e
BLAKE2b-256 checksum
How to use checksums
65e915fedc90cac45082da2b31b7332d9f6301569f53a76ce38bce1da568aeeb
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.10-py3-none-any.whl

Download URL gptrouter-1.0.10-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d4eae50425601263ea88ada2d6cb5086a2146691ca1e28091d1d4359f3038a
BLAKE2b-256 checksum
How to use checksums
36068489322659d3544651c6cf686426cf7bb34b9ed15e95bee6a189d43112fc
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.10

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