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

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.12
File Size Uploaded Provenance Actions
gptrouter-1.0.12.tar.gz 23.0 kB Without provenance Details for gptrouter-1.0.12.tar.gz

Built distribution (wheel)

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

Total release size: 46.1 kB

Release files / gptrouter-1.0.12.tar.gz

Download URL gptrouter-1.0.12.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9fb240bdbd3f80a78eed63a5c060369ca9997866f506aa7766bbb16df8f32db2
BLAKE2b-256 checksum
How to use checksums
b08b63d1e0ced0018a0581800cd8f00c92a03e35983461a07182844b9bb7cd90
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.12-py3-none-any.whl

Download URL gptrouter-1.0.12-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3c6937f7ce3cfa82632eb8bf1fd76c5e60495172334b190d74597504992484d
BLAKE2b-256 checksum
How to use checksums
4485706426a0169745d636f9eb43bcaba521a3ed2ba855a980549f84fc31bd34
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.12

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