SolDocs

Build with Sol.

Turn text into speech, clone a voice, or translate text. Use HTTPS with a server-side API key.

Base URLhttps://api.buildsol.ai

Your first request

  1. Sign in, then create a key in API Keys.
  2. Set SOL_API_KEY in your server environment. Install the Python or JavaScript SDK. Python 3.10+ or Node.js 20+ is required.
  3. Generate a file with the default voice:

The response body is audio. A default preset must be configured and an inference server must have capacity. The request deliberately leaves out model-specific controls.

SDKs use https://api.buildsol.ai by default. Set base_url (Python) or baseURL (JavaScript) only for another trusted environment. cURL examples require --fail-with-body (cURL 7.76 or later); a nonzero exit means failure, even if an output file was written.

# pip install buildsol
from buildsol import Sol

with Sol() as sol:  # reads SOL_API_KEY
    with sol.speech.stream(
        text="Hola, tu pedido llega mañana.", speed=1.0,
    ) as audio:
        audio.save("speech.mp3")

Python and JavaScript SDKs

Official clients for streaming speech, voices, transcription and translation. Python supports synchronous and asynchronous code; JavaScript includes TypeScript types, ESM and CommonJS for Node.js.

Version 0.1.1 is available on PyPI and npm. Install the official buildsol package using the commands below.

python -m pip install buildsol

PyPI · npm · Source code and examples · Python guide · JavaScript and TypeScript guide · Downloads and checksums

What is included

FeaturePythonJavaScript
Audio generation and streamingspeech.create / speech.streamspeech.create / speech.stream
Voice catalogue and cloningvoices.list / get / create / deletevoices.list / get / create / delete
Controls, accents and balancecontrols.get / dialects.list / balance.getcontrols.get / dialects.list / balance.get
File transcription and SSEtranscriptions.create / streamtranscriptions.create / stream
Live transcriptionlive.create_session / live.connectlive.createSession / live.connect
Translationtranslations.createtranslations.create

Both clients read SOL_API_KEY from the server environment. Never put permanent API keys in browser or mobile bundles. The SDKs preserve your text, voice, tags, speed and audio bytes.

Stream as soon as audio arrives

import asyncio
from buildsol import AsyncSol

async def main():
    async with AsyncSol() as sol:
        async with sol.speech.stream(text="Buenos días.") as audio:
            async for chunk in audio:
                print(len(chunk))  # forward to your playback pipeline

asyncio.run(main())

Use stream() for incremental chunks and create() for a complete audio result. save() writes audio to a file; it does not implement browser playback. Close streams when you stop reading. Python uses with / async with; JavaScript supports for await and close().

Errors, retries and cancellation

Transient GET failures retry up to twice by default. Transcription and translation retry only when you supply an idempotency key. Speech generation, voice creation/deletion and live session creation are never automatically retried. A partial stream is never replayed.

Python timeout is in seconds per network operation; JavaScript timeoutMs covers each HTTP attempt including the body. Use async task cancellation in Python or AbortSignal in JavaScript. APIError preserves the status, code, details and request ID.

Live transcription uses single-use session tokens and raw PCM16LE at 16 kHz mono. Send audio at real-time speed, send stop, then wait for completed. File SSE is not live microphone transcription. See the SDK guides for complete runnable examples.

from buildsol import Sol, APIError

with Sol(timeout=120, max_retries=2) as sol:
    try:
        result = sol.translations.create(
            text="Buenos días.", source_language="es", target_language="pt",
            idempotency_key="order-2026-001",
        )
        print(result["translation"])
    except APIError as error:
        print(error.status_code, error.code, error.request_id)

Authentication

Send the key on every /v1 request. Keep it on your server, outside public client code and repositories.

Keys may be disabled, expired or revoked. Manage them in the dashboard. A key belongs to one account; it does not grant access to other accounts’ private voices.

Request header
Authorization: Bearer $SOL_API_KEY

Text to speech

POST/v1/text-to-speech

Accepts JSON, or multipart form data for an uploaded reference. Returns audio on success and JSON on errors before streaming begins.

Multiple audio tags

