> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vapi.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.vapi.ai/_mcp/server.

# The Grid

> Wire The Grid, an OpenAI-compatible inference marketplace, into Vapi with the custom-llm provider and Custom Credentials.

The Grid is an inference marketplace that serves models from several labs behind one OpenAI-compatible API. Its instrument IDs describe capability tiers rather than specific lab models.

`text-standard`, `code-prime`, and `agent-max` each route to a current model for that tier. When The Grid replaces an underlying model, an assistant can keep using the same instrument ID.

The Grid exposes an OpenAI-compatible Chat Completions API, so you can connect it to Vapi as a [custom LLM](/customization/custom-llm/fine-tuned-openai-models).

Before starting, create an account with The Grid and a [Consumption API key](https://thegrid.ai/docs/api-reference/authentication).

## Add your credential

Send the following body to `POST https://api.vapi.ai/credential`. Use your [Vapi private API key](/security-and-privacy/api-keys) in the `Authorization: Bearer <VAPI_PRIVATE_KEY>` header:

```json
{
  "provider": "custom-llm",
  "apiKey": "<YOUR THE GRID API KEY>"
}
```

Save the credential `id` from the response. Add it to the assistant's `credentialIds` to select that credential.

## Create the assistant

Send this body to `POST https://api.vapi.ai/assistant` with the same Vapi private API key. Set `model.url` to The Grid's base URL and `model.model` to an instrument ID:

```json
{
  "name": "My Assistant",
  "credentialIds": ["<YOUR THE GRID CREDENTIAL ID>"],
  "model": {
    "provider": "custom-llm",
    "url": "https://api.thegrid.ai/v1",
    "model": "text-prime",
    "metadataSendMode": "off",
    "maxTokens": 600,
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful voice assistant. Keep replies short."
      }
    ]
  }
}
```

Setting `metadataSendMode` to `off` keeps Vapi call metadata out of requests to The Grid.

## Choose an instrument

`GET https://api.thegrid.ai/v1/models` lists available instrument IDs. Check [instrument specifications](https://thegrid.ai/instruments) and [pricing](https://thegrid.ai/pricing) for current details. Current instruments:

### Capability tiers

| Instrument       | Description                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------------------------- |
| `text-standard`  | Price-optimized models with low latency, high throughput, and shorter maximum outputs                         |
| `text-prime`     | Reliable models for everyday text generation, editing, and analysis across diverse workflows                  |
| `text-max`       | Frontier models for deep reasoning, long context, and complex workflows                                       |
| `agent-standard` | Price-optimized models for fast tool calls, simple agent loops, high-throughput automation, and orchestration |
| `agent-prime`    | Reliable models for dependable agentic applications, multi-step tool use, and reasoning workflows             |
| `agent-max`      | Frontier models for autonomous research, deep multi-step tool chains, and complex long-horizon tasks          |
| `code-standard`  | Price-optimized models for rapid autocomplete, linting, high-frequency suggestions, and batch edits           |
| `code-prime`     | Reliable models for everyday software tasks, code completion, review, and standard debugging                  |
| `code-max`       | Frontier models for complex research, architectural decisions, debugging, and multi-file development          |

### Latest-model aliases

Each alias follows the newest model release from one lab, with fallbacks to previous versions.

| Instrument             | Description                                                                             |
| ---------------------- | --------------------------------------------------------------------------------------- |
| `bytedance-pro-latest` | Latest ByteDance Pro model release with fallbacks to previous versions for reliability  |
| `claude-opus-latest`   | Latest Claude Opus model release with fallbacks to previous versions for reliability    |
| `deepseek-pro-latest`  | Latest DeepSeek Pro model release with fallbacks to previous versions for reliability   |
| `gemini-pro-latest`    | Latest Gemini Pro model release with fallbacks to previous versions for reliability     |
| `glm-latest`           | Latest GLM model release with fallbacks to previous versions for reliability            |
| `gpt-sol-latest`       | Latest OpenAI GPT Sol model release with fallbacks to previous versions for reliability |
| `kimi-latest`          | Latest Kimi model release with fallbacks to previous versions for reliability           |
| `minimax-latest`       | Latest MiniMax model release with fallbacks to previous versions for reliability        |

## Set `maxTokens` for spoken replies

Vapi uses `250` for `maxTokens` when it is omitted and sends the value to The Grid as `max_tokens`. A low cap can cut off a response.

The `600` value in the example is a starting point. Test your chosen instrument with representative spoken turns and raise the limit if replies are truncated. Keep the system prompt explicit about brevity.

## Check the other model settings

In the [Vapi Dashboard](https://dashboard.vapi.ai), open your assistant, select the **Model** card, and choose **Custom LLM** in the panel that opens. Check each setting against The Grid's values. [`GET https://api.thegrid.ai/v1/models`](https://api.thegrid.ai/v1/models) returns the current numbers for every instrument.

| Setting                | What to set                                                                                                                                                                |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Model**              | The exact instrument ID, such as `text-prime`. Don't use the display name.                                                                                                 |
| **Custom LLM URL**     | `https://api.thegrid.ai/v1`                                                                                                                                                |
| **Max Tokens**         | At or below the instrument's `max_completion_tokens`. Vapi's default of `250` suits short spoken replies.                                                                  |
| **Request Timeout**    | Above the instrument's `grid.ttft_max_seconds`, the longest time its providers can take to start streaming and still meet the specification. Vapi's default is 20 seconds. |
| **Metadata Send Mode** | **Off — send only messages**, to keep Vapi call metadata out of requests to The Grid.                                                                                      |

Limits differ between instruments and change over time, so read them from [`GET https://api.thegrid.ai/v1/models`](https://api.thegrid.ai/v1/models) instead of copying numbers into your configuration.

## Tool calling

The Grid's API supports OpenAI-style function calling. To configure Vapi tools, see the [tool calling integration guide](/customization/tool-calling-integration). Test a tool call with your chosen instrument before relying on it.

## Verify the assistant

Start a test call and ask the assistant a short question. Confirm it speaks a complete answer. Check the call logs for custom LLM errors. If you attached a tool, request an action that uses it. Confirm the tool runs.