Skip to content

AI 0.14.0: Image generation and xAI text-to-speech

AI 0.14.0 lets a Phoenix app generate images through its AI endpoints, with OpenAI, OpenRouter or xAI, and adds one-shot text-to-speech for xAI.

Image generation

PhoenixKitAI.generate_image/3 calls the provider’s image generation API. OpenAI, OpenRouter and xAI share the same request and answer, so one function covers all three. When the call passes no size or quality, the endpoint’s stored defaults are used.

The endpoint form gets a new Image Generation model type with its own size and quality picker. It is offered only for providers that declare image generation in PhoenixKit’s Integrations: OpenAI, OpenRouter and xAI, and not Mistral or DeepSeek. Image models such as dall-e-*, gpt-image-* and grok-imagine-image are now recognised and badged in the admin instead of being shown as chat models. Image requests are logged in AI usage with their own type, image.

Text-to-speech for xAI

speak/3 now works with xAI endpoints. It sends one request and gets the whole audio file back, which suits generating speech once and caching it. This sits beside the Playground’s streaming voice, which plays audio as it arrives.

Fixes

The endpoint form no longer offers Text-to-Speech for xAI, where it always gave an empty model list: xAI speech has no models, only voices. Switching an endpoint to xAI while it is selected resets the model type. xAI’s image models now show up when the form filters for image generation.

Upgrading

AI 0.14 needs PhoenixKit 1.7.196 or later, which adds image generation to OpenRouter and xAI. No migration. Update both dependencies.

Full release notes: AI 0.14.0

0.14.0 · 15 July 2026

Added

  • Image generation. PhoenixKitAI.generate_image/3 (and Completion.generate_image/3) call the provider’s POST /images/generations — the same path and response envelope across OpenAI, OpenRouter, and xAI, so one implementation covers all three (unlike TTS, which needed a separate xAI-specific function). Falls back to the endpoint’s stored image_size/image_quality when the caller passes neither.
    • The Endpoint form gets a new “Image Generation” model type (with its own size/quality picker), gated on the Integrations registry’s :image_generation capability via Endpoint.image_gen_model_picker?/1 — shown for OpenAI, OpenRouter, and xAI; correctly absent for providers with no image-gen models (Mistral, DeepSeek).
    • Endpoint.kind/1 now recognizes image-gen models (dall-e-*, gpt-image-*, grok-imagine-image*, etc.) for admin-UI badging instead of falling back to chat.
    • New request_type: "image" in usage tracking (added to Request’s valid types).
  • xAI batch REST TTS via POST /v1/tts (dispatched from existing PhoenixKitAI.speak/3 / Completion.text_to_speech/3). Synchronous counterpart to the streaming Playground panel — generate once, cache, serve.
  • Depends on phoenix_kit ~> 1.7.196 (adds the :image_generation capability to OpenRouter and xAI — OpenAI already had it).

Fixed

  • Endpoint form: hide the non-functional TTS model type for xAI. xAI TTS is not model-based (POST /v1/tts takes voice_id, nothing in GET /models), so picking “Text-to-Speech” always returned an empty model list. Endpoint.tts_model_picker?/1 hides the option for xAI and resets model_type when switching an endpoint onto xAI while TTS was selected.
  • :image_gen model filter for xAI. Relied on architecture.modality, which xAI’s /models never returns — grok-imagine-image / -quality never matched. No-modality branch now uses image_price / id substring the same way the :text exclusion already did.

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