Skip to Content
DocumentationSDK

SDK

Programmatic API for integrating Neovate Code into your applications.

Installation

npm install @neovate/code

Quick Start

One-Shot Prompts

For simple, single-turn interactions:

import { prompt } from '@neovate/code'; const result = await prompt('Explain what this code does', { model: 'anthropic/claude-sonnet-4-20250514', cwd: '/path/to/project', }); console.log(result.content);

Streaming Sessions

For real-time message streaming:

import { createSession } from '@neovate/code'; const session = await createSession({ model: 'anthropic/claude-sonnet-4-20250514', cwd: process.cwd(), }); await session.send('Refactor this function to use async/await'); for await (const msg of session.receive()) { if (msg.type === 'message') { console.log(`[${msg.role}]`, msg); } else if (msg.type === 'result') { console.log('Done:', msg.content); } } session.close();

Resume Sessions

Continue a previous conversation:

import { resumeSession } from '@neovate/code'; const session = await resumeSession('session-id-here', { model: 'anthropic/claude-sonnet-4-20250514', }); await session.send('What were we discussing?'); for await (const msg of session.receive()) { // Handle messages... } session.close();

API Reference

prompt(message, options)

One-shot prompt that returns when complete.

ParameterTypeDescription
messagestringThe prompt to send
options.modelstringModel identifier (required)
options.cwdstringWorking directory (optional)

Returns: Promise<SDKResultMessage>

createSession(options)

Creates a new streaming session.

ParameterTypeDescription
options.modelstringModel identifier (required)
options.cwdstringWorking directory (optional)
options.productNamestringProduct name (optional)

Returns: Promise<SDKSession>

resumeSession(sessionId, options)

Resumes an existing session by ID.

ParameterTypeDescription
sessionIdstringSession ID to resume
optionsSDKSessionOptionsSame as createSession

Returns: Promise<SDKSession>

SDKSession

MethodDescription
send(message)Send a message (string or SDKUserMessage)
receive()AsyncGenerator yielding SDKMessage objects
close()Close the session
sessionIdThe session’s unique identifier

Message Types

TypeDescription
systemSession initialization info
messageConversation message (user/assistant/tool)
resultFinal result with success/error status
Last updated on