Skip to main content
improvement
Per-message cache control on user and tool result messages

@core-ai/core-ai

  • UserMessage and ToolResultMessage gain providerOptions, keyed by provider id, with the new UserMessageProviderOptions and ToolResultMessageProviderOptions interfaces for provider packages to augment.

@core-ai/anthropic

  • User and tool result messages accept providerOptions.anthropic.cacheControl for explicit cache breakpoints with their own TTL. The breakpoint goes on the last content block the message produces. These breakpoints count toward the 4-breakpoint limit and the TTL ordering checks. A user message with cacheControl that is empty or ends with an empty text part throws ValidationError.
  • Serialize Messages API request bodies in a cache-friendly key order: tools, system, and messages come first, followed by per-request settings. Gateways that route prompt-cache lookups by the leading bytes of the body now see an identical prefix across turns.

@core-ai/anthropic-vertex

  • User and tool result messages accept options under the anthropic-vertex key, including per-message cacheControl.
  • Improve prompt-cache hit rates on Vertex AI multi-region (eu, us) and global endpoints, which route requests by the leading bytes of the body.
breakingimprovement
System message placement capability and per-message cache control
This release contains breaking changes to @core-ai/core-ai, @core-ai/anthropic, @core-ai/google-genai, and @core-ai/google-vertex.

@core-ai/core-ai

  • Breaking: ModelCapabilities gains a required messages.systemPlacement field ('leading' | 'before-reply' | 'anywhere') describing where a model accepts system messages after the first non-system message. Custom ChatModel implementations and capability registries must add it.
  • Add validateSystemMessagePlacement(), which provider adapters run before every request and which throws the new UnsupportedSystemMessagePlacementError, and getSystemMessagePlacementIssues() to check a conversation without sending it. validateMessages() runs every message-level capability check in one call.
  • SystemMessage gains providerOptions, keyed by provider id.

@core-ai/anthropic

  • Breaking: system messages are no longer joined into the top-level system prompt. Leading system messages are sent as one system text block each, which causes one cache miss on the first request after upgrading. On models that report systemPlacement: 'before-reply' (Claude Opus 4.8, Sonnet 5, Haiku 5.5 and later, and unrecognized model IDs), a later system message is sent in place. On earlier models, a later system message throws UnsupportedSystemMessagePlacementError.
  • System messages accept providerOptions.anthropic.cacheControl for per-message cache breakpoints with their own TTL. Requests that exceed 4 breakpoints, place a 1h breakpoint after a 5m one, or mismatch the TTL of a breakpoint on the last block throw ValidationError before the request.
  • Model ID aliases ending in -latest or -0 now resolve to the capabilities of the model they point at, and the Vertex ID claude-3-5-sonnet-v2 is recognized as Claude 3.5 Sonnet.

@core-ai/anthropic-vertex

  • System messages accept options under the anthropic-vertex key, including per-message cacheControl. Claude Opus 4.8, Sonnet 5, Haiku 5.5, and later models accept a system message directly after a user or tool message.

@core-ai/google-genai, @core-ai/google-vertex

  • Breaking: models report systemPlacement: 'leading', and a system message after the first non-system message throws UnsupportedSystemMessagePlacementError instead of being merged into systemInstruction.

@core-ai/openai, @core-ai/kimi, @core-ai/mistral, @core-ai/xai

  • Models report systemPlacement: 'anywhere', and requests run the system message placement check. System messages are still sent where they appear.
breakingimprovement
Provider options keyed by provider id for Vertex wrappers
This release contains breaking changes to @core-ai/anthropic, @core-ai/anthropic-vertex, @core-ai/google-genai, and @core-ai/google-vertex.

@core-ai/anthropic

  • Breaking: the adapter reads providerOptions from the key matching the model’s provider id (model.provider). Models from createAnthropic() are unaffected; providers built on createAnthropicChatProvider() with a custom providerId read options only from their own key.
  • Add model capability support for claude-haiku-5-5.

@core-ai/anthropic-vertex

  • Breaking: provider options are read from providerOptions['anthropic-vertex'] instead of providerOptions.anthropic. Move existing options to the 'anthropic-vertex' key (same fields). AnthropicVertexGenerateProviderOptions is exported.

