Conversation
Add a databricks-openai provider to the generated opencode.json using @ai-sdk/openai against /ai-gateway/codex/v1, and bucket discovered or admin-listed GPT models with version 5.6 or newer into it. Older GPT models stay hidden because their OpenCode compatibility was never validated. Co-authored-by: Isaac <no-reply@databricks.com>
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.
What changed and why?
ug opencodenever exposed GPT models: the generatedopencode.jsononly haddatabricks-anthropic,databricks-google, anddatabricks-oss. This adds a fourth provider,databricks-openai, that talks to the Responses API (@ai-sdk/openai→<workspace>/ai-gateway/codex/v1) and serves GPT 5.6 and newer only:gpt-6-1-sol,gpt-6-sol,gpt-6-luna,gpt-6-astragpt-5-6-sol,gpt-5-6-terra,gpt-5-6-lunaOlder GPT models (≤ 5.5) stay hidden on purpose, because the OpenCode problems reported against them (#85, #99) have not been re-checked. Dated snapshot IDs such as
gpt-5-2025-08-07andgpt-oss-*are also excluded.Changes:
agents/opencode.py:databricks-openaiprovider, with the per-model User-Agent header and the token-refresh auth plugin wired the same way as the other providers;opencode_gpt_models(), the 5.6+ filter;build_opencode_models(), soconfigureandstatusbuild the provider buckets with the same code.cli.py: configuringopencodenow also discovers codex/GPT models.databricks.py:build_opencode_base_urls()now returns anopenaientry.managed_resolve.py: GPT 5.6+ models in a managed config's model list now go to theopenaibucket instead of being dropped.Existing users see the GPT models after running
ug configureagain. Older state has noopenaibucket, which is harmless.Why this works now (and didn't in #85)
The last investigation (#85, OpenCode 1.15.11) found both wire formats broken. I re-tested on the current gateway:
content_part.added, so OpenCode failed withtext part … not found(#85)output_item.added→content_part.added→output_text.deltareasoningSummary(#85)/ai-gateway/mlflow/v1still fails, now withParameter 'store' is not supported, which is why this PR uses ResponsesHow this differs from related issues and PRs
main, including the--modelsupport from Support per-launch model selection for OpenCode #834.limitfor GPT models; that can come later if needed.model_config.model_serviceslists are ignored for pi/opencode. This PR doesn't fix it; it only makes GPT 5.6+ bucketable once that list reaches_bucket_by_provider.Validation
ruff check,ruff format --check, andty check srcpass.pytest, excludingtest_e2e*.py: 3057 passed, 2 failed. The two failures (tests/test_claude_smart_routing_v2.py, socket-based) fail the same way on unmodifiedmainin my sandbox and are unrelated.configure, managed-config bucketing, the default-model order, base URLs, and the auth plugin's provider set.opencode-ai@1versionuginstalls): ranug configurewith real discovery, thenug opencode -m <model> -- runfor three turns. Turn 1 reads a file with a tool, turn 2 (-c) lists files with a tool, and turn 3 (-c) recalls both answers without tools. All three turns passed forgpt-6-sol,gpt-6-luna,gpt-6-1-sol,gpt-5-6-sol,gpt-5-6-terra, andgpt-5-6-luna. OpenCode 2.0.14 also passed forgpt-6-solandgpt-6-luna.gpt-6-astrais included but untested: it isn't available in my test workspace.This pull request and its description were written by Isaac.