Overview
core-ai supports three types of models, each designed for specific tasks:- Chat Models: Generate text responses, support conversations with tool calling
- Embedding Models: Convert text into vector representations for semantic search
- Image Models: Generate images from text prompts
Chat Models
Chat models are the most versatile, supporting text generation, conversations, tool calling, and structured output.Interface
Basic Text Generation
Streaming Responses
Structured Output
Generate type-safe structured data using Zod schemas:Tool Calling
Extend model capabilities with function tools:Generate result
generate() returns a GenerateResult with parts, content, reasoning, toolCalls, finishReason, and usage.
Stream events
stream() returns a replayable ChatStream that emits reasoning, text, tool-call, and finish events while also exposing .result and .events.
See the types reference for the full GenerateResult, StreamEvent, and FinishReason type definitions.
Embedding Models
Embedding models convert text into numerical vectors for semantic similarity and search.Interface
Basic Usage
Batch Embedding
Custom Dimensions
Embed Result
Image Models
Image models generate images from text descriptions.Interface
Basic Usage
Generate Options
Multiple Images
Image Result
Different providers may return images as URLs, base64 data, or both. Check
the provider documentation for specific behavior.
Model Properties
All models expose readonlyprovider and modelId properties:
Chat model capabilities
Chat models also expose acapabilities property that describes how the model
accepts unified generation options. Use reasoning.mode to distinguish
unsupported, optional, and always-on reasoning:
get*ModelCapabilities(modelId) helpers (for example getOpenAIModelCapabilities) that return the same data without constructing a ChatModel. See the types reference for the full ModelCapabilities definition and clampReasoningEffort for adjusting an effort level to the supported set.
Next steps
- Learn about Messages to structure conversations
- Configure models with Configuration options
- Extend models with Middleware for logging, validation, and more
- Handle errors with Error Handling