Skip to content

feat: add The Grid provider - #480

Open
BarneyChambers wants to merge 1 commit into
charmbracelet:mainfrom
BarneyChambers:feat/add-thegrid-provider
Open

feat: add The Grid provider#480
BarneyChambers wants to merge 1 commit into
charmbracelet:mainfrom
BarneyChambers:feat/add-thegrid-provider

Conversation

@BarneyChambers

@BarneyChambers BarneyChambers commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Adds The Grid as an OpenAI-compatible provider with 9 models: internal/providers/configs/thegrid.json, its registration in internal/providers/providers.go, and the InferenceProvider constant in pkg/catwalk/provider.go — the same three-file shape as #373.

The Grid is an OpenAI-compatible inference platform (docs, API base https://api.thegrid.ai/v1). These records are generated from the same source of truth that drives our live /v1/models endpoint, so the values in this PR match what the API enforces.

How these values are derived

Grid models differ from single-model providers in ways that affect the values here:

  • Each model id routes across a pool of underlying models rather than naming one. Published limits are the guaranteed floor across that pool — the minimum every pooled model accepts — so requests within the published limits never fail on limit grounds.
  • The max input limit is a real, independently enforced cap. It is not derivable as context − max output.
  • Pricing is uniform across token types: input, output, and cached tokens bill at the same rate, so cost_per_1m_in, cost_per_1m_out, and both cached figures are equal by design rather than by omission. The published figure is the trailing 7-day volume-weighted average of the live spot price; we refresh it whenever we update these records.
  • type is openai-compat and api_key is $THEGRID_API_KEY, matching how the other third-party OpenAI-compatible providers in configs/ declare themselves.
  • supports_attachments is true only on the *-max tier, which is what architecture.input_modalities reports in our catalog; the prime and standard tiers are text-only.

Models

model context max input max output USD / 1M tokens (in = out)
agent-max 1,000,000 922,000 128,000 1.5885
agent-prime 196,608 120,000 30,000 0.1422
agent-standard 128,000 120,000 16,000 0.02
code-max 1,000,000 922,000 128,000 1.7553
code-prime 196,608 120,000 30,000 0.1493
code-standard 128,000 120,000 16,000 0.0288
text-max 1,000,000 922,000 128,000 1.68
text-prime 196,608 120,000 30,000 0.1017
text-standard 128,000 120,000 16,000 0.03

default_large_model_id is agent-max and default_small_model_id is text-standard.

Verification

  • go build ./..., go vet ./..., and go test ./... all pass on this branch (Go 1.26), and gofmt -l ./internal ./pkg is clean.
  • TestValidDefaultModels/The_Grid passes both default model ids resolve within the models array.
  • Confirmed the embedded config decodes into catwalk.Provider with every field populated (no JSON key silently missing a struct tag): type=openai-compat, endpoint=https://api.thegrid.ai/v1, key=$THEGRID_API_KEY, 9 models with limits, prices, and capability flags all set.
  • Live values are checkable without auth: curl -sS https://api.thegrid.ai/v1/models.

These entries are maintained by an automated generator with daily reconciliation against the published registry, so drift is caught and corrected promptly. Happy to add a cmd/thegrid generator and wire it into the auto-update workflow (the #463 shape) if you'd prefer these refreshed automatically rather than by PR.

The Grid is an OpenAI-compatible inference platform where each model id routes
across a pool of underlying models rather than naming a single one.

Adds the provider config plus its registration and InferenceProvider constant.
@BarneyChambers

Copy link
Copy Markdown
Author

Please let me know if you have any style-guides for submitting pull requests and I would be happy to amend my request to align with that. Thanks for reading!

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