Write tags directly in text; no extra API parameter is needed. The same syntax works in the playground and the API.

Mi familia fue de paseo a Sao Paulo. [suspiro].
Ojalá hubiese podido ir con ellos, pero estoy segura que el próximo año podré acompañarlos.
[emocionado] Pero cuéntame, ¿Tú cómo vas?

Tags may be written in Spanish, English or both in the same text. The API uses a regular expression to replace supported Spanish tags with their English equivalents before synthesis. English tags and the words outside brackets are left unchanged.

For example, [suspiro] becomes [sighs] and [emocionado] becomes [excited]. Spanish tags accept uppercase and lowercase, and gender variants such as [emocionada].

Spanish tag equivalents
SpanishEnglish
emocionado, emocionada[excited]
feliz, alegre[happy]
sorprendido, sorprendida[surprised]
cálido, cálida[warmly]
triste[sad]
curioso, curiosa[curious]
nervioso, nerviosa[nervous]
cansado, cansada[tired]
enojado, enojada, enfadado, enfadada[angry]
tranquilo, tranquila, calma[calm]
susurro, susurrando[whispers]
grito, gritando[shouts]
suave[softly]
normal[normal]
lento, lenta, despacio[slow]
rápido, rápida[fast]
neutro, neutra, reiniciar[neutral]
risa, risas, riendo[laughs]
suspiro, suspiros[sighs]
respiración, respira[breath]
respiración rápida[quick_breath]
tos, tosiendo[cough]
siseo[hissing]
chasquido de labios[lipsmack]
cacareo[clucking]
ruido[noise]
ruido vocal[vocalized-noise]
tarareo[mn]

Put each tag in square brackets. Spaces or underscores are accepted in multiword Spanish tags. Accented tags also accept their unaccented spelling.

Emotions, delivery and pace apply to the following words. A new tag replaces the previous one in its category. Combine categories, or use [neutral] to reset all styles. Sounds happen where you place them.

Your original text is kept in History and used for character billing. The playground always sends the ID of the named voice shown in the voice picker.

Read inline_tags from GET /v1/tts/controls for the current tag catalog and aliases. [laughs] and [laughter] are equivalent; [sighs] and [sigh] are equivalent. Unsupported or malformed tags return HTTP 400 before charging.

Expression varies by voice. [yawns] is not supported. Use <strong>words</strong> for emphasis. Tags count toward the character limit and usage.

FieldTypeDetails
textstringRequired. Nonblank text, up to 3 000 Unicode characters per request, including whitespace and punctuation.
voice_idstringOptional. An ID from GET /v1/voices. Without a reference or controls, the default preset is selected.
countrystringOptional national accent, paired with gender and age. Read the valid combinations from GET /v1/tts/controls.
genderstringfemale or male. Part of structured voice controls.
agestringyoung, middle_aged or old. Support varies by country and gender.
stylestringOptional structured style. neutral by default; use values advertised by the controls endpoint.
style_positionstringstart, middle or end; only for whispers, laughs and sighs.
dialectstringOptional catalogue code, accepted only when a deployed model supports it. See dialect availability.
instructionstringOptional delivery guidance, up to 500 characters. Interpretation depends on the model.
speednumber0.5 to 2.0; default 1.0.
streambooleanStreaming is always enabled. The legacy flag is accepted for compatibility; setting it to false does not buffer audio.
output_formatstringmp3 (default), wav or pcm.
reference_audiofile / base64Optional voice reference, up to 10 MiB by default. Send a multipart file or a base64 string; do not also send voice_id.
reference_textstringOptional transcript of the reference audio; trimmed and limited to 1 000 characters.
reference_filenamestringOptional filename for a base64 reference, including its audio extension.
seedintegerOptional value from 0 to 2 147 483 647 for comparing requests. It does not guarantee identical output.

Choose an existing voice

This example obtains a real voice ID before generating a WAV file.

Response headers

