Skip to content

laguagu/claude-code-nextjs-skills / skills/ai-sdk-7

ai-sdk-7

Verified

Vercel AI SDK v7 development and migration. Use when building or upgrading AI SDK 7 apps, especially ToolLoopAgent, WorkflowAgent, HarnessAgent, Claude Code/Codex/Pi harnesses, runtimeContext, toolsContext, toolApproval, telemetry, reasoning, file or skill uploads, realtime, video generation, or v6-to-v7 breaking changes. For version discovery, v6 code and general doc lookup use ai-sdk.

references/media-and-files.md

View on GitHub
---
title: Media, Files, Realtime, and Video in AI SDK 7
description: Provider file uploads, skill uploads, realtime sessions, and video generation.
---

# Files, skills, realtime and video

Check the configured provider's capabilities before choosing an API. These
features are not universally supported across providers or interchangeable IDs.

`uploadFile` returns a provider reference for reuse with a compatible provider;
`uploadSkill` uploads provider-managed skill files. Provider skills are separate
from HarnessAgent instruction bundles.

Canonical file parts use `type: 'file'`, `data` and `mediaType`. V7 accepts
a full IANA type or a top-level segment such as `image`, with subtype detection
from inline bytes where possible. Use a precise type when known; validate remote
or opaque references against the provider's contract. Inline tool results use
`{ type: 'file', mediaType, data: { type: 'data', data } }` in v7; retain handling
of deprecated `file-data` in persisted/legacy outputs and `reasoning-file` parts
in serializers/renderers.

Realtime APIs are experimental. Create scoped ephemeral browser credentials on
the server; keep long-lived provider keys there. Verify reconnect and
client-driven tool execution behavior for the chosen provider.

Realtime facts the docs do not state (`experimental_useRealtime`, 7.0.159, OpenAI token sessions):

- `connect({ stream })` only stores the stream. Call `startAudioCapture(stream)` once `status` is
  `connected`, or no `input_audio_buffer.append` frame is ever sent and no error comes.
- `response-create` with `instructions` replaces the session's instructions for that response.
- `sessionConfig.providerOptions` is copied into the session as it is, so options go at its top level:
  `providerOptions: { reasoning: { effort: "minimal" } }`, not under `openai`. On `gpt-realtime-2.1`
  this took the wait before a tool call from about 3.3 s to under a second.
- The hook gives no audio levels. Take them from the PCM in `audio-delta` events through `onEvent`.

Video generation and media downloads need the actual provider limits, bounded
sizes and cancellation. Do not bake demo model IDs or download behavior into a
shared wrapper.

Read the provider documentation and
[v7 migration guide](https://ai-sdk.dev/docs/migration-guides/migration-guide-7-0)
for file-part changes; locate current realtime/video APIs in the installed docs.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall