Contributing to the Vercel AI SDK
Thanks for your interest in contributing to the Vercel AI SDK! This guide covers everything you need to know.
Development Setup
Prerequisites
- Node.js 18+
- pnpm 9+
Getting Started
git clone https://github.com/vercel/ai.git
cd ai
pnpm install
pnpm build
Running Tests
# All tests
pnpm test
# Specific package
pnpm test --filter=ai
# Watch mode
pnpm test --filter=ai -- --watch
Repository Structure
This is a monorepo managed with pnpm workspaces and Turborepo:
packages/ai/— Core AI SDK (aipackage)packages/provider/— Provider interface and utilitiespackages/openai/— OpenAI provider (@ai-sdk/openai)packages/anthropic/— Anthropic provider (@ai-sdk/anthropic)packages/google/— Google provider (@ai-sdk/google)examples/— Example applicationscontent/docs/— Documentation (MDX)
Contribution Guidelines
Types of Contributions
- Bug fixes: Always welcome, please include a test case
- New providers: Follow the provider interface in
packages/provider/ - Documentation: Improvements to docs, examples, and guides
- Performance: Streaming and parsing optimizations
Pull Request Process
- Create a branch from
main - Write or update tests
- Ensure
pnpm buildandpnpm testpass - Add a changeset:
pnpm changeset - Submit your PR with a clear description
Code Standards
- TypeScript strict mode
- ESLint + Prettier formatting
- No
anytypes (useunknownand narrow) - Comprehensive JSDoc on public APIs
- Unit tests for all utility functions
Provider Development
To add a new provider:
- Create a package in
packages/<provider-name>/ - Implement the
LanguageModelinterface from@ai-sdk/provider - Add streaming support via
ReadableStream - Include integration tests with API mocking
- Add documentation in
content/docs/providers/
Changesets
We use Changesets for version management:
pnpm changeset
# Select the packages affected
# Choose the semver bump type
# Write a changelog entry
License
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.