HeaderMeaning
Content-Typeaudio/mpeg, audio/wav or audio/pcm.
X-CharactersCharacter count for the request.
X-Sample-Rate24000.
X-Request-IdRequest identifier. Keep it for support.
X-Voice-IdSelected voice, when a saved or preset voice was used.
X-Model-VersionModel version, when available.
X-Sol-WarningMay contain voice_mismatch when the selected preset's demographics differ from the requested controls.
from buildsol import Sol

with Sol() as sol:
    voices = sol.voices.list()["voices"]
    if not voices:
        raise RuntimeError("No voices are available.")
    with sol.speech.stream(
        text="Hola, gracias por llamar.", voice_id=voices[0]["id"],
        speed=1.0, output_format="wav",
    ) as audio:
        audio.save("speech.wav")

Voice controls

GET/v1/tts/controls

Query the deployed models before offering countries, genders, ages or styles in your application.

from buildsol import Sol
with Sol() as sol:
    print(sol.controls.get())
Response fieldPurpose
structuredA controls object, or null when no deployed model offers structured controls.
structured.countriesEach country’s code, names and combinations, mapping gender to supported ages.
structured.stylesSupported value and labels. positions indicates whether a style accepts a position.
structured.positionsAllowed position values and labels.
structured.model_versionsVersions contributing structured controls.
dialectsWhether any deployed model supports explicit dialect control. This is not a per-dialect guarantee.

Send country, gender and age together. Missing values may be filled from an explicitly selected voice. Without a voice ID, Sol selects a preset, preferring matching demographics and falling back when necessary.

National controls and regional dialects are different request modes. Do not add a regional dialect to a structured-controls request. Unsupported combinations return an error before billing.

Use supported controls
from buildsol import Sol

with Sol() as sol:
    controls = sol.controls.get()["structured"]
    if not controls or not controls["countries"]:
        raise RuntimeError("Structured controls are not available.")
    country = controls["countries"][0]
    gender, ages = next(iter(country["combinations"].items()))
    with sol.speech.stream(
        text="Mañana salimos temprano.", country=country["code"],
        gender=gender, age=ages[0], speed=1.0,
    ) as audio:
        audio.save("speech.mp3")

Streaming

Every speech request returns chunks as the model produces them, including at speeds other than 1.0. These examples write the stream incrementally to a file. The website plays the first audio as it arrives and saves the completed recording to History.

Check the HTTP status before consuming the body. A failure before the first audio chunk returns JSON and refunds the speech charge. Once audio has been sent, an interrupted stream remains charged and may end without a JSON error. Keep the request ID and handle incomplete audio in your client.

# Install the SDK: https://www.buildsol.ai/docs#sdks
from buildsol import Sol

with Sol() as sol:  # reads SOL_API_KEY
    with sol.speech.stream(
        text="Hola, tu pedido llega mañana.", speed=1.0,
    ) as audio:
        audio.save("speech.mp3")

Emotion and style

Structured styles are advertised by /v1/tts/controls. Possible values include excited, whispers, laughs, sighs, surprised, warmly, sad and curious. Only send values supported by the deployment.

Use instruction for additional free-form guidance, such as Habla con calma y voz suave. It can accompany structured controls, but the result depends on the model. Test the delivery with your own text.

Voice catalogue

GET/v1/voices

Returns {"voices": [...]} containing public presets and your private voices. Filter with ?country=MX&gender=female&age=young; filters apply to voice metadata.

Each voice includes id, name, description, gender, age_group, country, kind, dialect, preview_url, is_default and created_at. A dialect or preview URL can be null. Preview URLs are generated with a one-hour expiry.

GET/v1/voices/{voice_id}

Returns {"voice": {...}} for an accessible voice. Use an ID returned by the catalogue.

Voice cloning

POST/v1/voices

Creating a voice is free and needs no additional model training. Upload at least one minute of a single speaker; the first 30 seconds are used as the voice reference. Speech generation uses your credit balance: 10 000 free each month, or 100 000 with an approved creator application. Apply to the creator program.

Upload a sample as multipart form data. The saved voice is private to your account. Use only your own voice or a recording you have permission to clone.

