Skip to main content

The official Veyra Python SDK — sync + async, fully typed.

Project description

veyra-python

PyPI Python Versions License CI

The official Veyra Python SDK: sync + async clients, typed models, streaming, pagination, retries, and rich API exceptions.

Installation

pip install veyra

Quickstart (Sync)

import veyra

client = veyra.Veyra()
completion = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Hello!"}],
    reasoning={"effort": "low"},
)
print(completion.choices[0].message.content)

Quickstart (Async)

import asyncio
import veyra

async def main() -> None:
    async with veyra.AsyncVeyra() as client:
        completion = await client.chat.completions.create(
            model="gpt-5.4-mini",
            messages=[{"role": "user", "content": "Hello from async"}],
        )
        print(completion.choices[0].message.content)

asyncio.run(main())

Authentication

Set environment variable:

export VEYRA_API_KEY="veyra_sk_..."

Or pass explicitly:

client = veyra.Veyra(api_key="veyra_sk_...")

Resources at a glance

Namespace Method
client.chat.completions create(...)
client.completions create(...)
client.responses create(...)
client.embeddings create(...)
client.images.generations create(...)
client.audio.transcriptions create(...)
client.models list(), retrieve(id)
client.quota status(), list_plans(), list_public_plans()
client.billing.usage list(), daily_summary(), monthly_summary(), conversation_summary(id)
client.billing.profile retrieve(), upsert(...), access()
client.api_keys create(...), list(), update(...), revoke(...)
client.assistant chat(...)
client.health check(), ready()

Streaming

import veyra

client = veyra.Veyra()
with client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Count to 3"}],
    stream=True,
) as stream:
    for chunk in stream:
        print(chunk.choices[0].delta.content or "", end="")

Responses reasoning

response = client.responses.create(
    model="gpt-5.4-mini",
    input="Summarize the tradeoff in one sentence.",
    reasoning={"effort": "medium", "summary": "auto"},
    max_output_tokens=128,
)
print(response.output[0].content[0].text)

Error handling

import veyra

client = veyra.Veyra()
try:
    client.chat.completions.create(
        model="gpt-5.4-mini",
        messages=[{"role": "user", "content": "Hello"}],
    )
except veyra.RateLimitError as exc:
    print("Retry after:", exc.retry_after)
except veyra.APIError as exc:
    print(exc.status_code, exc.code, exc)

Pagination

for record in client.billing.usage.list(limit=100):
    print(record.model, record.total_tokens)

Retries and timeouts

client = veyra.Veyra(max_retries=4, timeout=30)
client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Hello"}],
    timeout=10,
)

Raw responses

raw = client.with_raw_response.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Hi"}],
)
print(raw.request_id)
print(raw.http_status)

Async streaming

import asyncio
import veyra

async def main() -> None:
    async with veyra.AsyncVeyra() as client:
        stream = await client.chat.completions.create(
            model="gpt-5.4-mini",
            messages=[{"role": "user", "content": "Count to 3"}],
            stream=True,
        )
        async with stream:
            async for chunk in stream:
                print(chunk.choices[0].delta.content or "", end="")

asyncio.run(main())

Full docs: docs/

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

tubox_veyra-1.0.1.tar.gz (74.7 kB view details)

Uploaded Source

Built Distribution

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

tubox_veyra-1.0.1-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file tubox_veyra-1.0.1.tar.gz.

File metadata

  • Download URL: tubox_veyra-1.0.1.tar.gz
  • Upload date:
  • Size: 74.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tubox_veyra-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b33dd65ce71052ecaadc7798c9185ed0ed42fb1aecd8f1e5e10adf99323d4731
MD5 389d4ff27b4e3f2c448b789723e7c6cc
BLAKE2b-256 97e75f66a91d6b43aeaf03bd219845c5f3f9145bc6ab646f5d9f0f94e2227b0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tubox_veyra-1.0.1.tar.gz:

Publisher: release.yml on tubox-labs/veyra-python

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

File details

Details for the file tubox_veyra-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: tubox_veyra-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tubox_veyra-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d349c5416c9c400e42c01e7e71a109e4ad5b55b7738e4d020fa937d151e5b30
MD5 74d09721095b51c84b0c1d1260f0498b
BLAKE2b-256 83b0a2ff7818c1b605f7bec149ee63aed57052ac7b98757c0a981d9af3166f63

See more details on using hashes here.

Provenance

The following attestation bundles were made for tubox_veyra-1.0.1-py3-none-any.whl:

Publisher: release.yml on tubox-labs/veyra-python

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