Skip to main content

Sonnely SDK for Python

Run text inference on Sonnely from Python 3.10 or newer. Create a funded Sonnely API key and store it server-side as SONNELY_API_KEY.

import os
from sonnely import Sonnely

sonnely = Sonnely(os.environ["SONNELY_API_KEY"])
request = {
    "model": "z-ai/glm-5.3-flash",
    "messages": [{"role": "user", "content": "Describe winter in two words."}],
    "max_tokens": 128,
    "max_cost_microusd": 500,
}
result = sonnely.complete(request, receipt=True)
print(result["choices"][0]["message"]["content"], result["usage"])

Call models() for live routes and rates. Use stream(request, receipt=True) for an iterator that yields text deltas and final usage. The iterator requires the gateway's settlement marker to complete normally. Each completion or stream is billed separately.

SDK guide · API reference · Usage

Metadata

Release files for sonnely-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sonnely-sdk 0.1.2
File Size Uploaded Provenance Actions
sonnely_sdk-0.1.2.tar.gz 2.9 kB With provenance Details for sonnely_sdk-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sonnely-sdk 0.1.2
File Interpreter ABI Platform Actions
sonnely_sdk-0.1.2-py3-none-any.whl Python 3 none any Details for sonnely_sdk-0.1.2-py3-none-any.whl

Total release size: 6.1 kB

Release files / sonnely_sdk-0.1.2.tar.gz

Download URL sonnely_sdk-0.1.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ecd51c201987f4a2c2c911f2605eecf54e944d65d2a70b6ff08f381502ce84b4
BLAKE2b-256 checksum
How to use checksums
9b8faa9eee65b0ac1a8846ab8631e2ae37ec265605b42581a4ebb27317542286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / sonnely_sdk-0.1.2-py3-none-any.whl

Download URL sonnely_sdk-0.1.2-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ac8d1d3628462f60aaa6b0db136f3a238445598b84a8e093276490546671fef
BLAKE2b-256 checksum
How to use checksums
7b9828e208a38cb866dfb115c40abddd7c9116426ef2de097a598888ed5e2f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for sonnely-sdk 0.1.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sonnely_sdk-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

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

0.1.2 This release

2 release files Full 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