Add The Grid provider - #409
Open
CastilloLuis wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.OpenAIagainst abase_url, withOpenAICompliantMessageConverteron the response so tool calls and usage come back normalized. Auto-discovered byProviderFactoryvia the*_provider.pyfilename convention, so no registry change is needed.Files
aisuite/providers/thegrid_provider.pytests/providers/test_thegrid_provider.pyguides/thegrid.mdguides/README.mdREADME.mdOne behaviour worth calling out
Because an instrument pools several backing models, the
modelfield of a response names the model that actually served the request, not the instrument requested. Asking fortext-standardcan come back asopenai/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:
And end to end against the live API, since mocks cannot tell you the base URL or auth is right:
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
openaiclient, so nopyproject.tomlextra is needed (same asdeepseek,ollama,lmstudio).__init__.pychange — discovery is by filename.