# Set up the GetDeploying API

These are instructions from GetDeploying for AI coding agents. Follow them to set up the user's project to call the GetDeploying API: cloud GPU prices from 91 providers, price history, GPU models and providers, as JSON over REST. They are published at https://getdeploying.com/help/api/agent-setup.md, so you can check them again at any time.

## 1. Get an API key from the user

- The API needs a key. The user creates one in their dashboard: https://getdeploying.com/dashboard. Without an account, they can start a free trial at https://getdeploying.com/signup (100 requests).
- Ask the user to add the key to the project's configuration as `GETDEPLOYING_API_KEY`, where the project already keeps its secrets (for example a `.env` file). Check that the file is git-ignored.
- Do not ask the user to paste the key into the chat. Never print, log or commit the key.

## 2. Check that the key works

Make one call. It does not count against the trial:

```bash
curl -s -H "Authorization: Bearer $GETDEPLOYING_API_KEY" https://getdeploying.com/api/whoami
```

Your shell may not have `GETDEPLOYING_API_KEY` set. Load it from the project's configuration the way the project does, without printing it. If you cannot, ask the user to run the command and share the output.

It returns the workspace, its plan, `has_access` and, on a trial, `trial_remaining`.

- `401`: the key is wrong or revoked. Ask the user to check it.
- `has_access` is false: the workspace has no API access left, and other calls answer `402`. Tell the user; they can subscribe at https://getdeploying.com/api#pricing.

## 3. Spend requests carefully

- Every other request counts, including errors. A trial has 100 requests in total. A paid plan has 3,000 a day, shared by every key in the workspace.
- Read the reference before calling anything else: https://getdeploying.com/help/api.md
- Do not explore by trial and error. Filter on the server (`gpu_model`, `provider`, `billing_type`, `max_price` and the rest) and use `page_size=100` rather than many small pages.
- Cache responses in the code you write. Prices are re-checked every 15 minutes to once a day, so polling more often returns the same data.
- Read the `X-RateLimit-Remaining` header, and `X-Trial-Remaining` on a trial, and stop well before either reaches zero.

## 4. Write the integration

- Base URL: `https://getdeploying.com/api`
- Every request sends `Authorization: Bearer <key>`. The code reads the key from the project's configuration (`GETDEPLOYING_API_KEY`), never from a value written into the source.
- Send a `User-Agent` header that names the project and its version, in the form `User-Agent: <project-name>/<version>`. Support uses it to find the user's calls if they ask for help.
- Endpoints:
  - `GET /api/gpu-offerings`: current GPU offerings with specs and prices, filtered and sorted
  - `GET /api/gpu-price-history`: weekly or daily price points per GPU model, optionally per provider
  - `GET /api/gpus`: GPU models and their specs
  - `GET /api/providers`: providers and their details
- Prices are the list prices providers publish, converted to USD. They are not quotes or transaction prices.
- Use in internal tools, models, reports and your own products is allowed. Redistributing or reselling the raw data is not. See section 10 of the Terms: https://getdeploying.com/terms

## 5. Tell the user what you did

Summarize in a few lines: where the key is read from, what code you added, and how many requests you used.

## Help

The user can write to support@getdeploying.com. The full reference: https://getdeploying.com/help/api
