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

import os
import json
from base64 import b64encode
from assemblyai import Transcriber, Client, Settings, TranscriptStatus
BASE_URL = "https://api.respan.ai/api/assemblyai/"
class RespanAssemblyAIClient(Client):
"""AssemblyAI client wrapper that routes through the Respan gateway."""
def __init__(self, respan_api_key: str, headers: dict):
settings = Settings(api_key=respan_api_key, base_url=BASE_URL)
super().__init__(settings=settings)
self._http_client.headers.update(headers)
respan_params = {
"metadata": {"paid_user": "true"},
# other respan parameters...
}
respan_headers = {
"X-Assemblyai-Api-Key": os.environ["ASSEMBLYAI_API_KEY"],
"X-Data-Respan-Params": b64encode(json.dumps(respan_params).encode()).decode(),
}
client = RespanAssemblyAIClient(
respan_api_key=os.environ["RESPAN_API_KEY"],
headers=respan_headers,
)
transcriber = Transcriber(client=client)
transcript = transcriber.transcribe("https://assembly.ai/wildfires.mp3")
if transcript.status == TranscriptStatus.error:
print(transcript.error)
else:
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 params & metadata 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.