# lg_gateway_keys_create: Create an inference API key

Create an inference API key; the secret is in this answer only. As an agent you must set limit_total_usd, at most the organization's balance; it can never spend more.

- **Changes data:** yes
- **Credential scope:** `gateway:write` (an API key's scopes, or what you allowed when connecting with OAuth)
- **Assistant level:** an assistant at Full; a lower level is refused

## Inputs

| Field | Type | Required | Notes |
|---|---|---|---|
| `body` | object (name, limit_total_usd, limit_daily_usd, limit_monthly_usd, rate_limit_rpm, byok_fallback, expires_in_days, workspace_id) | yes |  |
| `body.name` | string | yes |  |
| `body.limit_total_usd` | string or number | no | Most this key may ever spend (required for agents) |
| `body.limit_daily_usd` | string or number | no | US dollars, at most 6 decimals: "5.00" |
| `body.limit_monthly_usd` | string or number | no | US dollars, at most 6 decimals: "5.00" |
| `body.rate_limit_rpm` | integer | no | Requests a minute (default 600) |
| `body.byok_fallback` | boolean | no | When your provider key is refused, go on with credits (web app only) |
| `body.expires_in_days` | integer | no |  |
| `body.workspace_id` | string | no | The key spends within this workspace's budget |

## Example MCP call

A `tools/call` request to `https://manage.restolayer.com/mcp`:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lg_gateway_keys_create",
    "arguments": {
      "body": {
        "name": "nightly-evals",
        "limit_total_usd": "5.00",
        "limit_daily_usd": "1.00"
      }
    }
  }
}
```

## Example REST call

The same thing over REST (`POST /v1/gateway-keys`):

```bash
curl -s -X POST "https://manage.restolayer.com/v1/gateway-keys" \
  -H "Authorization: Bearer $LG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"nightly-evals","limit_total_usd":"5.00","limit_daily_usd":"1.00"}'
```

All tools: [MCP tools](https://www.restolayer.com/docs/mcp/tools). Connecting: [connect your assistant](https://www.restolayer.com/docs/connect).
