Skip to content

backport v6#5

Open
callycodes wants to merge 2748 commits into
ZenningAI:mainfrom
vercel:main
Open

backport v6#5
callycodes wants to merge 2748 commits into
ZenningAI:mainfrom
vercel:main

Conversation

@callycodes

Copy link
Copy Markdown

Background

Summary

Manual Verification

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)
  • I have reviewed this pull request (self-review)

Future Work

Related Issues

shaper and others added 30 commits May 20, 2026 16:33
…#15488)

## Summary

- The Gemini API returns the applied service tier in two places: the
`x-gemini-service-tier` response header (non-streaming only) and
`usageMetadata.serviceTier` in the response body (both streaming and
non-streaming).
- The previous implementation only read the header, so
`providerMetadata.google.serviceTier` was always `null` on `streamText`.
- Read `usageMetadata.serviceTier` from the body for both `doGenerate`
and `doStream`. Single source of truth, no header involvement, matches
the pattern Vertex already uses (`usageMetadata.trafficType`).
- Docs updated to drop the implementation detail about where the value
comes from.

## Test plan

- [x] `pnpm test` in `packages/google` — 583 tests pass (node + edge),
incl. two new tests asserting `serviceTier` is populated from
`usageMetadata` in both generate and stream paths.
- [x] `pnpm type-check:full` — clean.
- [x] Verified live against the Gemini API:
- `pnpm tsx src/generate-text/google/service-tier.ts` → `serviceTier:
priority` (still works after dropping header read)
- `pnpm tsx src/stream-text/google/service-tier.ts` → `serviceTier:
priority` (previously `null`)
- [x] Verified Vertex examples unaffected:
- `pnpm tsx src/generate-text/google/vertex-service-tier.ts` →
`trafficType: ON_DEMAND_PRIORITY`
- `pnpm tsx src/stream-text/google/vertex-service-tier.ts` →
`trafficType: ON_DEMAND_PRIORITY`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/google@4.0.0-canary.71

### Patch Changes

- 045d2e8: fix(google): read `serviceTier` from
`usageMetadata.serviceTier` in both generate and stream paths

The previous implementation read `serviceTier` from the
`x-gemini-service-tier`
response header, which is only populated on non-streaming responses.
Gemini
streaming includes the value in `usageMetadata.serviceTier` on every
chunk, so
`providerMetadata.google.serviceTier` was always `null` for streams.
Read from
    `usageMetadata` for both paths instead.

## @ai-sdk/google-vertex@5.0.0-canary.90

### Patch Changes