@core-ai/google-genai

  • Breaking: chat, embedding, and image models read providerOptions from the key matching the model’s provider id. Models from createGoogleGenAI() are unaffected; providers built on createGoogleGenAIProvider() with a custom providerId read options only from their own key.
  • Align the Gemini 3 capability table with the model IDs Google serves. Add gemini-3-flash-preview with its four thinking levels, and remove gemini-3-pro, gemini-3.1-pro, and gemini-3.1-flash-lite-preview.

@core-ai/google-vertex

  • Breaking: provider options for chat, embedding, and image models are read from providerOptions['google-vertex'] instead of providerOptions.google. Move existing options to the 'google-vertex' key (same fields). GoogleVertexGenerateProviderOptions, GoogleVertexEmbedProviderOptions, and GoogleVertexImageProviderOptions are exported.
fix
Gemini 3 thinking levels and Anthropic context-window truncation

@core-ai/anthropic

  • A response that stops with model_context_window_exceeded reports finishReason: 'length' instead of 'unknown'. Upgrade @anthropic-ai/sdk to ^0.114.0.

@core-ai/google-genai

  • Use each Gemini 3 model’s own thinking levels. capabilities.reasoning.supportedEfforts lists the efforts a model has a level for, and medium and minimal send MEDIUM and MINIMAL where the model accepts them. Efforts without a level are clamped to the nearest one.
breakingimprovement
maxTokens contract and output ceilings
This release contains breaking changes to @core-ai/anthropic, @core-ai/anthropic-vertex, @core-ai/google-genai, and @core-ai/google-vertex.

@core-ai/core-ai

  • Define maxTokens as the total output allowance, covering reasoning tokens and the visible answer. An omitted maxTokens means the model’s output ceiling, and adapters reject an explicit limit that cannot hold the reasoning budget of the requested effort instead of shrinking the budget.
  • Add optional ModelCapabilities.output.maxTokens, the verified output ceiling for a model ID.

@core-ai/anthropic

  • Breaking: an omitted maxTokens uses defaultMaxTokens if you set it, otherwise the model’s output ceiling (128,000 on Opus/Sonnet 4.6 and later, Fable, and Mythos; 64,000 on Claude 4.5), and 4,096 only for model IDs without a known ceiling.
  • Breaking: manual thinking budgets (Claude 4.5 and earlier) are no longer shrunk to fit maxTokens; a limit at or below the budget throws ValidationError. The high and max budgets are 50% and 75% of the model’s output ceiling.
  • generate() and generateObject() stream internally and return the same result. Mid-stream errors such as overloaded_error surface as ModelOverloadedError, and aborts as AbortedError.
  • Keep redacted thinking blocks in streamed results, and report output.maxTokens for known Claude models.

@core-ai/anthropic-vertex

  • Breaking: defaultMaxTokens no longer defaults to 4,096. Requests that omit maxTokens use the model’s output ceiling, and manual thinking budgets throw ValidationError when maxTokens cannot hold them.

@core-ai/google-genai

  • Use each Gemini 2.5 model’s documented thinking budget range: max maps to the documented maximum (32,768 on Pro, 24,576 on Flash and Flash-Lite) and high to 75% of it.
  • Breaking: an explicit maxTokens at or below the Gemini 2.5 thinking budget throws ValidationError instead of returning an empty answer.
  • Report output.maxTokens (65,536) for known Gemini 2.5 and 3 models and reasoning.thinkingBudgetRange for Gemini 2.5.

@core-ai/google-vertex

  • Re-export GoogleThinkingBudgetRange. Gemini 2.5 models use their documented thinking budget ranges, and an explicit maxTokens at or below the thinking budget throws ValidationError.
improvement
New Claude and GPT model support

@core-ai/anthropic

  • Add model capability support for claude-sonnet-5-5, claude-fable-5-1, and claude-mythos-5-1. Adaptive thinking accepts max effort and is always on for Fable 5.1 and Mythos 5.1. These models, along with claude-opus-5-5, reject forced tool choice and non-default sampling parameters.

@core-ai/openai

  • Add model capability support for gpt-6.1-sol. Tool calling requires the Responses API; Chat Completions requests that include tools are rejected.
breaking
GPT-6 Chat Completions tool calling
This release contains breaking changes to @core-ai/openai.

@core-ai/openai

  • Breaking: gpt-6-sol and gpt-6-luna report Chat Completions function calling as supported. Tool requests are forwarded as given, omitting reasoning no longer sets reasoning_effort to none, and combining tools with reasoning is no longer rejected.
