API reference
Transcribe audio
POST /api/pub/v1/transcriptions, turn an audio file into text.
POST
https://api.dhanu.ai/api/pub/v1/transcriptionsTranscribes one audio file sent as a multipart request (field audio) and returns
the text. It runs synchronously, so keep clips to a few minutes; for long recordings
upload the file and start a task instead. Billed per call; a test key returns a
fixture transcript at no cost.
Request
curl -X POST https://api.dhanu.ai/api/pub/v1/transcriptions \
-H "Authorization: Bearer $DHANU_API_KEY" \
-F "audio=@standup.m4a"const { text } = await dhanu.transcriptions.create({
data: await fs.readFile("standup.m4a"),
filename: "standup.m4a",
mimeType: "audio/mp4",
});with open("standup.m4a", "rb") as fh:
transcript = dhanu.transcriptions.create(data=fh.read(), filename="standup.m4a", mime_type="audio/mp4")
print(transcript.text) Response
201 Created
{ "text": "Yesterday I finished the invoice export…", "cost": { "amount": 12, "currency": "NPR" } }
Errors
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
invalid_request_body | 422 | The body did not match the schema; error.issues names each field. |
project_id_required | 422 | A multi-project key called without projectId. |
insufficient_credits | 402 | The workspace credit balance is zero or below. |
key_spend_limit_reached | 402 | The key reached its monthly spend cap. |
invalid_generation_prompt | 422 | The prompt was empty or longer than 2000 characters. |
unsupported_media_type | 415 | The file type is not accepted. |