This release is a pre-release and may not be stable for production use.
Behest Python SDK
The official Python SDK for Behest AI -- extends the OpenAI Python SDK with Behest authentication and local JWT signing.
Installation
pip install behest
Quick Start
API Key Flow
from behest import BehestClient
client = BehestClient(api_key="bh_live_YOUR_API_KEY")
response = client.chat.completions.create(
model="gemini-2.5-flash",
messages=[{"role": "user", "content": "Hello, Behest!"}],
)
print(response.choices[0].message.content)
Local Signing Flow (Tenant Signing Keys)
For server-to-server use cases where you want to eliminate the mint round-trip (~1ms local signing vs 50-200ms mint):
import os
from behest import BehestSigningClient
client = BehestSigningClient(
signing_key_pem=os.environ["BEHEST_SIGNING_KEY_PEM"],
key_id=os.environ["BEHEST_SIGNING_KEY_ID"], # "sk_a1b2c3..."
tenant_id=os.environ["BEHEST_TENANT_ID"],
project_id=os.environ["BEHEST_PROJECT_ID"],
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello from Python!"}],
)
print(response.choices[0].message.content)
Manual Token Signing
from behest.signing import sign_behest_jwt
result = sign_behest_jwt(
private_key_pem=os.environ["BEHEST_SIGNING_KEY_PEM"],
key_id="sk_a1b2c3...",
tenant_id="your-tenant-id",
project_id="your-project-id",
user_id="alice",
expires_in=3600,
)
print(result["access_token"])
Streaming
stream = client.chat.completions.create(
model="gemini-2.5-flash",
messages=[{"role": "user", "content": "Write a poem about the sea."}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Error Handling
from behest import BehestClient
from behest.errors import (
AuthenticationError,
RateLimitError,
BehestError,
)
client = BehestClient(api_key="bh_live_YOUR_API_KEY")
try:
response = client.chat.completions.create(
model="gemini-2.5-flash",
messages=[{"role": "user", "content": "Hello"}],
)
except AuthenticationError:
print("Check your API key.")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after_ms}ms")
except BehestError as e:
print(f"Behest error {e.status}: {e}")
License
MIT
Metadata
Release files for behest-ai 1.5.0b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| behest_ai-1.5.0b1.tar.gz | 23.4 kB | Without provenance | Details for behest_ai-1.5.0b1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| behest_ai-1.5.0b1-py3-none-any.whl | Python 3 | none | any | Details for behest_ai-1.5.0b1-py3-none-any.whl |
Total release size: 38.3 kB
Release files / behest_ai-1.5.0b1.tar.gz
| Download URL | behest_ai-1.5.0b1.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7f104c482c838d3b93817c607913265b29269b75e7d586e8aa63add2966d233
|
|
BLAKE2b-256 checksum How to use checksums |
5bab08550a159f5be9b05148dbb3bff97499bc2b3d022ec83642cbf2ceb6fcf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / behest_ai-1.5.0b1-py3-none-any.whl
| Download URL | behest_ai-1.5.0b1-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a064e17c5f674f26ed507400a256126a9d163960dab2999fab2e2e59c5ee7bbd
|
|
BLAKE2b-256 checksum How to use checksums |
47d1700c288e27bb3562cc473fcf5a4adf6c88e284adc89119070848412869c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for behest-ai 1.5.0b1
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.