vercel/ai · error

`provider` is no longer needed in `streamUI`. Use `model` in

Error message

`provider` is no longer needed in `streamUI`. Use `model` instead.

What it means

streamUI no longer accepts a `provider` option; the model is passed directly via the `model` option as a provider model instance. The throw exists to migrate users off the deprecated `provider` setting during the experimental phase.

Source

Thrown at packages/rsc/src/stream-ui/stream-ui.tsx:190

         * Response headers.
         */
        headers?: Record<string, string>;
      };
    }) => Promise<void> | void;
  }): Promise<RenderResult> {
  // TODO: Remove these errors after the experimental phase.
  if (typeof model === 'string') {
    throw new Error(
      '`model` cannot be a string in `streamUI`. Use the actual model instance instead.',
    );
  }
  if ('functions' in settings) {
    throw new Error(
      '`functions` is not supported in `streamUI`, use `tools` instead.',
    );
  }
  if ('provider' in settings) {
    throw new Error(
      '`provider` is no longer needed in `streamUI`. Use `model` instead.',
    );
  }
  if (tools) {
    for (const [name, tool] of Object.entries(tools)) {
      if ('render' in tool) {
        throw new Error(
          'Tool definition in `streamUI` should not have `render` property. Use `generate` instead. Found in tool: ' +
            name,
        );
      }
    }
  }

  const ui = createStreamableUI(initial);

  // The default text renderer just returns the content as string.
  const textRender = text || defaultTextRenderer;

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Remove the `provider` option entirely
  2. Pass a model instance created from the provider, e.g. openai('gpt-4o'), to `model`

Example fix

// before
streamUI({ provider: openai, model: 'gpt-4o' });
// after
streamUI({ model: openai('gpt-4o') });
Defensive patterns

Strategy: validation

Validate before calling

if ('provider' in settings) throw new TypeError('Remove `provider`; pass a model instance via `model`');

Prevention

When it happens

Trigger: Calling streamUI({ ..., provider: someProvider }) — the `'provider' in settings` check throws before execution.

Common situations: Migrating from the earliest experimental API where streamUI took `provider` plus a string model; old examples configuring a provider instance separately; leftovers after updating the `model` argument.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/976d620c07c25b66. Report an issue: GitHub.