FieldTypeDetails
namestringRequired. Nonblank, up to 60 characters.
audiofileRequired. WAV, MP3, M4A, WEBM, OGG or FLAC. Up to 25 MiB by default. Use a clear recording of at least one minute.
consentbooleanRequired. Send true to confirm the speaker’s permission.
transcriptstringOptional transcript of the first 30 seconds, trimmed and capped at 1 000 characters.
dialectstringOptional catalogue code describing the speaker.
genderstringOptional: female, male or neutral.
age_groupstringOptional: young, middle_aged or old.
countrystringOptional two-letter country code; inferred from a Spanish dialect when omitted.
descriptionstringOptional description, limited to 200 characters.

Place your authorized recording at sample.wav before running the example. Success returns 201 and {"voice": {...}}.

DELETE/v1/voices/{voice_id}

Deletes one of your own cloned voices and its stored sample. Returns {"ok": true}. Requests using a deleted voice return 404.

from buildsol import Sol

# Only with permission from the speaker.
with Sol() as sol:
    result = sol.voices.create(name="My voice", audio="sample.wav", consent=True)
    print(result["voice"]["id"])

Accents and languages

GET/v1/dialects

Returns {"dialects": [...]} with each active catalogue entry’s code, name, language, country, country_code, region and group.

The catalogue does not establish model support. If /v1/tts/controls returns dialects: false, omit explicit dialects and use supported structured controls or a voice ID. An unsupported code returns unsupported_dialect. Do not assume every listed voice can speak every language.

Audio formats

output_formatContent-TypeResponse
mp3audio/mpegMP3 audio; the default.
wavaudio/wavWAV audio.
pcmaudio/pcmRaw PCM audio; configure playback for the model’s encoding.

The API sends X-Sample-Rate: 24000. Speed ranges from 0.5 to 2.0. Confirm the encoding and streaming behavior with the deployed model before connecting a player.

Balance and billing

GET/v1/balance

Returns characters_remaining, free_remaining, subscription_remaining, topup_remaining and free_resets_at.

Speech uses one credit per Unicode character, including spaces and punctuation. Free credits are spent first, followed by subscription credits and top-ups. Top-ups do not expire. See Usage for daily and per-key reporting.

Failed speech requests are refunded unless audio has already been streamed. Translation uses a separate USD balance or an approved evaluation quota.

Errors

Before audio starts, failures return an HTTP error status and a JSON body. Some include error.details.

StatusCodeAction
400invalid_requestCorrect the field identified by the message.
400unsupported_combinationChoose an age from error.details.available_ages.
400unsupported_country / unsupported_styleRefresh the controls endpoint and choose a supported value.
400dialect_conflictRemove the conflicting dialect from the controls request.
400controls_unavailable / unsupported_dialectCheck deployed capabilities; try the default voice without optional controls.
401unauthorized / key_disabled / key_expiredCheck the key and its status in the dashboard.
402insufficient_charactersAdd speech credits or change plans.
402insufficient_translation_creditCheck translation credit or request evaluation access.
403account_suspended / voice_limitContact support, or remove a saved voice if the voice limit was reached.
404not_foundCheck the resource ID and account access.
413text_too_long / file_too_largeReduce the text or audio size.
429rate_limited / too_many_concurrent_requestsWait for the Retry-After interval before retrying.
502model_errorRetry with backoff. Failed requests before audio are refunded.
503no_capacity / no_voicesRetry after Retry-After when present; no_voices requires a configured voice.

Retried generation requests can create a new charge if the original succeeded. After an ambiguous network failure, check usage before submitting the same text again.

Example error
{
  "error": {
    "code": "invalid_request",
    "message": "Add the text to speak."
  }
}

Limits and pricing

Speech limit: 3 000 characters per request. Split longer texts into separate requests. The dashboard shows your current account limits. Default translation limit, when enabled: 5 000 characters per request. Reference upload limit: 10 MiB.

PlanUSD / monthCharactersRequests / secConcurrentSaved voices
Free0 USD10 0002101
Starter2 USD200 0003105
Plus10 USD1 000 00051010
Pro30 USD3 000 00081030
Scale100 USD10 000 0001020100

