Repository navigation
feat(ai): add an opper provider alias - #118
Merged
Merged
Conversation
Add Opper, an EU-hosted OpenAI compatible gateway, as a PGBOT_AI_PROVIDER alias for explain and ask, wired the same way as the requesty alias. No new client code: it reuses the /chat/completions provider and only picks the endpoint and key variable. - internal/ai/openai.go: defaultOpperURL = https://api.opper.ai/v3/compat - internal/ai/resolve.go: opper joins the /chat/completions case, maps to its endpoint and reads its key from OPPER_API_KEY (or PGBOT_AI_API_KEY) only. keyVarsFor names OPPER_API_KEY. It is not added to auto detection. - internal/ai/resolve_test.go: TestResolve_opper, a copy of the requesty test. - README environment table and explain section, CHANGELOG entry under Unreleased. The default model gpt-5.6-terra is served by Opper under the same id, with reasoning_effort up to max, so it works without PGBOT_AI_MODEL. Not run locally: scripts/gate.sh, go test, gofmt (no Go toolchain on this machine). The change copies the requesty alias line for line. Disclosure: Opper is my startup. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.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 and why
Adds Opper (an EU-hosted, OpenAI compatible LLM gateway) as a
PGBOT_AI_PROVIDERalias forexplainandask, wired the same way as the existingrequestyandopenrouteraliases. No new client code: it reuses the/chat/completionsprovider and only picks the endpoint and key variable.Changes:
internal/ai/openai.go:defaultOpperURL = "https://api.opper.ai/v3/compat"next todefaultRequestyURL.internal/ai/resolve.go:opperjoins the/chat/completionscase, maps to its endpoint, and reads its key fromOPPER_API_KEY(orPGBOT_AI_API_KEY) only, so an OpenAI or OpenRouter key in the shell is never sent to it. The requestyif/elsebecame a smallswitchfor that.keyVarsFornamesOPPER_API_KEYin the missing key error. It is not added to auto detection.internal/ai/resolve_test.go:TestResolve_opper, the requesty test with the names swapped (both key variables, refusal to borrowOPENAI_API_KEY, no auto detection).The default
gpt-5.6-terrais served by Opper under the same id, withreasoning_effortup tomax, soPGBOT_AI_MODELis optional.How to test:
Validation:
scripts/gate.sh,go testandgofmt -lwere not run here. The change copies the requesty alias and its test line for line.Disclosure: Opper is my startup.
Checklist
scripts/gate.shpasses (builds HEAD, not just the working tree) (not run locally, see above)EXPLAIN ANALYZE; findings stay deterministic (computed in Go) (no SQL touched)model.Context/--json/ the store (unchanged)--jsonchange is additive, ormodel.SchemaVersionbumped + schema regenerated (go run ./tools/schemagen) (no--jsonchange)docs/findings/<id>.mdpage + catalog entry (no new finding)