Repository navigation
feat(ai): add a cheaperinference provider alias - #128
Open
aiapienthusiast wants to merge 1 commit into
Open
aiapienthusiast wants to merge 1 commit into
aiapienthusiast wants to merge 1 commit into
Conversation
PGBOT_AI_PROVIDER=cheaperinference points the /chat/completions client at https://api.cheaperinference.com/v1, the same way the requesty and opper aliases pick their endpoints. The key comes from CHEAPER_INFERENCE_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, 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
This PR adds
PGBOT_AI_PROVIDER=cheaperinferenceforexplainandask.It copies the
requestyalias (#105) and theopperalias (#118).No new client code: it reuses the
/chat/completionsprovider.Cheaper Inference is an OpenAI-compatible LLM gateway.
The alias sets the endpoint to
https://api.cheaperinference.com/v1.It reads the key from
CHEAPER_INFERENCE_API_KEYorPGBOT_AI_API_KEYonly.It never takes an OpenAI or OpenRouter key.
It is not added to auto-detection.
The default
gpt-5.6-terrais served under the same id.PGBOT_AI_MODELselects another model, for examplegpt-5.4-mini.Details
Files:
internal/ai/openai.go:defaultCheaperInfURL.internal/ai/resolve.go:cheaperinferencejoins the/chat/completionscase. It maps to its endpoint and key variable.keyVarsFornamesCHEAPER_INFERENCE_API_KEY.internal/ai/resolve_test.go:TestResolve_cheaperinference, a copy of the opper test.README.md: environment table row and explain section.CHANGELOG.md: entry under Unreleased.Tests:
go test ./internal/ai/,go vet ./internal/ai/andgofmt -l internal/aipass.scripts/gate.shwas not run. The Go 1.27 toolchain download is not available on my machine.Live check:
gpt-5.4-minireturned a reply throughResolve()andGenerate()withPGBOT_AI_PROVIDER=cheaperinference.Checklist
scripts/gate.shpasses (builds HEAD, not just the working tree)EXPLAIN ANALYZE; findings stay deterministic (computed in Go) (no SQL change)model.Context/--json/ the store--jsonchange is additive, ormodel.SchemaVersionbumped + schema regenerated (go run ./tools/schemagen) (no--jsonchange)docs/findings/<id>.mdpage + catalog entry (not applicable)