Mozaik

OpenResponses

How Mozaik maps to the OpenResponses specification for multi-provider LLM APIs.

Mozaik's object model is designed to match OpenResponses, a shared way to describe LLM interactions across vendors: the same conceptual items for context and responses, even when wire formats differ.

Inputs and outputs

  • Input (context) — Client-supplied items such as UserMessageItem, DeveloperMessageItem, SystemMessageItem, and FunctionCallOutputItem (tool results fed back to the model).
  • Output (response) — Model-produced items such as ReasoningItem, FunctionCallItem, and ModelMessageItem.
  • Streaming — Incremental provider output is exchanged as SemanticEvent<T> (type + data) on the environment before full items are assembled. See Streaming.

Mozaik turns that vocabulary into TypeScript classes you can construct, append to a ModelContext, serialize, and store.

Provider resolution

You select a model by its ModelName string when you call runInference. Mozaik resolves the name to a provider endpoint and model specification internally, maps the ModelContext to that provider's API, and returns typed ContextItems (and SemanticEvents when streaming is enabled).

ProviderModelName values
OpenAI"gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5"
Anthropic"claude-haiku-4-5", "claude-sonnet-4-6", "claude-opus-4-7", "claude-opus-4-8"
Gemini"gemini-3.5-flash", "gemini-3.1-pro-preview"
DeepSeek"deepseek-v4-flash", "deepseek-v4-pro"

Structured output uses the same ModelMessageItem shape — valid JSON in the text field, no new item type. See Structured output.

Why it matters

When your domain model follows a provider-agnostic spec:

  • Swapping or combining providers becomes a smaller change — you change the ModelName, not your domain model.
  • Persistence and replay stay stable — your database stores typed context items, not one-off JSON blobs per vendor.
  • Tool use, reasoning traces, and assistant messages share one mental model across the whole environment.

Learn more

On this page