AssemblyAI

AssemblyAI is an applied AI company offering models for audio transcription, content moderation, summarization, topic detection, and more. Route AssemblyAI calls through the Respan gateway to get full observability over every transcription request.

Create an account at platform.respan.ai and grab an API key. For gateway, also add credits or a provider key.

Run npx @respan/cli setup to set up with your coding agent.

AssemblyAI is a gateway-only integration. The endpoint is https://api.respan.ai/api/assemblyai/.

Setup

1

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export ASSEMBLYAI_API_KEY="YOUR_ASSEMBLYAI_API_KEY"
2

Wrap the AssemblyAI client to point at Respan

1import os
2import json
3from base64 import b64encode
4from assemblyai import Transcriber, Client, Settings, TranscriptStatus
5
6BASE_URL = "https://api.respan.ai/api/assemblyai/"
7
8class RespanAssemblyAIClient(Client):
9 """AssemblyAI client wrapper that routes through the Respan gateway."""
10
11 def __init__(self, respan_api_key: str, headers: dict):
12 settings = Settings(api_key=respan_api_key, base_url=BASE_URL)
13 super().__init__(settings=settings)
14 self._http_client.headers.update(headers)
15
16respan_params = {
17 "metadata": {"paid_user": "true"},
18 # other respan parameters...
19}
20
21respan_headers = {
22 "X-Assemblyai-Api-Key": os.environ["ASSEMBLYAI_API_KEY"],
23 "X-Data-Respan-Params": b64encode(json.dumps(respan_params).encode()).decode(),
24}
25
26client = RespanAssemblyAIClient(
27 respan_api_key=os.environ["RESPAN_API_KEY"],
28 headers=respan_headers,
29)
30
31transcriber = Transcriber(client=client)
32transcript = transcriber.transcribe("https://assembly.ai/wildfires.mp3")
33
34if transcript.status == TranscriptStatus.error:
35 print(transcript.error)
36else:
37 print(transcript.text)
3

View your trace

Open the Traces page to see transcription requests with audio, output, and timing.

Respan params

Pass any Respan observability parameters in the respan_params dict (base64-encoded into X-Data-Respan-Params).

ParameterDescription
customer_identifierIdentifies the end user.
thread_identifierGroups related messages into a conversation.
metadataCustom key-value pairs.