Manages formatting and token estimation for inline audio inputs in OpenAI-compatible APIs. Use this to ensure audio payloads meet provider specifications and budget constraints.
// Source: https://github.com/vellum-ai/vellum-assistant | License: MIT | Copyright 2025 Vellum AI
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Shared source of truth for how OpenAI-compatible chat-completions providers
* ingest inline audio: which MIME types map onto the wire `input_audio.format`
* enum, the inline size cap, and the token-cost heuristic. The provider
* transform (`chat-completions-provider.ts`) and the context budgeter
* (`context/token-estimator.ts`) both read these — if they disagreed about
* which audio is sent inline, the budgeter would mis-count what the provider
* actually ships.
*
* Wire shape (OpenAI chat-completions spec):
* { type: "input_audio", input_audio: { data: <base64>, format: "wav"|"mp3" } }
*
* m4a/ogg/flac/opus
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key