improvement
GPT-6 model support

@core-ai/openai

  • Add model capability support for gpt-6-astra, gpt-6-sol, and gpt-6-luna. These models reason by default and accept low through max effort. temperature and topP are rejected while reasoning is enabled.
improvement
Claude Opus 5.5 support

@core-ai/anthropic

  • Add model capability support for claude-opus-5-5. Adaptive thinking is always on, max effort is supported, and non-default sampling parameters and forced tool choice are rejected.
breakingimprovement
xAI provider and provider options keyed by provider id
This release contains breaking changes to @core-ai/openai, @core-ai/azure-openai, @core-ai/openai-compat, and @core-ai/omnifact.

@core-ai/xai

  • Add @core-ai/xai, a provider for xAI Grok models. Uses the Responses API by default with stateless encrypted-reasoning round trips, and exposes the Chat Completions API under .chat.

@core-ai/openai

  • Add the reasoningTokenAccounting compatibility option and the promptCacheKey provider option. Encrypted reasoning is requested for always-on reasoning models, and the Responses API no longer sends a reasoning effort to models without configurable efforts.
  • Breaking: createOpenAIProvider always reads provider options from providerOptions[providerId] on both APIs. The providerOptionsKey factory option is removed; use the new responsesProviderOptionsSchema factory option to validate a wrapper’s Responses options.

@core-ai/azure-openai

  • Breaking: provider options are read from providerOptions['azure-openai'] on every API (v1 Responses, v1 Chat Completions, and classic). Move existing options from the openai key. Typed via AzureOpenAIResponsesGenerateProviderOptions and AzureOpenAIChatGenerateProviderOptions.

@core-ai/openai-compat

  • Breaking: provider options are read from providerOptions['openai-compat']. Move existing options from the openai key. Typed via OpenAICompatGenerateProviderOptions.

@core-ai/omnifact

  • Breaking: provider options are read from providerOptions.omnifact. Move existing options from the openai key. Typed via OmnifactGenerateProviderOptions.
improvement
Per-tool strict tool schemas

@core-ai/core-ai

  • Add per-tool strict tool schemas: defineTool({ strict: true }) opts a single tool into provider-enforced schema adherence, ModelCapabilities.tools.strictSchemas reports model support, and strict tools are validated locally against the strict-capable schema contract (object root, closed objects, every key required, and the keyword subset every strict-capable provider accepts). Violations throw ToolSchemaStrictnessError with a violations list naming each offending schema path and a fix hint.

@core-ai/anthropic

  • Strict tool schemas are now per-tool opt-in on Claude 4.5 and later models; previous releases marked every tool strict. The 20-strict-tool limit counts only opted-in tools, and discriminated unions (oneOf) are rewritten to anyOf. The internal strictToolSchemasEnabled factory option was removed.

@core-ai/anthropic-vertex

  • Breaking: the useStrictToolSchemas option was removed. Strict tool schemas follow the per-tool opt-in and the underlying model capabilities. Vertex enforces the structured_outputs partner-model feature through your GCP organization policy.

@core-ai/openai

  • Support per-tool strict: true on the Responses and Chat Completions APIs. Strict tools are sent with a normalized schema ($schema stripped, additionalProperties: false added recursively, oneOf rewritten to anyOf); non-strict tools keep the raw schema and carry an explicit strict: false on the Responses API. Models that predate Structured Outputs report strict schemas as unsupported through both APIs; unknown model IDs, including fine-tuned ft:... models, resolve optimistically to supported. The strictToolSchemas, strictToolSchemasUnsupportedReason/Details, and disableParallelToolCallsWithStrictTools factory options were removed.

@core-ai/azure-openai

  • Support per-tool strict: true on the v1 (Responses) endpoint and on classic deployments with API version 2024-08-01-preview or later; the strictToolSchemasEnabled deployment assertion was removed.

@core-ai/openai-compat

  • Forward per-tool strict: true function tools with normalized schemas to gateways that implement OpenAI strict function tools; the strictToolSchemas endpoint assertion was removed.

@core-ai/kimi

  • Forward per-tool strict: true function tools with normalized schemas.

@core-ai/omnifact

  • Report strict tool schemas as supported and forward per-tool strict: true to the gateway with normalized schemas.