-   Updated dependencies [045d2e8]
    -   @ai-sdk/google@4.0.0-canary.71

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…e id (#15503)

## Background

#15502 / reported in
#15492

when `previousResponseId` is used with the openai provider, with `store:
true`, we observe that duplicate reasoning items and function call items
are being passed and the provider throws a 404 error.

[openai docs
highlight](https://developers.openai.com/cookbook/examples/responses_api/reasoning_items#:~:text=If%20you%20use%20previous_response_id%20for%20multi%2Dturn%20conversations%2C%20the%20model%20will%20automatically%20have%20access%20to%20all%20previously%20produced%20reasoning%20items.)
that:

> If you use previous_response_id for multi-turn conversations, the
model will automatically have access to all previously produced
reasoning items

so it's fine if we skip passing those items under those conditions

## Summary

- introduced a flag `hasPreviousResponseId` and if it does - we skip
passing ONLY the reasoning items and function calls

## Manual Verification

verified by running the repro in the issue: 

<details>
<summary>repro:</summary>

```ts
import {
  openai,
  type OpenaiResponsesProviderMetadata,
  type OpenAILanguageModelResponsesOptions,
} from '@ai-sdk/openai';
import { isStepCount, streamText, tool } from 'ai';
import { z } from 'zod';
import { run } from '../../lib/run';

run(async () => {
  let previousResponseId: string | undefined;

  const result = streamText({
    model: openai.responses('gpt-5-mini'),
    maxRetries: 0,
    stopWhen: isStepCount(2),
    tools: {
      getWeather: tool({
        description: 'Get the weather in a city.',
        inputSchema: z.object({
          city: z.string().describe('The city to get the weather for.'),
        }),
        execute: async ({ city }) => ({
          city,
          weather: 'sunny',
          temperature: 72,
        }),
      }),
    },
    prompt: 'Use the weather tool for San Francisco, then answer briefly.',
    reasoning: 'low',
    include: {
      requestBody: true,
    },
    prepareStep: ({ stepNumber }) => ({
      toolChoice:
        stepNumber === 0 ? { type: 'tool', toolName: 'getWeather' } : 'auto',
      providerOptions: {
        openai: {
          store: true,
          ...(previousResponseId != null ? { previousResponseId } : {}),
        } satisfies OpenAILanguageModelResponsesOptions,
      },
    }),
    onStepFinish: step => {
      const providerMetadata = step.providerMetadata as
        | OpenaiResponsesProviderMetadata
        | undefined;

      previousResponseId =
        providerMetadata?.openai.responseId ?? previousResponseId;

      console.log('Step response ID:', previousResponseId);
    },
  });

  for await (const chunk of result.fullStream) {
    switch (chunk.type) {
      case 'start-step':
        console.log(
          'Request body:',
          JSON.stringify(chunk.request.body, null, 2),
        );
        break;

      case 'tool-call':
        console.log('Tool call:', chunk.toolName, chunk.input);
        break;

      case 'tool-result':
        console.log('Tool result:', chunk.output);
        break;

      case 'text-delta':
        process.stdout.write(chunk.text);
        break;

      case 'error':
        throw chunk.error;
    }
  }
});
```
</details>

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

fixes #15502
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-canary.150

### Patch Changes

-   Updated dependencies [bba5250]
-   Updated dependencies [94c6edc]
    -   @ai-sdk/gateway@4.0.0-canary.89

## @ai-sdk/alibaba@2.0.0-canary.53

### Patch Changes

-   94c6edc: Add `qwen3.7-max` model ID to Alibaba and AI Gateway.

## @ai-sdk/amazon-bedrock@5.0.0-canary.67

### Patch Changes

-   Updated dependencies [17b5597]
    -   @ai-sdk/openai@4.0.0-canary.63

## @ai-sdk/angular@3.0.0-canary.150

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/azure@4.0.0-canary.63

### Patch Changes

-   Updated dependencies [17b5597]
    -   @ai-sdk/openai@4.0.0-canary.63

## @ai-sdk/gateway@4.0.0-canary.89

### Patch Changes

- bba5250: chore(provider/gateway): update gateway model settings files
-   94c6edc: Add `qwen3.7-max` model ID to Alibaba and AI Gateway.

## @ai-sdk/langchain@3.0.0-canary.150

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/llamaindex@3.0.0-canary.150

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/openai@4.0.0-canary.63

### Patch Changes

- 17b5597: fix(openai): skip passing reasoning items when using previous
response id

## @ai-sdk/otel@1.0.0-canary.96

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/react@4.0.0-canary.151

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/rsc@3.0.0-canary.151

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/svelte@5.0.0-canary.150

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/vue@4.0.0-canary.150

### Patch Changes

-   ai@7.0.0-canary.150

## @ai-sdk/workflow@1.0.0-canary.67

### Patch Changes

-   ai@7.0.0-canary.150

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary

- Change `concurrency.group` in `.github/workflows/release.yml` from a
single global `'release'` to `'release-${{ github.ref }}'` so each
release branch (`main`, `release-v6.0`, `release-v5.0`) gets its own
concurrency slot.

## Why

Today all three Release runs share one concurrency group. With
`cancel-in-progress: false`, GitHub queues at most one pending run per
group — so when three pushes arrive in quick succession (as happened
today on #15509, #15513, #15517), the middle pending run gets bumped out
of the queue and canceled. Run
[26246209250](https://github.com/vercel/ai/actions/runs/26246209250) was
canceled this way.

Scoping the group per branch lets each branch's Release workflow run
independently while still serializing runs within a single branch.

## Test plan

- [ ] Mirror change on `release-v6.0` and `release-v5.0` branches
- [ ] Confirm subsequent overlapping pushes across branches no longer
cancel each other
)

## Background

Add a 1st-party `@ai-sdk/quiverai` provider for
[QuiverAI](https://quiver.ai/) SVG image generation, ported from
https://github.com/quiverai/ai-sdk-provider.

This PR targets `main` (canary pre-release). It must be merged **after**
#15463 has shipped
`@ai-sdk/quiverai@1.0.0` from `release-v6.0`. With #15463's `v1.0.0`
recorded as the initial version in `.changeset/pre.json`, the major
changeset on this branch will publish `@ai-sdk/quiverai@2.0.0` once
canary mode exits.

## Summary

- New `packages/quiverai` package (image model only) supporting
`generate` and `vectorize` operations against Arrow models (`arrow-1`,
`arrow-1.1`, `arrow-1.1-max`).
- Workflow serialization, example in
`examples/ai-functions/src/generate-image/quiverai/`, docs at
`content/providers/01-ai-sdk-providers/180-quiverai.mdx`, major
changeset.
- `package.json` version pinned to `1.0.0` and `.changeset/pre.json`
initialVersions seeded with `@ai-sdk/quiverai: 1.0.0` so canary
publishes start at `2.0.0-canary.x` and avoid colliding with the
`v1.0.0` line shipped from `release-v6.0`.

## Manual Verification

Ran both examples added in this PR against the live QuiverAI API:

- `examples/ai-functions/src/generate-image/quiverai/basic.ts` —
text-to-SVG generation with `arrow-1.1`.
- `examples/ai-functions/src/generate-image/quiverai/vectorize.ts` —
vectorization of `examples/ai-functions/data/wtf-logo.png` with
`arrow-1.1`.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

Closes #15459

Depends on #15463 (must merge first).

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/quiverai@2.0.0-canary.0

### Major Changes

- d56c97b: Add `@ai-sdk/quiverai` provider for QuiverAI SVG image
generation and vectorization.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…nerateImage` with Gemini (#15522)

## Background

`generateText` can ground Gemini calls on Google Search via the
`google.tools.googleSearch(...)` tool, but `generateImage` has no
`tools` parameter — so there was no way to apply the same grounding when
using `generateImage` with Gemini image models.

## Summary

Exposes Google Search grounding for `generateImage` through
`providerOptions.google.googleSearch`, which the Google image model
forwards as the `google.google_search` provider tool on the underlying
language-model call (Gemini image generation already routes through the
language model API). Grounding info from the response is now merged onto
the image result's `providerMetadata.google`.

## Manual Verification

Run the new example.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
## Background

#15465

Before, both 401 paths in the transport independently called `auth()`:
- `send()` handles POST /mcp initialize 401.
- `openInboundSse()` handles background GET /mcp 401.

that meant if one request is already refreshing tokens, any other
concurrent 401 recovery would start its own recovery. this could lead to
a race condition in the refresh and return invalid auth / force re auth.

## Summary

- introduce a new function `authorizeOnce()` that runs a single OAuth
recovery flow for concurrent 401 responses

## Manual Verification

verified in the reproduction in the unit tests

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

fixes #15465
…el (#15525)

## Background

reported in #14351

when using the model id `flux-pro-1.0-fill`, the BFL api expects the the
field `image` instead of `input_image`

this is also logged in their docs in the request sent
[here](https://docs.bfl.ml/flux_tools/flux_1_fill#create-a-request)

## Summary

change just that field for the mode id `flux-pro-1.0-fill` based on a
conditional check

## Manual Verification

verified by running the repro: 

<details>
<summary>repro </summary>

```ts
import {
  blackForestLabs,
  type BlackForestLabsImageModelOptions,
} from '@ai-sdk/black-forest-labs';
import { generateImage } from 'ai';
import sharp from 'sharp';
import { run } from '../../lib/run';
import { presentImages } from '../../lib/present-image';

run(async () => {
  const image = await sharp({
    create: {
      width: 256,
      height: 256,
      channels: 3,
      background: { r: 120, g: 180, b: 255 },
    },
  })
    .png()
    .toBuffer();
  const mask = await sharp({
    create: {
      width: 256,
      height: 256,
      channels: 3,
      background: { r: 255, g: 255, b: 255 },
    },
  })
    .png()
    .toBuffer();

  console.log(
    'Running BFL fill inpainting with a 256x256 input image and mask.',
  );

  const result = await generateImage({
    model: blackForestLabs.image('flux-pro-1.0-fill'),
    prompt: {
      text: 'Replace the masked area with a red square.',
      images: [image],
      mask,
    },
    aspectRatio: '1:1',
    providerOptions: {
      blackForestLabs: {
        outputFormat: 'png',
        steps: 25,
        guidance: 7.5,
      } satisfies BlackForestLabsImageModelOptions,
    },
  });

  await presentImages(result.images);
});
```
</details>

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

fixes #14351
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/black-forest-labs@2.0.0-canary.45

### Patch Changes

- 23b6aca: fix(bfl): use 'image' field instead of 'input_image' for fill
pro model

## @ai-sdk/google@4.0.0-canary.72

### Patch Changes

- b71c0d7: feat(provider/google): support Google search grounding when
using `generateImage` with Gemini

## @ai-sdk/google-vertex@5.0.0-canary.91

### Patch Changes

-   Updated dependencies [b71c0d7]
    -   @ai-sdk/google@4.0.0-canary.72

## @ai-sdk/mcp@2.0.0-canary.53

### Patch Changes

-   6c17a9f: fix(mcp): deduplicate auth refresh on http transport

## @ai-sdk/react@4.0.0-canary.152

### Patch Changes

-   Updated dependencies [6c17a9f]
    -   @ai-sdk/mcp@2.0.0-canary.53

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background

The Google provider `README.md` inside the `packages` folder contained a
documentation link that points to a non-existent page on `ai-sdk.dev`.

The broken link was:


https://ai-sdk.dev/docs/reference/stream-helpers/google-generative-ai-stream

This currently redirects to a 404 page. The correct documentation page
is:

https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai

## Summary

Updated both occurrences of the broken Google provider documentation
link in the README file.

The links now point to the correct Google Generative AI provider
documentation page:

https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

Fixes #15541
## Background

Currently if web search returns an error, we mishandled it and
lose the tool response when continuing the conversation.

This would result in errors like:
```
Error: messages.1: `web_search` tool use with id `srvtoolu_01DZi3ZdTUsKUj24ZhA1XdSV` was found without a corresponding `web_search_tool_result` block
```

## Summary

web fetch already has handling for this, so reuse that.

## Manual Verification

I verified that trying to continue a conversation with an error failed
on the old version and works with this one.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/amazon-bedrock@5.0.0-canary.68

### Patch Changes

-   Updated dependencies [acdbf84]
    -   @ai-sdk/anthropic@4.0.0-canary.58

## @ai-sdk/anthropic@4.0.0-canary.58

### Patch Changes

-   acdbf84: Handle errors from anthropic websearch tool

## @ai-sdk/google-vertex@5.0.0-canary.92

### Patch Changes

-   Updated dependencies [acdbf84]
    -   @ai-sdk/anthropic@4.0.0-canary.58

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background

Vercel AI Gateway needs SDK support for scoping requests made with
Vercel access credentials. Vercel app access tokens (`vca_...`) and
personal access tokens (`vcp_...`) can already be sent as bearer
credentials through the existing `apiKey` option, but multi-team
credentials need a way to specify the target team.

## Summary

Adds optional team scoping to the Gateway provider:

```ts
const gateway = createGateway({
  apiKey: 'vca_...',
  teamIdOrSlug: 'vercel',
});
```

This PR does **not** add a new credential option. The existing `apiKey`
option remains the single explicit bearer credential field and can be
used with:

- AI Gateway API keys
- Vercel app access tokens (`vca_...`)
- Vercel personal access tokens (`vcp_...`)

When `teamIdOrSlug` is provided, the SDK sends:

```http
x-vercel-ai-gateway-team: <teamIdOrSlug>
```

No new environment variable is introduced, and no new
`ai-gateway-auth-method` value is introduced.

Credential precedence remains:

```txt
apiKey > AI_GATEWAY_API_KEY > OIDC
```

## Manual Verification

Automated validation run:

```bash
pnpm --filter @ai-sdk/gateway type-check
pnpm --filter @ai-sdk/gateway test:node
pnpm --filter @ai-sdk/gateway test:edge
git diff --check
```

Gateway tests pass:

```txt
428 passed
```

`pnpm type-check:full` was also attempted earlier, but failed on
existing unrelated missing-module errors in other packages/examples.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Future Work

## Related Issues

N/A
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-canary.151

### Patch Changes

-   Updated dependencies [8b811d8]
    -   @ai-sdk/gateway@4.0.0-canary.90

## @ai-sdk/angular@3.0.0-canary.151

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/gateway@4.0.0-canary.90

### Patch Changes

- 8b811d8: feat(provider/gateway): add optional Vercel team scoping for
Gateway authentication. The existing `apiKey` option can be used with AI
Gateway API keys, Vercel personal access tokens, and Vercel app access
tokens.

## @ai-sdk/langchain@3.0.0-canary.151

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/llamaindex@3.0.0-canary.151

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/otel@1.0.0-canary.97

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/react@4.0.0-canary.153

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/rsc@3.0.0-canary.152

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/svelte@5.0.0-canary.151

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/vue@4.0.0-canary.151

### Patch Changes

-   ai@7.0.0-canary.151

## @ai-sdk/workflow@1.0.0-canary.68

### Patch Changes

-   ai@7.0.0-canary.151

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary

Adds a unified `serviceTier: 'flex' | 'priority'` option to
`GatewayProviderOptions`. The AI Gateway translates this into whichever
per-provider option each provider expects.

If the user also set a per-provider tier directly, the gateway value
overrides it.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-canary.152

### Patch Changes

-   Updated dependencies [d4d4a5e]
    -   @ai-sdk/gateway@4.0.0-canary.91

## @ai-sdk/angular@3.0.0-canary.152

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/gateway@4.0.0-canary.91

### Patch Changes

- d4d4a5e: Add `serviceTier: 'flex' | 'priority'` to
`GatewayProviderOptions`.

## @ai-sdk/langchain@3.0.0-canary.152

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/llamaindex@3.0.0-canary.152

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/otel@1.0.0-canary.98

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/react@4.0.0-canary.154

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/rsc@3.0.0-canary.153

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/svelte@5.0.0-canary.152

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/vue@4.0.0-canary.152

### Patch Changes

-   ai@7.0.0-canary.152

## @ai-sdk/workflow@1.0.0-canary.69

### Patch Changes

-   ai@7.0.0-canary.152

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ecution` tool dynamic calls from latest `web_fetch` or `web_search` (#15566)

## Background

When Anthropic's `web_fetch` or `web_search` tools internally trigger
code execution, the API emits `code_execution` tool calls even though
the user did not register that tool. The fix from #12668 marked such
calls as `dynamic: true` to bypass validation, but several code paths in
the Anthropic language model still emitted unmarked calls, causing
errors. The newer `code_execution_20250825` tool variant also surfaces
calls under sub-names (`bash_code_execution`,
`text_editor_code_execution`) that need the same treatment.

## Summary

- Mark `code_execution` tool calls as `dynamic` in all remaining
emission sites for the 20250825 tool variant (non-streaming
`bash_code_execution`/`text_editor_code_execution` branch, streaming
first-delta and end paths, and streaming `tool-call` finalization).
- Normalize the streaming delta path to use the unified `code_execution`
provider tool name and consistently backfill input with `"type":
"programmatic-tool-call"` so downstream consumers see a consistent
shape.
- Only set `firstDelta: true` when no input has been buffered yet,
avoiding double-prefixing. This was not surfacing in a real bug so far,
but it was clearly also an oversight (per `firstDelta: true` only ever
being okay if there was no input yet on that same chunk).

## Manual Verification

Run the existing examples:

-
`examples/ai-functions/src/stream-text/anthropic/web-fetch-20260209-pdf.ts`
-
`examples/ai-functions/src/stream-text/anthropic/web-fetch-20260209-pdf.ts`

Without this PR, they will somewhere in the stream include the error
about an incompatible tool being found, most times when executing them.
With this PR, this error is gone from both.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/anthropic-aws@1.0.0-canary.0

### Major Changes

-   e617cba: feat(anthropic-aws): add Claude Platform on AWS provider

### Patch Changes

-   Updated dependencies [648705c]
    -   @ai-sdk/anthropic@4.0.0-canary.59

## @ai-sdk/amazon-bedrock@5.0.0-canary.69

### Patch Changes

-   Updated dependencies [648705c]
    -   @ai-sdk/anthropic@4.0.0-canary.59

## @ai-sdk/anthropic@4.0.0-canary.59

### Patch Changes

- 648705c: fix(provider/anthropic): fix remaining errors with Anthropic
`code_execution` tool dynamic calls from latest `web_fetch` or
`web_search`

## @ai-sdk/google-vertex@5.0.0-canary.93

### Patch Changes

-   Updated dependencies [648705c]
    -   @ai-sdk/anthropic@4.0.0-canary.59

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…hunks (#15464)

## Background

Some OpenAI-compatible providers (e.g. zhipu/glm-5) send an empty string
`""` for `delta.role` in streaming chunks instead of `"assistant"` or
omitting it. The strict `z.enum(['assistant']).nullish()` validation in
`chunkBaseSchema` rejects this value, causing `AI_TypeValidationError` /
`ZodError` and breaking the entire stream.

Related: anomalyco/opencode#28427

## Summary

Relax the `role` field validation in both the response schema
(`OpenAICompatibleChatResponseSchema`) and the streaming chunk schema
(`chunkBaseSchema`) from a strict enum/literal check to
`z.string().nullish()`. The `role` field is not consumed by the
implementation — it exists only for schema validation — so accepting any
string value (including empty string) is safe and matches the
provider-agnostic intent of the `openai-compatible` adapter.

### Changes

-
`packages/openai-compatible/src/chat/openai-compatible-chat-language-model.ts`:
Change `role` validation from `z.literal('assistant').nullish()` /
`z.enum(['assistant']).nullish()` to `z.string().nullish()`
- Added test case for streaming with empty string `role` in delta chunks

## Manual Verification

Confirmed that the error from the issue (`AI_TypeValidationError:
Invalid input: expected "assistant"` at path `choices[0].delta.role`) is
caused by the strict enum validation rejecting `role: ""`. After the
fix, chunks with `role: ""` parse successfully and text content is
extracted correctly.

## Checklist

- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

---

🤖 **Disclosure:** This PR was authored by
[Kagura](https://github.com/kagura-agent), an AI agent. Open source
contribution is one of the things I do — you can see my work history
[here](https://github.com/kagura-agent/github-contribution). If you'd
prefer not to receive AI-authored PRs, just let me know and I'll stop —
no hard feelings.

---------

Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/alibaba@2.0.0-canary.54

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/baseten@2.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/cerebras@3.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/deepinfra@3.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/fireworks@3.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/google-vertex@5.0.0-canary.94

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/huggingface@2.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/moonshotai@3.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/openai-compatible@3.0.0-canary.51

### Patch Changes

- 9f1e1ba: fix: accept empty string `role` in streaming delta chunks
from OpenAI-compatible providers

## @ai-sdk/togetherai@3.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/vercel@3.0.0-canary.51

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

## @ai-sdk/xai@4.0.0-canary.67

### Patch Changes

-   Updated dependencies [9f1e1ba]
    -   @ai-sdk/openai-compatible@3.0.0-canary.51

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…15466)

## Background

Consumers that define a tool with `execute` in their own codebase and
then call `.execute(...)` (most often in tests) currently hit a typing
gap. The inferred type of `tool({ ...with execute... })` is the wide
`Tool<INPUT, OUTPUT, CONTEXT>` union, where `execute` is
`ToolExecuteFunction<...> | undefined`. That forces `isExecutableTool`
narrowing, a `!` assertion, or `?.()` chaining at the call site even
when the consumer statically knows `execute` is defined.

The SDK already ships the right primitive: `ExecutableTool<TOOL>` from
`@ai-sdk/provider-utils` (added in #14516). It just isn't wired into
`tool()`'s own return type. Current options to get a narrowed tool are:

1. Call `isExecutableTool(t)` (runtime guard) at every consumption site.
2. Cast at the definition site with `as ExecutableTool<...>`.
3. Wrap `tool()` in a project-local factory that re-applies the cast.

## Summary

Add a fifth overload to `tool()` that matches calls whose config
includes an `execute` function. That overload returns
`ExecutableTool<Tool<INPUT, OUTPUT, CONTEXT>>` instead of the wider
`Tool<INPUT, OUTPUT, CONTEXT>`. Calls without `execute` fall through to
the existing four overloads unchanged.

```ts
// New overload (added at the top so it wins for execute-bearing calls):
export function tool<INPUT, OUTPUT, CONTEXT extends Context>(
  tool: Tool<INPUT, OUTPUT, CONTEXT> & {
    execute: ToolExecuteFunction<INPUT, OUTPUT, CONTEXT>;
  },
): ExecutableTool<Tool<INPUT, OUTPUT, CONTEXT>>;
```

This is non-breaking:

- Runtime: identical. The implementation body is still `return tool;`.
- Value-level type: `ExecutableTool<Tool<I, O, C>>` is `Tool<I, O, C> &
{ execute: NonNullable<...> }`. Strictly assignable to the old return;
anything that took a `Tool<...>` keeps compiling.
- Property-level type: `t.execute` narrows from
`ToolExecuteFunction<...> | undefined` to `ToolExecuteFunction<...>`.
Existing runtime null checks become provably-true but still compile.

The existing type tests in `tool.test-d.ts` codified the wider contract.
This PR updates the three affected assertions to expect the narrower
one.

Effect at a call site:

```ts
const t = tool({
  inputSchema: z.object({ q: z.string() }),
  execute: async ({ q }) => ({ result: q.toUpperCase() }),
});

// Before: t.execute is `ToolExecuteFunction<...> | undefined`.
//   Needs isExecutableTool(t), or t.execute!(...), or t.execute?.(...).
// After:  t.execute is `ToolExecuteFunction<...>`. Direct call type-checks.
await t.execute({ q: 'hi' }, { toolCallId: 'x', messages: [], context: {} });
```

## Manual Verification

- `pnpm type-check:full` passes.
- `pnpm exec vitest --typecheck.only` in `packages/provider-utils`: 26
type-test files, 184 assertions, all pass.
- `pnpm exec vitest --typecheck.only` in `packages/ai`: 30 type-test
files, 504 assertions, all pass.
- `pnpm --filter '@ai-sdk/provider-utils' test:node`: 65 test files, 606
tests, all pass.
- `pnpm check` (lint + format) clean.

## Open question for maintainers

This is small enough to land standalone, but #14516 deliberately
introduced `ExecutableTool` and `isExecutableTool` as additive
primitives and chose not to wire them into `tool()` itself. Was that
intentional?

If you'd rather keep `tool()`'s return wide and expose narrowing as an
opt-in, happy to close this and instead propose:

- A named `executableTool()` factory exported from
`@ai-sdk/provider-utils` (symmetric with
`isExecutableTool`/`ExecutableTool`).
- A short doc paragraph in
`content/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx` covering
`isExecutableTool` for the runtime-discovered case (MCP etc).

Marking this as a draft until you've had a chance to weigh in.

## Checklist

- [ ] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added
- [x] I have reviewed this pull request (self-review)

## Related

- #14516 — introduced `ExecutableTool` and `isExecutableTool`.
- #14849 — restructured `Tool` into a 4-variant union.
- No prior issues filed for this specific friction (searched many
phrasings).
…treams (#15196)

## Background

`@ai-sdk/langchain`'s `toUIMessageStream` adapter handles plain JSON
message objects from LangGraph `RemoteGraph` streams. The type guard
`isAIMessageChunk` and the `values`-event `tool_calls` extraction in
`processLangGraphEvent` both match `obj.type === 'ai'`, which is the
discriminator used by TypeScript `langchain-core`.

Python `langchain-core` serializes streaming chunks with `type ===
'AIMessageChunk'` ([Python
source](https://github.com/langchain-ai/langchain/blob/master/libs/core/langchain_core/messages/ai.py))
instead of the TypeScript `type === 'ai'` ([TypeScript
source](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-core/src/messages/ai.ts)).
Plain Python message objects fall through both gates.

User-visible symptom: when streaming from a Python LangGraph server
(`langgraph new --python`, LangSmith Cloud Python deployments,
RemoteGraph against a Python deployment), `start`, `start-step`,
`finish-step`, and `finish` arrive in the UI stream, but `text-start` /
`text-delta` / `text-end` and tool-call events never do. The model
output is silently lost.

## Summary

`packages/langchain/src/utils.ts`:

- `isAIMessageChunk`: also match `obj.type === 'AIMessageChunk'` for
plain message objects; JSDoc updated to document both discriminators.
- `processLangGraphEvent` `values` branch: also recognize `obj.type ===
'AIMessageChunk'` when extracting `tool_calls` from non-streamed
messages.

The change is intentionally narrow — no behavior change for TypeScript
callers, only widens the accepted discriminator for plain RemoteGraph
objects.

## Manual Verification

Reproduced against `@ai-sdk/langchain@2.0.162` (stable) and
`@ai-sdk/langchain@3.0.0-canary.131` (canary) using a standalone
async-iterable mock that emits `['messages', [chunk, metadata]]` events
with both shapes (`type: 'ai'` vs `type: 'AIMessageChunk'`):

- Before fix: TypeScript shape produced 2 `text-delta` UIMessageChunks,
Python shape produced 0.
- After fix (patched `dist/index.js` locally): both shapes produced
identical output (`text-start`, 2 `text-delta`, `text-end`).

Then verified at the source level: the three new regression tests fail
on unfixed `main`, all 190 langchain tests pass with the fix applied.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
— JSDoc on `isAIMessageChunk`
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Future Work

`isToolMessageType` (same file) uses the equivalent `obj.type ===
'tool'` pattern. Python `langchain-core` also uses the `'tool'` literal
for `ToolMessage`, so it is not affected by this bug — but if future
Python versions emit class-name discriminators (`'ToolMessage'`), a
parallel guard would be needed. Out of scope here.

I deliberately did not add a runnable example under `examples/` (per
AGENTS.md "When to Deviate"): exercising the bug end-to-end requires a
Python LangGraph server, which is impractical for a TypeScript monorepo
example, and the new unit tests serve as a deterministic, in-process
reproduction. Happy to add one if maintainers prefer.

## Related Issues

Fixes #14341.

Co-authored-by: cristiandrei1234 <cristiandrei1234@users.noreply.github.com>
Co-authored-by: Lars Grammel <lars.grammel@gmail.com>
aayush-kapoor and others added 30 commits June 12, 2026 09:50
## Background

we were using the `exec()` command of the node api which runs shell
commands, and URL characters like `$()`, `&`, `|`, or backticks could be
interpreted as commands instead of just URL text

## Summary

fixed it by replacing `exec()` with `execFile()` and passing the URL as
a separate argument. that launches the browser opener directly, without
shell parsing

## Manual Verification

verified that the example `examples/mcp/src/mcp-with-auth/client.ts`
still runs and connects

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
## Summary

You must use the new harness packages with the canary tags. This PR
updates the docs snippets to clarify that.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
…with Bun (#16069)

## Summary

Bun can miss `stdout` from detached sandbox bridge processes that bind
an exposed port, so Claude Code/Codex startup timed out waiting for
`bridge-ready` even though the bridge was running.

This PR adds a shared harness readiness helper that keeps `stdout` as
the primary signal (for non-Bun), falls back to the bridge metadata
file, and marks startup state to avoid stale metadata on respawn.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/harness@1.0.0-canary.8

### Patch Changes

- aae0138: fix(harness): make listening for sandbox bridge readiness
compatible with Bun

## @ai-sdk/harness-claude-code@1.0.0-canary.4

### Patch Changes

- aae0138: fix(harness): make listening for sandbox bridge readiness
compatible with Bun
-   Updated dependencies [aae0138]
    -   @ai-sdk/harness@1.0.0-canary.8

## @ai-sdk/harness-codex@1.0.0-canary.4

### Patch Changes

- aae0138: fix(harness): make listening for sandbox bridge readiness
compatible with Bun
-   Updated dependencies [aae0138]
    -   @ai-sdk/harness@1.0.0-canary.8

## @ai-sdk/harness-pi@1.0.0-canary.4

### Patch Changes

-   Updated dependencies [aae0138]
    -   @ai-sdk/harness@1.0.0-canary.8

## @ai-sdk/sandbox-just-bash@1.0.0-canary.8

### Patch Changes

-   Updated dependencies [aae0138]
    -   @ai-sdk/harness@1.0.0-canary.8

## @ai-sdk/sandbox-vercel@1.0.0-canary.8

### Patch Changes

-   Updated dependencies [aae0138]
    -   @ai-sdk/harness@1.0.0-canary.8

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background

the oauth flow was fetching OAuth/OIDC well-known metadata and trusted
its endpoints after schema parsing, but did not verify that
`metadata.issuer` matched the issuer implied by the discovery url.

this is a requirement mentioned in the spec and there was a gap:
https://www.rfc-editor.org/rfc/rfc8414.html#section-3.3

## Summary

now each discovery candidate carries its expected issuer, and parsed
metadata is rejected if `metadata.issuer` does not exactly match

## Manual Verification

na

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
## Background

currently in the langchain provider, message IDs from the remote stream
were used as keys in plain objects like `messageSeen[msgId]`

if the remote stream sent id: `"__proto__"`, `messageSeen["__proto__"]`
resolves to `Object.prototype` not a normal own entry, which could
pollute value of object globally
 
## Summary

the state now uses `Map`, and tool tracking uses `Set`

## Manual Verification

na

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
…en usage (#16087)

## Summary

The Fireworks provider never set `includeUsage`, so it never sent
`stream_options: { include_usage: true }` on streaming requests. For
models that don't return usage by default (e.g. `minimax-m3`), this
means **streaming responses come back with `usage` entirely
onsumers
(incl. AI Gateway cost accounting) then compute a cost of `0`.

Other models served by Fireworks (e.g. `deepseek-v4-flash`, `kimi-k2.6`)
include usage in the final chunk regardless, which masked the gap.

## Root cause

`OpenAICompatibleChatLanguageModel` only emits
`stream_options.include_usage` when its config has `includeUsage`
truthy:

```ts
stream_options: this.config.includeUsage ? { include_usage: true } : undefined
```

`createFireworks` built the chat/completion models without
`includeUsage`, and — unlike `createOpenAICompatible` — the Fireworks
settings type never exposed it, so the flag could not reach the model
config.

## Fix

Set `includeUsage: true` on the Fireworks chat and completion model
configs, mirroring how the closest sibling provider
(`@ai-sdk/moonshotai`) already does it. This makes Fireworks request the
usage chunk on streams so token usage is reported for all models.

## Verification

Reproduced through AI Gateway (`only: fireworks`, streaming)
before/after:

| Model | Before | After |
|---|---|---|
| `minimax/minimax-m3` | usage `undefined`, cost `0` | input 132 /
output 23, cost computed |
| `deepseek/deepseek-v4-flash` | usage present | usage present
(unchanged) |
| `moonshotai/kimi-k2.6` | usage present | usage present (unchanged) |

`pnpm test:node` passes (45 tests, incl. new assertions that chat &
completion configs set `includeUsage: true`).
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-canary.173

### Patch Changes

-   Updated dependencies [efec111]
    -   @ai-sdk/gateway@4.0.0-canary.105

## @ai-sdk/angular@3.0.0-canary.173

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/fireworks@3.0.0-canary.57

### Patch Changes

- 38010a1: Enable `includeUsage` for Fireworks so streaming responses
report token usage

## @ai-sdk/gateway@4.0.0-canary.105

### Patch Changes

- efec111: chore(provider/gateway): update gateway model settings files

## @ai-sdk/harness@1.0.0-canary.9

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/harness-claude-code@1.0.0-canary.5

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.9

## @ai-sdk/harness-codex@1.0.0-canary.5

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.9

## @ai-sdk/harness-pi@1.0.0-canary.5

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.9

## @ai-sdk/langchain@3.0.0-canary.173

### Patch Changes

-   c1afaed: fix(langchain): prevent polluting global object.prototype
    -   ai@7.0.0-canary.173

## @ai-sdk/llamaindex@3.0.0-canary.173

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/mcp@2.0.0-canary.64

### Patch Changes

-   024a6b4: fix(mcp): validate oauth metadata issuer during discovery

## @ai-sdk/otel@1.0.0-canary.119

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/policy-opa@1.0.0-canary.10

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/react@4.0.0-canary.176

### Patch Changes

-   Updated dependencies [024a6b4]
    -   @ai-sdk/mcp@2.0.0-canary.64
    -   ai@7.0.0-canary.173

## @ai-sdk/rsc@3.0.0-canary.174

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/sandbox-just-bash@1.0.0-canary.9

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.9

## @ai-sdk/sandbox-vercel@1.0.0-canary.9

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.9

## @ai-sdk/svelte@5.0.0-canary.173

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/tui@1.0.0-canary.8

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/vue@4.0.0-canary.173

### Patch Changes

-   ai@7.0.0-canary.173

## @ai-sdk/workflow@1.0.0-canary.90

### Patch Changes

-   ai@7.0.0-canary.173

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background

#16002

the mcp `HTTP/SSE` transports only processed sse frames when `event ===
'message'`

bare sse frames were dropped, so JSON-RPC responses never reached
`DefaultMCPClient.request()`, causing `createMCPClient()` to hang
instead of resolving

## Summary

missing SSE event: fields are treated as the default message event,
matching the SSE spec

## Manual Verification

na

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

fixes #16002
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/mcp@2.0.0-canary.65

### Patch Changes

- b29e087: fix (mcp): handle SSE messages without explicit event fields

## @ai-sdk/react@4.0.0-canary.177

### Patch Changes

-   Updated dependencies [b29e087]
    -   @ai-sdk/mcp@2.0.0-canary.65

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-canary.174

### Patch Changes

-   Updated dependencies [ca2cf45]
    -   @ai-sdk/gateway@4.0.0-canary.106

## @ai-sdk/angular@3.0.0-canary.174

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/gateway@4.0.0-canary.106

### Patch Changes

- ca2cf45: fix(provider/gateway): map `forbidden` error responses to
GatewayForbiddenError instead of GatewayInternalServerError

## @ai-sdk/harness@1.0.0-canary.10

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/harness-claude-code@1.0.0-canary.6

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.10

## @ai-sdk/harness-codex@1.0.0-canary.6

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.10

## @ai-sdk/harness-pi@1.0.0-canary.6

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.10

## @ai-sdk/langchain@3.0.0-canary.174

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/llamaindex@3.0.0-canary.174

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/otel@1.0.0-canary.120

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/policy-opa@1.0.0-canary.11

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/react@4.0.0-canary.178

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/rsc@3.0.0-canary.175

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/sandbox-just-bash@1.0.0-canary.10

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.10

## @ai-sdk/sandbox-vercel@1.0.0-canary.10

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.10

## @ai-sdk/svelte@5.0.0-canary.174

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/tui@1.0.0-canary.9

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/vue@4.0.0-canary.174

### Patch Changes

-   ai@7.0.0-canary.174

## @ai-sdk/workflow@1.0.0-canary.91

### Patch Changes

-   ai@7.0.0-canary.174

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
<!--
Welcome to contributing to AI SDK! We're excited to see your changes.

We suggest you read the following contributing guide we've created
before submitting:

https://github.com/vercel/ai/blob/main/CONTRIBUTING.md
-->

## Background

<!-- Why was this change necessary? -->

`runBridge()` waits for the WebSocket server to start listening. If the
port is already occupied, for example by another run in the same
sandbox, the server emits `EADDRINUSE`. Because the startup promise did
not handle that error, it remained pending and Node eventually exited
with an unsettled top-level-await error.

## Summary

<!-- What did you change? -->

Added a listener for websocket error events that rejects the promise,
also moved listeners to once instead of on.

## Manual Verification

<!--
For features & bugfixes.
Please explain how you *manually* verified that the change works
end-to-end as expected (excluding automated tests).
Remove the section if it's not needed (e.g. for docs).
-->

Started a plain Node TCP server to occupy a port, called `runBridge()`
requesting the same port and confirmed it properly rejects the promise
and exists correctly.

## Checklist

<!--
Do not edit this list. Leave items unchecked that don't apply. If you
need to track subtasks, create a new "## Tasks" section

Please check if the PR fulfills the following requirements:
-->

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Future Work

<!--
Feel free to mention things not covered by this PR that can be done in
future PRs.
Remove the section if it's not needed.
 -->

## Related Issues

<!--
List related issues here, e.g. "Fixes #1234".
Remove the section if it's not needed.
-->
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @ai-sdk/harness@1.0.0-canary.11

### Patch Changes

- be83911: fix(harness): reject bridge startup when the WebSocket port
cannot be bound

## @ai-sdk/harness-claude-code@1.0.0-canary.7

### Patch Changes

-   Updated dependencies [be83911]
    -   @ai-sdk/harness@1.0.0-canary.11

## @ai-sdk/harness-codex@1.0.0-canary.7

### Patch Changes

-   Updated dependencies [be83911]
    -   @ai-sdk/harness@1.0.0-canary.11

## @ai-sdk/harness-pi@1.0.0-canary.7

### Patch Changes

-   Updated dependencies [be83911]
    -   @ai-sdk/harness@1.0.0-canary.11

## @ai-sdk/sandbox-just-bash@1.0.0-canary.11

### Patch Changes

-   Updated dependencies [be83911]
    -   @ai-sdk/harness@1.0.0-canary.11

## @ai-sdk/sandbox-vercel@1.0.0-canary.11

### Patch Changes

-   Updated dependencies [be83911]
    -   @ai-sdk/harness@1.0.0-canary.11

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background

introduced in v7, the user-facing model lifecycle callbacks had to be
made stable across the codebase and the docs

## Summary

the callbacks are marked stable + deprecated the experimental versions
(since some of them were introduced when main was still on v6)

## Manual Verification

verified by running the example
`examples/ai-functions/src/generate-text/openai/listen-to-events.ts`

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-canary.175

### Patch Changes

-   6ec57f5: feat(ai): make the experimental lifecycle callbacks stable

## @ai-sdk/angular@3.0.0-canary.175

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/harness@1.0.0-canary.12

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/harness-claude-code@1.0.0-canary.8

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.12

## @ai-sdk/harness-codex@1.0.0-canary.8

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.12

## @ai-sdk/harness-pi@1.0.0-canary.8

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.12

## @ai-sdk/langchain@3.0.0-canary.175

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/llamaindex@3.0.0-canary.175

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/otel@1.0.0-canary.121

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/policy-opa@1.0.0-canary.12

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/react@4.0.0-canary.179

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/rsc@3.0.0-canary.176

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/sandbox-just-bash@1.0.0-canary.12

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.12

## @ai-sdk/sandbox-vercel@1.0.0-canary.12

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.12

## @ai-sdk/svelte@5.0.0-canary.175

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/tui@1.0.0-canary.10

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/vue@4.0.0-canary.175

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

## @ai-sdk/workflow@1.0.0-canary.92

### Patch Changes

-   Updated dependencies [6ec57f5]
    -   ai@7.0.0-canary.175

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background

the highlighted code lines were incorrect

<img width="1398" height="1544" alt="Screenshot 2026-06-15 at 2 12
05 PM"
src="https://github.com/user-attachments/assets/4b40a7a1-cccd-4a05-a007-5dbc8f7ac087"
/>

<img width="1264" height="1692" alt="Screenshot 2026-06-15 at 2 12
36 PM"
src="https://github.com/user-attachments/assets/7468da3d-e36b-4886-92e8-635231aceccb"
/>


## Summary

change the highlighted code

## Manual Verification

na

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Future Work

there's probably a lot of mis-highlighted code lines across the docs
which should be fixed
## Background

the docs page had to be updated to provide a guide on how to use the
model lifecycle callbacks that were added in v7

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-canary.176

### Patch Changes

-   Updated dependencies [d5b8263]
    -   @ai-sdk/gateway@4.0.0-canary.107

## @ai-sdk/angular@3.0.0-canary.176

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/gateway@4.0.0-canary.107

### Patch Changes

- d5b8263: chore(provider/gateway): update gateway model settings files

## @ai-sdk/harness@1.0.0-canary.13

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/harness-claude-code@1.0.0-canary.9

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.13

## @ai-sdk/harness-codex@1.0.0-canary.9

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.13

## @ai-sdk/harness-pi@1.0.0-canary.9

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.13

## @ai-sdk/langchain@3.0.0-canary.176

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/llamaindex@3.0.0-canary.176

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/otel@1.0.0-canary.122

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/policy-opa@1.0.0-canary.13

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/react@4.0.0-canary.180

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/rsc@3.0.0-canary.177

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/sandbox-just-bash@1.0.0-canary.13

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.13

## @ai-sdk/sandbox-vercel@1.0.0-canary.13

### Patch Changes

-   @ai-sdk/harness@1.0.0-canary.13

## @ai-sdk/svelte@5.0.0-canary.176

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/tui@1.0.0-canary.11

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/vue@4.0.0-canary.176

### Patch Changes

-   ai@7.0.0-canary.176

## @ai-sdk/workflow@1.0.0-canary.93

### Patch Changes

-   ai@7.0.0-canary.176

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…cted (#16141)

## Background

The realtime voice chat example
(`examples/ai-e2e-next/app/realtime/page.tsx`) was stuck on
`DISCONNECTED` for all three providers (OpenAI, Google, xAI), even
though the provider WebSocket actually opened and `session-created` /
`session-updated` events arrived.

Root cause: `experimental_useRealtime` recreates its internal
`RealtimeStore` whenever the store key changes, and the key compares
`sessionConfig` by object identity
(`packages/react/src/use-realtime.ts`). The example passed a fresh
inline `sessionConfig` object literal on every render, so the store was
recreated on every render:

1. Clicking **Connect** flips store A to `connecting` → `connected` (its
socket is the live one).
2. That state update re-renders the hook, which sees a new
`sessionConfig` reference and builds store B (`disconnected`), binding
the UI to it.
3. The live socket on store A is orphaned and the UI shows store B's
`disconnected` state — the status never even flashed `connecting`.

`model` was already memoized in the example, so `sessionConfig` was the
only unstable key.

## Summary

Memoized `sessionConfig` with `useMemo` (keyed on `voice` and the
provider `config`), mirroring how `model` is already memoized. This
keeps the store key stable across renders so the connected store stays
bound to the UI.

## Manual Verification

Tested the e2e realtime example with all 3 providers

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added
(example-only change; examples are not published)
- [x] I have reviewed this pull request (self-review)

## Future Work

`experimental_useRealtime` recreates its store when `sessionConfig`
changes by reference, which is fragile for the common pattern of passing
an inline object. A follow-up could harden the hook (e.g. drop
`sessionConfig` from the recreation key or compare it structurally) so
consumers don't have to memoize it.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
## Background

Graduates the current `canary` pre-release line to `beta`. This is the
reverse of #14920, which switched the pre-release tag the other way
(`beta` → `canary`).

## Summary

- Switch the pre-release npm tag in `.changeset/pre.json` from `canary`
to `beta`.
- Rename all publishable package versions from `X.Y.Z-canary.N` to
`X.Y.Z-beta.N`, preserving the increment counter (e.g. `ai`:
`7.0.0-canary.175` → `7.0.0-beta.175`). The next changeset bump produces
`-beta.176`.
- Add a changeset bumping all publishable packages (`patch`) to trigger
the initial beta release. This includes packages added since #14920
(`anthropic-aws`, `harness`, `harness-claude-code`, `harness-codex`,
`harness-pi`, `policy-opa`, `quiverai`, `sandbox-just-bash`,
`sandbox-vercel`, `tui`, `voyage`).

Notes:
- `initialVersions` in `pre.json` is left untouched — it is
informational; the next-version computation reads from current
`package.json`, so leaving it stale has no effect on the release plan
(same rationale as #14920).
- `pnpm-lock.yaml` is unchanged — internal packages are referenced via
`workspace:*`, not pinned versions.
- `tools/konsistent-provider` is left on its existing version — it is
`private` and not published (also untouched by #14920).
- The `react-server-dom-webpack@18.3.0-canary-...` dependency in
`packages/rsc` is an unrelated upstream React build and was
intentionally not modified.

## Checklist

- [ ] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-beta.177

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/gateway@4.0.0-beta.108
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/alibaba@2.0.0-beta.60

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/amazon-bedrock@5.0.0-beta.85

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/anthropic@4.0.0-beta.67
    -   @ai-sdk/openai@4.0.0-beta.74
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/angular@3.0.0-beta.177

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   ai@7.0.0-beta.177

## @ai-sdk/anthropic@4.0.0-beta.67

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/anthropic-aws@1.0.0-beta.8

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/anthropic@4.0.0-beta.67
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/assemblyai@3.0.0-beta.51

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/azure@4.0.0-beta.76

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/deepseek@3.0.0-beta.55
    -   @ai-sdk/openai@4.0.0-beta.74
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/baseten@2.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/black-forest-labs@2.0.0-beta.51

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/bytedance@2.0.0-beta.52

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/cerebras@3.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/codemod@4.0.0-beta.7

### Patch Changes

-   b8396f0: trigger initial beta release

## @ai-sdk/cohere@4.0.0-beta.53

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/deepgram@3.0.0-beta.50

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/deepinfra@3.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/deepseek@3.0.0-beta.55

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/devtools@1.0.0-beta.31

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/elevenlabs@3.0.0-beta.50

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/fal@3.0.0-beta.50

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/fireworks@3.0.0-beta.58

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/gateway@4.0.0-beta.108

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/gladia@3.0.0-beta.50

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/google@4.0.0-beta.82

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/google-vertex@5.0.0-beta.108

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/anthropic@4.0.0-beta.67
    -   @ai-sdk/google@4.0.0-beta.82
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/groq@4.0.0-beta.54

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/harness@1.0.0-beta.14

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19
    -   ai@7.0.0-beta.177

## @ai-sdk/harness-claude-code@1.0.0-beta.10

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/harness@1.0.0-beta.14
    -   @ai-sdk/provider-utils@5.0.0-beta.49

## @ai-sdk/harness-codex@1.0.0-beta.10

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/harness@1.0.0-beta.14
    -   @ai-sdk/provider-utils@5.0.0-beta.49

## @ai-sdk/harness-pi@1.0.0-beta.10

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/harness@1.0.0-beta.14
    -   @ai-sdk/provider-utils@5.0.0-beta.49

## @ai-sdk/huggingface@2.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/hume@3.0.0-beta.50

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/klingai@4.0.0-beta.51

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/langchain@3.0.0-beta.177

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   ai@7.0.0-beta.177

## @ai-sdk/llamaindex@3.0.0-beta.177

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   ai@7.0.0-beta.177

## @ai-sdk/lmnt@3.0.0-beta.50

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/luma@3.0.0-beta.50

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/mcp@2.0.0-beta.66

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/mistral@4.0.0-beta.55

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/moonshotai@3.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/open-responses@2.0.0-beta.54

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/openai@4.0.0-beta.74

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/openai-compatible@3.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/otel@1.0.0-beta.123

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider@4.0.0-beta.19
    -   ai@7.0.0-beta.177

## @ai-sdk/perplexity@4.0.0-beta.53

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/policy-opa@1.0.0-beta.14

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19
    -   ai@7.0.0-beta.177

## @ai-sdk/prodia@2.0.0-beta.53

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/provider@4.0.0-beta.19

### Patch Changes

-   b8396f0: trigger initial beta release

## @ai-sdk/provider-utils@5.0.0-beta.49

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/quiverai@2.0.0-beta.6

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/react@4.0.0-beta.181

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/mcp@2.0.0-beta.66
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19
    -   ai@7.0.0-beta.177

## @ai-sdk/replicate@3.0.0-beta.51

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/revai@3.0.0-beta.51

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/rsc@3.0.0-beta.178

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19
    -   ai@7.0.0-beta.177

## @ai-sdk/sandbox-just-bash@1.0.0-beta.14

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/harness@1.0.0-beta.14
    -   @ai-sdk/provider-utils@5.0.0-beta.49

## @ai-sdk/sandbox-vercel@1.0.0-beta.14

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/harness@1.0.0-beta.14
    -   @ai-sdk/provider-utils@5.0.0-beta.49

## @ai-sdk/svelte@5.0.0-beta.177

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   ai@7.0.0-beta.177

## @ai-sdk/test-server@2.0.0-beta.7

### Patch Changes

-   b8396f0: trigger initial beta release

## @ai-sdk/togetherai@3.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/tui@1.0.0-beta.12

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   ai@7.0.0-beta.177

## @ai-sdk/valibot@3.0.0-beta.49

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49

## @ai-sdk/vercel@3.0.0-beta.57

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/voyage@2.0.0-beta.24

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

## @ai-sdk/vue@4.0.0-beta.177

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   ai@7.0.0-beta.177

## @ai-sdk/workflow@1.0.0-beta.94

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19
    -   ai@7.0.0-beta.177

## @ai-sdk/xai@4.0.0-beta.75

### Patch Changes

-   b8396f0: trigger initial beta release
-   Updated dependencies [b8396f0]
    -   @ai-sdk/openai-compatible@3.0.0-beta.57
    -   @ai-sdk/provider-utils@5.0.0-beta.49
    -   @ai-sdk/provider@4.0.0-beta.19

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ntal runtime (#16080)

## Background

The gateway realtime model can only be used server-side today: the
WebSocket
upgrade is authenticated with the long-lived Gateway credential (API key
/
OIDC), carried in the `ai-gateway-auth.<token>` subprotocol. A browser
can't
hold that credential, so `gateway.experimental_realtime` throws in
browser
environments. The Gateway now exposes a mint endpoint
(`POST /v1/realtime/client-secrets`) that exchanges the long-lived
credential
for a single-use, short-lived `vcst_` token — the missing piece for
browser
realtime.

## Summary

`gateway.experimental_realtime.getToken()` now mints a `vcst_` client
secret
via the Gateway mint endpoint instead of returning the raw credential:

- `GatewayRealtimeModel.doCreateClientSecret(options)` delegates to a
provider-supplied `createClientSecret` hook, forwarding
`expiresAfterSeconds`
and surfacing the returned `expiresAt`. The model stays a pure event
codec.
- The provider implements minting (`POST
{origin}/v1/realtime/client-secrets`,
authenticated with the Gateway credential, body `{ model, expiresIn?
}`),
resolving the route against the gateway origin since it lives at
`/v1/...`
  rather than under the realtime `/v4/ai` base path.
- `getToken()` threads its options through to the mint call.
- The server-environment guard moves from realtime model construction to
the
mint path. Browsers can now build the realtime codec they need to drive
the
transport with a server-minted token; minting (which requires the
credential)
  stays server-side with a clear, actionable error.

Browser usage is now: your server calls `getToken()`, hands the browser
only
`{ token, url }`, and the browser connects with the `vcst_` token — the
API key
never reaches the client.

## Manual Verification

Built the gateway package locally, packed it, and ran it against a
deployed
Gateway preview carrying the mint endpoint:

- `getToken({ model: 'openai/gpt-realtime-2' })` returns a `vcst_…`
token (not
  the API key) with an `expiresAt`; the POST hits
  `/v1/realtime/client-secrets` on the gateway origin, carries
  `Authorization: Bearer <key>`, and forwards `expiresIn`.
- Opening the WebSocket with `getWebSocketConfig({ token, url })`
redeems the
token and streams a real response from `gpt-realtime-2` (verified via a
  terminal voice-TUI sample driving the packed build end-to-end).
- Reusing a redeemed token is rejected (single-use), and a
browser-global
environment throws the "must be minted server-side" error on
`getToken()`
  while still allowing model construction.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added
- [x] I have reviewed this pull request (self-review)
## Background

we introduced diagnostic channels in
#14854 as a way to propagate event
data.

but the problem was that there was no to establish a relation with the
parent and child calls that happen when consuming information via the
diagnostics channels. context propagation for subagents remained
unsolved (meaning subagents will be detached from the main parent call)

## Summary

- use `tracingChannel()` instead of diagnostic `channel()`
- model and tool execution are now wrapped with
`tracingChannel.tracePromise(...)` via the existing
`executeLanguageModelCall` and `executeTool` dispatcher paths
- in unsupported/non-Node runtimes, tracing dynamically no-ops and
directly runs the original callback/execution

## Manual Verification

verified that event data is still transmitted at each lifecycle event by
running the example
`examples/ai-functions/src/telemetry/tracing-channel/generate-text.ts`

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## ai@7.0.0-beta.178

### Patch Changes

- b097c52: feat(ai): use tracing channels to track parent-child context
-   Updated dependencies [15eb253]
    -   @ai-sdk/gateway@4.0.0-beta.109

## @ai-sdk/angular@3.0.0-beta.178

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/gateway@4.0.0-beta.109

### Patch Changes

- 15eb253: feat(gateway): mint short-lived client secrets for
experimental realtime

`gateway.experimental_realtime.getToken()` now mints a single-use,
short-lived
client secret (`vcst_`) via the Gateway's `POST
/v1/realtime/client-secrets`
endpoint instead of returning the long-lived Gateway credential. The
customer's
server calls `getToken()` and hands the returned token to the browser,
which
    opens the realtime WebSocket with it through the existing
`ai-gateway-auth.<token>` subprotocol — the API key / OIDC token never
reaches
the client. `expiresAfterSeconds` is forwarded to the mint endpoint and
the
    returned `expiresAt` is surfaced on the result.

The server-environment guard moves from realtime model construction to
minting:
the browser can now build the realtime event codec it needs to drive the
transport, while minting (which requires the Gateway credential) stays
    server-side.

## @ai-sdk/harness@1.0.0-beta.15

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/harness-claude-code@1.0.0-beta.11

### Patch Changes

-   @ai-sdk/harness@1.0.0-beta.15

## @ai-sdk/harness-codex@1.0.0-beta.11

### Patch Changes

-   @ai-sdk/harness@1.0.0-beta.15

## @ai-sdk/harness-pi@1.0.0-beta.11

### Patch Changes

-   @ai-sdk/harness@1.0.0-beta.15

## @ai-sdk/langchain@3.0.0-beta.178

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/llamaindex@3.0.0-beta.178

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/otel@1.0.0-beta.124

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/policy-opa@1.0.0-beta.15

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/react@4.0.0-beta.182

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/rsc@3.0.0-beta.179

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/sandbox-just-bash@1.0.0-beta.15

### Patch Changes

-   @ai-sdk/harness@1.0.0-beta.15

## @ai-sdk/sandbox-vercel@1.0.0-beta.15

### Patch Changes

-   @ai-sdk/harness@1.0.0-beta.15

## @ai-sdk/svelte@5.0.0-beta.178

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/tui@1.0.0-beta.13

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/vue@4.0.0-beta.178

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

## @ai-sdk/workflow@1.0.0-beta.95

### Patch Changes

-   Updated dependencies [b097c52]
    -   ai@7.0.0-beta.178

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Bumps `@angular/*` off the vulnerable `@angular/core@20.3.21` to patched
`20.3.25`, clearing the Socket alert for CVE-2026-54267 (VULN-11768).

Dependency hygiene only — the AI SDK is not exploitable via this CVE:
`@angular/core` is a peer dep, `@ai-sdk/angular` only imports `signal`,
and there's no SSR/hydration usage.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
## Background

the telemetry docs were missing the nextjs instrumentation setup

## Summary

add code snippet explaining how to register telemetry for next.js apps

## Manual Verification

na

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [ ] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [ ] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.