Skip to content

feat(ai): add a runcrate provider alias - #138

Open
heydryft wants to merge 1 commit into
pgrundev:mainfrom
heydryft:feat/runcrate-provider
Open

heydryft wants to merge 1 commit into
pgrundev:mainfrom
heydryft:feat/runcrate-provider

Conversation

@heydryft

Copy link
Copy Markdown

What and why

Adds runcrate as an explicit PGBOT_AI_PROVIDER alias for explain / ask, following the same shape as the opper alias from #118. Runcrate serves open models over an OpenAI-compatible /chat/completions API, so the existing OpenAIProvider covers it and only the endpoint, key variable and default model differ.

  • PGBOT_AI_PROVIDER=runcrate sends /chat/completions to https://api.runcrate.ai/v1 with RUNCRATE_API_KEY (or PGBOT_AI_API_KEY).
  • It is never auto-detected and never picks up an OpenAI or OpenRouter key, the same as requesty and opper.
  • Runcrate does not serve the OpenAI default gpt-5.6-terra, so the alias defaults to deepseek-ai/DeepSeek-V4.1-Flash when neither PGBOT_AI_MODEL nor PGBOT_OPENAI_MODEL is set. Any id from https://api.runcrate.ai/v1/models works through PGBOT_AI_MODEL.

Files: internal/ai/openai.go (endpoint and default model constants), internal/ai/resolve.go (alias, key variable, default model, keyVarsFor), internal/ai/resolve_test.go (TestResolve_runcrate), README.md, CHANGELOG.md (Unreleased, Added).

Keys are created at https://www.runcrate.ai/dashboard/api-keys?utm_source=pgbot&utm_medium=directory&utm_campaign=gpu_pricing .

Testing

  • gofmt -l .: no output
  • go vet ./...: clean
  • go test ./internal/ai/ -run TestResolve -v: all 19 TestResolve_* pass, including the new TestResolve_runcrate (both key variables, endpoint, default model, PGBOT_AI_MODEL override, refuses an OpenAI key, not auto-detected)
  • scripts/gate.sh: HEAD builds, vets, and tests clean (6 targets)
  • Live check: Resolve() with PGBOT_AI_PROVIDER=runcrate and a real RUNCRATE_API_KEY, then Generate() with a system and user turn (throwaway test, not committed). deepseek-ai/DeepSeek-V4.1-Flash (the default), zai-org/GLM-5.3-Flash and Qwen/Qwen3.8-Flash each returned "pong" with finish_reason=stop.

Checklist

  • scripts/gate.sh passes (builds HEAD, not just the working tree)
  • New SQL is read-only; no EXPLAIN ANALYZE; findings stay deterministic (computed in Go) (no SQL touched)
  • No PII enters a model.Context / --json / the store (unchanged)
  • --json change is additive, or model.SchemaVersion bumped + schema regenerated (no --json change)
  • A new finding has a docs/findings/<id>.md page + catalog entry (no new finding)

This PR was prepared with AI assistance: an AI coding agent wrote the change and ran the checks above.

Disclosure: I work on Runcrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant