Skip to content

AI 0.14.1: xAI speech decodes and xAI image defaults that fit

AI 0.14.1 fixes two things for xAI endpoints.

Text-to-speech through xAI expected a JSON envelope around the audio, but the live API returns the raw audio file. speak/3 now accepts both, and an error JSON without audio is still reported as an error instead of being read as sound.

The endpoint form’s image generation defaults for xAI used OpenAI’s size and quality fields, which xAI does not take. xAI endpoints now get Default Aspect Ratio and Default Resolution, and generate_image/3 sends those. OpenAI and OpenRouter keep size and quality.

Full release notes: AI 0.14.1

0.14.1 · 15 July 2026

Fixed

  • xAI batch TTS decode against the live API. Completion.text_to_speech/3’s xAI path (POST /v1/tts) assumed the documented {"audio": <base64>, "content_type", "duration"} envelope. Verified against a live endpoint: the response is the raw audio bytes (e.g. MP3) with status 200 — same ambiguity the OpenAI-compatible path already tolerates. decode_xai_audio/3 now accepts both shapes, falling back to raw binary only when the body is not JSON at all (so a real error JSON with a missing/null "audio" still surfaces as :invalid_audio_response rather than the JSON text misread as audio).
  • xAI image-generation form defaults no longer send OpenAI-only fields. The Endpoint form’s Image Generation defaults for xAI are now aspect ratio / resolution (stored in provider_settings), and generate_image/3 applies those as :aspect_ratio / :resolution instead of the OpenAI image_size / image_quality columns. OpenAI / OpenRouter keep the existing size/quality behaviour.

Added

  • xAI batch REST TTS (landed in 0.14.0, documented here). speak/3 dispatches to POST /v1/tts for xAI endpoints — a single request, complete audio file back — distinct from the Playground’s streaming WebSocket path. Request fields: text, voice_id, language (default "auto"), nested output_format, optional speed.

AI 0.14.1. Install or update: {:phoenix_kit_ai, "~> 0.14"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.