Request limits apply per account per second, shared across all API keys and products. Account-specific limits take priority. Concurrency is a separate limit. Paid speech plans and top-ups cost 10 USD per million characters. Prices are in USD. Plans can change; check your dashboard before purchasing.

Speech to Text

sol-transcribe-v1 supports two modes: live transcription as you speak, and transcription of uploaded recordings. Both support 60 languages, including Spanish, Portuguese, English, French, German and Italian.

Live transcription

POST/v1/audio/transcription-sessions

Create a session with your API key, then connect to the returned WebSocket URL. The single-use token expires after 60 seconds. Send a start message containing that token and wait for ready before sending audio. Keep API keys on your server; only pass a session token to a browser.

wss://api.buildsol.ai/v1/audio/transcriptions/live

Send binary frames of raw PCM16 little-endian audio, mono at 16 kHz, at normal playback speed. Use small frames, such as 100 ms (3 200 bytes); the maximum frame size is 64 KB. The ready event reports the session limit, up to 5 minutes depending on your balance.

# Install: https://www.buildsol.ai/docs#sdks
# audio.wav: mono, 16 kHz, PCM16. Sent at playback speed.
import asyncio
import wave
from buildsol import AsyncSol

async def main():
    async with AsyncSol() as sol:
        async with sol.live.connect(language="es") as live:
            async def send_audio():
                with wave.open("audio.wav", "rb") as audio:
                    assert (audio.getnchannels(), audio.getframerate(), audio.getsampwidth()) == (1, 16000, 2)
                    while chunk := audio.readframes(1600):
                        await live.send_audio(chunk)
                        await asyncio.sleep(len(chunk) / 32000)
                await live.stop()
            async def receive():
                async for event in live:
                    if event["type"] in ("transcript", "completed"):
                        print(event["text"])  # replace the cumulative text
            tasks = [asyncio.create_task(send_audio()), asyncio.create_task(receive())]
            try:
                await asyncio.gather(*tasks)
            finally:
                for task in tasks:
                    if not task.done(): task.cancel()
                await asyncio.gather(*tasks, return_exceptions=True)

asyncio.run(main())

Each transcript event contains the current full text: replace the text on screen instead of appending it. Interim text can change as more audio arrives. Send {"type":"stop"} when you finish, then wait for completed to receive the final text, usage and billing. Live transcription does not return speaker labels or timestamps.

Live price: 0.54 USD per hour of audio (0.009 USD per minute). Only audio sent is counted; paused time is not billed. The maximum session cost is reserved temporarily and the unused amount is returned after completion. Failed or interrupted sessions and audio without recognized speech are not charged. A used session token cannot be replayed.

Uploaded recordings

POST/v1/audio/transcriptions

Send multipart/form-data with file and model=sol-transcribe-v1. Omit language for automatic detection, or set a supported code such as es, pt, fr, de or it. Audio can be up to 5 minutes and 25 MB. WAV, MP3, M4A, FLAC and WebM are supported.

This endpoint returns JSON after the uploaded recording has been processed. For live audio, use the WebSocket session above. Use diarize=true for speaker labels and transcription_style=clean to remove fillers; the default is verbatim. The response includes text, language, segments, words, usage and billing. The legacy stream=true transport returns completed segments and a completed event after processing, not live partial transcripts.

Price: 0.10 USD per hour of audio, billed using the reported audio seconds (about 0.001667 USD per minute). A temporary reservation is released after settlement. Failed requests and audio without recognized speech are not charged. Reuse the same Idempotency-Key with the same file and settings after a lost connection to avoid a second charge.

5 USD in free credit, once per account, shared by transcription and translation. Voice credits stay separate.

# Install: https://www.buildsol.ai/docs#sdks
import uuid
from buildsol import Sol

with Sol() as sol:
    result = sol.transcriptions.create(
        file="audio.wav",
        language="es",
        diarize=True, transcription_style="verbatim",
        idempotency_key=str(uuid.uuid4()),
    )
    print(result["text"])

Translation

POST/v1/translate

sol-v1-preview-translate translates between Spanish and Brazilian Portuguese, Ayacucho Chanka Quechua, Central Aymara or Paraguayan Guarani, in either direction.

