Skip to content
Source
Sign inSign up
TanStack/ai

packages/ai-opencode

README.md

TanStack AI

@tanstack/ai-opencode

OpenCode harness adapter for TanStack AI — run OpenCode (via @opencode-ai/sdk) as a chat backend with local tool execution, token-level streaming, stateful sessions, and TanStack tool bridging.

import { chat } from '@tanstack/ai'
import { opencodeText } from '@tanstack/ai-opencode'

const stream = chat({
  adapter: opencodeText('anthropic/claude-sonnet-4-5', {
    directory: '/path/to/project',
    permissionMode: 'acceptEdits',
  }),
  messages: [{ role: 'user', content: 'Fix the failing test.' }],
  threadId: 'thread-1',
})

Server-only (Node); requires the opencode CLI installed and authenticated. See the OpenCode adapter docs for sessions, tool bridging, permissions, and limitations.