Developers

Mathematical narration, over a small API.

Send text and LaTeX, inspect the spoken script and the quote for each mode, then render and download audio, captions and the script. Every step the studio does is available to your code.

Overview

The API mirrors the studio workflow: you prepare a plan, which writes every formula out as spoken words and prices it; you check the plan’s spoken text and issues; you render it as a job in one of two modes; and you download the results. Nothing is charged until a render is delivered.

ModeVoice idCreditsTypical turnaround
Standardevaria-standard1 per characterSeconds to a few minutes
Studioevaria-studio2 per characterSeveral minutes

The older ids evaria-formula and evaria-lecture are accepted as aliases of evaria-standard and evaria-studio.

Quickstart

Set EVARIA_API_URL to https://evaria.ai/api/narration and EVARIA_API_KEY to a key from your dashboard. The example prepares a plan, renders it in Standard and saves the MP3.

export EVARIA_API_URL="https://evaria.ai/api/narration"
export EVARIA_API_KEY="ev_live_..."   # create one in your dashboard

# 1. Prepare a speech plan and read the quote for each mode.
curl -s "$EVARIA_API_URL/v1/plans" \
  -H "Authorization: Bearer $EVARIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "mathematics",
    "segments": [
      {"kind": "text", "text": "The area under the curve from zero to one is"},
      {"kind": "latex", "text": "\\int_0^1 x^2\\,dx = \\frac{1}{3}"}
    ]
  }'
# -> {"id": "plan_...", "ready": true, "issues": [],
#     "quote": {"characters": ..., "by_voice": {"evaria-standard": ..., "evaria-studio": ...}}, ...}

# 2. Render with the exact quoted credits for the mode you choose.
#    Reuse the same Idempotency-Key when you retry this request.
curl -s "$EVARIA_API_URL/v1/jobs" \
  -H "Authorization: Bearer $EVARIA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"plan_id": "'"$PLAN_ID"'", "voice": "evaria-standard", "expected_credits": '"$CREDITS"'}'

# 3. Poll until the state is review_required, then download.
curl -s "$EVARIA_API_URL/v1/jobs/$JOB_ID" -H "Authorization: Bearer $EVARIA_API_KEY"
curl -s -o narration.mp3 "$EVARIA_API_URL/v1/jobs/$JOB_ID/audio?format=mp3" \
  -H "Authorization: Bearer $EVARIA_API_KEY"

Authentication

Send your key in the Authorization header of every request: Authorization: Bearer ev_live_…. Keys are created in the dashboard and shown only once; store them in a secret manager and revoke any key you suspect is exposed. Older keys that start with sv_ keep working.

A key spends your account’s credits. Call the API from your server — never embed a key in a web page, mobile app or public repository.

Plans and quotes

POST /v1/plans accepts typed segments. text segments are read as prose, latex segments are written out as spoken mathematics, and pause segments add silence. Use spoken_override to give the exact reading for a segment, symbols to declare what single letters are (scalar, matrix, vector, function, set, event or probability), and glossary for pronunciations.

POST /v1/plans — request body
{
  "domain": "mathematics",
  "language": "en",
  "segments": [
    {"kind": "text", "text": "Let A be a square matrix."},
    {"kind": "latex", "text": "A v = \\lambda v"},
    {"kind": "pause", "pause_ms": 400},
    {"kind": "latex", "text": "\\det(A - \\lambda I) = 0",
     "spoken_override": "the determinant of A minus lambda I equals zero"}
  ],
  "symbols": {"A": "matrix", "v": "vector"},
  "glossary": {"Laplacian": "la-PLAY-see-an"}
}

The response contains the plan id, the prepared segments (their spoken_text is exactly what will be said), any issues, whether the plan is ready, and a quote:

quote
"quote": {
  "characters": 128,
  "credits": 128,
  "by_voice": {"evaria-standard": 128, "evaria-studio": 256},
  "unit": "unicode_characters_in_prepared_speech"
}

A plan with issues is not ready: read each issue, supply a spoken_override for the affected segment and prepare the plan again. Automatic readings that raise no issue can still be wrong, so check the spoken text before you publish audio made from it.

Jobs

POST /v1/jobs with {"plan_id", "voice", "expected_credits"} renders a ready plan. expected_credits must equal quote.by_voice[voice], so you are never charged more than the quote you saw. Send a unique Idempotency-Key header (8–128 characters) with each new job and reuse it when retrying the same request: the job is created and its credits reserved exactly once.

Jobs move from queued to running to review_required when the audio is ready. You can then record a review with POST /v1/jobs/{id}/review (complete or revision_requested). A job can also end as failed or cancelled, which release the reserved credits. Poll Standard jobs every few seconds and Studio jobs every 10–15 seconds; Studio renders take minutes, especially when the engine is starting.

Credits are reserved at submission and charged once when the audio is delivered. Jobs that are rendering or waiting for review count toward your plan’s limit of active jobs (Free: 2 · Creator: 4 · Pro: 8).