@core-ai/google-genai, @core-ai/google-vertex, @core-ai/mistral

  • Report per-tool strict schemas as unsupported; a tool with strict: true throws ToolSchemaStrictnessError before any provider I/O.
improvement
Provider quota errors and Responses API failure handling

@core-ai/core-ai

  • Add ProviderQuotaExceededError for non-retryable provider billing and exhausted-credit failures.

@core-ai/openai

  • Raise Responses API failures (error / response.failed stream events, and generate status: 'failed') as provider errors instead of a successful result with finishReason: 'unknown'. response.incomplete ends the stream with the reported finish reason (length / content-filter) and usage.
  • Map in-band Azure no_capacity stream errors to ModelOverloadedError.

@core-ai/mistral

  • Map Mistral service tier capacity exceeded errors to ModelOverloadedError, aligning backend-capacity errors with Azure NoCapacity and Anthropic overloaded_error.

@core-ai/anthropic, @core-ai/openai, @core-ai/google-genai, @core-ai/mistral

  • Normalize non-retryable billing and exhausted-credit failures to ProviderQuotaExceededError.

@core-ai/google-genai

  • Add model capability support for gemini-3.8-flash, gemini-3.7-flash, gemini-3.6-flash, gemini-3.5-flash, and gemini-3.5-flash-lite.
improvement
Typed in-band stream errors

@core-ai/core-ai

  • Add ProviderError.code so adapters can lift the provider’s machine-readable error identifier, and createChatStream({ mapError }) so in-band stream failures use the same typed errors as the initial request.

@core-ai/anthropic

  • Wrap in-band stream errors as typed provider errors and expose the Anthropic error type as ProviderError.code. In-band api_error and timeout_error become a retryable ServiceUnavailableError.

@core-ai/openai

  • Wrap in-band stream errors as typed provider errors and expose the OpenAI error code (including insufficient_quota and credit_balance_exhausted).
  • Classify Azure OpenAI context-window responses without a machine-readable error code as ContextLengthExceededError.

@core-ai/google-genai

  • Wrap in-band stream errors as typed provider errors and expose Google’s gRPC status (for example RESOURCE_EXHAUSTED) as ProviderError.code.

@core-ai/mistral

  • Wrap in-band stream errors as typed provider errors and expose the Mistral error type as ProviderError.code.
improvement
Metadata on media input parts

@core-ai/core-ai

  • Allow application-owned metadata on image, file, and audio input parts.
improvement
System message metadata

@core-ai/core-ai

  • Add optional application-owned metadata to SystemMessage. Provider adapters ignore it and never serialize it to provider APIs.
breakingimprovement
Tool call provider metadata and reasoning namespaces
This release contains breaking changes to @core-ai/azure-openai.

@core-ai/core-ai

  • Add providerMetadata to ToolCallPart and the tool-call-end stream event so provider-owned data attached to a tool call, such as a Google thought signature, survives aggregation and can be replayed with the call.

@core-ai/google-genai

  • Round-trip thought signatures on function calls. Without this, Gemini 3 rejects multi-step tool calling with a 400 for a missing thought_signature. Assistant text is read from candidate parts instead of the SDK .text getter.

@core-ai/openai

  • Namespace Responses API encrypted reasoning under each wrapper’s providerId instead of always using openai. Foreign namespaces downgrade to thinking text; same-namespace ciphertext still round-trips.

@core-ai/azure-openai

  • Breaking: Responses encrypted reasoning is stored under azure-openai instead of openai. Read metadata with getProviderMetadata(..., 'azure-openai'). Foreign providerMetadata.openai ciphertext is downgraded to thinking text on Azure continuation.
breakingimprovement
Chat modality capabilities and audio input
This release contains breaking changes to @core-ai/core-ai.

@core-ai/core-ai

  • Breaking: add chat modality capabilities as directional arrays on the required ModelCapabilities.modalities field: input (ChatInputModality[]) and output (ChatOutputModality[]). Custom ChatModel implementations and capability registries must add it. Presets (TEXT_ONLY_MODALITIES, MULTIMODAL_INPUT_MODALITIES) and helpers (supportsInputModality, supportsOutputModality) are exported.
  • Add validateInputModalities, which rejects user content parts whose modalities the model does not support with UnsupportedInputModalityError. Provider adapters run the same check before sending a request.
  • Breaking: add base64 AudioPart user content. Code that exhaustively handles UserContentPart must add an 'audio' branch.

