Skip to content

feat(llm): add API Route gateway preset - #957

Open
DennyHo0917 wants to merge 2 commits into
zzet:mainfrom
DennyHo0917:feat/api-route-preset
Open

DennyHo0917 wants to merge 2 commits into
zzet:mainfrom
DennyHo0917:feat/api-route-preset

Conversation

@DennyHo0917

@DennyHo0917 DennyHo0917 commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

Add API Route as an optional OpenAI-compatible gateway preset. I am affiliated with API Route. This follows the one-entry preset approach used in #928/#929.

Changes

  • One gatewayPresets entry: canonical endpoint, API_ROUTE_API_KEY, gpt-6.1-sol, strict JSON schema, frontier prompt profile.
  • One preset-resolution regression case and one row in the existing gateway table.
  • Reuses the generic custom-provider transport and existing user override behavior.

Testing

  • go test ./internal/llm ./internal/llm/provider/openaicompat passes.
  • go vet ./internal/llm ./internal/llm/provider/openaicompat passes; gofmt and diff whitespace checks pass.
  • Real calls through openaicompat.Client using the preset's endpoint/model/key variable: freeform and ShapeExpandTerms strict JSON-schema output both succeed with reasoning_effort: low.
  • golangci-lint v2.14.0 run ./internal/llm ./internal/llm/provider/openaicompat: 0 issues.
  • Full CGO build and full race suite were not run locally. Verification used a focused sparse checkout on Windows; the Gortex graph tools are not installed in this environment.

Checklist

  • Existing preset pattern followed.
  • No new transport package or unnecessary abstraction.
  • Language extractor and benchmark items are not applicable.

Signed-off-by: dennyho0917 <dennyho0917@gmail.com>

@zzet zzet left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clear PR and for disclosing the affiliation. The entry has the same shape as the cheaperinference preset, and provider list, provider show and the unknown-provider error pick it up with no other changes. On Go 1.27.3, go vet, the internal/llm and cmd/gortex provider tests and golangci-lint v2.14.0 all pass. The endpoint answers with OpenAI-style errors, and gpt-6.1-sol is in API Route's public model list.

Two small corrections before merge, each with a suggestion inline:

  1. Docs row order. gortex provider list sorts presets by name, so the api-route row should come first in the gateway presets table, before cheaperinference.
  2. Link in the code comment. https://www.api-route.com/en/docs/quickstart redirects to /docs/quickstart, which covers setting up Codex and Claude Code clients. https://www.api-route.com/docs/overview describes the OpenAI-compatible API, which is what the comment is about.

Comment thread docs/llm.md Outdated
Comment on lines +172 to +173
| `cheaperinference` | `https://api.cheaperinference.com/v1` | `gpt-5.4-mini` | `CHEAPER_INFERENCE_API_KEY` | `frontier` |
| `api-route` | `https://global.api-route.com/v1` | `gpt-6.1-sol` | `API_ROUTE_API_KEY` | `frontier` |

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gortex provider list sorts presets by name, so the table can follow the same order:

Suggested change
| `cheaperinference` | `https://api.cheaperinference.com/v1` | `gpt-5.4-mini` | `CHEAPER_INFERENCE_API_KEY` | `frontier` |
| `api-route` | `https://global.api-route.com/v1` | `gpt-6.1-sol` | `API_ROUTE_API_KEY` | `frontier` |
| `api-route` | `https://global.api-route.com/v1` | `gpt-6.1-sol` | `API_ROUTE_API_KEY` | `frontier` |
| `cheaperinference` | `https://api.cheaperinference.com/v1` | `gpt-5.4-mini` | `CHEAPER_INFERENCE_API_KEY` | `frontier` |

Comment thread internal/llm/presets.go Outdated
// Preset names are deliberately not reserved: a user custom provider of
// the same name (providers.json or inline `llm.custom`) always wins.
var gatewayPresets = map[string]CustomProvider{
// API Route (https://www.api-route.com/en/docs/quickstart) uses the

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL redirects to /docs/quickstart, which is about client setup. The overview page describes the API:

Suggested change
// API Route (https://www.api-route.com/en/docs/quickstart) uses the
// API Route (https://www.api-route.com/docs/overview) uses the

Signed-off-by: dennyho0917 <dennyho0917@gmail.com>
@DennyHo0917

Copy link
Copy Markdown
Author

Thank you for the review. Both suggestions are addressed in signed commit b5b714a: the API Route row now precedes cheaperinference, matching the sorted preset list, and the code comment links to https://www.api-route.com/docs/overview. This follow-up changes only documentation and a comment; gofmt and git diff --check pass. Ready for another look.

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.

2 participants