> ## Documentation Index
> Fetch the complete documentation index at: https://docs.knoxcall.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Agent

> Create an AI agent within a gateway, bound to a provider and upstream secret, with optional default model and budget configuration.

### Create agent

```http theme={"dark"}
POST /admin/ai-gateway/{gatewayId}/agents
```

This is a control-plane endpoint on the **admin host** (`admin.knoxcall.com`). Authenticate with a session JWT, send the `X-Tenant-ID` header, and use an owner or admin account — it is **not** an `api.knoxcall.com` API-key endpoint.

**Request body**

```json theme={"dark"}
{
  "name": "Customer Support Bot",
  "slug": "support-bot",
  "provider": "anthropic",
  "upstream_secret_id": "00000000-0000-0000-0000-000000000000",
  "description": "Handles tier-1 support questions",
  "default_model": "claude-sonnet-4-6",
  "budget_daily_usd": 10.00,
  "budget_monthly_usd": 200.00,
  "streaming_enabled": true
}
```

**Create fields**

| Field                | Type                    | Description                                                                                                                                                      |
| -------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`               | string                  | **Required.** Display name for the agent.                                                                                                                        |
| `slug`               | string                  | **Required.** URL slug; the agent is served at `/v1/ai/{slug}`.                                                                                                  |
| `provider`           | `anthropic` \| `openai` | **Required.** Upstream provider. Determines the upstream URL and auth header template.                                                                           |
| `upstream_secret_id` | string (uuid)           | **Required.** ID of a secret in this tenant holding the provider API key. The gateway auto-creates an upstream route (`ai-gateway-{slug}`) wired to this secret. |
| `description`        | string                  | Optional free-text description.                                                                                                                                  |
| `default_model`      | string                  | Optional. Defaults to the provider default (`claude-sonnet-4-6` for Anthropic, `gpt-4o` for OpenAI).                                                             |
| `budget_daily_usd`   | number                  | Optional daily spend cap.                                                                                                                                        |
| `budget_monthly_usd` | number                  | Optional monthly spend cap.                                                                                                                                      |
| `streaming_enabled`  | boolean                 | Optional. Defaults to `true`.                                                                                                                                    |

<Note>
  The primary route is derived automatically from `provider` + `upstream_secret_id`; you do not pass `primary_route_id` at create time. Model policy (`model_allowlist`, `model_denylist`, `model_rewrite`), `tool_allowlist`, `output_schema` / `output_validation_action`, `fallback_route_ids`, and `firewall_policy_id` are configured **after** creation via `PATCH /admin/ai-gateway/{gatewayId}/agents/{agentId}` — they are not read by the create handler.
</Note>