@core-ai/openai

  • Report chat modalities per model and reject images for text-only models (gpt-3.5-turbo, o1-mini, o3-mini) before calling the API.
  • Accept WAV and MP3 audio input on supported Chat Completions audio models.
  • The Responses adapter resolves capabilities and the provider id from the chat model, so wrappers such as @core-ai/azure-openai validate against their own capability registry.

@core-ai/anthropic

  • Report chat modalities (['text', 'image', 'file'] input) and reject audio user content before calling the API.

@core-ai/google-genai

  • Report chat modalities and accept base64 audio input on Gemini chat models.

@core-ai/mistral

  • Resolve capabilities per model. Vision families advertise image input, while text-only families (codestral, devstral-*, open-mistral-*, open-mixtral-*) reject images before the request is sent. Pinned versions from before a family gained vision are reported as text-only.
  • Reject unsupported audio user content.

@core-ai/kimi

  • Report chat modalities. K2.7 Code models are text-only and reject image and audio parts before the request is sent.

@core-ai/opentelemetry

  • Serialize audio user content in recorded chat input attributes.
improvement
Claude Opus 5 support

@core-ai/anthropic

  • Add model capability support for claude-opus-5.
breakingimprovement
Kimi provider, capabilities registry, and structured provider errors
This release contains breaking changes to @core-ai/openai and @core-ai/openai-compat.

@core-ai/core-ai

  • Add a reusable model capabilities registry with normalized model ID lookup, a fallback for unknown models, and explicit reasoning modes, sampling constraints, and supported tool choices.
  • Add structured ProviderError subclasses (ContextLengthExceededError, RateLimitError, ModelOverloadedError, ServiceUnavailableError) with a RetryableProviderError base for transient failures, including Retry-After parsing.

@core-ai/kimi

  • Add @core-ai/kimi, a provider for the Moonshot AI Kimi API built on the shared OpenAI-compatible implementation, with native reasoning_content support, preserved thinking round-trips, and structured output via generateObject() / streamObject().

@core-ai/openai

  • Add native reasoning round trips, JSON object structured output, capability-driven request validation, and capability overrides through a shared registry.
  • Breaking: the native structured output mode is renamed to json-schema.
  • Map SDK failures to structured ProviderError subclasses, including non-retryable insufficient_quota and Azure NoCapacity overload.
  • Convert historical reasoning to assistant text for models that do not support reasoning input.

@core-ai/openai-compat

  • Breaking: the native structured output mode is renamed to json-schema. Add a json-object mode for endpoints that support JSON Mode.

@core-ai/anthropic

  • Map SDK failures to structured ProviderError subclasses, including Vertex error envelopes and correct rate-limit vs context-length discrimination.

@core-ai/google-genai

  • Map SDK failures to structured ProviderError subclasses, including streaming error bodies and Vertex throttled overload.
  • Report always-on reasoning for Gemini models whose thinking cannot be disabled.

@core-ai/mistral

  • Map SDK failures to structured ProviderError subclasses.
  • Preserve historical reasoning when sending conversation history. Native reasoning is replayed as a thinking chunk only when the target model supports it; otherwise it is injected as <thinking> text.
improvement
Mistral SDK v2

@core-ai/mistral

  • Upgrade @mistralai/mistralai to v2.
improvement
Vertex providers, OpenAI Responses default, and openai-compat

@core-ai/anthropic-vertex

  • Add a first-party Anthropic Vertex AI provider for Claude models. Authenticates with Application Default Credentials or an explicit service account key.
  • Allow disabling strict tool schemas with the useStrictToolSchemas provider option.

@core-ai/google-vertex

  • Add a first-party Google Vertex AI provider for Gemini, embedding, and Imagen models with Application Default Credentials or explicit service-account authentication.

@core-ai/openai-compat

  • Add a standalone Chat Completions provider for OpenAI-compatible gateways. Configure nonstandard reasoning extraction and structured output transport independently with reasoning and structuredOutputMode.
  • Select the Chat Completions token-limit parameter automatically for known OpenAI models while keeping max_tokens as the compatibility default for unknown models.

@core-ai/openai

  • Root createOpenAI() uses the Responses API by default. Strict Chat Completions are available at openai.chat.chatModel(). Object generation prefers native strict JSON Schema output.
  • Map maxTokens to max_completion_tokens for known GPT-5 and o-series models when using strict Chat Completions.

