{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scaledthought-com/json-schema/scaledthought-com-create-key-input-schema.json",
  "title": "CreateKeyInput",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scaledthought-com-openapi.json#/components/schemas/CreateKeyInput",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "env": {
      "default": "live",
      "type": "string",
      "enum": [
        "live",
        "test"
      ]
    },
    "scopes": {
      "default": [
        "inference",
        "read"
      ],
      "description": "A subset of the calling key's own scopes",
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "inference",
          "read",
          "keys",
          "billing"
        ]
      }
    },
    "daily_budget_usd": {
      "description": "Hard daily spend cap for this key",
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 1000000
    },
    "rpm_limit": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 100000
    },
    "tpm_limit": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 100000000
    },
    "expires_in": {
      "description": "Key lifetime, e.g. \"30d\" or \"12h\" (max 365d)",
      "type": "string",
      "pattern": "^(0|[1-9]\\d{0,5}[smhd])$"
    },
    "expires_at": {
      "description": "When the key stops working (ISO 8601, at most 365 days ahead). Use this or expires_in",
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "child": {
      "default": false,
      "description": "Create a sub-agent key: it records the calling key as its parent and is revoked when the parent is. Keys created by a child key are always children",
      "type": "boolean"
    },
    "lives_in": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300,
      "pattern": "^[^\\p{C}]+$",
      "description": "Where this key is stored, e.g. \"vercel:billing-service/production\" (display only, max 300 chars)"
    }
  },
  "required": [
    "name"
  ]
}