Develop AI Functions Example
Official Vercel skill for developing, validating, and structuring AI SDK examples.
- Skill Road
- Develop AI Functions Example
Categories
Develop AI Functions Example is an official skill from Vercel's vercel/ai repository. According to the provider, it helps create, run, and modify examples under examples/ai-functions/src. Those examples validate provider support, demonstrate AI SDK features, and create test fixtures. The skill is therefore development guidance rather than an independent model provider, hosting service, or finished production system. It is intended for people who want to explore the AI SDK in TypeScript projects in a reproducible way or protect library changes with small, focused examples that can be reviewed and rerun.
Purpose and triggers
The official description identifies three central tasks. An example can validate support for a new provider, demonstrate a new feature with a particular provider, or reproduce a bug in an isolated file. Provider-specific options and API response fixtures are also within scope. This boundary matters because the skill should not silently design a complete application, alter unrelated infrastructure, or obtain credentials. It supplies context for the examples directory and supports a focused technical investigation with a visible, reviewable result.
Covered functions
According to the provider, the example area includes non-streaming text generation with generateText, streaming with streamText, structured output through generateObject and streamObject, and agentic workflows using ToolLoopAgent. It also covers single and batch embeddings, image generation, speech generation, transcription, reranking, middleware, provider registry setup, telemetry, complex multi-component examples, reusable tools, and shared utilities. Organizing material by function makes the behavior under test explicit and avoids flat collections of provider files that become difficult to compare.
Structure and workflow
The source recommends grouping examples by function and provider. A basic example should use the name basic.ts, while additional examples use descriptive kebab-case names. According to the provider, every example uses the run wrapper from lib/run.ts. That wrapper loads environment values from a local configuration and provides detailed API error handling. Streaming examples can use the helper for printing the full stream, while print utilities remove undefined values from diagnostic output. A useful example should have a clear prompt, a realistic model identifier, and one central behavior that a reviewer can understand without reconstructing a larger application.
Directory Structure and Naming
The examples live in examples/ai-functions/src, organized by AI SDK function, such as generate-text, stream-text, generate-object, agent, embed, generate-image and transcribe. Files follow the pattern <function>/<provider>/<feature>.ts. The entry example is called basic.ts, and further examples carry descriptive lowercase names with hyphens. Flat files such as generate-text/openai.ts should be avoided. An example is run from the examples/ai-functions folder with pnpm tsx, for instance pnpm tsx src/generate-text/openai/basic.ts. All examples use the run() wrapper from lib/run.ts, which loads environment variables and handles errors.
Safety, limits, and E-E-A-T
Examples may call external model providers and process prompts, files, or API responses. Credentials, tokens, private keys, and real personal data do not belong in source code, fixture files, or catalog content. Local execution does not automatically mean that data stays local, because the selected provider and model may process the content. The run wrapper improves error reporting but does not replace privacy review, cost controls, permission checks, or prompt-injection analysis. According to the provider, the skill is practical guidance in the official repository; the primary source and AI SDK documentation remain authoritative for current API details. The repository identifies Apache-2.0 as its license. This entry does not claim that every provider is compatible or that every example is production-ready, and it states no concrete prices. Teams should review current provider documentation, model availability, and account terms before execution.
Installation instructions
Develop AI Functions Example is an internal skill inside the official Vercel AI SDK repository on GitHub. It is not aimed at end users of a finished app but at contributors who work on the AI SDK itself and maintain example scripts for individual SDK functions inside the examples/ai-functions folder. A skill in this sense is a SKILL.md file with a short description telling an AI coding assistant such as Claude Code when to pull it in automatically. According to the provider, this particular skill is marked internal, meaning it is not distributed as a standalone product but acts as a reference the assistant loads within the context of the Vercel repository whenever someone wants to create, run, or modify examples under examples/ai-functions/src.
What the skill is actually for
Its core job is to validate provider support, demonstrate features, and produce test fixtures. Examples are organized by SDK function: generateText for non-streaming text generation, streamText for streaming responses, generateObject and streamObject for structured output against a schema, plus sections for agents using tool loops, single and batch embeddings, image and speech generation, transcription, document reranking, and areas for middleware, provider registry setup, and OpenTelemetry integration. This structure makes it quick to see where a new example for a given use case belongs instead of scattering files arbitrarily.
Naming convention and structure
The skill enforces a clear file naming rule: the entry-point example for a function is always named basic.ts, while additional examples follow a pattern combining function, provider, and optionally sub-provider or feature, such as stream-text for the openai provider with a file called tool-call.ts for a specific tool-calling scenario. Flat files without a per-provider subfolder are explicitly disallowed so the structure stays consistent across dozens of providers. Every example uses a shared run wrapper from a library file that loads environment variables from an env file and logs errors with detailed API messages, so when testing a new model it is immediately clear why a call failed.
Requirements for using it
To make meaningful use of this skill you need a local clone of the vercel/ai repository, a working Node.js and TypeScript environment, and valid API keys for the relevant model providers stored in a local env file. The skill itself is not installed separately; it already lives in the repository and gets picked up automatically by a compatible coding agent whenever its description matches the current work context.
Security and credential handling
Because the examples make real API calls against model providers, keys and credentials end up in a local env file that should never be committed. Anyone creating new examples following this pattern should also double check that no real customer data or internal secrets end up inside prompt strings, since these files remain permanently visible in the repository history.
Practical value and limitations
The practical value lies mainly in giving new AI SDK contributors an immediately consistent structure, while a coding assistant automatically applies the correct naming patterns and templates when creating new examples, which speeds up code review. The limitation is equally clear: this skill is not a general-purpose tool for your own projects but exists solely to maintain the Vercel AI SDK example folder, and outside the context of that specific repository it offers no added value. Anyone maintaining their own SDK or example collection can still borrow the underlying idea: clear naming conventions plus a shared wrapper for environment variables and error handling save a lot of coordination effort in any larger repository.
- Provider
- Vercel
- License
- Apache-2.0
- Last reviewed
- 09.09.2026
Repository and documentation
Categories
Compatible with
Related guides
Guides and background related to this entry.