@core-ai/azure-openai

  • Azure OpenAI v1 uses the Responses API by default. Strict Chat Completions are available at azure.chat.chatModel(). Classic API access is unchanged.
  • Select max_completion_tokens automatically for known OpenAI model IDs used with Azure Chat Completions while keeping max_tokens for unknown deployment names.

@core-ai/google-genai

  • Support Gemini native image models through imageModel() while preserving the existing Imagen generation path.
  • Expose a reusable provider factory with configurable provider attribution for Google GenAI clients.

@core-ai/omnifact

  • Use the shared OpenAI compatibility layer for nonstandard reasoning response fields.
  • Always map maxTokens to max_completion_tokens for Omnifact Chat Completions requests.

@core-ai/core-ai

  • Normalize dated Vertex model IDs for capability detection.
improvement
Application part metadata and text boundary events

@core-ai/core-ai

  • Add optional application-owned metadata on text-bearing message parts and text-start / text-end stream events. Stream aggregation preserves metadata through results and resultToMessage().
fix
Anthropic reasoning fixes and OpenAI SDK bump

@core-ai/anthropic

  • Fix Anthropic adaptive and manual reasoning requests, including tool-use beta headers, token budgets, thinking block preservation, summarized output, and reasoning token usage.

@core-ai/openai

  • Bump the OpenAI SDK to 6.46.0 for GPT-5.6 API types and Responses API fixes.
improvement
Model capabilities and new models

@core-ai/core-ai

  • Add a shared ModelCapabilities contract on ChatModel with reasoning support and sampling restrictions. Expose provider get*ModelCapabilities helpers so consumers can inspect model behavior without duplicating provider maps.

@core-ai/openai

  • Add model capability support for gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna.

@core-ai/anthropic

  • Add model capability support for claude-sonnet-5.
improvement
Axiom GenAI telemetry

@core-ai/axiom

  • Add a first-party Axiom GenAI telemetry package with createAxiomMiddleware, embedding and image middleware aliases, and OTLP exporter configuration helpers.
fix
CommonJS interop

All packages

  • Add require and default export conditions so packages resolve under CommonJS loaders such as tsx.
improvement
Omnifact, Azure OpenAI, and model updates

@core-ai/omnifact

  • Add a first-party Omnifact provider for the Omnifact API Gateway with a default production base URL.

@core-ai/azure-openai

  • Add an Azure OpenAI chat provider with v1 Chat Completions support by default and classic API fallback.

@core-ai/openai

  • Add model capability support for GPT-5.5, GPT-5.4 mini/nano, GPT-5.3 Codex, GPT-5 Pro, o3-pro, and GPT Image 2.
  • Export createOpenAICompatChatModel from @core-ai/openai/compat and allow a custom provider id in the compat chat layer.

@core-ai/anthropic

  • Add model capability support for Claude Fable 5, Claude Mythos 5, Claude Opus 4.8, and Claude Opus 4.7, including adaptive-thinking effort support.

@core-ai/core-ai

  • Normalize provider model IDs with dashed YYYY-MM-DD snapshot suffixes so current model aliases and snapshots share capability handling.
fix
Langfuse usage fixes and OpenAI reasoning spacing

@core-ai/openai

  • Preserve spacing between OpenAI reasoning summary parts.

@core-ai/langfuse

  • Fix usageDetails keys to match Langfuse’s expected naming convention so cost inference and UI aggregation work correctly.
  • Fix double-counting of cache and reasoning tokens in the Langfuse usage breakdown.
improvement
Langfuse middleware

@core-ai/langfuse

  • Add a first-party Langfuse middleware package for chat, embedding, and image model telemetry.
improvement
Model middleware and OpenTelemetry

@core-ai/core-ai

  • Add model-level middleware wrappers (wrapChatModel, wrapEmbeddingModel, wrapImageModel) for intercepting and augmenting model calls.

@core-ai/opentelemetry

  • Add first-party OpenTelemetry middleware via createOtelMiddleware, createOtelEmbeddingMiddleware, and createOtelImageMiddleware.
improvement
Standardized error hierarchy

@core-ai/core-ai

  • Standardize library error handling around CoreAIError, ValidationError, ProviderError, and abort error classes so callers can distinguish validation, abort, provider, and structured output failures without relying on provider SDK exceptions.

