---
title: "Add a model to the machine's AI gateway, or replace one"
method: PUT
path: "/api/nodes/{node_id}/ai-gateway/models/{alias}"
tags: ["nodes"]
---

# Add a model to the machine's AI gateway, or replace one

`PUT /api/nodes/{node_id}/ai-gateway/models/{alias}`

## Request

- Base URL: `https://app.nerdit.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://app.nerdit.ai/api/nodes/{node_id}/ai-gateway/models/{alias}`
- Auth: none declared

Forward ``PUT /api/ai-gateway/routes/{alias}`` with a fresh ``Idempotency-Key``.

The key travels as its ``${secrets.shared.KEY}`` reference. The daemon's
refusals pass through in its words (``ai_gateway.base_url_invalid``,
``ai_gateway.secret_ref_invalid``, ``ai_gateway.alias_invalid``).

## Path parameters

- `alias` string, required
- `node_id` string, uuid, required

## Request body

- NodeAiModelWrite: A model to add: the provider's model and base URL, and the key's **name**.
  - `model` string, required
  - `base_url` string, required
  - `key` string, required

## Response `200`

Successful Response

- NodeAiModelWriteView: What the write came to.
  - `online` boolean, required
  - `alias` string, required
  - `created` boolean, required
  - `enabled` boolean, required

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Unprocessable Content
- `429`: Too Many Requests
- `502`: Bad Gateway

---

[API](https://skmtc.dev/nerdit/apis/nerdit-cloud-web.md) · [All operations](https://skmtc.dev/nerdit/apis/nerdit-cloud-web/llms.txt) · [OpenAPI document](https://skmtc.dev/nerdit/apis/nerdit-cloud-web/revisions/06e3b44b58be?raw)