Translation uses a fine-tuned Gemini 3.5 Flash endpoint. Direct translation between two non-Spanish languages is not supported.

FieldTypeDetails
modelstringOptional. sol-v1-preview-translate is the default and only supported model.
textstringRequired. Nonblank, up to 5 000 characters by default.
source_languagestringRequired: es, pt, qu, ay or gn.
target_languagestringRequired. Either the source or target must be es; the languages must differ.
request_idstringOptional idempotency key: 1–64 letters, digits, hyphens or underscores. Reuse it to recover the same response after a connection failure.

Specific language aliases are also accepted: pt-BR, quy, ayr, gug. The response uses the short codes. Idempotency-Key can also be sent as an HTTP header.

Returns id, model, translation, source_language, target_language, characters, usage and billing.

FieldTypeDetails
usage.input_tokensintegerAll prompt tokens, including the translation instruction.
usage.output_tokensintegerTranslation tokens returned by the model.
usage.thinking_tokensintegerAny reasoning tokens reported by the provider, billed at the output rate. Reasoning is disabled for this model.
billing.amountdecimal stringActual charge in USD. Zero when covered by approved evaluation access.
billing.list_price_amountdecimal stringToken-priced value before evaluation credit.
billing.ratesobjectInput and output prices used for this request, per million tokens.

Translation pricing

Launch pricing remains 0.25 USD per million input tokens and 1.50 USD per million output tokens after the Gemini 3.5 Flash upgrade. Sol customer prices are separate from provider costs. Google pricing.

Charge = (input tokens × input rate + output and reasoning tokens × output rate) / 1 000 000. For example, 1 000 input tokens and 500 output tokens cost 0.001 USD. Charges are recorded to eight decimal places.

Translation and transcription share one USD credit balance, including a one-time 5 USD trial per account. Add shared credit in Studio through PayPal; voice credits and subscriptions are separate. Translation reservations settle to actual token usage. Incomplete, rejected or failed translations are not charged. Existing approved evaluation quotas remain available.

View current rates, available credit and language directions at GET /api/translation in your signed-in Studio session. API keys use the same account balance. Usage and CSV exports include input tokens, output tokens and charges.

Validation errors return 400, insufficient credit 402, idempotency conflicts or pending requests 409, oversized input 413, and provider failures 502/503/504. Retry a lost response with the same request ID; a different text with that ID is rejected.

Measured translation quality

Historical evaluation of the previous Gemini 3.1 Flash-Lite fine-tune: AmericasNLP 2021 test, 1 003 sentences per direction. These scores do not measure the current Gemini 3.5 Flash model. BLEU and chrF++ are corpus metrics, not accuracy percentages. Evaluated on October 20, 2026 with SacreBLEU 2.5.1, BLEU tokenization 13a and chrF++ word order 2.

FieldTypeDetails
es → quyBLEU 6.06chrF++ 40.07 · Without exact training overlap: 6.06 / 40.07 (n=1002)
quy → esBLEU 25.44chrF++ 46.05 · Without exact training overlap: 25.45 / 46.06 (n=1002)
es → ayrBLEU 2.40chrF++ 28.69 · Without exact training overlap: 2.40 / 28.68 (n=1001)
ayr → esBLEU 13.97chrF++ 34.10 · Without exact training overlap: 13.98 / 34.10 (n=1001)
es → gugBLEU 6.77chrF++ 36.34 · Without exact training overlap: 6.77 / 36.33 (n=1001)
gug → esBLEU 21.67chrF++ 42.06 · Without exact training overlap: 21.68 / 42.05 (n=1001)

Some exact normalized sentences overlap with training; the secondary scores exclude them. This does not rule out paraphrase overlap. Portuguese was included in training but has no result in this benchmark. Training translations are synthetic and were not reviewed by native speakers. Benchmark source.

Review translations before publishing. Quality varies by language and context.

from buildsol import Sol
with Sol() as sol:
    result = sol.translations.create(
        text="La campaña de vacunación empieza el lunes.",
        source_language="es", target_language="qu",
        idempotency_key="my-translation-001",
    )
    print(result["translation"])