@core-ai/openai

  • Wrap provider SDK errors in the standardized CoreAIError hierarchy.

@core-ai/anthropic

  • Wrap provider SDK errors in the standardized CoreAIError hierarchy.

@core-ai/mistral

  • Wrap provider SDK errors in the standardized CoreAIError hierarchy.
improvementinternal
Prompt caching, internal refactors

@core-ai/anthropic

  • Add prompt caching support through the cacheControl provider option for automatic cache reuse and cache token metrics.

All packages

  • Internal refactors to stream handling, shared provider helpers, and structured output internals without changing public behavior.
breaking
Require Zod 4 and native JSON Schema conversion
This release contains breaking changes across all packages.

All packages

  • Require Zod 4 (^4.0.0) and switch JSON Schema conversion to Zod 4’s native z.toJSONSchema() support.
  • Export zodSchemaToJsonSchema() from @core-ai/core-ai for direct schema conversion.
improvementinternal
New model support, internal refactors

@core-ai/core-ai

  • Refactor internal chat/image wrapper plumbing and stream event reduction logic to reduce duplication and improve readability without changing public behavior.

@core-ai/openai

  • Add model capability support for gpt-5.4 and gpt-5.4-pro.
  • Refactor chat adapter internals to reduce duplicated stream and part-aggregation logic, and consistently report finishReason: 'tool-calls' when a function call is emitted from the stream.

@core-ai/google-genai

  • Add model capability support for gemini-3.1-pro and gemini-3.1-flash-lite-preview.
  • Refactor adapter internals to reduce duplication and simplify stream/request helper logic without changing runtime behavior.

@core-ai/mistral

  • Refactor adapter internals to reduce duplication and simplify stream/request helper logic without changing runtime behavior.
breakingimprovement
Streaming redesign, typed provider options, Responses API
This release contains breaking changes to @core-ai/core-ai.

@core-ai/core-ai

  • Replace ModelConfig with flat sampling fields (temperature, maxTokens, topP) on generate options. Introduce method-specific typed provider option interfaces (GenerateProviderOptions, EmbedProviderOptions, ImageProviderOptions) that providers extend via declaration merging.
  • Restructure reasoning providerMetadata to use provider-namespaced keys. Adapters now detect cross-provider reasoning blocks and downgrade them to plain text instead of forwarding opaque metadata. Add getProviderMetadata helper.
  • Redesign chat and object streaming around replayable stream handles with result and events, rename the handle types to ChatStream and ObjectStream, and accept caller-provided AbortSignals for cancellation.

@core-ai/openai

  • Migrate default chat models to the OpenAI Responses API and add a @core-ai/openai/compat entrypoint for Chat Completions compatibility.
  • Namespace provider options under openai key with Zod validation. Responses API options: store, serviceTier, include, parallelToolCalls, user. Compat options: stopSequences, frequencyPenalty, presencePenalty, seed. Embed options: encodingFormat, user. Image options: background, moderation, outputCompression, outputFormat, quality, responseFormat, style, user.
  • Update streaming adapters to expose replayable stream handles using ChatStream and ObjectStream.

@core-ai/anthropic

  • Namespace provider options under anthropic key with Zod validation. Generate options: topK, stopSequences, betas, outputConfig.
  • Restructure reasoning providerMetadata to use provider-namespaced keys.
  • Update streaming adapters to expose replayable stream handles using ChatStream and ObjectStream.

@core-ai/google-genai

  • Namespace provider options under google key with strict Zod validation. Generate options: stopSequences, frequencyPenalty, presencePenalty, seed, topK. Embed options: taskType, title, mimeType, autoTruncate. Image options: aspectRatio, personGeneration, safetyFilterLevel, negativePrompt, guidanceScale, seed.
  • Restructure reasoning providerMetadata to use provider-namespaced keys.
  • Update streaming adapters to expose replayable stream handles using ChatStream and ObjectStream.

@core-ai/mistral

  • Namespace provider options under mistral key with Zod validation. Generate options: stopSequences, frequencyPenalty, presencePenalty, randomSeed, parallelToolCalls, promptMode, safePrompt. Embed options: outputDtype, encodingFormat, metadata.
  • Restructure reasoning providerMetadata to use provider-namespaced keys.
  • Update streaming adapters to expose replayable stream handles using ChatStream and ObjectStream.
fix
Publish fix

