---
title: "Update Ai Config"
method: PUT
path: "/api/v1/master/ai/config"
tags: ["master-ai"]
---

# Update Ai Config

`PUT /api/v1/master/ai/config`

## Request

- Base URL: `https://teraads.co` (the document declares no server; this is the origin it was published from)
- URL: `https://teraads.co/api/v1/master/ai/config`
- Auth: none declared

Update AI provider API keys and routing preferences at runtime.

Keys are set in os.environ (immediate effect for all workers)
and persisted to system_state so they survive container restarts
when loaded by the startup hook.

## Request body

- AIKeyUpdate: API key update request — only provided fields are changed.
  - `anthropic_key` string, nullable
  - `openrouter_key` string, nullable
  - `runpod_key` string, nullable
  - `runpod_endpoint_id` string, nullable
  - `runpod_template_id` string, nullable
  - `default_tier` string, nullable
  - `opus_enabled` boolean, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/teraads/apis/tera-ads-api.md) · [All operations](https://skmtc.dev/teraads/apis/tera-ads-api/llms.txt) · [OpenAPI document](https://skmtc.dev/teraads/apis/tera-ads-api/revisions/fb2526b5cf3c?raw)
