Agents

# Agent setup

An agent can discover the API, create a key and pay for its own inference without a browser or email.

**On this page**

- [Discovery files](https://inference.dagon.so/docs/agents#discovery-files)
- [How an agent pays](https://inference.dagon.so/docs/agents#how-an-agent-pays)
- [Remote MCP server](https://inference.dagon.so/docs/agents#remote-mcp-server)
- [Local MCP server](https://inference.dagon.so/docs/agents#local-mcp-server)
- [Coding agents and SDK tools](https://inference.dagon.so/docs/agents#coding-agents-and-sdk-tools)

## Discovery files

| File | What it holds |
| --- | --- |
| [/llms.txt](https://inference.dagon.so/llms.txt) | The API, models and prices, and how to pay, written for language models |
| [/llms-full.txt](https://inference.dagon.so/llms-full.txt) | The same plus the full text of every guide |
| [/openapi.json](https://inference.dagon.so/openapi.json) | OpenAPI 3.1, with x402 payment info on the inference operations |
| [/.well-known/api-catalog](https://inference.dagon.so/.well-known/api-catalog) | RFC 9727 link set pointing at the API and its descriptions |
| [/models.json](https://inference.dagon.so/models.json) | Catalog snapshot (the live list is /v1/models) |
| [/changelog.xml](https://inference.dagon.so/changelog.xml) | Atom feed of catalog changes: new, removed and renamed models, refusal labels, providers, prices (also /changelog.json) |

## How an agent pays

1. **[x402 per request](https://inference.dagon.so/docs/x402)**: no key, no setup. The first paid response returns a key in `x-dagon-key`.
2. **[Wallet top-up](https://inference.dagon.so/docs/wallet-purchase)**: create a key with `POST /v1/keys`, then fund it in two calls.
3. **MCP server**, remote or local, below.

## Remote MCP server

`https://inference.dagon.so/mcp` is an MCP server over Streamable HTTP (stateless, JSON responses) for any client that takes a URL: Claude and ChatGPT connectors, Claude Code, Cursor, MCP directories. Send your `gk_` key as `Authorization: Bearer` on the connection, as with the API; `dagon_models` and `dagon_create_key` work without one. Each tool call is an ordinary API request made with your key and your address, so the same limits, location block, billing and receipts apply; `dagon_chat` returns the receipt id. The server holds no wallet and never signs: `dagon_buy_credits` returns the unsigned USDC transaction for `payer_wallet` to sign, then `dagon_confirm_purchase` takes the signed transaction (fee sponsored) or the signature of the one you sent. Requests are limited to 120 a minute per network and 1 MiB each; a browser client's `Origin` must be https (or http on localhost).

Shell

```sh
claude mcp add --transport http dagon https://inference.dagon.so/mcp --header "Authorization: Bearer gk_..."
```

.mcp.json

```json
{
  "mcpServers": {
    "dagon": {
      "type": "http",
      "url": "https://inference.dagon.so/mcp",
      "headers": { "Authorization": "Bearer ${DAGON_API_KEY}" }
    }
  }
}
```

## Local MCP server

The gateway repository's `mcp/` folder is a local stdio MCP server for Claude Desktop, Claude Code, omp and other MCP clients, with the same tools. It can also sign purchases with a wallet you configure. It is not published to npm: run it from a checkout (Node 22.18 or newer). It does not pay with x402.

| Tool | What it does |
| --- | --- |
| `dagon_models` | `GET /v1/models` |
| `dagon_balance` | `GET /v1/credits` |
| `dagon_create_key` | `POST /v1/keys` |
| `dagon_buy_credits` | Buys credits with Solana USDC (signs with a configured wallet, or returns the unsigned transaction) |
| `dagon_confirm_purchase` | Credits a payment you signed yourself: the signed transaction when fee sponsored, else the signature of the one you sent |
| `dagon_chat` | One non-streaming chat completion |

Shell

```sh
git clone https://github.com/inkwell-finance/dagon-inference.git
cd dagon-inference/mcp && npm ci
claude mcp add dagon --env DAGON_API_KEY=gk_... -- node /path/to/dagon-inference/mcp/src/index.ts
```

claude\_desktop\_config.json / .mcp.json

```json
{
  "mcpServers": {
    "dagon": {
      "command": "node",
      "args": ["/path/to/dagon-inference/mcp/src/index.ts"],
      "env": { "DAGON_API_KEY": "${DAGON_API_KEY}" }
    }
  }
}
```

Purchases are bounded by the server's own limits (by default $50 per call and $200 per day) and need `DAGON_TREASURY_WALLET` set independently. See `mcp/README.md` in the repository for every variable.

## Coding agents and SDK tools

Any tool that accepts an OpenAI-compatible base URL works with `https://inference.dagon.so/v1`; tools built on the Anthropic SDK use `https://inference.dagon.so`. Use a [child key](https://inference.dagon.so/docs/child-keys) per agent with a set balance, so a runaway loop spends at most that.

Last updated 2026-11-10

[Previous **Privacy and data retention**](https://inference.dagon.so/docs/privacy)
