Skip to main content

Python SDK for Kestrel — route LLM requests to the cheapest capable model

Project description

Kestrel Python SDK

Drop-in LLM cost optimization. Route requests to the cheapest capable model with one line of code.

Install

pip install kestrel-sdk

Usage

import kestrel_sdk

client = kestrel_sdk.Client(
    api_key="ks-your-kestrel-key",
    provider_key="sk-your-openai-key",
    base_url="http://localhost:8080/v1",
)

# Send requests as usual — Kestrel handles routing
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "What is 2+2?"}],
)

The SDK is a thin wrapper over the OpenAI Python SDK. All openai.OpenAI methods work as expected.

Async

import kestrel_sdk

client = kestrel_sdk.AsyncClient(
    api_key="ks-your-key",
    provider_key="sk-your-openai-key",
)

response = await client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)

Learn More

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kestrel_sdk-0.1.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kestrel_sdk-0.1.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file kestrel_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: kestrel_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kestrel_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 33cdc1ba4d743fdba519d839d9af01929b2652edde2453660f1dd7e39a95fb16
MD5 ee89867b7f9cac4dece675b15ea36435
BLAKE2b-256 bf3cf5003362e2fbc3d75d9be77091968d7e33d07aeba6e5caeecd01e5056271

See more details on using hashes here.

Provenance

The following attestation bundles were made for kestrel_sdk-0.1.0.tar.gz:

Publisher: publish.yml on andber6/kestrel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kestrel_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kestrel_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kestrel_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95f701d84f561b9ea8373e000abeae7ec789f667afea1b072fb7848e961dffc8
MD5 2d955596e4a7282088c3e347ab89473e
BLAKE2b-256 6f74c9c8ef938f0f9b1cf10f7d0b83c8cded369e49965d1e48d3a17811b3026f

See more details on using hashes here.

Provenance

The following attestation bundles were made for kestrel_sdk-0.1.0-py3-none-any.whl:

Publisher: publish.yml on andber6/kestrel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page