@ai-sdk/openai-compatible
An adapter package in the Vercel AI SDK ecosystem for third-party services compatible with the OpenAI API specification. It allows any service that follows the OpenAI Chat Completions protocol to be integrated into the AI SDK.
Core Facts
xAI provides an OpenAI-compatible API interface, which was the basis for early @ai-sdk/xai being able to adapt via the Chat Completions endpoint.
@ai-sdk/zai@3.0.8 synchronously updated upstream dependencies: @ai-sdk/provider@4.0.12, @ai-sdk/openai-compatible@3.0.46, and @ai-sdk/provider-utils@5.0.38.
@ai-sdk/togetherai is the official Vercel AI SDK adapter for the TogetherAI platform, built on top of the openai-compatible base package.
Timeline (last 90 days)
Accessing models through the openai-compatible layer allows reuse of request construction, streaming parsing and tool-call handling logic, reducing maintenance costs, but behavior is affected by the implementation details of that compatibility layer.
There is a strict dependency chain among the three packages: the adapter depends on openai-compatible, and openai-compatible in turn depends on provider and provider-utils.
When @ai-sdk/openai-compatible adjusts protocol details (such as incremental assembly of tool calls or the usage field), downstream adapters passively inherit these changes as dependencies are upgraded.
A single fix in the compatibility layer benefits all downstream providers at once, but subtle behavioral changes in the compatibility layer also propagate horizontally, so when upgrading a dependency you should check its changelog to confirm what changed.
Any behavioral change in the compatibility layer (such as field mapping, streaming response handling, or error code conversion) propagates to all downstream providers through dependency updates.
When locking versions, one should pay attention to the version combination of both the provider package and the compatibility package, rather than only watching the top-level package number.
Because different vendors may differ subtly in field defaults, error codes and streaming termination conditions, the compatibility package needs continuous fine-tuning to cover these edge cases, which is one reason it releases patches frequently.
@ai-sdk/openai-compatible's core responsibilities include: converting the AI SDK's unified call parameters into OpenAI format, parsing responses and mapping them back to the AI SDK's standardized results, and handling chunking and errors in streaming responses.
When upgrading similar patch dependencies, it is advisable to confirm the dependency resolution result in the lockfile and to watch the changelog of @ai-sdk/openai-compatible 2.0.86.
@ai-sdk/openai-compatible is the common compatibility layer for many OpenAI-compatible model services, and changes to its version may affect multiple provider adapter packages at once.
36 more timeline events
All Facts (20)
xAI provides an OpenAI-compatible API interface, which was the basis for early @ai-sdk/xai being able to adapt via the Chat Completions endpoint.
90%Verified@ai-sdk/zai@3.0.8 synchronously updated upstream dependencies: @ai-sdk/provider@4.0.12, @ai-sdk/openai-compatible@3.0.46, and @ai-sdk/provider-utils@5.0.38.
90%Verified@ai-sdk/togetherai is the official Vercel AI SDK adapter for the TogetherAI platform, built on top of the openai-compatible base package.
90%VerifiedVercel AI SDK provides unified abstract interfaces (such as generateText and streamText), allowing developers to maintain a consistent coding style when calling different model providers.
90%VerifiedOpenAI's API interface specification has become the de facto communication standard in the AI industry, and many model providers including Anthropic, Google, and Mistral offer interfaces compatible with this format.
90%Verified@ai-sdk/openai-compatible is the common compatibility layer for many OpenAI-compatible model services, and changes to its version may affect multiple provider adapter packages at once.
85%VerifiedThe zai provider depends on @ai-sdk/openai-compatible, indicating it is most likely built on top of an OpenAI-compatible interface.
85%Verified@ai-sdk/zai depends on @ai-sdk/openai-compatible, indicating that Zhipu GLM's API interface is largely compatible with OpenAI's calling conventions.
85%Verified@ai-sdk/openai-compatible's core responsibilities include: converting the AI SDK's unified call parameters into OpenAI format, parsing responses and mapping them back to the AI SDK's standardized results, and handling chunking and errors in streaming responses.
80%VerifiedWithin the AI SDK ecosystem, there exists an adapter package @ai-sdk/zod similar to @ai-sdk/valibot, with both providing the same public interface.
80%VerifiedThe @ai-sdk/zai module depends on foundational modules such as provider, openai-compatible, and provider-utils.
80%VerifiedIn the AI SDK multi-package collaborative ecosystem, if a low-level package (such as provider-utils or openai-compatible) undergoes a MAJOR change, all vendor adapter packages that depend on it are forced to follow, forming a chain of upgrades.
75%Verified@ai-sdk/zai, as the Provider implementation for Z.ai, reuses the communication and protocol handling logic of the OpenAI compatibility layer at its foundation.
75%VerifiedThe @ai-sdk/openai package is responsible for integration with OpenAI models.
75%VerifiedThe fact that @ai-sdk/amazon-bedrock depends on @ai-sdk/openai does not mean an OpenAI account or key is required, because @ai-sdk/openai encapsulates general-purpose capabilities such as HTTP request handling, streaming response parsing, and tool-calling protocols that are shared across multiple provider packages.
75%Verified@ai-sdk/zai is built on the @ai-sdk/openai-compatible compatibility layer and only requires configuring Zhipu-specific endpoint addresses and parameters.
75%Verified@ai-sdk/openai-compatible handles common logic such as streaming output, tool calling, and error format normalization.
75%Verified@ai-sdk/zai released version 3.0.32, a patch update (Patch Changes) containing only two commits.
80%UnverifiedAccessing models through the openai-compatible layer allows reuse of request construction, streaming parsing and tool-call handling logic, reducing maintenance costs, but behavior is affected by the implementation details of that compatibility layer.
50%UnverifiedThere is a strict dependency chain among the three packages: the adapter depends on openai-compatible, and openai-compatible in turn depends on provider and provider-utils.
50%