# API reference

- [Overview](https://thegrid.ai/docs/api-reference/api-reference.md): The Grid exposes its inference market over HTTP. This section covers what to call, how to authenticate, and how the routing layer behaves at runtime.
- [Authentication](https://thegrid.ai/docs/api-reference/authentication.md): The Grid issues two types of API keys. Each key authenticates against a different API and uses a different scheme. This page covers how to generate, use, and rotate both.
- [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, or place limit orders yourself instead of letting Auto Mode buy on your behalf.
- [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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
