Why callModel?
- Items-Based Model: Built on OpenRouter’s Responses API with structured
items (messages, tool calls, reasoning) instead of raw message chunks
- Multiple Consumption Patterns: Get text, stream responses, or access
structured data - all from a single call
- Automatic Tool Execution: Define tools with Zod schemas and let the SDK
handle execution loops
- Type Safety: Full TypeScript inference for tool inputs, outputs, and
events
- Format Compatibility: Convert to/from OpenAI chat and Anthropic Claude
message formats
- Streaming First: Built on a reusable stream architecture that supports
concurrent consumers
Quick Start
Consumption Patterns
callModel returns a ModelResult object that provides multiple ways to consume
the response:
Text Methods
Streaming Methods
callModel accepts multiple input formats:
What’s Next?
Explore the guides to learn more about specific features:
- Working with Items - Understand
the items-based streaming paradigm
- Text Generation -
Input formats, model selection, and response handling
- Streaming - All streaming
methods and patterns
- Tools - Creating typed tools
with Zod schemas and multi-turn orchestration
- nextTurnParams -
Tool-driven context injection for skills and plugins
- Message Formats -
Converting to/from OpenAI and Claude formats
- Dynamic Parameters
- Async functions for adaptive behavior
- Stop Conditions -
Intelligent execution control
- API Reference - Complete
type definitions and method signatures
Ready-to-use tool implementations:
- Weather Tool - Basic API integration
- Skills Loader - Claude Code skills pattern