BoundaryML/baml · error · anyhow::Error

BAML internal error (openai-transcriptions): multipart body…

Error message

BAML internal error (openai-transcriptions): multipart body construction is not wired

What it means

The OpenAI transcriptions strategy in build_body is explicitly unwired: multipart body construction (required by /v1/audio/transcriptions) has not been implemented and bails immediately. It is a placeholder for future work, so any request routed to ProviderStrategy::TranscriptionsApi fails.

Solutions

  1. Do not route LLM calls through the TranscriptionsApi strategy; call the transcription endpoint outside BAML
  2. Use the chat completions or responses strategy with audio encoded as input_audio media instead
  3. Check BAML releases for multipart transcriptions support
  4. File/track a BAML feature request for multipart body wiring

Example fix

// before
provider baml-openai { options { api_strategy "transcriptions" } }
// after
provider baml-openai { options { api_strategy "chat-completions" } } // pass audio as input_audio media
Defensive patterns

Strategy: fallback

Validate before calling

// fail fast if the client targets an unimplemented strategy
if (client.provider.includes("transcriptions")) {
  throw new Error("Use a chat-completions client or call /v1/audio/transcriptions directly");
}

Prevention

When it happens

Trigger: Any LLM call whose client resolves to ProviderStrategy::TranscriptionsApi (openai transcriptions endpoint), because build_body has no multipart implementation.

Common situations: Configuring a BAML openai client with a transcriptions endpoint/strategy expecting BAML to handle audio file upload, before the feature exists.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/b1f7d8db1de19066. Report an issue: GitHub.

Appendix: source

Thrown at engine/baml-runtime/src/internal/llm_client/primitive/openai/openai_client.rs:249

            ProviderStrategy::StandardOpenAI { .. } => {
                if is_completion {
                    format!("{base_url}/completions")
                } else {
                    format!("{base_url}/chat/completions")
                }
            }
        }
    }

    fn build_body(
        &self,
        prompt: either::Either<&String, &[RenderedChatMessage]>,
        properties: &BamlMap<String, serde_json::Value>,
        chat_converter: &impl ToProviderMessageExt,
    ) -> Result<serde_json::Value> {
        match self {
            ProviderStrategy::TranscriptionsApi => {
                anyhow::bail!(
                    "BAML internal error (openai-transcriptions): multipart body construction is not wired"
                );
            }
            ProviderStrategy::ResponsesApi => {
                // Start with all properties passed through
                let mut body = properties.clone();

                let input = match prompt {
                    either::Either::Left(prompt) => {
                        // For simple string prompts, pass directly as string
                        json!(prompt)
                    }
                    either::Either::Right(messages) => {
                        let structured_messages: Result<Vec<_>> = messages
                            .iter()
                            .map(|msg| {
                                // Convert message parts to Responses API format
                                let content_parts: Result<Vec<_>> = msg

View on GitHub (pinned to bd85ce9dee)