feat(ai): add a requesty provider alias - #105
Open
Thibaultjaigu wants to merge 1 commit into
Open
Thibaultjaigu wants to merge 1 commit into
Thibaultjaigu wants to merge 1 commit into
Conversation
PGBOT_AI_PROVIDER=requesty points the /chat/completions client at https://router.requesty.ai/v1, the same way the openrouter alias picks its endpoint. The key comes from REQUESTY_API_KEY or PGBOT_AI_API_KEY only, so an OpenAI or OpenRouter key in the shell is never sent to it, and it is never auto-detected. Documented in the README environment table and the explain section, including the EU endpoint, and in the changelog.
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 Requesty (an OpenAI compatible LLM gateway) as a
PGBOT_AI_PROVIDERalias forexplainandask, wired the same way as the existingopenrouteralias. No new client code: it reuses the/chat/completionsprovider and only picks the endpoint and key variable.Changes:
internal/ai/openai.go:defaultRequestyURL = "https://router.requesty.ai/v1"next todefaultOpenRouterURL.internal/ai/resolve.go:requestyjoins the/chat/completionscase, maps to its endpoint, and reads its key fromREQUESTY_API_KEY(orPGBOT_AI_API_KEY) only, so an OpenAI or OpenRouter key in the shell is never sent to it.keyVarsFornamesREQUESTY_API_KEYin the missing key error. It is not added to auto detection, so it only runs when selected explicitly.internal/ai/resolve_test.go: covers the endpoint with both key variables, the refusal to borrowOPENAI_API_KEY, and thatREQUESTY_API_KEYalone is not auto detected.https://router.eu.requesty.ai/v1viaPGBOT_AI_BASE_URL), plus a changelog entry under Unreleased.How to test:
Validation:
scripts/gate.shpasses on HEAD (build, vet, golangci-lint 0 issues, tests, 6 targets).gofmt -lclean.Resolve()andopenaiModel.Generateagainst Requesty: HTTP 200 withopenai/gpt-4o-mini, and HTTP 200 with the defaultgpt-5.6-terrathrough the reasoning path (max_completion_tokensandreasoning_effort).govulnchecknot run locally; no dependencies changed.Checklist
scripts/gate.shpasses (builds HEAD, not just the working tree)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)Disclosure: I work at Requesty. Happy to adjust anything to match project conventions.