TypeScript SDK API Reference
While the complete API reference is centralized in the main API documentation, this page highlights key functions to get you started quickly.
Commonly Used Functions
claude.query(prompt: string, options?: QueryOptions): The primary function for interacting with Claude. It sends a prompt and returns the response.claude.stream(prompt: string, options?: QueryOptions): Use this for real-time, streaming responses.
Getting Started Example
Here’s a simple example of how to use the SDK:
import { claude } from '@anthropic-ai/claude-code';
async function getGreeting() {
const response = await claude.query("Write a one-sentence greeting.");
console.log(response);
}
getGreeting();→ View the Complete API Reference
Quick Links
- 📚 Complete API Reference - Full API documentation
- 🚀 Quick Start Guide - Get started in 5 minutes
- 💡 Code Examples - Practical implementations
- ✨ Best Practices - Production guidelines
- 🌊 Streaming Patterns - Real-time response handling
- ⚠️ Error Handling - Robust error management
Related Documentation
- TypeScript SDK Overview - Main SDK documentation
- Hooks Documentation - Integration with Claude Code hooks
- Advanced Patterns - Complex usage scenarios
Tags: claude-code typescript sdk api reference