All packages

  • Fix release publish race: remove prepublishOnly to avoid concurrent tsup builds failing to resolve @core-ai/core-ai.
breakingimprovement
Reasoning support
This release contains breaking changes to @core-ai/core-ai.

@core-ai/core-ai

Add unified reasoning/thinking support with effort-based configuration.Breaking changes:
  • AssistantMessage: content and toolCalls fields replaced by parts: AssistantContentPart[] array
  • StreamEvent: content-delta renamed to text-delta, new reasoning-start, reasoning-delta, reasoning-end events added
  • GenerateResult: adds required parts and reasoning fields
  • ChatOutputTokenDetails.reasoningTokens: changed from number to optional
New types: ReasoningEffort, ReasoningConfig, AssistantContentPart, ReasoningPartNew utilities: resultToMessage() for multi-turn reasoning state preservation, assistantMessage() for convenient message constructionNew option: reasoning?: ReasoningConfig on GenerateOptions, GenerateObjectOptions, StreamObjectOptions

@core-ai/openai

  • Add reasoning support for OpenAI models (Chat Completions API). Maps unified reasoning.effort to reasoning_effort with model-aware clamping. Extracts reasoning content from responses and streams. Validates parameter restrictions for GPT-5.1+ models.

@core-ai/anthropic

  • Add reasoning support for Anthropic models with adaptive and manual thinking modes. Maps unified reasoning.effort to adaptive effort levels or manual budget_tokens based on model capabilities. Extracts thinking and redacted thinking blocks with signature preservation for multi-turn fidelity.

@core-ai/google-genai

  • Add reasoning support for Google GenAI models. Maps unified reasoning.effort to thinkingLevel for Gemini 3 or thinkingBudget for Gemini 2.5 based on model capabilities. Extracts thought content with thought signature preservation for multi-turn fidelity.

@core-ai/mistral

  • Add reasoning support for Mistral Magistral models. Extracts thinking chunks from response content and streams as reasoning events.
breakingimprovement
Usage accounting redesign
This release contains breaking changes to @core-ai/core-ai.

@core-ai/core-ai

Refactor the core ChatUsage contract to nested detail objects for input and output token accounting.Breaking changes:
  • Remove usage.totalTokens
  • Move usage.reasoningTokens to usage.outputTokenDetails.reasoningTokens
  • Add usage.inputTokenDetails.{cacheReadTokens, cacheWriteTokens}

@core-ai/openai

  • Update usage mapping to the new nested ChatUsage structure. Maps prompt_tokens_details.cached_tokens to inputTokenDetails.cacheReadTokens and completion_tokens_details.reasoning_tokens to outputTokenDetails.reasoningTokens.

@core-ai/anthropic

  • Update usage mapping to the new nested ChatUsage structure. Reports total inputTokens including cache tokens, maps cache_read_input_tokens and cache_creation_input_tokens to inputTokenDetails.

@core-ai/google-genai

  • Update usage mapping to the new nested ChatUsage structure. Maps cachedContentTokenCount to inputTokenDetails.cacheReadTokens and thoughtsTokenCount to outputTokenDetails.reasoningTokens.

@core-ai/mistral

  • Update usage mapping to the new nested ChatUsage structure with zero defaults for cache and reasoning token details.
improvement
Structured output

@core-ai/core-ai

  • Add first-class structured output support with generateObject() and streamObject() across core and all provider chat models. Introduces schema-driven typed object generation, structured output streaming events, and standardized structured-output errors.
  • Clarify embedding usage semantics by making EmbedResult.usage optional in the core API contract, so providers can return usage: undefined when token counts are not exposed by the underlying API.

@core-ai/openai

  • Add structured output support with generateObject() and streamObject().

@core-ai/anthropic

  • Add structured output support with generateObject() and streamObject().

@core-ai/google-genai

  • Add structured output support with generateObject() and streamObject().
  • Update embedding behavior to only include usage when token statistics are present, and add provider E2E contract coverage.

@core-ai/mistral

  • Add structured output support with generateObject() and streamObject().
fix
Initial Zod 4 compatibility

All packages

  • Add initial Zod 4 compatibility by broadening package ranges and updating zod-to-json-schema to a version that supports Zod 4.
improvement
Mistral provider

@core-ai/mistral

  • Add new @core-ai/mistral provider package powered by the @mistralai/mistralai SDK, including chat generation, streaming, tool-calling, and embeddings support.