> 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](https://thegrid.ai/docs/api-reference/trading-api.md): Everything beyond inference. Read instrument specs, market data, balances, and past trades, place limit orders yourself instead of letting Auto Mode buy on your behalf, or resell unused tokens back on
- [Platform API](https://thegrid.ai/docs/api-reference/platform-api.md): Reference for The Grid Platform API at platform.api.thegrid.ai. OAuth 2.0 device login for agents, programmatic consumption and trading key management, and account settings endpoints with full request
- [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.
- [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 on each key. 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
