ai-sdk-provider-claude-code 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/index.cjs +878 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +483 -0
- package/dist/index.d.ts +483 -0
- package/dist/index.js +843 -0
- package/dist/index.js.map +1 -0
- package/docs/DEVELOPMENT-STATUS.md +221 -0
- package/docs/GUIDE.md +865 -0
- package/docs/TROUBLESHOOTING.md +238 -0
- package/package.json +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ben Vargas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# AI SDK Provider for Claude Code (Alpha)
|
|
2
|
+
|
|
3
|
+
> **Warning**: This package is experimental and subject to change.
|
|
4
|
+
|
|
5
|
+
**ai-sdk-provider-claude-code** lets you use Claude via the [Vercel AI SDK](https://sdk.vercel.ai/docs) through the official `@anthropic-ai/claude-code` CLI.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
### 1. Install and authenticate the CLI
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @anthropic-ai/claude-code
|
|
12
|
+
claude login
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. Add the provider
|
|
16
|
+
```bash
|
|
17
|
+
npm install git+https://github.com/ben-vargas/ai-sdk-provider-claude-code.git
|
|
18
|
+
npm install ai
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Disclaimer
|
|
22
|
+
|
|
23
|
+
**This is an unofficial community provider** and is not affiliated with or endorsed by Anthropic or Vercel. By using this provider:
|
|
24
|
+
|
|
25
|
+
- You understand that your data will be sent to Anthropic's servers through the Claude Code CLI
|
|
26
|
+
- You agree to comply with [Anthropic's Terms of Service](https://www.anthropic.com/legal/consumer-terms)
|
|
27
|
+
- You acknowledge this software is provided "as is" without warranties of any kind
|
|
28
|
+
|
|
29
|
+
Please ensure you have appropriate permissions and comply with all applicable terms when using this provider.
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { generateText } from 'ai';
|
|
35
|
+
import { claudeCode } from 'ai-sdk-provider-claude-code';
|
|
36
|
+
|
|
37
|
+
const { text } = await generateText({
|
|
38
|
+
model: claudeCode('sonnet'),
|
|
39
|
+
prompt: 'Hello, Claude!'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
console.log(text);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Models
|
|
46
|
+
|
|
47
|
+
- **`opus`** - Claude 4 Opus (most capable)
|
|
48
|
+
- **`sonnet`** - Claude 4 Sonnet (balanced performance)
|
|
49
|
+
|
|
50
|
+
## Documentation
|
|
51
|
+
|
|
52
|
+
- **[Usage Guide](docs/GUIDE.md)** - Comprehensive examples and configuration
|
|
53
|
+
- **[Troubleshooting](docs/TROUBLESHOOTING.md)** - Common issues and solutions
|
|
54
|
+
- **[Examples](examples/)** - Sample scripts and patterns
|
|
55
|
+
|
|
56
|
+
## Core Features
|
|
57
|
+
|
|
58
|
+
- 🚀 Full Vercel AI SDK compatibility
|
|
59
|
+
- 🔄 Streaming support
|
|
60
|
+
- 💬 Multi-turn conversations
|
|
61
|
+
- 🎯 Object generation with JSON schemas
|
|
62
|
+
- 🛑 AbortSignal support
|
|
63
|
+
- 🔧 Tool management (MCP servers, permissions)
|
|
64
|
+
|
|
65
|
+
## Limitations
|
|
66
|
+
|
|
67
|
+
- Requires Node.js ≥ 18
|
|
68
|
+
- No image support
|
|
69
|
+
- Some AI SDK parameters unsupported (temperature, maxTokens, etc.)
|
|
70
|
+
|
|
71
|
+
## Contributing
|
|
72
|
+
|
|
73
|
+
We welcome contributions, especially:
|
|
74
|
+
- Code structure improvements
|
|
75
|
+
- Performance optimizations
|
|
76
|
+
- Better error handling
|
|
77
|
+
- Additional examples
|
|
78
|
+
|
|
79
|
+
See [Contributing Guidelines](docs/GUIDE.md#contributing) for details.
|
|
80
|
+
|
|
81
|
+
For development status and technical details, see [Development Status](docs/DEVELOPMENT-STATUS.md).
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|