Repository navigation
Conversation
…iders Add an optional headers table to [default_model] and [[fallback_providers]] in config.toml. DriverConfig picks it up and OpenAI-compatible drivers apply the pairs via with_extra_headers (e.g. x-opencode-session required by the OpenCode Go endpoint). Ignored by non-HTTP and subprocess drivers.
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.
Problem
The OpenCode Go gateway (
https://opencode.ai/zen/go/v1) now requires anx-opencode-sessionheader on every request (see the official requirements and this write-up on the breaking change). Without it, every completion fails with:OpenFang's
OpenAIDriveralready supports extra headers viawith_extra_headers()(used hard-coded for GitHub Copilot), but there is no configuration path that populates it, so OpenCode Go subscriptions cannot be used as a provider at all.Solution
Add an optional
headerstable to[default_model]and[[fallback_providers]]:DriverConfigand applied increate_driver()to OpenAI-compatible drivers via the existingwith_extra_headers().subprocess_timeout_secs: from[default_model]for the primary provider, from the matching[[fallback_providers]]entry for fallbacks,Noneotherwise (headers belong to a specific endpoint, not inheritable).Debugoutput (length only), consistent withapi_keyhandling.docs/configuration.md) andopenfang.toml.exampleupdated.Testing
cargo checkonopenfang-types,openfang-runtime,openfang-kernel,openfang-api,openfang-cli,openfang-migratecargo test: 388 (types) + 995 (runtime) pass, including 4 new config round-trip testscargo fmt --checkclean, clippy 0 warnings on touched filesx-opencode-sessionset