Skip to content

Feature: model-generated files (inline images) in chat/responses turns #548

Closed

Description

@abhiaiyer91

Problem

Image generation and the Files API are mocked as separate endpoints, but there is no way to make a chat/responses model turn return a generated file (e.g. an inline image). Clients that surface model-generated files (AI SDK file stream parts) can't be tested through aimock.

Proposal

An optional files field on text / content+tool-call responses:

llm.on({ endpoint: 'responses' }, {
  content: 'Here is your chart.',
  files: [{ mediaType: 'image/png', data: '<base64>' }],
});

Emitted per wire format:

  • OpenAI Responses: an image_generation_call output item with result (base64)
  • Gemini: inlineData parts in the candidate content
  • Chat Completions / Anthropic: reject with a clear unsupported error (same pattern as customToolCalls)

Use case

Same as the citations request: Mastra's loop regression tests need to assert that model-generated files flow through to the stream and stored messages.

Activity

  1. jpr5 commented on Oct 21, 2026

    @jpr5
    Contributor

    #550 handles Gemini inline files on model turns. It's waiting on the same two review changes I mentioned on #547. After it merges I'll keep this open for the rest, which is image output on Responses and clear unsupported errors on the other providers.

  2. jpr5 commented on Oct 23, 2026

    @jpr5
    Contributor

    Reopening — #550 shipped generated files for Gemini only. The OpenAI side is next.

  3. reopened this on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions