> For the complete documentation index, see [llms.txt](https://thegrid.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thegrid.ai/docs/api-reference.md).

# API reference

- [Overview](https://thegrid.ai/docs/api-reference/api-reference.md): Complete API reference for The Grid's market-priced AI inference platform. Covers the Consumption API for OpenAI- and Anthropic-compatible inference, the Trading API for market data and orders, and th
- [Authentication](https://thegrid.ai/docs/api-reference/authentication.md): The Grid issues two types of API keys plus OAuth access tokens for programmatic account control. This page covers generation, use, rotation, and the agent onboarding path.
- [Consumption API](https://thegrid.ai/docs/api-reference/consumption-api.md): The Consumption API is what you call to run inference. Two surfaces (OpenAI Chat Completions and Anthropic Messages) sit in front of the same routing engine.
- [Trading API | Market Data, Trading Balances, & Orders](https://thegrid.ai/docs/api-reference/trading-api.md): API reference for trading and reselling. Read instrument specs, market data, balances, trades, and place orders. Only necessary for advanced mode users.
- [Platform API | OAuth, Key Management & Account Settings](https://thegrid.ai/docs/api-reference/platform-api.md): API reference for OAuth, Trading & Consumption API Key management, and Account Settings, most commonly used by agents.
- [Diagnostics](https://thegrid.ai/docs/api-reference/diagnostics.md): Safe, read-only diagnostics for The Grid CLI and for raw HTTP clients using Platform, Trading, or Consumption authentication.
- [API Errors and Rate Limits](https://thegrid.ai/docs/api-reference/errors-and-rate-limits.md): How both APIs report failure, which errors are retryable, and how rate limits behave. Use this page when your client hits something other than a 200.
- [Request routing and redirects](https://thegrid.ai/docs/api-reference/request-routing-and-redirects.md): How a request to the Consumption API gets to the supplier fulfilling your inference, and which clients need configuration to follow the routing redirect.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://thegrid.ai/docs/api-reference.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
