Skip to content

egoist-bot/ai-sdk-provider-claude-code

 
 

Repository files navigation

alpha warning npm version install size npm downloads Node.js ≥ 18 License: MIT

AI SDK Provider for Claude Code SDK

Warning: This package is experimental and subject to change.

ai-sdk-provider-claude-code lets you use Claude via the Vercel AI SDK through the official @anthropic-ai/claude-code SDK/CLI.

Installation

1. Install and authenticate the CLI

npm install -g @anthropic-ai/claude-code
claude login

2. Add the provider

npm install ai-sdk-provider-claude-code ai

Disclaimer

This is an unofficial community provider and is not affiliated with or endorsed by Anthropic or Vercel. By using this provider:

  • You understand that your data will be sent to Anthropic's servers through the Claude Code SDK
  • You agree to comply with Anthropic's Terms of Service
  • You acknowledge this software is provided "as is" without warranties of any kind

Please ensure you have appropriate permissions and comply with all applicable terms when using this provider.

Quick Start

import { generateText } from 'ai';
import { claudeCode } from 'ai-sdk-provider-claude-code';

const { text } = await generateText({
  model: claudeCode('sonnet'),
  prompt: 'Hello, Claude!'
});

console.log(text);

Models

  • opus - Claude 4 Opus (most capable)
  • sonnet - Claude 4 Sonnet (balanced performance)

Documentation

Core Features

  • 🚀 Vercel AI SDK compatibility
  • 🔄 Streaming support
  • 💬 Multi-turn conversations
  • 🎯 Object generation with JSON schemas
  • 🛑 AbortSignal support
  • 🔧 Tool management (MCP servers, permissions)

Limitations

  • Requires Node.js ≥ 18
  • No image support
  • Some AI SDK parameters unsupported (temperature, maxTokens, etc.)

Contributing

We welcome contributions, especially:

  • Code structure improvements
  • Performance optimizations
  • Better error handling
  • Additional examples

See Contributing Guidelines for details.

For development status and technical details, see Development Status.

License

MIT

About

Vercel AI SDK community provider for Claude Code SDK - Use Pro/Max Subscription via SDK.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.0%
  • JavaScript 3.3%
  • Shell 0.7%