AI Gateway
Audio
POST
Pass-through to the provider’s audio endpoint (speech, transcription, translation). Request and response bodies follow the standard OpenAI Audio API schema. The provider is inferred from the model name (e.g.
Additional fields follow the standard OpenAI Audio API schema. For speech, include
tts-1, whisper-1 route to OpenAI).
Audio requests pass through to your provider and work today. They are not yet counted toward your cost totals. Full cost tracking for audio is coming soon.
Audio supports both JSON (
application/json) and multipart/form-data bodies. Use JSON for text-to-speech (TTS) requests and multipart/form-data for transcription and translation (Whisper) requests, following the standard OpenAI Audio API schema.Headers
Your Toolken API key. Validated by the gateway and stripped before forwarding.
Your provider key in Bearer format (BYOK), e.g.
Bearer sk-.... Forwarded untouched, never stored.Primary attribution channel. JSON object of key-value pairs (e.g.
{"agent":"research-agent","customer_id":"cust_abc"}). Each key becomes a groupable dimension in the dashboard.Flat-header shorthand.
X-Toolken-Metadata-Agent: research-agent writes metadata key agent. Equivalent to sending the same key in X-Toolken-Metadata.Sets the
feature metadata key. Use to group costs by agent name, workflow, UI surface, or job type.Sets the
customer_id metadata key. Use to attribute costs to an end-customer, org slug, or account ID.Body
Audio model identifier (e.g.
tts-1 for speech, whisper-1 for transcription/translation).input (text to synthesize) and voice. For transcription and translation, send multipart/form-data with a file field.
Response
Speech requests return audio bytes (audio/mpeg). Transcription and translation requests return a JSON object with a text field. The response is forwarded verbatim from the provider.