Downloads

  • GET /v1/jobs/{id}/audio?format=wav — 24 kHz mono WAV (the default).
  • GET /v1/jobs/{id}/audio?format=mp3 — MP3 for streaming and sharing.
  • GET /v1/jobs/{id}/captions — WebVTT captions, timed at utterance boundaries (not word by word).
  • GET /v1/jobs/{id}/transcript — the spoken script as plain text.

Download the files you need to keep; see the privacy notice for how long audio is stored.

Documents

For whole documents, send the raw file to POST /v1/documents/import?format=latex&filename=notes.tex (or format=pdf). The response is a private draft split into chapters and passages; importing is free. Compile one chapter with POST /v1/narration/plans and {"draft", "chapter_id", "overrides"}, where overrides carry your corrected spoken text for individual passages, bound to each passage’s source_sha256. The result is a normal plan with a quote.

A PDF is read with mathematics recognition in the background: the import answers 202 with {"import_id", "status": "processing"}. Poll GET /v1/documents/imports/{import_id} every few seconds until status is complete (with the draft) or failed (with an error). Select at most 30 pages with first_page and last_page. Each recognised page must be confirmed before rendering: send "ocr_pages_checked": {"<page>": "<page_sha256>"} in the overrides, using each passage’s ocr_review.

Recognition can misread symbols and structure. Check every passage from a PDF against the original page; LaTeX sources give the best results.

Endpoint reference

All paths are relative to https://evaria.ai/api/narration. Requests and responses are JSON unless noted. API key management and account deletion are available only in the dashboard.

MethodPathPurpose
GET/v1/voicesThe narration modes and their credit multipliers.
POST/v1/plansPrepare a speech plan from typed text and LaTeX segments.
GET/v1/plans/{id}Retrieve a saved plan.
POST/v1/documents/importImport a LaTeX or PDF document as a private draft (no credits).
GET/v1/documents/imports/{id}Poll a PDF import that returned 202 until its draft is ready.
POST/v1/narration/plansCompile one chapter of a draft, with your corrections, into a plan.
POST/v1/jobsRender a plan in a mode. Requires Idempotency-Key.
GET/v1/jobsList your jobs, newest first (limit, cursor).
GET/v1/jobs/{id}Job state, credits, voice and audit summary.
POST/v1/jobs/{id}/cancelCancel a queued or running job and release its credits.
POST/v1/jobs/{id}/reviewRecord “accept” or “reject” after listening to all of it.
DELETE/v1/jobs/{id}Delete the stored audio; charges are unchanged.
GET/v1/jobs/{id}/audioDownload audio: format=wav (default) or mp3.
GET/v1/jobs/{id}/captionsWebVTT captions timed at utterance boundaries.
GET/v1/jobs/{id}/transcriptThe prepared spoken script as plain text.
GET/v1/meAccount, plan, balance, limits and features.
GET/v1/billing/catalogPublic plans, top-ups and minute estimates (no key needed).
GET/v1/billing/historyYour credit ledger, newest first (limit, cursor).
POST/v1/promo/redeemRedeem a promotional code.
GET/v1/account/exportExport your account data as JSON.

Errors

Errors use standard HTTP status codes and a JSON body of the form {"error": "A human-readable message"}. Responses with status 429 or 503 may include a Retry-After header in seconds.

StatusMeaning
400The request is malformed, for example invalid JSON or a bad Idempotency-Key.
401The API key is missing, malformed, revoked or unknown.
402Not enough available credits for this job.
403The operation needs a signed-in website session (API keys cannot manage keys or delete the account).
404The plan, job or resource does not exist on your account.
409A conflict: the quote differs from expected_credits, an Idempotency-Key was reused for a different request, or the job is in the wrong state.
413The request or document is larger than the limit.
422Validation failed: the plan has unresolved issues, an utterance is too long, a voice is unknown, or a document could not be read.
429Too many requests, or your plan’s limit of active jobs is reached. Wait for Retry-After, or review finished jobs.
503Temporarily unavailable. Retry later; job submissions are safe to retry with the same Idempotency-Key.

Limits

  • Typed plans: 1–80 segments, at most 1,500 characters per segment and 15,000 in total.
  • Each prepared utterance must be at most 700 characters; divide longer sentences.
  • Document import: PDFs up to 20 MB, LaTeX up to 1 MB. Chapters of at most 300 passages.
  • Active jobs at once — Free: 2 · Creator: 4 · Pro: 8. A job counts while it is queued, running or waiting for review.
  • Very long chapters may exceed the maximum size of one job; the API answers 422 with the limit, and you can split the chapter into sections.
  • Sign-in, promo codes, contact requests and job submission are rate-limited; honour Retry-After.

New accounts start with 20,000 free credits. See pricing for plans and top-ups.

Support

Questions, integration help or a misreading to report? Use the contact form or email hello@evaria.ai. Include the job or plan id — never your API key.