Sol Python SDK
Official synchronous and asynchronous Python client. Requires Python 3.10+.
Install
python -m pip install buildsol
Install the official buildsol package from PyPI. For development, clone this repository and run pip install -e './python[dev]'.
Set SOL_API_KEY on your server, then:
from buildsol import Sol
with Sol() as sol:
voices = sol.voices.list(country="PE")
voice_id = voices["voices"][0]["id"] # handle an empty catalogue in your app
with sol.speech.stream(
text="Hola, tu pedido llega mañana.", voice_id=voice_id, speed=1.0
) as audio:
print(audio.request_id)
audio.save("speech.mp3")
AudioStream is an iterator of unchanged bytes. Always use its context manager so an early exit closes the connection. speech.create() returns Audio with .content, .headers, .request_id and .save(path) after downloading the full result. reference_file= supports multipart references; the JSON reference_audio= field is base64 text. Do not combine references with voice_id.
Async and incremental bytes
import asyncio
from buildsol import AsyncSol
async def main():
async with AsyncSol() as sol:
async with sol.speech.stream(text="Buenos días.", output_format="pcm") as audio:
async for chunk in audio:
print(len(chunk)) # forward to your own compatible playback pipeline
asyncio.run(main())
Transcription, translation and voices
from buildsol import Sol
with Sol() as sol:
transcript = sol.transcriptions.create(
file="recording.wav",
language="es",
diarize=True,
transcription_style="verbatim",
idempotency_key="recording-2026-001",
)
print(transcript["text"], transcript["billing"])
translated = sol.translations.create(
text="Buenos días.",
source_language="es",
target_language="pt",
idempotency_key="translation-2026-001",
)
print(translated["translation"])
print(sol.controls.get(), sol.dialects.list(), sol.balance.get())
# Only with the speaker's permission; creates an account voice:
# voice = sol.voices.create(name="Mi voz", audio="reference.wav", consent=True)
# sol.voices.get(voice["voice"]["id"])
# sol.voices.delete(voice["voice"]["id"]) # irreversible
File inputs accept a path, Path, bytes (default filename audio.wav), an open binary file, (filename, bytes) or (filename, bytes, content_type). Uploads are read into memory once, allowing safe idempotent replay of accepted small uploads. The SDK does not close caller-owned file objects.
File SSE:
with Sol() as sol:
with sol.transcriptions.stream(file="recording.wav", language="es") as events:
for event in events:
print(event) # segment, metadata, completed; an error raises APIError
This does not make file transcription real-time. Use a live session for microphone input. See live_python.py for concurrent sending, real-time pacing and finalization. LiveConnection and AsyncLiveConnection can also consume a pre-issued single-use session. Live receive timeout defaults to 30 seconds; close the connection when done. No token is reused or reconnected automatically.
Configuration and errors
from buildsol import Sol, APIError, ConnectionError, TimeoutError
with Sol(timeout=120.0, max_retries=2) as sol:
try:
balance = sol.balance.get(timeout=15.0)
except APIError as error:
print(error.status_code, error.code, error.request_id)
except TimeoutError:
print("Request timed out")
except ConnectionError:
print("Connection interrupted")
Optional api_key=, base_url= and http_client= configure the client. HTTPX's timeout is a per-network-operation timeout (connect/read/write/pool), in seconds. Cancel an async task normally; async with releases resources. AuthenticationError, PermissionDeniedError, NotFoundError and RateLimitError subclass APIError; .details and .headers retain server information. ProtocolError reports malformed server events/JSON. Never log secrets or full audio.
Retries are limited to GET or explicit-idempotency transcription/translation requests; TTS is never automatically retried. Partial-stream failures preserve the partial file and raise an error; the caller should remove or label incomplete files. See the repository README for full API coverage, limits, token rules and billing distinctions.
Metadata
Release files for buildsol 0.1.1
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 |
|---|---|---|---|---|
| buildsol-0.1.1.tar.gz | 14.0 kB | With provenance | Details for buildsol-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| buildsol-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for buildsol-0.1.1-py3-none-any.whl |
Total release size: 29.1 kB
Release files / buildsol-0.1.1.tar.gz
| Download URL | buildsol-0.1.1.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9bb00fb65d76c4b64a41623c8847617311bf2c91f0878c70ca724a136f7d45b
|
|
BLAKE2b-256 checksum How to use checksums |
c3cf4a48a6e9d7cd636d0b83b914a17de1734fb32d20cef7a94818047e41c311
|
| 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 7, 2026.
Transparency logRelease files / buildsol-0.1.1-py3-none-any.whl
| Download URL | buildsol-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e48a25974f7e88144a337d537cb393ca6b693e27fa5354a94285a556bacd4156
|
|
BLAKE2b-256 checksum How to use checksums |
4506509848dc6bbaeb462ba132a5f6efd0f8bf3f3329a0cc841d5b2155e3cab5
|
| 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 7, 2026.
Transparency logSecurity for buildsol 0.1.1
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.
Attestation for buildsol-0.1.1.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 7, 2026.
Transparency logA 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.