Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

README.md

39 lines1.2 KB

1<div align="center">
2 <picture>
3 <source
4 media="(prefers-color-scheme: dark)"
5 srcset="https://tanstack.com/api/readme/ai.png?theme=dark"
6 />
7 <source
8 media="(prefers-color-scheme: light)"
9 srcset="https://tanstack.com/api/readme/ai.png"
10 />
11 <img
12 src="https://tanstack.com/api/readme/ai.png"
13 alt="TanStack AI"
14 width="900"
15 />
16 </picture>
17</div>
18​
19<br />
20​
21# @tanstack/ai-opencode
22​
23OpenCode harness adapter for [TanStack AI](https://tanstack.com/ai) — run [OpenCode](https://opencode.ai) (via `@opencode-ai/sdk`) as a chat backend with local tool execution, token-level streaming, stateful sessions, and TanStack tool bridging.
24​
25```typescript
26import { chat } from '@tanstack/ai'
27import { opencodeText } from '@tanstack/ai-opencode'
28​
29const stream = chat({
30 adapter: opencodeText('anthropic/claude-sonnet-4-5', {
31 directory: '/path/to/project',
32 permissionMode: 'acceptEdits',
33 }),
34 messages: [{ role: 'user', content: 'Fix the failing test.' }],
35 threadId: 'thread-1',
36})
37```
38​
39Server-only (Node); requires the `opencode` CLI installed and authenticated. See the [OpenCode adapter docs](https://tanstack.com/ai/latest/docs/adapters/opencode) for sessions, tool bridging, permissions, and limitations.