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

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.13
File Size Uploaded Provenance Actions
gptrouter-1.0.13.tar.gz 23.4 kB Without provenance Details for gptrouter-1.0.13.tar.gz

Built distribution (wheel)

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

Total release size: 47.0 kB

Release files / gptrouter-1.0.13.tar.gz

Download URL gptrouter-1.0.13.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2ebca6879a480d34f3aad8db5505b3ce0725c0c71a856aabd83b02c883e6da4a
BLAKE2b-256 checksum
How to use checksums
b409175a40b8be3861a2c9587b5c4186311ab7fb4f4fae55d89d65d1ebea24c0
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.13-py3-none-any.whl

Download URL gptrouter-1.0.13-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
418b594357cb5529d10cd215ab1dea0f2492ec512888e71ef48d4c776439e2e0
BLAKE2b-256 checksum
How to use checksums
d6f329ca0074bf69de78c6c4713e0249c11c9de47adeb98a93105acdbf344fef
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.13

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