Skip to content

Add The Grid provider - #409

Open
CastilloLuis wants to merge 1 commit into
andrewyng:mainfrom
the-gridai:thegridai/thegrid-provider
Open

Add The Grid provider#409
CastilloLuis wants to merge 1 commit into
andrewyng:mainfrom
the-gridai:thegridai/thegrid-provider

Conversation

@CastilloLuis

Copy link
Copy Markdown

Summary

Adds The Grid as a provider.

The Grid is an OpenAI-compatible inference API whose model ids are market instruments rather than fixed foundation models. A caller selects a quality tier — text-standard, code-prime, agent-max — and The Grid acquires qualifying inference on its market to serve the request. Lab-specific markets are also available (claude-opus-latest, kimi-latest, gpt-sol-latest, and others).

Mirrors the existing Eden AI provider: openai.OpenAI against a base_url, with OpenAICompliantMessageConverter on the response so tool calls and usage come back normalized. Auto-discovered by ProviderFactory via the *_provider.py filename convention, so no registry change is needed.

Files

File
aisuite/providers/thegrid_provider.py the provider
tests/providers/test_thegrid_provider.py 5 mock-based tests
guides/thegrid.md setup guide
guides/README.md link to it
README.md one word added to the inline provider list

One behaviour worth calling out

Because an instrument pools several backing models, the model field of a response names the model that actually served the request, not the instrument requested. Asking for text-standard can come back as openai/gpt-oss-120b. That is intentional on The Grid's side — it is how they stay transparent about what served you — but it will surprise a caller who assumes the two match, so it is documented in the guide, in the class docstring, and pinned by a test.

Verification

Mock-based tests, per the repo convention:

$ pytest tests/providers/test_thegrid_provider.py -q
.....                                                                    [100%]
5 passed in 1.01s

$ black --check aisuite/providers/thegrid_provider.py tests/providers/test_thegrid_provider.py
All done! ✨ 🍰 ✨
2 files would be left unchanged.

And end to end against the live API, since mocks cannot tell you the base URL or auth is right:

provider discovered: True
  thegrid:text-standard   -> content='OK'
  thegrid:code-prime      -> content='OK'
  tool_calls: get_weather({"city": "San Francisco"})

Tool calling is exercised deliberately — #121 asked for it on a previous provider, so it is here from the start rather than as a follow-up.

Notes

  • No new dependency. Reuses the existing openai client, so no pyproject.toml extra is needed (same as deepseek, ollama, lmstudio).
  • No registry, enum or __init__.py change — discovery is by filename.

The Grid (https://thegrid.ai) is an OpenAI-compatible inference API whose
model ids are market instruments rather than fixed foundation models. A
caller selects a quality tier such as text-standard, code-prime or
agent-max and The Grid acquires qualifying inference on its market to
serve the request. Lab-specific markets are also available, e.g.
claude-opus-latest and kimi-latest.

Follows the Eden AI provider pattern: openai.OpenAI against a base_url,
with OpenAICompliantMessageConverter for the response, so tool calls and
usage come back normalized. Auto-discovered by ProviderFactory via the
*_provider.py filename convention, so no registry change is needed.

Adds guides/thegrid.md and registers it in guides/README.md.

Documented, and covered by a test, is one behaviour a caller should not
be surprised by: because an instrument pools several backing models, the
`model` field of a response names the model that actually served the
request rather than the instrument requested.

Verified against the live API, not just mocks:
  - provider discovery via ProviderFactory
  - thegrid:text-standard and thegrid:code-prime both return content
  - thegrid:agent-standard returns a real tool call

Five mock-based unit tests pass; black clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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