npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-sdk-cc-provider

v0.2.3

Published

Claude Code provider for Vercel AI SDK using @anthropic-ai/claude-code

Readme

AI SDK Claude Code Provider

A provider for Vercel AI SDK that enables the use of Claude Code with development tools, file operations, and reasoning support.

Features

  • 🛠️ 13 Built-in Tools: File operations, bash commands, web search, project management
  • 🧠 Reasoning Support: Claude-style thinking with reasoning streams
  • 🔄 Streaming: Real-time response and tool execution streaming
  • AI SDK v5: Compatible with latest Vercel AI SDK

NOTE

  • Supports AI SDK v5 with LanguageModelV2 specification.
  • Currently supports generateText and streamText. Object generation (generateObject, streamObject) is not yet supported.

Installation

npm install ai-sdk-cc-provider

Quick Start

Basic Usage

import { generateText } from 'ai';
import { claudeCode, getCommonClaudeCodeTools } from 'ai-sdk-cc-provider';

const result = await generateText({
  model: claudeCode('claude-sonnet-4-0', {
    options: {
      cwd: process.cwd(),
      maxTurns: 3,
      allowedTools: ['Read', 'Write', 'Bash', 'Glob', 'Grep'],
    },
  }),
  tools: getCommonClaudeCodeTools(), // Read, Write, Bash, Glob, Grep
  prompt: 'Help me create a simple React component',
});

console.log(result.text);

Streaming Text with Reasoning

import { streamText } from 'ai';
import { claudeCode, getFileTools } from 'ai-sdk-cc-provider';

const { textStream, reasoningStream } = await streamText({
  model: claudeCode('claude-opus-4-1', {
    options: {
      cwd: process.cwd(),
      maxThinkingTokens: 10000, // Enable reasoning mode
      allowedTools: ['Read', 'Write', 'Edit', 'MultiEdit'],
    },
  }),
  tools: getFileTools(),
  prompt: 'Analyze my codebase and suggest improvements',
});

// Stream reasoning deltas (thinking process)
for await (const reasoning of reasoningStream || []) {
  process.stdout.write(reasoning.delta);
}

// Stream final text output
for await (const text of textStream) {
  process.stdout.write(text);
}

Tool Access Methods

// Method 1: Direct access
tools: {
  Read: claudeCode.tools.Read,
  Bash: claudeCode.tools.Bash,
}

// Method 2: Use utility functions
import { getCommonClaudeCodeTools, getAllClaudeCodeTools } from 'ai-sdk-cc-provider';
tools: getCommonClaudeCodeTools() // 5 most common tools
tools: getAllClaudeCodeTools()    // All 13 tools

Configuration

const model = claudeCode('claude-sonnet-4-0', {
  options: {
    cwd: process.cwd(),                    // Working directory
    maxTurns: 5,                          // Max conversation turns
    maxThinkingTokens: 10000,             // Enable reasoning mode
    allowedTools: ['Read', 'Write', 'Bash'], // Specific tools to enable
    additionalDirectories: ['/src'],      // Extra accessible directories
    mcpServers: { /* MCP configs */ },    // Custom MCP servers
  },
});

Supported Models

  • claude-opus-4-1 - Latest Opus (→ claude-opus-4-1-20250805)
  • claude-opus-4-0 - Claude Opus 4 (→ claude-opus-4-20250514)
  • claude-sonnet-4-5 - Best model for complex agents and coding (→ claude-sonnet-4-5-20250929)
  • claude-sonnet-4-0 - High-performance Sonnet (→ claude-sonnet-4-20250514)
  • claude-3-7-sonnet-latest - Claude 3.7 Sonnet (→ claude-3-7-sonnet-20250219)
  • claude-3-5-haiku-latest - Fast Haiku (→ claude-3-5-haiku-20241022)

For production, you can use specific model versions (e.g., claude-sonnet-4-5-20250929) to ensure consistent behavior.

Available Tools

Tool Collections

import {
  getCommonClaudeCodeTools,    // Read, Write, Bash, Glob, Grep
  getFileTools,               // Read, Write, Edit, MultiEdit
  getExecutionTools,          // Bash, BashOutput, KillShell
  getWebTools,               // WebFetch, WebSearch
  getProjectTools,           // Task, TodoWrite
  getAllClaudeCodeTools,     // All 13 tools
} from 'ai-sdk-cc-provider';

13 Built-in Tools

File Operations: Read, Write, Edit, MultiEdit Search: Glob, Grep Execution: Bash, BashOutput, KillShell Web: WebFetch, WebSearch Project: Task, TodoWrite

Tool Usage

// Most common tools
tools: getCommonClaudeCodeTools()

// All tools
tools: getAllClaudeCodeTools()

// Specific categories
tools: {
  ...getFileTools(),
  ...getWebTools(),
}

// Direct access
tools: {
  Read: claudeCode.tools.Read,
  Bash: claudeCode.tools.Bash,
}

Examples

File Operations

import { generateText } from 'ai';
import { claudeCode, getFileTools } from 'ai-sdk-cc-provider';

const result = await generateText({
  model: claudeCode('claude-sonnet-4-0', {
    options: {
      allowedTools: ['Read', 'Write', 'Edit', 'MultiEdit'],
    },
  }),
  tools: getFileTools(),
  prompt: 'Read package.json and create a README.md',
});

Web Tools

import { claudeCode, getWebTools } from 'ai-sdk-cc-provider';

const result = await generateText({
  model: claudeCode('claude-sonnet-4-0', {
    options: {
      allowedTools: ['WebFetch', 'WebSearch'],
    },
  }),
  tools: getWebTools(),
  prompt: 'Search for the latest TypeScript documentation',
});

With All Tools

import { claudeCode, getAllClaudeCodeTools } from 'ai-sdk-cc-provider';

const result = await generateText({
  model: claudeCode('claude-sonnet-4-0', {
    options: {
      allowedTools: ['Read', 'Write', 'Edit', 'MultiEdit', 'Bash', 'Glob', 'Grep', 'WebFetch', 'WebSearch', 'Task', 'TodoWrite'],
    },
  }),
  tools: getAllClaudeCodeTools(), // All 13 tools
  prompt: 'Help me analyze and refactor my codebase',
});

Requirements

Troubleshooting

  • Tool errors: Ensure Claude Code CLI is properly installed and configured
  • File access: Add directories to additionalDirectories option
  • Permission issues: Check Claude Code has access to your project directory

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.