feat(core): support OpenAI Chat Completions via openaiEndpointFormat#2347
Open
miguelg719 wants to merge 3 commits into
Open
feat(core): support OpenAI Chat Completions via openaiEndpointFormat#2347miguelg719 wants to merge 3 commits into
miguelg719 wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 7562df8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Confidence score: 5/5
- Safe to merge after the addressed issues were fixed.
Architecture diagram
sequenceDiagram
participant Client as Agent / Test
participant AgentHandler as V3AgentHandler
participant BuildOpts as buildAgentProviderOptions()
participant LLMProv as LLMProvider
participant GetModel as getAISDKLanguageModel()
participant OpenAISDK as OpenAI SDK
participant ProviderOpts as Provider Options
Note over Client,OpenAISDK: NEW: OpenAI Chat API mode support
Client->>AgentHandler: execute(instruction, options)
AgentHandler->>AgentHandler: wrap model with clientOptions (apiMode, baseURL, etc.)
Note over AgentHandler,LLMProv: Model creation
AgentHandler->>LLMProv: getClient(modelId, clientOptions)
LLMProv->>GetModel: getAISDKLanguageModel(subProvider, subModelName, clientOptions)
alt apiMode == "chat" AND subProvider == "openai"
GetModel->>GetModel: Extract apiMode, strip from clientOptions
GetModel->>OpenAISDK: createOpenAI() or openai
GetModel->>OpenAISDK: provider.chat(subModelName)
OpenAISDK-->>GetModel: language model (provider = "openai.chat")
else default (responses or other provider)
GetModel->>GetModel: use toAISDKClientOptions, find creator
GetModel->>OpenAISDK: provider.responses() or other method
OpenAISDK-->>GetModel: language model (provider = "openai.responses")
end
GetModel-->>LLMProv: LanguageModelV2
LLMProv-->>AgentHandler: LLMClient with model
Note over AgentHandler,ProviderOpts: Agent execution with provider options
AgentHandler->>BuildOpts: buildAgentProviderOptions(modelId, provider, thinkingEffort)
BuildOpts->>ProviderOpts: openAIStoreProviderOptions(provider)
alt provider == "openai.responses"
ProviderOpts-->>BuildOpts: { openai: { store: false } }
else provider == "openai.chat"
ProviderOpts-->>BuildOpts: {} (no store option)
end
BuildOpts-->>AgentHandler: providerOptions (including google, anthropic, openai)
AgentHandler->>OpenAISDK: generateText({ model, messages, providerOptions })
alt Responses API
OpenAISDK-->>AgentHandler: response with store: false applied
else Chat API
OpenAISDK-->>AgentHandler: response (store option omitted)
end
AgentHandler-->>Client: execute result
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
akeimach
approved these changes
Jul 16, 2026
The option only applies to OpenAI-compatible providers and selects the
wire format ('responses' | 'chat'), not a URL. The generic 'apiMode'
name gave no hint of either, and sitting next to 'baseURL' in the same
options object invited confusion with an endpoint address.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
openaiEndpointFormatto public model configurationopenaiEndpointFormatischatstoreoption for Chat providers, including finalization callsUsage
The option names the wire format used against the OpenAI-compatible endpoint at
baseURL— deliberately notapiMode(too generic) oropenaiEndpoint(reads like it holds a URL, and sits right next tobaseURL).Databricks verification
store: falsereproduced the 400: extra inputs are not permittedstore: 200 on both turnsTesting