pi-mono/packages/ai/scripts
Victor Navarro 177e2ad7e4
fix(ai): use OpenCode protocol-specific endpoints (#11434)
closes #11132

pi sends every opencode and opencode-go request to the shared base
(`https://opencode.ai/inference/v1`, `/inference/go/v1`), Jev included.
this switches them to the documented protocol-specific endpoints, which
is also what models.dev lists per model:

| api | before | after |
|---|---|---|
| openai-completions / openai-responses | `/inference/v1` |
`/inference/openai/v1` |
| anthropic-messages | `/inference` | `/inference/anthropic` (SDK
appends `/v1/messages`) |
| google-generative-ai | `/inference/v1` | `/inference/google/v1beta` |
| jev-1.13 / jev-1.13-free | `/inference/v1` | `/inference/systemone/v1`
|

go uses the same paths under `/inference/go/...`.

changes: base URLs in `generate-models.ts`, the jev URL expectations in
`test/classifier-models.test.ts`, and a stale comment in
`providers/opencode.ts`. `models.generated.ts` has no diff since the
catalog data is gitignored.

verified with the regenerated catalog:
- all 111 opencode/opencode-go models hit their new URL, none 404
- real requests with an OpenCode key returned replies on
anthropic-messages, google-generative-ai, openai-responses,
openai-completions and jev
- go returned 403 "subscription required" from the new paths (my key has
no Go sub), so routing works there too

`npm run check` passes. `./test.sh` passes for ai and coding-agent; the
only remaining failures were timeouts that pass in isolation and pi-env
tests that need cargo locally.

---

_Drafted with AI assistance, reviewed by me._
2026-10-27 10:40:41 +01:00
..
ai-gateway-pricing.ts fix(ai): keep prompt-length pricing tiers from all model catalogs 2026-10-07 21:54:18 +02:00
check-model-data.ts fix(ai): validate generated model data before builds 2026-07-20 22:29:06 +02:00
generate-models.ts fix(ai): use OpenCode protocol-specific endpoints (#11434) 2026-10-27 10:40:41 +01:00
generate-test-image.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
hydrate-model-catalog.ts feat(coding-agent): add Nix flake (#9137) 2026-10-02 18:30:51 +02:00
model-data.ts feat(coding-agent): add Nix flake (#9137) 2026-10-02 18:30:51 +02:00
models-dev-reasoning-options.ts generate-models: use reasoning options from models.dev (#6928) 2026-07-22 08:33:34 +02:00
openrouter-catalog.ts feat(ai,coding-agent): image input for System One classifiers 2026-10-21 23:53:47 +02:00
openrouter-reasoning-options.ts fix(ai): derive OpenRouter reasoning controls (#8614) 2026-08-25 12:11:21 +02:00