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

# Update AI settings

> Update AI model configuration, API keys, or budgets. Admin only.



## OpenAPI

````yaml /api-reference/openapi.json put /api/settings/ai
openapi: 3.1.0
info:
  title: Tedro API
  version: 1.0.0
  description: REST API for the Tedro communication operations platform.
servers:
  - url: https://api.tedro.io
    description: Production
security:
  - sessionCookie: []
    workspaceId: []
paths:
  /api/settings/ai:
    put:
      tags:
        - 'Settings: AI'
      summary: Update AI settings
      description: Update AI model configuration, API keys, or budgets. Admin only.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAiSettings'
      responses:
        '200':
          description: AI settings updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiSettingsUpdatedResponse'
        '400':
          description: Bad Request - invalid or missing parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Unauthorized - missing or invalid session cookie
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - insufficient role (admin required)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - sessionCookie: []
          workspaceId: []
components:
  schemas:
    UpdateAiSettings:
      type: object
      properties:
        defaultProvider:
          type: string
          enum:
            - openai
            - anthropic
        defaultModel:
          type: string
          minLength: 1
        maxTokensPerRun:
          type: number
          exclusiveMinimum: 0
        monthlyBudgetUsd:
          type:
            - number
            - 'null'
          minimum: 0
        logPrompts:
          type: boolean
        temperature:
          type: number
          minimum: 0
          maximum: 2
        openaiApiKey:
          type: string
        anthropicApiKey:
          type: string
      additionalProperties: false
      description: Update AI model configuration
      example:
        defaultProvider: openai
        defaultModel: gpt-4.1-mini
        temperature: 0.7
    AiSettingsUpdatedResponse:
      type: object
      properties:
        ok:
          type: boolean
      required:
        - ok
    ValidationErrorResponse:
      type: object
      properties:
        error:
          type: string
        details:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
            required:
              - path
              - message
      required:
        - error
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  securitySchemes:
    sessionCookie:
      type: apiKey
      in: cookie
      name: better-auth.session_token
      description: Session cookie set by Better Auth on sign-in.
    workspaceId:
      type: apiKey
      in: header
      name: x-workspace-id
      description: Workspace UUID. Required on all /api/* endpoints.

````