Quickstart
Install
Section titled “Install”npm install @npm-while1/claude-agent-sdk zodAsk a question
Section titled “Ask a question”The examples use DeepSeek’s Anthropic-compatible endpoint.
import { createAgent } from "@npm-while1/claude-agent-sdk";
const agent = createAgent({ apiKey: process.env.DEEPSEEK_API_KEY, baseURL: "https://api.deepseek.com/anthropic", model: "deepseek-v4-flash",});
for await (const message of agent.query("Say hello in one sentence.")) { console.log(message);}Return only the final result
Section titled “Return only the final result”const result = await agent.prompt("What is 2+2?");console.log(result.result);Disable streaming
Section titled “Disable streaming”const result = await agent.prompt("Write a short haiku.", { stream: false,});