Packages

@ai-sdk/openai

4.0.108 · 3 Nov 2026Apache-2.022M / weekRepositoryHomepagenpmAtom feed

Your version

2.0.0

major31 Jul 2025Where it was published

2.0.140 is the newest release of 2.x.

In short

4 breaking14 new30 fixed14 internal

  • breaking

    AI SDK 5

  • breaking

    Chore (provider/openai): switch default to openai responses api

  • breaking
  • breaking

    Fix (provider/openai): default strict mode to false

Release note

Major Changes

  • breaking

    AI SDK 5

  • breaking

    Chore (provider/openai): switch default to openai responses api

  • breaking

    Move Image Model Settings into generate options

    Image Models no longer have settings. Instead, maxImagesPerCall can be passed directly to generateImage(). All other image settings can be passed to providerOptions[provider].

    Before

    await generateImage({
      model: luma.image('photon-flash-1', {
        maxImagesPerCall: 5,
        pollIntervalMillis: 500,
      }),
      prompt,
      n: 10,
    });

    After

    await generateImage({
      model: luma.image('photon-flash-1'),
      prompt,
      n: 10,
      maxImagesPerCall: 5,
      providerOptions: {
        luma: { pollIntervalMillis: 5 },
      },
    });

    Pull Request: #6180

  • breaking

    Fix (provider/openai): default strict mode to false

Patch Changes

  • Feat (provider/openai): o4 updates for responses api

  • Fix streaming and reconstruction of reasoning summary parts

  • Add reasoning-part-finish parts for reasoning models in the responses API

  • Feat (providers/openai): add gpt-image-1 model id to image settings

  • Adding support for gpt-4o-search-preview and handling unsupported parameters

  • Add raw chunk support

  • Feat (providers/openai): add gpt-4.1 models

  • Chore (providers): remove model shorthand deprecation warnings

  • Add missing file_search tool support to OpenAI Responses API

  • Fix (provider/openai): multi-step reasoning with text

  • openai: Add priority processing service tier support

  • Feat (providers/openai): add o3 and o4-mini models

  • Add transcription with experimental_transcribe

  • embedding-model-v2: Add response body field

  • provider/openai: Add serviceTier option for flex processing

  • openai: Add file_search filters and update field names

  • packages: Export node10 compatible types

  • Propagate openai transcription fixes

  • openai: Update file_search fields to match API changes

  • Feat (providers/openai): add support for reasoning summaries

  • Refactor (image-model): rename ImageModelV1 to ImageModelV2

  • Core (ai): change transcription model mimeType to mediaType

  • Add speech with experimental_generateSpeech

  • Fix (provider/openai): correct default for chat model strict mode

  • Fix (provider/openai): multi-step reasoning with tool calls

  • Feat (provider/openai): add support for encrypted_reasoning to responses api

  • Do not warn if empty text is the first part of a reasoning sequence

  • Fix (provider/openai): push first reasoning chunk in output item added event

  • provider/openai: Add missing reasoning models to responses API

  • openai: Add file_search_call.results support to include parameter

  • Chore (provider/openai): standardize on itemId in provider metadata

  • Feat (provider): add providerMetadata to ImageModelV2 interface

    The experimental_generateImage method from the ai package now returnes revised prompts for OpenAI's image models.

    const prompt = 'Santa Claus driving a Cadillac';
    
    const { providerMetadata } = await experimental_generateImage({
      model: openai.image('dall-e-3'),
      prompt,
    });
    
    const revisedPrompt = providerMetadata.openai.images[0]?.revisedPrompt;
    
    console.log({
      prompt,
      revisedPrompt,
    });
  • provider/openai: Add o3 & o4-mini with developer systemMessageMode

  • Using Zod 4 for internal stuff

  • Fix (provider/openai): handle responses api errors

  • providers/openai: Logprobs for stream alongside completion model

  • Fix (provider/openai): increase transcription model resilience

  • Fix (openai): structure output for responses model

  • Improve Zod compatibility

  • providers/openai: Zod parse error with function

  • providers: Always use optional instead of mix of nullish for providerOptions

  • tool-calling: Don't require the user to have to pass parameters

  • Fix PDF file parts when passed as a string url or Uint8Array

  • Feat (providers/openai): support gpt-image-1 image generation