{
  "components": {
    "schemas": {
      "APIKeyInfo": {
        "description": "Information about an API key.",
        "properties": {
          "api_key_last_digits": {
            "title": "Api Key Last Digits",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "team_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Team Id"
          },
          "usage_cost": {
            "title": "Usage Cost",
            "type": "number"
          },
          "usage_tokens": {
            "title": "Usage Tokens",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "api_key_last_digits",
          "created_at",
          "usage_tokens",
          "usage_cost",
          "request_count"
        ],
        "title": "APIKeyInfo",
        "type": "object"
      },
      "ActivityEvent": {
        "description": "Represents a single user activity event.",
        "properties": {
          "action": {
            "default": "created",
            "description": "Action performed (created, updated, deleted, etc.)",
            "enum": [
              "created",
              "created_version",
              "updated",
              "deleted",
              "deleted_version"
            ],
            "title": "Action",
            "type": "string"
          },
          "created_at": {
            "description": "When the activity occurred",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by": {
            "description": "Display name of the creator",
            "title": "Created By",
            "type": "string"
          },
          "id": {
            "description": "Unique activity event identifier",
            "title": "Id",
            "type": "string"
          },
          "item_id": {
            "description": "ID of the related item",
            "title": "Item Id",
            "type": "string"
          },
          "name": {
            "description": "Human-readable activity name",
            "title": "Name",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional project ID associated with the activity",
            "title": "Project Id"
          },
          "type": {
            "description": "Activity event type",
            "enum": [
              "project",
              "dataset",
              "model",
              "evaluation",
              "deployment"
            ],
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "name",
          "item_id",
          "created_by",
          "created_at"
        ],
        "title": "ActivityEvent",
        "type": "object"
      },
      "ActivityLogResponse": {
        "description": "Response payload for activity log requests.",
        "properties": {
          "count": {
            "description": "Number of events returned",
            "title": "Count",
            "type": "integer"
          },
          "events": {
            "description": "Activity events in reverse-chronological order",
            "items": {
              "$ref": "#/components/schemas/ActivityEvent"
            },
            "title": "Events",
            "type": "array"
          },
          "has_more": {
            "default": false,
            "description": "Whether more events are available beyond the current page",
            "title": "Has More",
            "type": "boolean"
          },
          "success": {
            "description": "Whether the request succeeded",
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "count"
        ],
        "title": "ActivityLogResponse",
        "type": "object"
      },
      "AdapterTimeseriesEntry": {
        "description": "One training job together with all of its completed evaluations.\n\nAttributes:\n    training_job: Full training-job metadata.\n    latest_eval: Most-recent completed evaluation for this adapter.\n        None when the adapter has never been evaluated.\n    all_evals: Every evaluation (any status) associated with this adapter,\n        ordered by creation date descending.",
        "properties": {
          "all_evals": {
            "items": {
              "$ref": "#/components/schemas/EvaluationResponse"
            },
            "title": "All Evals",
            "type": "array"
          },
          "latest_eval": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EvaluationResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "training_job": {
            "$ref": "#/components/schemas/TrainingJobResponse"
          }
        },
        "required": [
          "training_job",
          "all_evals"
        ],
        "title": "AdapterTimeseriesEntry",
        "type": "object"
      },
      "AdaptiveCadence": {
        "description": "User-facing cadence preset for autonomous adaptive finetuning runs.",
        "enum": [
          "off",
          "daily",
          "weekly",
          "monthly"
        ],
        "title": "AdaptiveCadence",
        "type": "string"
      },
      "AgentRunCallbackRequest": {
        "description": "Request payload for sandbox run-completion callbacks.",
        "properties": {
          "data_curation_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data Curation Report"
          },
          "deliverables": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deliverables"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "final_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Final Report"
          },
          "llm_token_usage": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llm Token Usage"
          },
          "status": {
            "enum": [
              "completed",
              "failed"
            ],
            "title": "Status",
            "type": "string"
          },
          "system_deficiencies": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "System Deficiencies"
          }
        },
        "required": [
          "status"
        ],
        "title": "AgentRunCallbackRequest",
        "type": "object"
      },
      "AgentRunCallbackResponse": {
        "description": "Response payload for sandbox run-completion callbacks.",
        "properties": {
          "accepted": {
            "title": "Accepted",
            "type": "boolean"
          },
          "agent_run_id": {
            "title": "Agent Run Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "agent_run_id",
          "status",
          "accepted"
        ],
        "title": "AgentRunCallbackResponse",
        "type": "object"
      },
      "AgentRunDetail": {
        "description": "Full agent run details including deliverables.",
        "properties": {
          "completed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "data_curation_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data Curation Report"
          },
          "final_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Final Report"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "report": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Report"
          },
          "sandbox_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sandbox Id"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "system_deficiencies": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "System Deficiencies"
          },
          "trigger_type": {
            "title": "Trigger Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "project_id",
          "status",
          "trigger_type",
          "created_at"
        ],
        "title": "AgentRunDetail",
        "type": "object"
      },
      "AgentRunListResponse": {
        "description": "Paginated list of agent runs.",
        "properties": {
          "limit": {
            "description": "Page size limit.",
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "description": "Current offset.",
            "title": "Offset",
            "type": "integer"
          },
          "runs": {
            "description": "List of agent runs.",
            "items": {
              "$ref": "#/components/schemas/AgentRunSummary"
            },
            "title": "Runs",
            "type": "array"
          },
          "total": {
            "description": "Total count matching filters.",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "runs",
          "total",
          "limit",
          "offset"
        ],
        "title": "AgentRunListResponse",
        "type": "object"
      },
      "AgentRunSummary": {
        "description": "Summary of a single agent run for list endpoints.",
        "properties": {
          "completed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "trigger_type": {
            "title": "Trigger Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "project_id",
          "status",
          "trigger_type",
          "created_at"
        ],
        "title": "AgentRunSummary",
        "type": "object"
      },
      "AgentTurnBillingRequest": {
        "description": "Legacy per-turn LLM token usage compatibility report from a sandbox.\n\nOlder sandbox images may still POST one of these requests per LLM\nturn. Brain now bills brokered sandbox calls from server-observed\n``/v1/messages`` usage, so the sandbox-supplied provider/model/token\nfields are accepted for compatibility and rollout metrics but are\nnot trusted for billing.\n\nThe ``turn_id`` is generated client-side (typically the LangChain\ncallback's ``run_id`` UUID) and is the dedup key. Replays of the\nsame workload/turn pair return the cached compatibility result.",
        "properties": {
          "input_tokens": {
            "default": 0,
            "minimum": 0.0,
            "title": "Input Tokens",
            "type": "integer"
          },
          "model": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Model",
            "type": "string"
          },
          "output_tokens": {
            "default": 0,
            "minimum": 0.0,
            "title": "Output Tokens",
            "type": "integer"
          },
          "provider": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Provider",
            "type": "string"
          },
          "turn_id": {
            "description": "Sandbox-supplied dedup key for this turn (UUID recommended).",
            "maxLength": 128,
            "minLength": 1,
            "title": "Turn Id",
            "type": "string"
          }
        },
        "required": [
          "turn_id",
          "provider",
          "model"
        ],
        "title": "AgentTurnBillingRequest",
        "type": "object"
      },
      "AgentTurnBillingResponse": {
        "description": "Response from the legacy per-turn self-report endpoint.\n\n``billed`` is ``False`` for accepted compatibility self-reports\nbecause Brain's brokered ``/v1/messages`` path is the billing source\nof truth. ``request_id`` is normally ``None`` for newly accepted\nreports, but may contain a cached legacy id for old dedup entries.",
        "properties": {
          "billed": {
            "description": "False for accepted compatibility self-reports; brokered sandbox LLM usage is billed server-side on /v1/messages.",
            "title": "Billed",
            "type": "boolean"
          },
          "request_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Normally null for accepted compatibility self-reports; may contain a cached legacy requests row id for old dedup entries.",
            "title": "Request Id"
          }
        },
        "required": [
          "billed"
        ],
        "title": "AgentTurnBillingResponse",
        "type": "object"
      },
      "AnthropicMessage": {
        "description": "A message in Anthropic format.\n\n``content`` accepts a plain string *or* a list of content blocks to support\nboth simple text and structured tool_use / tool_result payloads.",
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ContentBlock"
                    },
                    {
                      "$ref": "#/components/schemas/ImageContentBlock"
                    },
                    {
                      "additionalProperties": true,
                      "type": "object"
                    }
                  ]
                },
                "type": "array"
              }
            ],
            "title": "Content"
          },
          "role": {
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "title": "AnthropicMessage",
        "type": "object"
      },
      "AnthropicMessagesRequest": {
        "description": "Anthropic Messages API request format.",
        "properties": {
          "cache_control": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cache Control"
          },
          "effort": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RoutingEffort"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request routing-effort tier (low/medium/high/xhigh/max) for router models like ``pioneer/auto``. Overrides the router's stored policy for this request only; ignored for non-router models."
          },
          "include_confidence": {
            "default": true,
            "title": "Include Confidence",
            "type": "boolean"
          },
          "include_spans": {
            "default": true,
            "title": "Include Spans",
            "type": "boolean"
          },
          "max_tokens": {
            "default": 1024,
            "maximum": 131072.0,
            "minimum": 1.0,
            "title": "Max Tokens",
            "type": "integer"
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/AnthropicMessage"
            },
            "minItems": 1,
            "title": "Messages",
            "type": "array"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "models": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request candidate-model subset the router may select between. Overrides the router's stored candidate set for this request only; ignored for non-router models.",
            "title": "Models"
          },
          "output_config": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AnthropicOutputConfig"
              },
              {
                "type": "null"
              }
            ]
          },
          "schema": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Schema for the Pioneer encoder. **Deprecated when supplied as a flat list** of entity labels; use the unified dict shape instead. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.",
            "title": "Schema"
          },
          "speed": {
            "anyOf": [
              {
                "enum": [
                  "standard",
                  "fast"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Anthropic inference speed mode. ``\"fast\"`` opts into high output-tokens-per-second inference on supported models (e.g. the latest Opus). Pioneer forwards this only to the native Anthropic upstream (with the required ``fast-mode`` beta header); Bedrock and OpenRouter routes ignore it.",
            "title": "Speed"
          },
          "stop_sequences": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Sequences"
          },
          "store": {
            "default": true,
            "title": "Store",
            "type": "boolean"
          },
          "stream": {
            "default": false,
            "title": "Stream",
            "type": "boolean"
          },
          "system": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "$ref": "#/components/schemas/SystemContentBlock"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "System"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "**Deprecated.** Legacy task hint. The unified schema disambiguates the task automatically. Submitting this field emits ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.",
            "title": "Task Type"
          },
          "temperature": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "thinking": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opt-in Anthropic-style extended-thinking controls. Pioneer does not enable thinking by default; send the Anthropic-native object: {'type': 'enabled', 'budget_tokens': N, 'display'?: 'summarized'|'omitted'} for manual mode, {'type': 'adaptive', 'effort'?: tier, 'display'?: ...} for adaptive mode (required on Opus 4.7+ / Mythos, recommended on Opus 4.6 / Sonnet 4.6), or {'type': 'disabled'} to turn thinking off on models that have it on by default. Pioneer canonicalizes this into InferenceRequest.reasoning at the adapter boundary so the request routes correctly whether the upstream is Anthropic native, Bedrock, or OpenRouter (which advertises the normalized ``reasoning`` field rather than ``thinking``). On models that require adaptive mode, Pioneer auto-upgrades manual configs (mapping ``budget_tokens`` to the nearest ``effort`` tier) rather than letting the upstream return a 400.",
            "title": "Thinking"
          },
          "tool_choice": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Choice"
          },
          "tools": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tools"
          },
          "top_k": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top K"
          },
          "top_p": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P"
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "title": "AnthropicMessagesRequest",
        "type": "object"
      },
      "AnthropicMessagesResponse": {
        "description": "Anthropic Messages API response format.\n\n``pioneer_inference_id`` is a Pioneer-only extension: the\n``inferences.id`` of the persisted row backing this completion. It mirrors\nthe ``x_pioneer.inference_id`` field on the OpenAI-compatible chat\ncompletion response so frontend playground clients can use the same\npoll-``GET /inferences/{id}``-for-judge-results round-trip on either\nsurface. ``None`` when persistence didn't run (e.g. ``store=false``).\n\n``pioneer_routed_model`` is the backend catalog model selected when the\nrequest used a router alias such as ``pioneer/auto``. ``None`` when no\nrouting occurred or the routed model matches the requested id.\n\n``pioneer_savings`` carries the per-1M-token savings rate diff of the routed\nmodel vs a fixed frontier reference (``baseline_model`` plus\n``rate_diff_per_mtok`` with ``input``/``output``/``cache_read``/\n``cache_write`` keys). The Claude Code cost hook multiplies it by per-turn\ntoken usage to show money saved. ``None`` when not routed to a cheaper model.",
        "properties": {
          "content": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Content",
            "type": "array"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "pioneer_inference_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pioneer Inference Id"
          },
          "pioneer_routed_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pioneer Routed Model"
          },
          "pioneer_savings": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pioneer Savings"
          },
          "role": {
            "default": "assistant",
            "title": "Role",
            "type": "string"
          },
          "stop_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "end_turn",
            "title": "Stop Reason"
          },
          "stop_sequence": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Sequence"
          },
          "type": {
            "default": "message",
            "title": "Type",
            "type": "string"
          },
          "usage": {
            "$ref": "#/components/schemas/AnthropicUsage"
          }
        },
        "required": [
          "id",
          "content",
          "model",
          "usage"
        ],
        "title": "AnthropicMessagesResponse",
        "type": "object"
      },
      "AnthropicOutputConfig": {
        "additionalProperties": true,
        "description": "Anthropic output configuration passed through supported providers.",
        "properties": {
          "effort": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Effort"
          },
          "format": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Format"
          },
          "task_budget": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task Budget"
          }
        },
        "title": "AnthropicOutputConfig",
        "type": "object"
      },
      "AnthropicUsage": {
        "description": "Usage statistics in Anthropic format.\n\n``input_tokens`` is Anthropic's non-cached input contract — cached\nreads / writes live in the separate ``cache_read_input_tokens`` /\n``cache_creation_input_tokens`` fields. Pioneer mirrors the same\nshape on the ``/v1/messages`` wire so SDK consumers reading the\nfields directly stay correct.",
        "properties": {
          "cache_creation_input_tokens": {
            "default": 0,
            "title": "Cache Creation Input Tokens",
            "type": "integer"
          },
          "cache_read_input_tokens": {
            "default": 0,
            "title": "Cache Read Input Tokens",
            "type": "integer"
          },
          "input_tokens": {
            "default": 0,
            "title": "Input Tokens",
            "type": "integer"
          },
          "output_tokens": {
            "default": 0,
            "title": "Output Tokens",
            "type": "integer"
          },
          "server_tool_use": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "integer"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Server Tool Use"
          },
          "service_tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Service Tier"
          },
          "speed": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Speed"
          },
          "thinking_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Thinking Tokens"
          }
        },
        "title": "AnthropicUsage",
        "type": "object"
      },
      "AsyncGlinerRequest": {
        "description": "Request for async GLiNER-2 processing.",
        "properties": {
          "format_results": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Format Results"
          },
          "include_confidence": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Include Confidence"
          },
          "include_spans": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Include Spans"
          },
          "schema": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "additionalProperties": true,
                "type": "object"
              }
            ],
            "description": "Extraction schema. The flat ``list[str]`` of entity labels is deprecated; use the unified dict shape (``entities`` / ``classifications`` / ``structures`` / ``relations``) for forward compatibility. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.",
            "title": "Schema"
          },
          "task": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "**Deprecated** legacy task hint. One of: 'extract_entities', 'classify_text', 'extract_json', 'schema'. Omit for the unified GLiNER2 path. Submitting a legacy task value still succeeds but the response carries ``Deprecation: true`` and a ``Sunset`` header.",
            "title": "Task"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "title": "Text"
          },
          "threshold": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "default": 0.5,
            "title": "Threshold"
          }
        },
        "required": [
          "text",
          "schema"
        ],
        "title": "AsyncGlinerRequest",
        "type": "object"
      },
      "AsyncGlinerResponse": {
        "description": "Response from async job submission.",
        "properties": {
          "estimated_tokens": {
            "title": "Estimated Tokens",
            "type": "integer"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "job_id",
          "status",
          "estimated_tokens",
          "message"
        ],
        "title": "AsyncGlinerResponse",
        "type": "object"
      },
      "AttachedResourceRef": {
        "description": "Pydantic mirror of the frontend ``AttachedResourceRef`` type.\n\nThe chip id carries a type prefix (``dataset:abc-123``) so the frontend\ncan render the correct icon without a second lookup. ``type`` repeats\nthe slug for clients that only consume one of the two fields.",
        "properties": {
          "id": {
            "description": "Type-prefixed resource id used by the frontend chip rendering. For example ``dataset:abc-123`` or ``model:tj-99``.",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "Human-readable label rendered inside the chip.",
            "title": "Name",
            "type": "string"
          },
          "type": {
            "description": "Resource type slug — one of ``dataset``, ``model``, ``evaluation``, or ``base-model``.",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "type"
        ],
        "title": "AttachedResourceRef",
        "type": "object"
      },
      "AugmentationOperation": {
        "description": "Configuration for a single augmentation operation.",
        "properties": {
          "enabled": {
            "default": true,
            "description": "Whether this operation is enabled",
            "title": "Enabled",
            "type": "boolean"
          },
          "type": {
            "description": "Type of augmentation operation",
            "enum": [
              "remove_duplicates",
              "remove_outliers",
              "balance"
            ],
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "title": "AugmentationOperation",
        "type": "object"
      },
      "AutoAgentClarifyRequest": {
        "description": "Request body for a clarification agent turn.\n\nEither `message` (new turn) or `resume_value` (MCQ selection resume) must be set.\n\nArgs:\n    message: The user's text input for a new turn.\n    resume_value: The option the user selected from an MCQ (resumes interrupted graph).\n    conversation_id: Conversation ID (required for resume; generated on first call).\n    history: Optional conversation history [{role, content}].",
        "properties": {
          "client_metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional client trace metadata for observability.",
            "title": "Client Metadata"
          },
          "conversation_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Existing conversation ID",
            "title": "Conversation Id"
          },
          "history": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Conversation history [{role, content, tool_calls?, tool_call_id?, name?}]",
            "title": "History"
          },
          "message": {
            "anyOf": [
              {
                "maxLength": 10000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User text input (for new turns)",
            "title": "Message"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID selected by the user. Hidden from the chat UI and used to scope any resources created by a triggered Auto Agent run.",
            "title": "Project Id"
          },
          "resume_value": {
            "anyOf": [
              {
                "maxLength": 10000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "MCQ option selected by user (resumes interrupted graph)",
            "title": "Resume Value"
          }
        },
        "title": "AutoAgentClarifyRequest",
        "type": "object"
      },
      "AutoAgentRunListResponse": {
        "description": "Response for listing Auto Agent runs.\n\nArgs:\n    runs: List of run summaries.\n    count: Number of runs in this response.",
        "properties": {
          "count": {
            "default": 0,
            "description": "Number of runs returned",
            "title": "Count",
            "type": "integer"
          },
          "runs": {
            "description": "List of run summaries",
            "items": {
              "$ref": "#/components/schemas/AutoAgentRunSummary"
            },
            "title": "Runs",
            "type": "array"
          }
        },
        "title": "AutoAgentRunListResponse",
        "type": "object"
      },
      "AutoAgentRunRequest": {
        "description": "Request body to start a new Auto Agent run.\n\nArgs:\n    message: The user's task description for the agent.\n    history: Optional conversation history for multi-turn context.",
        "properties": {
          "history": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/MessageHistoryItem"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Conversation history for multi-turn context",
            "title": "History"
          },
          "message": {
            "description": "Task description for the Auto Agent",
            "maxLength": 10000,
            "minLength": 1,
            "title": "Message",
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "title": "AutoAgentRunRequest",
        "type": "object"
      },
      "AutoAgentRunResponse": {
        "description": "Response after creating a new Auto Agent run.\n\nArgs:\n    run_id: UUID of the created run.\n    project_id: Project grouping all datasets and models from this run.\n    results_url: Frontend URL to check results when the run completes.",
        "properties": {
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID grouping datasets and models from this run",
            "title": "Project Id"
          },
          "results_url": {
            "description": "URL to view results when run completes",
            "title": "Results Url",
            "type": "string"
          },
          "run_id": {
            "description": "UUID of the created run",
            "title": "Run Id",
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "results_url"
        ],
        "title": "AutoAgentRunResponse",
        "type": "object"
      },
      "AutoAgentRunStatus": {
        "description": "Current status and results of an Auto Agent run.\n\nArgs:\n    run_id: UUID of the run.\n    status: Current status (running | complete | failed).\n    message: The task description the user provided.\n    project_id: Project grouping all datasets and models from this run.\n    deliverables_json: Parsed deliverables.json when complete.\n    curation_report: Contents of data-curation.md when complete.\n    final_report: Contents of final_report.md when complete.\n    error_message: Error description when failed.\n    tool_calls_made: Number of tool calls the agent executed.\n    created_at: ISO timestamp when the run was created.\n    completed_at: ISO timestamp when the run completed, or None.\n    current_phase: High-level progress phase for the frontend stepper.",
        "properties": {
          "completed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO timestamp of completion",
            "title": "Completed At"
          },
          "created_at": {
            "description": "ISO timestamp of run creation",
            "title": "Created At",
            "type": "string"
          },
          "curation_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "data-curation.md contents (available when complete)",
            "title": "Curation Report"
          },
          "current_phase": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "High-level progress phase: analyzing | researching | preparing_data | training | evaluating | finalizing",
            "title": "Current Phase"
          },
          "deliverables_json": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Parsed deliverables.json (available when complete)",
            "title": "Deliverables Json"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Error description (available when failed)",
            "title": "Error Message"
          },
          "final_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "final_report.md contents (available when complete)",
            "title": "Final Report"
          },
          "message": {
            "default": "",
            "description": "User task description",
            "title": "Message",
            "type": "string"
          },
          "progress_updates": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Accumulating AI-generated progress summaries, each with summary and timestamp",
            "title": "Progress Updates"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID grouping datasets and models from this run",
            "title": "Project Id"
          },
          "run_id": {
            "description": "Run UUID",
            "title": "Run Id",
            "type": "string"
          },
          "status": {
            "description": "running | complete | failed | stopped",
            "title": "Status",
            "type": "string"
          },
          "tool_calls_made": {
            "default": 0,
            "description": "Number of tool calls executed",
            "title": "Tool Calls Made",
            "type": "integer"
          }
        },
        "required": [
          "run_id",
          "status",
          "created_at"
        ],
        "title": "AutoAgentRunStatus",
        "type": "object"
      },
      "AutoAgentRunSummary": {
        "description": "Lightweight summary of an Auto Agent run for list views.\n\nArgs:\n    run_id: UUID of the run.\n    status: Current status (running | complete | failed).\n    message: The task description the user provided.\n    project_id: Project grouping all datasets and models from this run.\n    tool_calls_made: Number of tool calls the agent executed.\n    created_at: ISO timestamp when the run was created.\n    completed_at: ISO timestamp when the run completed, or None.\n    error_message: Error description when failed.",
        "properties": {
          "completed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO timestamp of completion",
            "title": "Completed At"
          },
          "created_at": {
            "description": "ISO timestamp of run creation",
            "title": "Created At",
            "type": "string"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Error description if failed",
            "title": "Error Message"
          },
          "message": {
            "default": "",
            "description": "User task description",
            "title": "Message",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID for this run",
            "title": "Project Id"
          },
          "run_id": {
            "description": "Run UUID",
            "title": "Run Id",
            "type": "string"
          },
          "status": {
            "description": "running | complete | failed | stopped",
            "title": "Status",
            "type": "string"
          },
          "tool_calls_made": {
            "default": 0,
            "description": "Number of tool calls executed",
            "title": "Tool Calls Made",
            "type": "integer"
          }
        },
        "required": [
          "run_id",
          "status",
          "created_at"
        ],
        "title": "AutoAgentRunSummary",
        "type": "object"
      },
      "BaseModelResponse": {
        "description": "Display metadata for a single base model in the public catalog.",
        "properties": {
          "agentic_benchmark_mean": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Mean of the model's curated agentic benchmarks on a 0-100 scale. Null when the model publishes fewer than two of them.",
            "title": "Agentic Benchmark Mean"
          },
          "agentic_benchmarks": {
            "description": "The figures averaged into agentic_benchmark_mean, strongest first.",
            "items": {
              "$ref": "#/components/schemas/BenchmarkComponentScore"
            },
            "title": "Agentic Benchmarks",
            "type": "array"
          },
          "cache_read_price_per_million": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Effective upper-bound USD list price per million input tokens served from the provider's prompt cache (Anthropic cache_read_input_tokens, Bedrock cacheReadInputTokens, OpenAI / Fireworks prompt_tokens_details.cached_tokens). Always the rate BillableEvent.record actually charges: when a provider does not differentiate cache-read pricing this equals ``input_price_per_million`` rather than ``None``, so customers compute ``cache_read_tokens × cache_read_price`` without special-casing. ``None`` only when the model has no pricing at all (cache reads are still tracked for analytics).",
            "title": "Cache Read Price Per Million"
          },
          "cache_write_price_per_million": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Effective upper-bound USD list price per million input tokens written into the provider's prompt cache (Anthropic cache_creation_input_tokens, Bedrock cacheWriteInputTokens). Providers that charge cache writes at the plain input rate (OpenAI, Modal) report ``input_price_per_million`` here rather than ``None``, matching what BillableEvent.record charges. ``None`` only when the model has no pricing at all.",
            "title": "Cache Write Price Per Million"
          },
          "coding_benchmark_mean": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Mean of the model's curated coding benchmarks on a 0-100 scale. Null when the model publishes fewer than two of them, since one benchmark is a data point rather than an average.",
            "title": "Coding Benchmark Mean"
          },
          "coding_benchmarks": {
            "description": "The figures averaged into coding_benchmark_mean, strongest first, so a listing can show its working without a request per model. Empty when there is no mean to explain. See GET /base-models/{id}/benchmarks for provenance and ranks.",
            "items": {
              "$ref": "#/components/schemas/BenchmarkComponentScore"
            },
            "title": "Coding Benchmarks",
            "type": "array"
          },
          "context_window": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum context length in tokens (min across providers)",
            "title": "Context Window"
          },
          "default_training_batch_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Catalog default training batch size for this model. Null when the model is not trainable on a provider that publishes batch defaults. Clients creating training jobs should prefer this value (or omit ``batch_size``) over hard-coding a global default.",
            "title": "Default Training Batch Size"
          },
          "deprecated": {
            "default": false,
            "description": "Whether the model is deprecated and discouraged for new work. Deprecated models still serve requests until their sunset date; sunset (removed) models are omitted from this catalog entirely.",
            "title": "Deprecated",
            "type": "boolean"
          },
          "deprecation_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Date the model entered (or will enter) the deprecated state. Null when the model is not on a deprecation path.",
            "title": "Deprecation Date"
          },
          "description": {
            "description": "Short description shown in UI",
            "title": "Description",
            "type": "string"
          },
          "id": {
            "description": "Model ID (canonical routing key)",
            "title": "Id",
            "type": "string"
          },
          "input_price_per_million": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Upper-bound USD list price per million input tokens (highest provider COGS multiplied by the inference margin). Caps what BillableEvent.record can charge for model_inference; actual charges may be lower when the request is routed to a cheaper provider.",
            "title": "Input Price Per Million"
          },
          "is_chat_model": {
            "description": "Whether the model has a chat template suitable for /v1/chat/completions. Pretrained/base models lack a chat template and produce gibberish on chat-formatted messages; frontends should route them to /v1/completions instead.",
            "title": "Is Chat Model",
            "type": "boolean"
          },
          "label": {
            "description": "Human-friendly display name",
            "title": "Label",
            "type": "string"
          },
          "license": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "SPDX license identifier or short name for the model weights (e.g. 'Apache-2.0', 'Llama-3-Community', 'Proprietary'). Display string only — null when unknown.",
            "title": "License"
          },
          "market_input_price_per_million": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Median USD per 1M input tokens across the third-party providers serving this model, for comparison against our own rate. Median rather than mean so one outlying listing cannot move it. Never used to bill. Null when nobody publishes a rate for it.",
            "title": "Market Input Price Per Million"
          },
          "market_output_price_per_million": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Median USD per 1M output tokens across third-party providers.",
            "title": "Market Output Price Per Million"
          },
          "market_price_provider_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Provider count behind the better-evidenced side: the larger of the input and output counts, which is a lower bound on how many providers list the model rather than a distinct count of them. The two sides can be drawn from different subsets, since a few providers publish an input rate only, so neither side alone is the total. Present so a lone quote can be told apart from a real market. Null when there are no market rates.",
            "title": "Market Price Provider Count"
          },
          "max_input_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum input tokens advertised for this model. Matches the conservative provider context window used by this catalog row.",
            "title": "Max Input Tokens"
          },
          "max_output_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum output tokens advertised for decoder generation. Null when no provider publishes a separate output cap.",
            "title": "Max Output Tokens"
          },
          "max_training_batch_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Safe maximum training batch size for this model on the training provider. Null when unset or the model is not trainable. Requests above this maximum are rejected (except the legacy explicit Field-default clamp documented on TrainingJobCreate).",
            "title": "Max Training Batch Size"
          },
          "output_price_per_million": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Upper-bound USD list price per million output tokens (highest provider COGS multiplied by the inference margin). Caps what BillableEvent.record can charge for model_inference; actual charges may be lower when the request is routed to a cheaper provider.",
            "title": "Output Price Per Million"
          },
          "release_month": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Official release month shown in the public catalog, formatted as 'Mon YYYY' (for example, 'Apr 2026'). Null when unknown.",
            "title": "Release Month"
          },
          "replacement_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Canonical ID of the successor model to migrate to, when the model is deprecated and a replacement is declared.",
            "title": "Replacement Model"
          },
          "sunset_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Date the model is removed and requests begin to be rejected. Null when no removal is scheduled.",
            "title": "Sunset Date"
          },
          "supports_image_input": {
            "default": false,
            "description": "Whether this model accepts image (vision) content blocks on the compat inference APIs. True when any provider catalog entry for this model sets supports_vision=True. Output is always text — no model supports image output.",
            "title": "Supports Image Input",
            "type": "boolean"
          },
          "supports_inference": {
            "description": "Whether this model supports serverless base-model inference (pre-deployed, no startup latency, pay-per-token).",
            "title": "Supports Inference",
            "type": "boolean"
          },
          "supports_on_demand_inference": {
            "description": "Whether this model supports on-demand LoRA deployment (dedicated GPU serving a fine-tuned adapter).",
            "title": "Supports On Demand Inference",
            "type": "boolean"
          },
          "supports_training": {
            "description": "Whether this model supports fine-tuning on any provider. When False the model is available for inference only.",
            "title": "Supports Training",
            "type": "boolean"
          },
          "supports_zdr": {
            "default": false,
            "description": "Whether this model has a Zero-Data-Retention-compliant route. Informational — shown on the models page. Fails closed: defaults False and is True only when the model is explicitly catalogued as ZDR-supported, so the claim is never over-reported.",
            "title": "Supports Zdr",
            "type": "boolean"
          },
          "task_type": {
            "description": "Model architecture: 'decoder' for LLMs, 'encoder' for GLiNER/NER models, or 'embedding' for text embedding models",
            "title": "Task Type",
            "type": "string"
          },
          "tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Capability tier: 'open' (open weights), 'fast' (latency-optimized), 'enterprise' (proprietary commercial API), or 'research' (research preview). Null when unclassified.",
            "title": "Tier"
          }
        },
        "required": [
          "id",
          "label",
          "description",
          "task_type",
          "supports_inference",
          "is_chat_model",
          "supports_on_demand_inference",
          "supports_training"
        ],
        "title": "BaseModelResponse",
        "type": "object"
      },
      "BaseModelsResponse": {
        "description": "Response listing all base models in the public catalog.",
        "properties": {
          "models": {
            "items": {
              "$ref": "#/components/schemas/BaseModelResponse"
            },
            "title": "Models",
            "type": "array"
          }
        },
        "required": [
          "models"
        ],
        "title": "BaseModelsResponse",
        "type": "object"
      },
      "BenchmarkAxisSummary": {
        "description": "An axis mean and the evidence behind it.",
        "properties": {
          "axis": {
            "description": "Which axis the mean summarises",
            "enum": [
              "coding",
              "agentic"
            ],
            "title": "Axis",
            "type": "string"
          },
          "count": {
            "description": "Benchmarks behind the mean",
            "title": "Count",
            "type": "integer"
          },
          "mean": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Mean of the benchmarks, 0-100",
            "title": "Mean"
          }
        },
        "required": [
          "axis",
          "count"
        ],
        "title": "BenchmarkAxisSummary",
        "type": "object"
      },
      "BenchmarkComponentScore": {
        "description": "One benchmark figure behind a published axis mean.\n\nDeliberately thinner than ``schemas.model_benchmarks.BenchmarkScore``: this\none is repeated for every model in the catalogue listing, and provenance,\nranks and timestamps belong on the detail endpoint where there is room to\npresent them.",
        "properties": {
          "benchmark_id": {
            "description": "Upstream benchmark slug",
            "title": "Benchmark Id",
            "type": "string"
          },
          "label": {
            "description": "Display name for the benchmark",
            "title": "Label",
            "type": "string"
          },
          "score": {
            "description": "Normalized score on a 0-100 scale",
            "title": "Score",
            "type": "number"
          }
        },
        "required": [
          "benchmark_id",
          "label",
          "score"
        ],
        "title": "BenchmarkComponentScore",
        "type": "object"
      },
      "BenchmarkEvaluationRequest": {
        "description": "Request to run a benchmark evaluation",
        "properties": {
          "benchmark": {
            "description": "Benchmark name (e.g., 'fewnerd', 'mteb/banking77', 'tweeteval')",
            "title": "Benchmark",
            "type": "string"
          },
          "benchmark_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Additional benchmark-specific configuration",
            "title": "Benchmark Config"
          },
          "max_samples": {
            "default": 100,
            "description": "Maximum samples to evaluate",
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Max Samples",
            "type": "integer"
          },
          "model_id": {
            "description": "Training job ID, explicit GLiNER base model ID ('fastino/gliner2-base-v1'), or decoder base model ID ('base:{hf_model_id}')",
            "title": "Model Id",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional project ID to associate the benchmark evaluation with",
            "title": "Project Id"
          },
          "split": {
            "default": "test",
            "description": "Dataset split to use",
            "title": "Split",
            "type": "string"
          },
          "task": {
            "description": "Task type for evaluation",
            "enum": [
              "ner",
              "text_classification"
            ],
            "title": "Task",
            "type": "string"
          }
        },
        "required": [
          "model_id",
          "task",
          "benchmark"
        ],
        "title": "BenchmarkEvaluationRequest",
        "type": "object"
      },
      "BenchmarkEvaluationResponse": {
        "additionalProperties": true,
        "description": "Response for benchmark evaluation",
        "properties": {
          "benchmark": {
            "title": "Benchmark",
            "type": "string"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "evaluation_id": {
            "title": "Evaluation Id",
            "type": "string"
          },
          "metrics": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metrics"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "complete",
              "failed",
              "cancelled"
            ],
            "title": "Status",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "task": {
            "title": "Task",
            "type": "string"
          }
        },
        "required": [
          "success",
          "evaluation_id",
          "status",
          "task",
          "benchmark",
          "model_id",
          "created_at"
        ],
        "title": "BenchmarkEvaluationResponse",
        "type": "object"
      },
      "BenchmarkInfo": {
        "description": "Information about a benchmark",
        "properties": {
          "dataset_source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dataset Source"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "metrics": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Metrics",
            "type": "array"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "task": {
            "title": "Task",
            "type": "string"
          }
        },
        "required": [
          "name",
          "description",
          "task"
        ],
        "title": "BenchmarkInfo",
        "type": "object"
      },
      "BenchmarkScore": {
        "description": "One third-party benchmark figure for a model.",
        "properties": {
          "axis": {
            "description": "Which axis the benchmark measures",
            "enum": [
              "coding",
              "agentic"
            ],
            "title": "Axis",
            "type": "string"
          },
          "benchmark_id": {
            "description": "Upstream benchmark slug",
            "title": "Benchmark Id",
            "type": "string"
          },
          "caveat": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Qualification to show beside the figure",
            "title": "Caveat"
          },
          "label": {
            "description": "Display name for the benchmark",
            "title": "Label",
            "type": "string"
          },
          "rank": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Position on this benchmark upstream",
            "title": "Rank"
          },
          "rank_total": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "How many models reported this benchmark upstream",
            "title": "Rank Total"
          },
          "score": {
            "description": "Normalized score on a 0-100 scale",
            "title": "Score",
            "type": "number"
          },
          "scored_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the figure was published",
            "title": "Scored At"
          },
          "self_reported": {
            "description": "Whether the vendor reported the figure",
            "title": "Self Reported",
            "type": "boolean"
          },
          "verified": {
            "description": "Whether the source independently verified it",
            "title": "Verified",
            "type": "boolean"
          }
        },
        "required": [
          "benchmark_id",
          "label",
          "axis",
          "score",
          "self_reported",
          "verified"
        ],
        "title": "BenchmarkScore",
        "type": "object"
      },
      "BillingAddress": {
        "description": "Billing address on file for a payment method, as held by Stripe.\n\nAll fields are optional because Stripe only returns the components the\ncustomer provided. The UI renders this read-only; it is never edited in\nPioneer (changes are made in the Stripe customer portal).",
        "properties": {
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "City"
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country"
          },
          "line1": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Line1"
          },
          "line2": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Line2"
          },
          "postal_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Postal Code"
          },
          "state": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "State"
          }
        },
        "title": "BillingAddress",
        "type": "object"
      },
      "BillingPortalResponse": {
        "description": "Response containing a Stripe Billing Portal URL.",
        "properties": {
          "url": {
            "description": "Stripe Billing Portal session URL",
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "BillingPortalResponse",
        "type": "object"
      },
      "BillingStatusResponse": {
        "description": "Response model for billing status.",
        "properties": {
          "billing_activated": {
            "default": false,
            "description": "Authoritative inference-gate result computed from the same billing fields the request path reads. Frontend surfaces (paywall, upgrade CTA) MUST consume this field instead of re-deriving from ``payment_plan`` / ``card_verified``.",
            "title": "Billing Activated",
            "type": "boolean"
          },
          "card_verified": {
            "default": false,
            "title": "Card Verified",
            "type": "boolean"
          },
          "credit_limit": {
            "title": "Credit Limit",
            "type": "number"
          },
          "direct_model_inference_available": {
            "default": true,
            "description": "Whether the team can currently run direct (non-router) individual models. False when the router-only restriction is active and the team has no spendable paid credit balance (overage headroom alone does not qualify — a direct-model row only debits the paid wallet).",
            "title": "Direct Model Inference Available",
            "type": "boolean"
          },
          "exceeds_free_tier": {
            "title": "Exceeds Free Tier",
            "type": "boolean"
          },
          "free_tier_remaining": {
            "title": "Free Tier Remaining",
            "type": "number"
          },
          "has_payment_method": {
            "title": "Has Payment Method",
            "type": "boolean"
          },
          "paid_credit_balance": {
            "default": 0.0,
            "description": "Persistent paid credit wallet balance (credits). Funds direct individual-model inference; included allowance funds the router.",
            "title": "Paid Credit Balance",
            "type": "number"
          },
          "payment_methods": {
            "items": {
              "$ref": "#/components/schemas/PaymentMethodInfo"
            },
            "title": "Payment Methods",
            "type": "array"
          },
          "payment_plan": {
            "default": "hobby",
            "title": "Payment Plan",
            "type": "string"
          },
          "router_only_free_credits": {
            "default": false,
            "description": "Whether included plan credits are restricted to router inference for this team (direct models require paid credits).",
            "title": "Router Only Free Credits",
            "type": "boolean"
          },
          "stripe_customer_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stripe Customer Id"
          },
          "team_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Team Id"
          },
          "total_usage": {
            "title": "Total Usage",
            "type": "number"
          }
        },
        "required": [
          "total_usage",
          "free_tier_remaining",
          "exceeds_free_tier",
          "has_payment_method",
          "credit_limit"
        ],
        "title": "BillingStatusResponse",
        "type": "object"
      },
      "Body_create_dataset_version_felix_datasets__name__post": {
        "properties": {
          "file": {
            "contentMediaType": "application/octet-stream",
            "description": "Dataset file (JSONL, CSV, or Parquet)",
            "title": "File",
            "type": "string"
          },
          "format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "File format (jsonl, csv, parquet). Auto-detected if not provided.",
            "title": "Format"
          }
        },
        "required": [
          "file"
        ],
        "title": "Body_create_dataset_version_felix_datasets__name__post",
        "type": "object"
      },
      "Body_upload_user_report_attachments_user_reports_attachments_post": {
        "properties": {
          "files": {
            "description": "Files to attach to the report.",
            "items": {
              "contentMediaType": "application/octet-stream",
              "type": "string"
            },
            "title": "Files",
            "type": "array"
          },
          "report_id": {
            "description": "Backend-generated report UUID.",
            "title": "Report Id",
            "type": "string"
          }
        },
        "required": [
          "report_id",
          "files"
        ],
        "title": "Body_upload_user_report_attachments_user_reports_attachments_post",
        "type": "object"
      },
      "CancelBenchmarkResponse": {
        "description": "Response model for canceling a benchmark evaluation",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "CancelBenchmarkResponse",
        "type": "object"
      },
      "CancelSubscriptionResponse": {
        "description": "Result of cancelling a team subscription with an optional refund.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "refunded_cents": {
            "default": 0,
            "title": "Refunded Cents",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "CancelSubscriptionResponse",
        "type": "object"
      },
      "CancellationFeedbackRequest": {
        "description": "Optional feedback submitted during the offboarding flow.\n\nSent with both the downgrade and account cancellation endpoints\nso the cancellation reason can be tracked in analytics.",
        "properties": {
          "feedback_text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional free-text feedback from the user",
            "title": "Feedback Text"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Selected cancellation reason (e.g. 'Pricing', 'Missing features')",
            "title": "Reason"
          }
        },
        "title": "CancellationFeedbackRequest",
        "type": "object"
      },
      "CategoriesResponse": {
        "description": "Category rollups. Strictly the 7-day classification window.\n\n``non_coding`` is a first-class slice, never folded into ``other``.\n``window_days`` / ``window_start`` restate the constraint so the UI labels it.",
        "properties": {
          "categories": {
            "items": {
              "$ref": "#/components/schemas/CategoryRollup"
            },
            "title": "Categories",
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          },
          "unclassified_spend": {
            "default": 0.0,
            "description": "Spend in the window on tasks with no category — no stored prompt to classify (never persisted inline or offloaded to S3). Shown as an explicit slice, never silently dropped.",
            "title": "Unclassified Spend",
            "type": "number"
          },
          "unclassified_task_count": {
            "default": 0,
            "description": "Number of tasks with no category in the window.",
            "title": "Unclassified Task Count",
            "type": "integer"
          },
          "unclassified_tokens": {
            "default": 0,
            "description": "Tokens for unclassified tasks in the window.",
            "title": "Unclassified Tokens",
            "type": "integer"
          },
          "window_days": {
            "title": "Window Days",
            "type": "integer"
          },
          "window_start": {
            "format": "date-time",
            "title": "Window Start",
            "type": "string"
          }
        },
        "required": [
          "categories",
          "window_days",
          "window_start",
          "meta"
        ],
        "title": "CategoriesResponse",
        "type": "object"
      },
      "CategoryRollup": {
        "description": "Spend / tokens / task count for one work category (7d window).",
        "properties": {
          "category": {
            "description": "A member of ``WORK_CATEGORIES`` (incl. ``non_coding``).",
            "title": "Category",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "category",
          "spend",
          "total_tokens",
          "task_count"
        ],
        "title": "CategoryRollup",
        "type": "object"
      },
      "ChargeHistoryItem": {
        "description": "Stripe charge or invoice entry exposed in billing history.",
        "properties": {
          "amount_cents": {
            "title": "Amount Cents",
            "type": "integer"
          },
          "created": {
            "title": "Created",
            "type": "integer"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Metadata",
            "type": "object"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "type": {
            "enum": [
              "payment_intent",
              "invoice"
            ],
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "amount_cents",
          "currency",
          "status",
          "created"
        ],
        "title": "ChargeHistoryItem",
        "type": "object"
      },
      "ChargeHistoryResponse": {
        "description": "Recent Stripe charges and invoices for a team.",
        "properties": {
          "charges": {
            "items": {
              "$ref": "#/components/schemas/ChargeHistoryItem"
            },
            "title": "Charges",
            "type": "array"
          }
        },
        "required": [
          "charges"
        ],
        "title": "ChargeHistoryResponse",
        "type": "object"
      },
      "ChatCompletionChoice": {
        "description": "A single completion choice.",
        "properties": {
          "finish_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finish Reason"
          },
          "index": {
            "default": 0,
            "title": "Index",
            "type": "integer"
          },
          "message": {
            "additionalProperties": true,
            "title": "Message",
            "type": "object"
          }
        },
        "title": "ChatCompletionChoice",
        "type": "object"
      },
      "ChatCompletionRequest": {
        "description": "OpenAI-compatible chat completion request.",
        "properties": {
          "effort": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RoutingEffort"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request routing-effort tier (low/medium/high/xhigh/max) for router models like ``pioneer/auto``. Higher tiers prefer stronger, costlier models. Overrides the router's stored policy for this request only; ignored for non-router models."
          },
          "extra_body": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Body"
          },
          "extra_headers": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Headers"
          },
          "frequency_penalty": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Frequency Penalty"
          },
          "include_confidence": {
            "default": true,
            "title": "Include Confidence",
            "type": "boolean"
          },
          "include_spans": {
            "default": true,
            "title": "Include Spans",
            "type": "boolean"
          },
          "logit_bias": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logit Bias"
          },
          "max_tokens": {
            "anyOf": [
              {
                "maximum": 131072.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tokens"
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/schemas__openai_compat__ChatMessage"
            },
            "minItems": 1,
            "title": "Messages",
            "type": "array"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "models": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request candidate-model subset the router may select between. Overrides the router's stored candidate set for this request only; ignored for non-router models.",
            "title": "Models"
          },
          "n": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "N"
          },
          "presence_penalty": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Presence Penalty"
          },
          "reasoning": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opt-in reasoning / extended-thinking controls. Accepts the OpenRouter-normalized shape with keys ``enabled`` (bool), ``max_tokens`` (int, Anthropic-style budget), ``effort`` (one of minimal/low/medium/high/xhigh/max/none, OpenAI/Grok-style tier), and ``exclude`` (bool, hide reasoning tokens from the response). ``effort`` and ``max_tokens`` are mutually exclusive. Pioneer extensions for Claude routes (Anthropic direct + Bedrock): ``mode`` (manual/adaptive — adaptive lets the model pick thinking depth per request, required on Opus 4.7+) and ``display`` (summarized/omitted — controls whether thinking text streams back; omitted preserves only the signature for multi-turn). On Chat Completions, provider reasoning text is hidden by default and is returned on ``message.reasoning_content`` / ``delta.reasoning_content`` only when the caller explicitly requests visible reasoning with ``exclude=false`` or ``display=summarized``. Pioneer canonicalizes this into InferenceRequest.reasoning at the adapter boundary and each provider renders it to its native wire field (Anthropic ``thinking``, OpenAI ``reasoning_effort``, OpenRouter ``reasoning``). Pioneer does not enable reasoning by default.",
            "title": "Reasoning"
          },
          "response_format": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Format"
          },
          "schema": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Schema for the Pioneer encoder. **Deprecated when supplied as a flat list** of entity labels; use the unified dict shape (``entities`` / ``classifications`` / ``structures`` / ``relations``) instead. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.",
            "title": "Schema"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed"
          },
          "stop": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop"
          },
          "store": {
            "default": true,
            "title": "Store",
            "type": "boolean"
          },
          "stream": {
            "default": false,
            "title": "Stream",
            "type": "boolean"
          },
          "system": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "System"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "**Deprecated.** Legacy task hint (``extract_entities`` / ``classify_text`` / ``extract_json`` / ``ner`` / ``schema``). The unified schema disambiguates the task automatically so this field is no longer required. Submitting it emits ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers on the response.",
            "title": "Task Type"
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "tool_choice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Choice"
          },
          "tools": {
            "anyOf": [
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tools"
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P"
          },
          "user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User"
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "title": "ChatCompletionRequest",
        "type": "object"
      },
      "ChatCompletionResponse": {
        "description": "OpenAI-compatible chat completion response.",
        "properties": {
          "choices": {
            "items": {
              "$ref": "#/components/schemas/ChatCompletionChoice"
            },
            "title": "Choices",
            "type": "array"
          },
          "created": {
            "title": "Created",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "object": {
            "default": "chat.completion",
            "title": "Object",
            "type": "string"
          },
          "usage": {
            "$ref": "#/components/schemas/ChatCompletionUsage"
          },
          "x_pioneer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PioneerExtension"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "model",
          "choices",
          "usage"
        ],
        "title": "ChatCompletionResponse",
        "type": "object"
      },
      "ChatCompletionUsage": {
        "description": "Token usage statistics.\n\n``prompt_tokens`` follows the upstream wire contract — *includes* every\ninput class (non-cached, cache read, and cache write). The breakdown is\nexposed under ``prompt_tokens_details`` so consumers can attribute the\ncached-read and cache-write subsets. Cache-aware billing on the brain\nside reads the canonical ``InferenceUsage`` fields directly, not this\nwire payload.",
        "properties": {
          "completion_tokens": {
            "default": 0,
            "title": "Completion Tokens",
            "type": "integer"
          },
          "prompt_tokens": {
            "default": 0,
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "prompt_tokens_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PromptTokensDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "total_tokens": {
            "default": 0,
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "title": "ChatCompletionUsage",
        "type": "object"
      },
      "ChatMessageCreate": {
        "description": "Schema for a single chat message.",
        "properties": {
          "content": {
            "description": "Message content",
            "title": "Content",
            "type": "string"
          },
          "role": {
            "description": "Message role: 'user', 'assistant', or 'tool'",
            "title": "Role",
            "type": "string"
          },
          "tool_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Tool call ID for tool messages",
            "title": "Tool Call Id"
          },
          "tool_calls": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Tool calls made by assistant",
            "title": "Tool Calls"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "title": "ChatMessageCreate",
        "type": "object"
      },
      "ChatMessageResponse": {
        "description": "Response model for a single chat message.",
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "images": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Images"
          },
          "message_index": {
            "title": "Message Index",
            "type": "integer"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "tool_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Call Id"
          },
          "tool_calls": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Calls"
          }
        },
        "required": [
          "id",
          "session_id",
          "role",
          "content",
          "message_index",
          "created_at"
        ],
        "title": "ChatMessageResponse",
        "type": "object"
      },
      "ChatSessionCreate": {
        "description": "Request model for creating a chat session.",
        "properties": {
          "first_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "First user message (used for auto-title generation)",
            "title": "First Message"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional project ID to scope the session to",
            "title": "Project Id"
          },
          "title": {
            "anyOf": [
              {
                "maxLength": 100,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session title (auto-generated if not provided)",
            "title": "Title"
          }
        },
        "title": "ChatSessionCreate",
        "type": "object"
      },
      "ChatSessionDeleteResponse": {
        "description": "Response model for deleting a session.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message",
          "session_id"
        ],
        "title": "ChatSessionDeleteResponse",
        "type": "object"
      },
      "ChatSessionListResponse": {
        "description": "Response model for listing chat sessions.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "sessions": {
            "items": {
              "$ref": "#/components/schemas/ChatSessionResponse"
            },
            "title": "Sessions",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "sessions",
          "count",
          "total"
        ],
        "title": "ChatSessionListResponse",
        "type": "object"
      },
      "ChatSessionMessagesAppend": {
        "description": "Request model for appending messages to a session.",
        "properties": {
          "messages": {
            "description": "Messages to append",
            "items": {
              "$ref": "#/components/schemas/ChatMessageCreate"
            },
            "minItems": 1,
            "title": "Messages",
            "type": "array"
          }
        },
        "required": [
          "messages"
        ],
        "title": "ChatSessionMessagesAppend",
        "type": "object"
      },
      "ChatSessionMessagesAppendResponse": {
        "description": "Response model for appending messages.",
        "properties": {
          "messages_added": {
            "title": "Messages Added",
            "type": "integer"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "session_id",
          "messages_added"
        ],
        "title": "ChatSessionMessagesAppendResponse",
        "type": "object"
      },
      "ChatSessionResponse": {
        "description": "Response model for a chat session (without messages).",
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "first_user_attached_resources": {
            "description": "Resource chips the user attached to the *first* user message of this session, parsed from its attached-context preamble. Powers the threads-sidebar preview so users can see at a glance what context a thread was anchored on without opening it. Empty when the session has no user messages or none of them carry a preamble.",
            "items": {
              "$ref": "#/components/schemas/AttachedResourceRef"
            },
            "title": "First User Attached Resources",
            "type": "array"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "images_retention_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-session image retention window in days for this chat's image attachments. NULL inherits the 30-day default; 0 means keep forever. Drives image eviction by the nightly cleanup job.",
            "title": "Images Retention Days"
          },
          "is_archived": {
            "default": false,
            "title": "Is Archived",
            "type": "boolean"
          },
          "modal_sandbox_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Modal sandbox id for the persistent MLE agent runtime, if a sandbox is associated with this session. Surfaced for nightly smoke tests and observability — never used for client routing.",
            "title": "Modal Sandbox Id"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "title",
          "created_at",
          "updated_at"
        ],
        "title": "ChatSessionResponse",
        "type": "object"
      },
      "ChatSessionUpdate": {
        "description": "Request model for updating a chat session.",
        "properties": {
          "images_retention_days": {
            "anyOf": [
              {
                "maximum": 3650.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-session image retention window in days. 0 means keep forever (the UI 'forever' option). Omit to leave unchanged; when never set, the session inherits the 30-day default. Note: once any value is persisted the session keeps that explicit value even if the system default later changes — this endpoint has no path back to the NULL/inherit state (send 30 to match today's default).",
            "title": "Images Retention Days"
          },
          "is_archived": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Archive status of the session",
            "title": "Is Archived"
          },
          "title": {
            "anyOf": [
              {
                "maxLength": 100,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New title for the session",
            "title": "Title"
          }
        },
        "title": "ChatSessionUpdate",
        "type": "object"
      },
      "ChatSessionWithMessages": {
        "description": "Response model for a chat session with all messages.",
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "first_user_attached_resources": {
            "description": "Resource chips the user attached to the *first* user message of this session, parsed from its attached-context preamble. Mirrors the same field on :class:`ChatSessionResponse` so the agent page header can render the chips next to the session title without scanning every message in ``messages``.",
            "items": {
              "$ref": "#/components/schemas/AttachedResourceRef"
            },
            "title": "First User Attached Resources",
            "type": "array"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "images_retention_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-session image retention window in days for this chat's image attachments. NULL inherits the 30-day default; 0 means keep forever.",
            "title": "Images Retention Days"
          },
          "is_archived": {
            "default": false,
            "title": "Is Archived",
            "type": "boolean"
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/ChatMessageResponse"
            },
            "title": "Messages",
            "type": "array"
          },
          "modal_sandbox_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Modal sandbox id for the persistent MLE agent runtime, if a sandbox is associated with this session.",
            "title": "Modal Sandbox Id"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "raw_message_tree_present": {
            "default": false,
            "description": "True when the sandbox runtime has persisted a canonical Anthropic message tree for this session. The tree itself is backend-only state (it includes provider request payloads) so we expose only a presence flag that nightly smoke tests can assert on.",
            "title": "Raw Message Tree Present",
            "type": "boolean"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "title",
          "created_at",
          "updated_at",
          "messages"
        ],
        "title": "ChatSessionWithMessages",
        "type": "object"
      },
      "CheckoutSessionStatusResponse": {
        "description": "Verified status of a Stripe checkout session.\n\nReturned from ``GET /billing/checkout-session-status`` so the\nunauthenticated success page can confirm that the session_id\ncorresponds to a paid session before rendering the confirmation.",
        "properties": {
          "paid": {
            "title": "Paid",
            "type": "boolean"
          },
          "payment_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stripe payment status (e.g. 'paid', 'unpaid', 'no_payment_required')",
            "title": "Payment Status"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stripe session status (e.g. 'complete', 'open', 'expired')",
            "title": "Status"
          }
        },
        "required": [
          "paid"
        ],
        "title": "CheckoutSessionStatusResponse",
        "type": "object"
      },
      "CheckpointListResponse": {
        "description": "List of checkpoints response",
        "properties": {
          "checkpoints": {
            "items": {
              "$ref": "#/components/schemas/CheckpointResponse"
            },
            "title": "Checkpoints",
            "type": "array"
          },
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "checkpoints",
          "count"
        ],
        "title": "CheckpointListResponse",
        "type": "object"
      },
      "CheckpointResponse": {
        "description": "Single checkpoint response",
        "properties": {
          "accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy"
          },
          "checkpoint_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Checkpoint Path"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "epoch": {
            "title": "Epoch",
            "type": "integer"
          },
          "gpu_memory_total": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gpu Memory Total"
          },
          "gpu_memory_used": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gpu Memory Used"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "is_best": {
            "default": false,
            "title": "Is Best",
            "type": "boolean"
          },
          "is_deployable": {
            "default": false,
            "title": "Is Deployable",
            "type": "boolean"
          },
          "is_final": {
            "default": false,
            "title": "Is Final",
            "type": "boolean"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "learning_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Learning Rate"
          },
          "step": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Step"
          },
          "training_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Training Loss"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "validation_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation Loss"
          }
        },
        "required": [
          "id",
          "job_id",
          "epoch",
          "created_at",
          "updated_at"
        ],
        "title": "CheckpointResponse",
        "type": "object"
      },
      "ClassBalance": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "label": {
            "title": "Label",
            "type": "string"
          }
        },
        "required": [
          "label",
          "count"
        ],
        "title": "ClassBalance",
        "type": "object"
      },
      "ClassifiedExample": {
        "description": "Example with optional user feedback for improving generation.",
        "properties": {
          "feedback": {
            "anyOf": [
              {
                "enum": [
                  "positive",
                  "negative"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User feedback: positive (upvote) or negative (downvote)",
            "title": "Feedback"
          },
          "label": {
            "description": "Example label",
            "title": "Label",
            "type": "string"
          },
          "text": {
            "description": "Example text",
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "text",
          "label"
        ],
        "title": "ClassifiedExample",
        "type": "object"
      },
      "CliTelemetryEvent": {
        "additionalProperties": true,
        "description": "CLI telemetry event payload.",
        "properties": {
          "cli_version": {
            "title": "Cli Version",
            "type": "string"
          },
          "event": {
            "title": "Event",
            "type": "string"
          },
          "installation_id": {
            "title": "Installation Id",
            "type": "string"
          },
          "os_arch": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Os Arch"
          },
          "os_platform": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Os Platform"
          },
          "os_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Os Type"
          }
        },
        "required": [
          "event",
          "installation_id",
          "cli_version"
        ],
        "title": "CliTelemetryEvent",
        "type": "object"
      },
      "CodexSessionSavingsResponse": {
        "description": "Cumulative routed-vs-frontier savings for one Codex session.\n\nAttributes:\n    found: Whether any savings have been accumulated for the session.\n    savings_usd: Cumulative dollars saved this session vs the frontier\n        reference. ``0.0`` when nothing has accumulated yet.\n    baseline_model: The frontier reference the savings are measured\n        against, or ``None`` when no turn has been recorded.",
        "properties": {
          "baseline_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Frontier reference model the savings are measured against.",
            "title": "Baseline Model"
          },
          "found": {
            "description": "Whether any savings have accumulated for the session.",
            "title": "Found",
            "type": "boolean"
          },
          "savings_usd": {
            "default": 0.0,
            "description": "Cumulative dollars saved this session vs the frontier.",
            "minimum": 0.0,
            "title": "Savings Usd",
            "type": "number"
          }
        },
        "required": [
          "found"
        ],
        "title": "CodexSessionSavingsResponse",
        "type": "object"
      },
      "CompetitionInfo": {
        "description": "Information about a competition dataset.",
        "properties": {
          "dataset_id": {
            "title": "Dataset Id",
            "type": "string"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_type": {
            "title": "Dataset Type",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Description of the competition task",
            "title": "Description"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          },
          "sample_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Count"
          },
          "sample_rows": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Preview of a few sample rows from the dataset",
            "title": "Sample Rows"
          },
          "total_entries": {
            "default": 0,
            "title": "Total Entries",
            "type": "integer"
          },
          "winner": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LeaderboardEntry"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "dataset_id",
          "dataset_name",
          "dataset_type"
        ],
        "title": "CompetitionInfo",
        "type": "object"
      },
      "CompetitionsResponse": {
        "description": "Response listing all active competitions.",
        "properties": {
          "competitions": {
            "items": {
              "$ref": "#/components/schemas/CompetitionInfo"
            },
            "title": "Competitions",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "competitions"
        ],
        "title": "CompetitionsResponse",
        "type": "object"
      },
      "ConstraintRequest": {
        "description": "Constraint request model",
        "properties": {
          "choices": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional list of choices for this constraint",
            "title": "Choices"
          },
          "description": {
            "description": "Constraint description",
            "title": "Description",
            "type": "string"
          },
          "probability": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional probability (0.0-1.0) for this constraint",
            "title": "Probability"
          },
          "weights": {
            "anyOf": [
              {
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional weights for choices (must align with choices length)",
            "title": "Weights"
          }
        },
        "required": [
          "description"
        ],
        "title": "ConstraintRequest",
        "type": "object"
      },
      "ContentBlock": {
        "additionalProperties": true,
        "description": "A content block in Anthropic format.\n\nSupports ``text``, ``tool_use``, and ``tool_result`` block types so that\ntool-calling round-trips work with Anthropic SDK clients.",
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "input": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Input"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          },
          "tool_use_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Use Id"
          },
          "type": {
            "default": "text",
            "title": "Type",
            "type": "string"
          }
        },
        "title": "ContentBlock",
        "type": "object"
      },
      "CreateAPIKeyRequest": {
        "description": "Request model for creating an API key.\n\nAttributes:\n    name: User-visible identifier for the key.\n    expires_at: Optional ISO-8601 expiry; sentinels (``\"\"``, ``never``,\n        ``none``, ``null``) collapse to ``None``.\n    team_id: Tenant the key is bound to. ``None`` defaults to the\n        caller's active team; an explicit value must equal it.\n    captcha_token: hCaptcha response token for bot verification.",
        "properties": {
          "captcha_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "hCaptcha response token for bot verification",
            "title": "Captcha Token"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional expiration timestamp (ISO 8601). Sentinel strings like 'never' are accepted and treated as no expiration.",
            "title": "Expires At"
          },
          "name": {
            "description": "Name for the API key",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "team_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Team to bind the key to. Defaults to the caller's active team when omitted; an explicit value must equal the active team.",
            "title": "Team Id"
          }
        },
        "required": [
          "name"
        ],
        "title": "CreateAPIKeyRequest",
        "type": "object"
      },
      "CreateAPIKeyResponse": {
        "description": "Response model for API key creation.",
        "properties": {
          "api_key_last_digits": {
            "title": "Api Key Last Digits",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "secret_key": {
            "title": "Secret Key",
            "type": "string"
          },
          "stripe_customer_created": {
            "default": false,
            "title": "Stripe Customer Created",
            "type": "boolean"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "api_key_last_digits",
          "created_at",
          "team_id",
          "secret_key"
        ],
        "title": "CreateAPIKeyResponse",
        "type": "object"
      },
      "CustomEnumCreate": {
        "description": "Request model for creating a custom enum.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional description of the enum",
            "title": "Description"
          },
          "name": {
            "description": "Name for the enum type",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "values": {
            "description": "List of allowed enum values",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "title": "Values",
            "type": "array"
          }
        },
        "required": [
          "name",
          "values"
        ],
        "title": "CustomEnumCreate",
        "type": "object"
      },
      "CustomEnumDeleteResponse": {
        "description": "Response model for deleting a custom enum.",
        "properties": {
          "enum_id": {
            "title": "Enum Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message",
          "enum_id"
        ],
        "title": "CustomEnumDeleteResponse",
        "type": "object"
      },
      "CustomEnumListResponse": {
        "description": "Response model for listing custom enums.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "enums": {
            "items": {
              "$ref": "#/components/schemas/CustomEnumResponse"
            },
            "title": "Enums",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "enums",
          "count"
        ],
        "title": "CustomEnumListResponse",
        "type": "object"
      },
      "CustomEnumResponse": {
        "description": "Response model for a single custom enum.",
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "values": {
            "items": {
              "type": "string"
            },
            "title": "Values",
            "type": "array"
          }
        },
        "required": [
          "id",
          "user_id",
          "name",
          "values",
          "created_at",
          "updated_at"
        ],
        "title": "CustomEnumResponse",
        "type": "object"
      },
      "CustomEnumUpdate": {
        "description": "Request model for updating a custom enum.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New description",
            "title": "Description"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 100,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New name for the enum",
            "title": "Name"
          },
          "values": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "New list of allowed values",
            "title": "Values"
          }
        },
        "title": "CustomEnumUpdate",
        "type": "object"
      },
      "DataEditingCheckLabelsRequest": {
        "description": "Request to check labels using AI",
        "properties": {
          "dataset_name": {
            "description": "Dataset name",
            "title": "Dataset Name",
            "type": "string"
          },
          "label_column": {
            "description": "Column containing labels",
            "title": "Label Column",
            "type": "string"
          },
          "sample_size": {
            "default": 10,
            "description": "Number of samples to check",
            "maximum": 100.0,
            "minimum": 1.0,
            "title": "Sample Size",
            "type": "integer"
          },
          "text_column": {
            "description": "Column containing text",
            "title": "Text Column",
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Version"
          }
        },
        "required": [
          "dataset_name",
          "text_column",
          "label_column"
        ],
        "title": "DataEditingCheckLabelsRequest",
        "type": "object"
      },
      "DataEditingCheckLabelsResponse": {
        "description": "Response from label checking",
        "properties": {
          "checked_count": {
            "title": "Checked Count",
            "type": "integer"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "title": "Dataset Version",
            "type": "string"
          },
          "issues_found": {
            "title": "Issues Found",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/LabelCheckResult"
            },
            "title": "Results",
            "type": "array"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "dataset_name",
          "dataset_version",
          "checked_count",
          "issues_found",
          "results"
        ],
        "title": "DataEditingCheckLabelsResponse",
        "type": "object"
      },
      "DataEditingRemoveRequest": {
        "description": "Request to remove PII/PHD from dataset",
        "properties": {
          "dataset_name": {
            "description": "Dataset name",
            "title": "Dataset Name",
            "type": "string"
          },
          "findings": {
            "description": "Findings to redact/remove",
            "items": {
              "$ref": "#/components/schemas/PIIFinding"
            },
            "title": "Findings",
            "type": "array"
          },
          "new_dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name for the cleaned dataset (auto-generated if omitted)",
            "title": "New Dataset Name"
          },
          "redaction_method": {
            "default": "redact",
            "description": "How to handle findings",
            "enum": [
              "redact",
              "remove_row",
              "mask"
            ],
            "title": "Redaction Method",
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Version"
          }
        },
        "required": [
          "dataset_name",
          "findings"
        ],
        "title": "DataEditingRemoveRequest",
        "type": "object"
      },
      "DataEditingRemoveResponse": {
        "description": "Response after removing PII/PHD",
        "properties": {
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "title": "Dataset Version",
            "type": "string"
          },
          "entities_removed": {
            "title": "Entities Removed",
            "type": "integer"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "new_dataset_name": {
            "title": "New Dataset Name",
            "type": "string"
          },
          "new_dataset_version": {
            "title": "New Dataset Version",
            "type": "string"
          },
          "rows_affected": {
            "title": "Rows Affected",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "dataset_name",
          "dataset_version",
          "new_dataset_name",
          "new_dataset_version",
          "rows_affected",
          "entities_removed",
          "message"
        ],
        "title": "DataEditingRemoveResponse",
        "type": "object"
      },
      "DataEditingScanRequest": {
        "description": "Request to scan dataset for PII or PHD",
        "properties": {
          "columns": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Columns to scan. If not specified, scans all string columns.",
            "title": "Columns"
          },
          "dataset_name": {
            "description": "Dataset name",
            "title": "Dataset Name",
            "type": "string"
          },
          "threshold": {
            "default": 0.5,
            "description": "Detection threshold",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Threshold",
            "type": "number"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Version number (latest if omitted)",
            "title": "Version"
          }
        },
        "required": [
          "dataset_name"
        ],
        "title": "DataEditingScanRequest",
        "type": "object"
      },
      "DataEditingScanResponse": {
        "description": "Response from PII/PHD scanning",
        "properties": {
          "affected_rows": {
            "title": "Affected Rows",
            "type": "integer"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "title": "Dataset Version",
            "type": "string"
          },
          "findings": {
            "items": {
              "$ref": "#/components/schemas/PIIFinding"
            },
            "title": "Findings",
            "type": "array"
          },
          "findings_count": {
            "title": "Findings Count",
            "type": "integer"
          },
          "scan_type": {
            "enum": [
              "pii",
              "phd"
            ],
            "title": "Scan Type",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "dataset_name",
          "dataset_version",
          "scan_type",
          "findings_count",
          "affected_rows",
          "findings"
        ],
        "title": "DataEditingScanResponse",
        "type": "object"
      },
      "DataEditingSubsampleRequest": {
        "description": "Request to subsample a dataset",
        "properties": {
          "dataset_name": {
            "description": "Dataset name",
            "title": "Dataset Name",
            "type": "string"
          },
          "label_column": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Column for balanced/stratified sampling",
            "title": "Label Column"
          },
          "method": {
            "default": "random",
            "description": "Subsampling method",
            "enum": [
              "random",
              "balanced",
              "stratified"
            ],
            "title": "Method",
            "type": "string"
          },
          "n": {
            "description": "Target number of samples",
            "minimum": 1.0,
            "title": "N",
            "type": "integer"
          },
          "new_dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name for the new subsampled dataset (auto-generated if omitted)",
            "title": "New Dataset Name"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Random seed for reproducibility",
            "title": "Seed"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Version"
          }
        },
        "required": [
          "dataset_name",
          "n"
        ],
        "title": "DataEditingSubsampleRequest",
        "type": "object"
      },
      "DataEditingSubsampleResponse": {
        "description": "Response after subsampling",
        "properties": {
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "title": "Dataset Version",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "method": {
            "title": "Method",
            "type": "string"
          },
          "new_dataset_name": {
            "title": "New Dataset Name",
            "type": "string"
          },
          "new_dataset_version": {
            "title": "New Dataset Version",
            "type": "string"
          },
          "new_rows": {
            "title": "New Rows",
            "type": "integer"
          },
          "original_rows": {
            "title": "Original Rows",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "dataset_name",
          "dataset_version",
          "new_dataset_name",
          "new_dataset_version",
          "original_rows",
          "new_rows",
          "method",
          "message"
        ],
        "title": "DataEditingSubsampleResponse",
        "type": "object"
      },
      "DatasetAnalysisRequest": {
        "description": "Request for dataset analysis",
        "example": {
          "analyses": [
            "distribution",
            "outliers",
            "duplicates",
            "diversity"
          ],
          "dataset": [
            {
              "entities": [
                [
                  "Apple",
                  "ORG"
                ],
                [
                  "U.K.",
                  "GPE"
                ],
                [
                  "$1 billion",
                  "MONEY"
                ]
              ],
              "text": "Apple is looking at buying U.K. startup for $1 billion"
            },
            {
              "entities": [
                [
                  "San Francisco",
                  "GPE"
                ]
              ],
              "text": "San Francisco considers banning sidewalk delivery robots"
            }
          ],
          "options": {
            "diversity_visualization": {
              "dimensions": 3,
              "method": "tsne",
              "tsne_perplexity": 25
            }
          },
          "query": "What is the distribution of entity types?",
          "task_type": "ner"
        },
        "properties": {
          "analyses": {
            "description": "List of analyses to perform",
            "items": {
              "enum": [
                "distribution",
                "duplicates",
                "outliers",
                "correlation",
                "splits",
                "errors",
                "diversity"
              ],
              "type": "string"
            },
            "title": "Analyses",
            "type": "array"
          },
          "dataset": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "List of data samples (optional if dataset_name provided)",
            "title": "Dataset"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of stored dataset to analyze (optional if dataset provided)",
            "title": "Dataset Name"
          },
          "dataset_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Dataset Version"
          },
          "options": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Configuration options for analysis. Supported keys: `validation_percentage` (float) for split analysis and `diversity_visualization` (object) with optional `method` ('pca'|'tsne'|'umap'), `dimensions` (2-4), and `tsne_perplexity` (float).",
            "title": "Options"
          },
          "predictions": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional model predictions for error analysis",
            "title": "Predictions"
          },
          "query": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Natural language question about the dataset",
            "title": "Query"
          },
          "task_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Description of the task/domain for context. Helps the LLM quality analysis understand the intended use case.",
            "title": "Task Description"
          },
          "task_type": {
            "description": "Task type of the dataset",
            "enum": [
              "ner",
              "classification",
              "generative"
            ],
            "title": "Task Type",
            "type": "string"
          }
        },
        "required": [
          "task_type",
          "analyses"
        ],
        "title": "DatasetAnalysisRequest",
        "type": "object"
      },
      "DatasetAnalysisResponse": {
        "description": "Response containing analysis results",
        "properties": {
          "correlations": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Correlations"
          },
          "distribution": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DistributionAnalysis"
              },
              {
                "type": "null"
              }
            ]
          },
          "diversity": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DiversityAnalysis"
              },
              {
                "type": "null"
              }
            ]
          },
          "duplicates": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DuplicatesAnalysis"
              },
              {
                "type": "null"
              }
            ]
          },
          "errors": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Errors"
          },
          "natural_language_response": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Natural Language Response"
          },
          "outliers": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OutliersAnalysis"
              },
              {
                "type": "null"
              }
            ]
          },
          "splits": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SplitsAnalysis"
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "additionalProperties": true,
            "title": "Summary",
            "type": "object"
          }
        },
        "required": [
          "summary"
        ],
        "title": "DatasetAnalysisResponse",
        "type": "object"
      },
      "DatasetAugmentationRequest": {
        "description": "Request for dataset augmentation.",
        "example": {
          "dataset_name": "my-reviews-dataset",
          "domain_description": "Customer reviews for e-commerce products",
          "labels": [
            "positive",
            "negative"
          ],
          "new_dataset_name": "balanced_reviews_v2",
          "operations": [
            {
              "enabled": true,
              "type": "remove_duplicates"
            },
            {
              "enabled": true,
              "type": "remove_outliers"
            },
            {
              "enabled": true,
              "type": "balance"
            }
          ],
          "target_distribution": {
            "negative": 0.5,
            "positive": 0.5
          },
          "task_type": "classification",
          "update_in_place": false
        },
        "properties": {
          "dataset": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Inline dataset to augment (if dataset_name not provided)",
            "title": "Dataset"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of stored dataset to augment",
            "title": "Dataset Name"
          },
          "dataset_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Dataset Version"
          },
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for synthetic sample generation",
            "title": "Domain Description"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Labels for generation (required if balance operation used)",
            "title": "Labels"
          },
          "new_dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name for the new augmented dataset (required if update_in_place=False)",
            "title": "New Dataset Name"
          },
          "operations": {
            "description": "List of augmentation operations to perform",
            "items": {
              "$ref": "#/components/schemas/AugmentationOperation"
            },
            "title": "Operations",
            "type": "array"
          },
          "target_distribution": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "number"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Target class/entity distribution as percentages (must sum to 1.0)",
            "title": "Target Distribution"
          },
          "task_type": {
            "description": "Task type of the dataset",
            "enum": [
              "ner",
              "classification",
              "custom"
            ],
            "title": "Task Type",
            "type": "string"
          },
          "update_in_place": {
            "default": false,
            "description": "If True, creates new version with same name and soft-deletes old version",
            "title": "Update In Place",
            "type": "boolean"
          }
        },
        "required": [
          "task_type",
          "operations"
        ],
        "title": "DatasetAugmentationRequest",
        "type": "object"
      },
      "DatasetAugmentationResponse": {
        "description": "Response containing augmentation results.",
        "properties": {
          "distribution_comparison": {
            "items": {
              "$ref": "#/components/schemas/DistributionComparison"
            },
            "title": "Distribution Comparison",
            "type": "array"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "modifications": {
            "$ref": "#/components/schemas/ModificationSummary"
          },
          "new_dataset": {
            "$ref": "#/components/schemas/DatasetResponse"
          },
          "original_dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Original Dataset Name"
          },
          "original_dataset_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Original Dataset Version"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "updated_in_place": {
            "default": false,
            "description": "True if the original dataset was replaced (soft-deleted)",
            "title": "Updated In Place",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "new_dataset",
          "modifications",
          "distribution_comparison",
          "message"
        ],
        "title": "DatasetAugmentationResponse",
        "type": "object"
      },
      "DatasetEvaluationSummary": {
        "description": "Latest evaluation attached to an evaluation dataset row.\n\nUsed on the Datasets tab to surface the most recent pass-rate / loss\nfor a given evaluation dataset against the model in context.",
        "properties": {
          "accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "evaluation_id": {
            "title": "Evaluation Id",
            "type": "string"
          },
          "f1_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "F1 Score"
          },
          "sample_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Count"
          }
        },
        "required": [
          "evaluation_id"
        ],
        "title": "DatasetEvaluationSummary",
        "type": "object"
      },
      "DatasetEvaluationsResponse": {
        "description": "Response for all evaluations on a dataset",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "title": "Dataset Version",
            "type": "string"
          },
          "models": {
            "items": {
              "$ref": "#/components/schemas/ModelWithEvaluation"
            },
            "title": "Models",
            "type": "array"
          },
          "sample_count": {
            "title": "Sample Count",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "dataset_name",
          "dataset_version",
          "sample_count",
          "models",
          "count"
        ],
        "title": "DatasetEvaluationsResponse",
        "type": "object"
      },
      "DatasetLLMAnalysisRequest": {
        "description": "Request for LLM-only dataset quality analysis.\n\nUse this endpoint for the slow LLM-based diversity/quality analysis\nseparately from the fast statistical analysis endpoint.",
        "example": {
          "dataset_name": "my-ner-dataset",
          "labels": [
            "ORG",
            "LOC",
            "PERSON"
          ],
          "task_description": "Extract company names and locations from news articles",
          "task_type": "ner"
        },
        "properties": {
          "dataset": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "List of data samples (optional if dataset_name provided)",
            "title": "Dataset"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of stored dataset to analyze (optional if dataset provided)",
            "title": "Dataset Name"
          },
          "dataset_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Dataset Version"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "List of label names for the task. If not provided, will be extracted from the dataset.",
            "title": "Labels"
          },
          "task_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Description of the task/domain for context. Helps the LLM understand the intended use case.",
            "title": "Task Description"
          },
          "task_type": {
            "description": "Task type of the dataset",
            "enum": [
              "ner",
              "classification",
              "generative"
            ],
            "title": "Task Type",
            "type": "string"
          }
        },
        "required": [
          "task_type"
        ],
        "title": "DatasetLLMAnalysisRequest",
        "type": "object"
      },
      "DatasetListResponse": {
        "description": "Response model for listing datasets.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "datasets": {
            "items": {
              "$ref": "#/components/schemas/DatasetResponse"
            },
            "title": "Datasets",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "datasets",
          "count"
        ],
        "title": "DatasetListResponse",
        "type": "object"
      },
      "DatasetMergeRequest": {
        "description": "Request to merge multiple datasets into one.",
        "properties": {
          "output_name": {
            "description": "Name for the merged dataset",
            "title": "Output Name",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project to assign the merged dataset to",
            "title": "Project Id"
          },
          "sources": {
            "description": "Datasets to merge (at least 2)",
            "items": {
              "$ref": "#/components/schemas/DatasetMergeSource"
            },
            "minItems": 2,
            "title": "Sources",
            "type": "array"
          }
        },
        "required": [
          "sources",
          "output_name"
        ],
        "title": "DatasetMergeRequest",
        "type": "object"
      },
      "DatasetMergeResponse": {
        "description": "Response from a merge operation.",
        "properties": {
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "sample_size": {
            "description": "Total rows in the merged dataset",
            "title": "Sample Size",
            "type": "integer"
          },
          "source_counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Number of rows contributed by each source dataset",
            "title": "Source Counts",
            "type": "object"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "success",
          "dataset_name",
          "version",
          "sample_size",
          "source_counts",
          "message"
        ],
        "title": "DatasetMergeResponse",
        "type": "object"
      },
      "DatasetMergeSource": {
        "description": "A dataset to include in a merge operation.",
        "properties": {
          "dataset_name": {
            "description": "Name of the dataset",
            "title": "Dataset Name",
            "type": "string"
          },
          "version": {
            "default": "latest",
            "description": "Version to merge (default: latest)",
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "dataset_name"
        ],
        "title": "DatasetMergeSource",
        "type": "object"
      },
      "DatasetMetadataUpdate": {
        "description": "Request model for the legacy ``PUT /felix/datasets/{name}/{version}`` endpoint.\n\nConvention divergence: this legacy endpoint accepts ``project_id=\"\"``\n(empty string) to mean \"unassign\". The newer canonical endpoint\n``PATCH /felix/datasets/{dataset_id}`` (see :class:`DatasetUpdate`) uses\n``project_id=null`` for the same intent. Both schemas coexist because\n``frontend/src/app/utils/assign-project-handler.ts`` still drives the\nlegacy PUT path with ``projectId || ''``. New callers should prefer the\nPATCH endpoint and the ``null`` convention.",
        "properties": {
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New name for the dataset",
            "title": "Dataset Name"
          },
          "dataset_type": {
            "anyOf": [
              {
                "enum": [
                  "ner",
                  "classification",
                  "custom",
                  "decoder"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New type for the dataset",
            "title": "Dataset Type"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to assign this dataset to (use empty string to unassign).",
            "title": "Project Id"
          }
        },
        "title": "DatasetMetadataUpdate",
        "type": "object"
      },
      "DatasetQueryRequest": {
        "description": "Request to execute Polars code on a dataset server-side.\n\nThe code has access to:\n- `df`: Polars DataFrame containing the dataset\n- `pl`: Polars module for expressions (pl.col, pl.lit, pl.when, etc.)\n\nAssign result to `result` variable to return it.\nMulti-statement code with intermediate variables is supported.\nControl-flow (for/while/if-stmt), comprehensions, and f-strings are\nnot available; use ternary expressions (A if cond else B) for\nconditional results.",
        "examples": [
          {
            "code": "result = df.group_by('label').count()",
            "dataset_name": "my-sentiment-dataset"
          },
          {
            "code": "filtered = df.filter(pl.col('score') > 0.5)\ngrouped = filtered.group_by('label').agg([\n    pl.col('score').mean().alias('avg_score'),\n    pl.col('score').count().alias('count')\n])\nresult = grouped.sort('avg_score', descending=True)",
            "dataset_name": "my-dataset"
          }
        ],
        "properties": {
          "code": {
            "description": "Polars code to execute. Access data as 'df'. Assign output to 'result'.",
            "maxLength": 4096,
            "title": "Code",
            "type": "string"
          },
          "dataset_name": {
            "description": "Name of the dataset to query",
            "maxLength": 255,
            "pattern": "^[A-Za-z0-9_\\-./]+$",
            "title": "Dataset Name",
            "type": "string"
          },
          "max_rows_returned": {
            "default": 10000,
            "description": "Maximum rows to return in result (1-100000)",
            "maximum": 100000.0,
            "minimum": 1.0,
            "title": "Max Rows Returned",
            "type": "integer"
          },
          "timeout": {
            "default": 30,
            "description": "Execution timeout in seconds (1-120)",
            "maximum": 120.0,
            "minimum": 1.0,
            "title": "Timeout",
            "type": "integer"
          },
          "version": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Version"
          }
        },
        "required": [
          "dataset_name",
          "code"
        ],
        "title": "DatasetQueryRequest",
        "type": "object"
      },
      "DatasetQueryResponse": {
        "description": "Response from dataset query execution.",
        "properties": {
          "columns": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Column names if result is a DataFrame",
            "title": "Columns"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "title": "Dataset Version",
            "type": "string"
          },
          "execution_time_ms": {
            "description": "Execution time in milliseconds",
            "title": "Execution Time Ms",
            "type": "integer"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "result": {
            "description": "JSON-serializable query result",
            "title": "Result"
          },
          "result_type": {
            "description": "Type of the returned result",
            "enum": [
              "dataframe",
              "series",
              "scalar",
              "string",
              "list",
              "object",
              "none"
            ],
            "title": "Result Type",
            "type": "string"
          },
          "row_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of rows if result is a DataFrame",
            "title": "Row Count"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "truncated": {
            "default": false,
            "description": "Whether result was truncated due to size limits",
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "dataset_name",
          "dataset_version",
          "result",
          "result_type",
          "execution_time_ms",
          "message"
        ],
        "title": "DatasetQueryResponse",
        "type": "object"
      },
      "DatasetReference": {
        "description": "Reference to a dataset by name and optional version",
        "properties": {
          "name": {
            "description": "Dataset name",
            "title": "Name",
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Version (latest if omitted)",
            "title": "Version"
          }
        },
        "required": [
          "name"
        ],
        "title": "DatasetReference",
        "type": "object"
      },
      "DatasetResponse": {
        "description": "Response model for a single dataset.",
        "properties": {
          "annotation_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Annotation Config"
          },
          "annotation_progress": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Annotation Progress"
          },
          "annotation_status": {
            "anyOf": [
              {
                "enum": [
                  "none",
                  "in_progress",
                  "completed"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Annotation Status"
          },
          "column_mapping": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Column mapping from original to standard names",
            "title": "Column Mapping"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_path": {
            "title": "Dataset Path",
            "type": "string"
          },
          "dataset_type": {
            "title": "Dataset Type",
            "type": "string"
          },
          "generation_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the dataset was created: synthesize, upload, auto_relabel, manual_relabel, grow, external",
            "title": "Generation Type"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "is_competition": {
            "default": false,
            "description": "Whether this dataset is a competition benchmark",
            "title": "Is Competition",
            "type": "boolean"
          },
          "is_seed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": false,
            "description": "Whether this dataset is a seed dataset (small set for review before full expansion)",
            "title": "Is Seed"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Label names (entity types for NER, class labels for classification)",
            "title": "Labels"
          },
          "processing_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Error message if status is failed",
            "title": "Processing Error"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "root_dataset_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Root Dataset Id"
          },
          "sample_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Size"
          },
          "schema": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schema"
          },
          "schema_warnings": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schema Warnings"
          },
          "size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size"
          },
          "status": {
            "anyOf": [
              {
                "enum": [
                  "initialized",
                  "uploading",
                  "converting",
                  "validating",
                  "ready",
                  "failed",
                  "generating",
                  "queued"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "ready",
            "description": "Dataset status: initialized/uploading/converting/validating/ready/failed/generating/queued",
            "title": "Status"
          },
          "synthesis_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "UUID of the synthesis log session for this dataset, used to restore creation workflow on resume",
            "title": "Synthesis Session Id"
          },
          "train_ratio": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Train split ratio for this dataset version. Left-to-right split with no shuffle; validation is the tail.",
            "title": "Train Ratio"
          },
          "type": {
            "default": "training",
            "description": "Dataset purpose tag: 'training', 'evaluation', or 'benchmark'",
            "title": "Type",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "validation": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation"
          },
          "version_number": {
            "default": "1",
            "title": "Version Number",
            "type": "string"
          },
          "visibility": {
            "default": "private",
            "description": "Dataset visibility: 'private' or 'public'",
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "dataset_name",
          "dataset_path",
          "dataset_type",
          "created_at",
          "updated_at"
        ],
        "title": "DatasetResponse",
        "type": "object"
      },
      "DatasetRowsDeleteRequest": {
        "description": "Request to delete specific rows from a dataset.\n\nExactly one of ``row_indices`` or ``fingerprints`` must be provided.\nFingerprint-based deletion is preferred because it is immune to\ndataset mutations between analysis and delete.",
        "properties": {
          "fingerprints": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Content fingerprints of rows to remove (position-independent)",
            "title": "Fingerprints"
          },
          "row_indices": {
            "anyOf": [
              {
                "items": {
                  "type": "integer"
                },
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Zero-based indices of rows to remove",
            "title": "Row Indices"
          }
        },
        "title": "DatasetRowsDeleteRequest",
        "type": "object"
      },
      "DatasetRowsDeleteResponse": {
        "description": "Response after deleting dataset rows.",
        "properties": {
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "new_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New version number if a new version was created",
            "title": "New Version"
          },
          "rows_deleted": {
            "title": "Rows Deleted",
            "type": "integer"
          },
          "rows_remaining": {
            "title": "Rows Remaining",
            "type": "integer"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "dataset_name",
          "version",
          "rows_deleted",
          "rows_remaining"
        ],
        "title": "DatasetRowsDeleteResponse",
        "type": "object"
      },
      "DatasetRowsUpdateRequest": {
        "description": "Request to update specific rows in a dataset.",
        "properties": {
          "updates": {
            "description": "List of row updates to apply",
            "items": {
              "$ref": "#/components/schemas/RowUpdate"
            },
            "minItems": 1,
            "title": "Updates",
            "type": "array"
          }
        },
        "required": [
          "updates"
        ],
        "title": "DatasetRowsUpdateRequest",
        "type": "object"
      },
      "DatasetRowsUpdateResponse": {
        "description": "Response after updating dataset rows.",
        "properties": {
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "new_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New version number if a new version was created",
            "title": "New Version"
          },
          "rows_updated": {
            "title": "Rows Updated",
            "type": "integer"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          },
          "validation_warnings": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation Warnings"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "dataset_name",
          "version",
          "rows_updated"
        ],
        "title": "DatasetRowsUpdateResponse",
        "type": "object"
      },
      "DatasetTypeUpdateResponse": {
        "description": "Response after updating a dataset's use type.\n\nAttributes:\n    id: The dataset UUID.\n    type: The updated use type value.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "type": {
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "type"
        ],
        "title": "DatasetTypeUpdateResponse",
        "type": "object"
      },
      "DatasetUpdate": {
        "additionalProperties": false,
        "description": "Thin PATCH body for ``PATCH /felix/datasets/{dataset_id}``.\n\nExposes only ``project_id``. Send ``null`` to unassign the dataset from its\ncurrent project. Unknown fields are rejected with HTTP 422.\n\nConvention divergence: the legacy :class:`DatasetMetadataUpdate` (used by\n``PUT /felix/datasets/{name}/{version}``) accepts ``project_id=\"\"`` for\n\"unassign\". This PATCH endpoint is the canonical path going forward and\nstandardizes on ``null``. The two schemas coexist while the frontend\nmigrates off the legacy PUT.",
        "properties": {
          "project_id": {
            "anyOf": [
              {
                "pattern": "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID (UUID) to assign the dataset to, or null to unassign.",
            "title": "Project Id"
          }
        },
        "title": "DatasetUpdate",
        "type": "object"
      },
      "DatasetUploadProcessRequest": {
        "description": "Request to process uploaded dataset from S3.",
        "properties": {
          "dataset_id": {
            "description": "Dataset ID from upload/url response (all metadata stored in DB)",
            "title": "Dataset Id",
            "type": "string"
          }
        },
        "required": [
          "dataset_id"
        ],
        "title": "DatasetUploadProcessRequest",
        "type": "object"
      },
      "DatasetUploadUrlRequest": {
        "description": "Request to get presigned URL for dataset upload (bypasses API Gateway limits).",
        "properties": {
          "column_mapping": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Column mapping from source to standard names (e.g., {\"sentence\": \"text\", \"category\": \"label\"}). Valid standard targets: text, label, labels, entities.",
            "title": "Column Mapping"
          },
          "dataset_name": {
            "description": "Name for the dataset",
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_type": {
            "default": "ner",
            "description": "Type of dataset",
            "enum": [
              "classification",
              "ner",
              "custom",
              "decoder"
            ],
            "title": "Dataset Type",
            "type": "string"
          },
          "filename": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Original filename (used for format detection if format not provided)",
            "title": "Filename"
          },
          "format": {
            "anyOf": [
              {
                "enum": [
                  "jsonl",
                  "csv",
                  "tsv",
                  "parquet",
                  "json"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "File format (auto-detected from filename if not provided)",
            "title": "Format"
          },
          "generation_type": {
            "anyOf": [
              {
                "enum": [
                  "synthesize",
                  "upload",
                  "auto_relabel",
                  "manual_relabel",
                  "grow",
                  "external"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the dataset was created: synthesize, upload, auto_relabel, manual_relabel, grow, external",
            "title": "Generation Type"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional project ID (UUID) to assign this dataset to",
            "title": "Project Id"
          },
          "schema": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Expected schema as JSON object (e.g., {\"age\": \"Int64\", \"name\": \"Utf8\"}). Enforces column types during parsing. Valid types: Int8, Int16, Int32, Int64, UInt8-64, Float32, Float64, Utf8, Boolean, Date, Datetime, Time, Duration, Categorical, Binary",
            "title": "Schema"
          },
          "split_ratio": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "number"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Split ratio when type is 'split', e.g. {'training': 0.8, 'evaluation': 0.2}",
            "title": "Split Ratio"
          },
          "type": {
            "anyOf": [
              {
                "enum": [
                  "training",
                  "evaluation",
                  "benchmark"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "training",
            "description": "Dataset purpose: 'training' (trainable), 'evaluation' (not trainable), 'benchmark' (system-managed, evaluation-only; cannot be trained on or directly accessed).",
            "title": "Type"
          },
          "visibility": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "private",
            "description": "Dataset visibility: 'private' (owner only) or 'public' (anyone can see)",
            "title": "Visibility"
          }
        },
        "required": [
          "dataset_name"
        ],
        "title": "DatasetUploadUrlRequest",
        "type": "object"
      },
      "DatasetUploadUrlResponse": {
        "description": "Response with presigned S3 URL for direct upload.",
        "properties": {
          "dataset_id": {
            "description": "Dataset ID for subsequent processing",
            "title": "Dataset Id",
            "type": "string"
          },
          "dataset_name": {
            "description": "Dataset name (for polling status via GET /{name}/{version})",
            "title": "Dataset Name",
            "type": "string"
          },
          "expires_in": {
            "description": "URL expiration time in seconds",
            "title": "Expires In",
            "type": "integer"
          },
          "presigned_url": {
            "description": "S3 presigned URL for PUT upload",
            "title": "Presigned Url",
            "type": "string"
          },
          "upload_instructions": {
            "default": "Upload file via HTTP PUT to presigned_url, then call /datasets/upload/process with dataset_id, format, and schema (if applicable)",
            "description": "Instructions for completing the upload",
            "title": "Upload Instructions",
            "type": "string"
          },
          "version_number": {
            "description": "Version number for this dataset",
            "title": "Version Number",
            "type": "string"
          }
        },
        "required": [
          "presigned_url",
          "dataset_id",
          "dataset_name",
          "version_number",
          "expires_in"
        ],
        "title": "DatasetUploadUrlResponse",
        "type": "object"
      },
      "DatasetUseTypeUpdate": {
        "description": "Request to change whether a dataset is used for training or evaluation.\n\nArgs:\n    type: The new use type for the dataset.",
        "properties": {
          "type": {
            "description": "New use type: 'training' or 'evaluation'",
            "enum": [
              "training",
              "evaluation"
            ],
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "title": "DatasetUseTypeUpdate",
        "type": "object"
      },
      "DatasetVersionsResponse": {
        "description": "List of all versions of a dataset",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "versions": {
            "items": {
              "$ref": "#/components/schemas/DatasetResponse"
            },
            "title": "Versions",
            "type": "array"
          }
        },
        "required": [
          "success",
          "versions",
          "count"
        ],
        "title": "DatasetVersionsResponse",
        "type": "object"
      },
      "DeleteAPIKeyRequest": {
        "description": "Request model for deleting an API key.",
        "properties": {
          "key_id": {
            "description": "ID of the API key to delete",
            "title": "Key Id",
            "type": "string"
          }
        },
        "required": [
          "key_id"
        ],
        "title": "DeleteAPIKeyRequest",
        "type": "object"
      },
      "DeleteAccountRequest": {
        "description": "Request for account deletion with optional feedback and ownership transfers.\n\nCombines cancellation feedback with team ownership transfers so\nthe entire delete-account flow is a single atomic request.\n\nAttributes:\n    reason: Selected cancellation reason (e.g. 'Pricing').\n    feedback_text: Free-form feedback from the user.\n    ownership_transfers: Mapping of team_id to new_owner_id for\n        teams the user owns that still have other members.",
        "properties": {
          "feedback_text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Feedback Text"
          },
          "ownership_transfers": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ownership Transfers"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "title": "DeleteAccountRequest",
        "type": "object"
      },
      "DeleteEvaluationResponse": {
        "description": "Response model for deleting an evaluation.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "DeleteEvaluationResponse",
        "type": "object"
      },
      "DeleteTrainingJobResponse": {
        "description": "Response model for deleting a training job",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "DeleteTrainingJobResponse",
        "type": "object"
      },
      "DeleteUserResponse": {
        "description": "Response for user deletion.",
        "properties": {
          "code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status",
          "message"
        ],
        "title": "DeleteUserResponse",
        "type": "object"
      },
      "DeployCheckpointResponse": {
        "description": "Response after deploying a checkpoint",
        "properties": {
          "checkpoint_id": {
            "title": "Checkpoint Id",
            "type": "string"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "mme_path": {
            "title": "Mme Path",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message",
          "job_id",
          "checkpoint_id",
          "mme_path"
        ],
        "title": "DeployCheckpointResponse",
        "type": "object"
      },
      "DeploymentCreate": {
        "description": "Request body for deploying a model to a project.\n\nExactly one of ``training_job_id`` or ``base_model`` must be supplied.\n\nAttributes:\n    training_job_id: UUID of a completed training job to activate.\n    base_model: HuggingFace base model ID to activate (e.g.\n        ``fastino/gliner2-base-v1``). Used when rolling back from a\n        fine-tuned checkpoint to the original base model.\n    reason: Optional human-readable reason for the swap.\n    project_id: Project ID -- used only by the deprecated\n        /felix/deployments endpoint. For new clients, supply project_id\n        in the URL path instead.",
        "properties": {
          "base_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "HuggingFace base model ID to deploy (e.g. 'fastino/gliner2-base-v1'). Mutually exclusive with training_job_id.",
            "title": "Base Model"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "[Deprecated] Project ID. Provide in the URL path (/projects/{project_id}/deployments) instead.",
            "title": "Project Id"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional reason for this deployment",
            "title": "Reason"
          },
          "training_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "UUID of the training job to deploy",
            "title": "Training Job Id"
          }
        },
        "title": "DeploymentCreate",
        "type": "object"
      },
      "DeploymentHistoryResponse": {
        "description": "Paginated list of deployment history records.\n\nAttributes:\n    deployments: Ordered list of deployment records (newest first).",
        "properties": {
          "deployments": {
            "items": {
              "$ref": "#/components/schemas/DeploymentResponse"
            },
            "title": "Deployments",
            "type": "array"
          }
        },
        "required": [
          "deployments"
        ],
        "title": "DeploymentHistoryResponse",
        "type": "object"
      },
      "DeploymentResponse": {
        "description": "A single deployment history record.\n\nA deployment targets exactly one of ``training_job_id`` or\n``base_model``: the trained adapter that was activated, or the base\ncatalog model that was activated when no adapter is in use.\n\nAttributes:\n    id: Unique deployment record ID.\n    project_id: The project whose active model was changed.\n    training_job_id: Training job that was deployed (training-job shape).\n    base_model: HuggingFace base model ID that was deployed (base-model shape).\n    deployed_by: User ID who triggered the deployment.\n    reason: Optional reason for the swap.\n    deployed_at: When the swap occurred.",
        "properties": {
          "base_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Model"
          },
          "deployed_at": {
            "format": "date-time",
            "title": "Deployed At",
            "type": "string"
          },
          "deployed_by": {
            "title": "Deployed By",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "training_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Training Job Id"
          }
        },
        "required": [
          "id",
          "project_id",
          "deployed_by",
          "reason",
          "deployed_at"
        ],
        "title": "DeploymentResponse",
        "type": "object"
      },
      "DismissImprovementCandidateResponse": {
        "description": "Response after dismissing an improvement candidate.\n\nAttributes:\n    training_job_id: Dismissed training job ID.\n    dismissed_at: Dismissal timestamp.",
        "properties": {
          "dismissed_at": {
            "format": "date-time",
            "title": "Dismissed At",
            "type": "string"
          },
          "training_job_id": {
            "title": "Training Job Id",
            "type": "string"
          }
        },
        "required": [
          "training_job_id",
          "dismissed_at"
        ],
        "title": "DismissImprovementCandidateResponse",
        "type": "object"
      },
      "DismissOutlierRequest": {
        "description": "Request to dismiss (keep) an outlier so it doesn't reappear on refresh.",
        "properties": {
          "dataset_name": {
            "description": "Name of the dataset",
            "title": "Dataset Name",
            "type": "string"
          },
          "fingerprint": {
            "description": "Content fingerprint of the outlier sample",
            "title": "Fingerprint",
            "type": "string"
          }
        },
        "required": [
          "dataset_name",
          "fingerprint"
        ],
        "title": "DismissOutlierRequest",
        "type": "object"
      },
      "DismissOutlierResponse": {
        "description": "Response after dismissing an outlier.",
        "properties": {
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "title": "DismissOutlierResponse",
        "type": "object"
      },
      "DistributionAnalysis": {
        "description": "Result of distribution analysis",
        "properties": {
          "class_balance": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ClassBalance"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Class Balance"
          },
          "completion_length_stats": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DistributionStats"
              },
              {
                "type": "null"
              }
            ]
          },
          "entity_counts": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/EntityCount"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Counts"
          },
          "label_correlation": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LabelCorrelation"
              },
              {
                "type": "null"
              }
            ]
          },
          "most_frequent_spans": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/SpanFrequency"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Most Frequent Spans"
          },
          "prompt_length_stats": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DistributionStats"
              },
              {
                "type": "null"
              }
            ]
          },
          "span_length_by_type": {
            "anyOf": [
              {
                "additionalProperties": {
                  "$ref": "#/components/schemas/DistributionStats"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Span Length By Type"
          },
          "span_length_stats": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DistributionStats"
              },
              {
                "type": "null"
              }
            ]
          },
          "text_length_stats": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DistributionStats"
              },
              {
                "type": "null"
              }
            ]
          },
          "token_count_histogram": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/HistogramBucket"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Count Histogram"
          },
          "token_count_stats": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DistributionStats"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "DistributionAnalysis",
        "type": "object"
      },
      "DistributionComparison": {
        "description": "Before/after distribution comparison.",
        "properties": {
          "after_count": {
            "title": "After Count",
            "type": "integer"
          },
          "after_percentage": {
            "title": "After Percentage",
            "type": "number"
          },
          "before_count": {
            "title": "Before Count",
            "type": "integer"
          },
          "before_percentage": {
            "title": "Before Percentage",
            "type": "number"
          },
          "label": {
            "title": "Label",
            "type": "string"
          }
        },
        "required": [
          "label",
          "before_count",
          "before_percentage",
          "after_count",
          "after_percentage"
        ],
        "title": "DistributionComparison",
        "type": "object"
      },
      "DistributionStats": {
        "description": "Statistics for a numerical distribution",
        "properties": {
          "max": {
            "title": "Max",
            "type": "number"
          },
          "mean": {
            "title": "Mean",
            "type": "number"
          },
          "median": {
            "title": "Median",
            "type": "number"
          },
          "min": {
            "title": "Min",
            "type": "number"
          },
          "std": {
            "title": "Std",
            "type": "number"
          }
        },
        "required": [
          "min",
          "max",
          "mean",
          "median",
          "std"
        ],
        "title": "DistributionStats",
        "type": "object"
      },
      "DiversityAnalysis": {
        "properties": {
          "interpretation": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Interpretation"
          },
          "llm_analysis": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DiversityLLMAnalysis"
              },
              {
                "type": "null"
              }
            ],
            "description": "LLM-generated reasoning analysis of dataset diversity, showing the thought process similar to an ML engineer"
          },
          "sample_size": {
            "title": "Sample Size",
            "type": "integer"
          },
          "vendi_score": {
            "title": "Vendi Score",
            "type": "number"
          },
          "visualization": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DiversityVisualization"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "vendi_score",
          "sample_size"
        ],
        "title": "DiversityAnalysis",
        "type": "object"
      },
      "DiversityLLMAnalysis": {
        "description": "LLM-generated reasoning analysis of dataset diversity.\n\nMimics how a machine learning engineer would analyze diversity.",
        "properties": {
          "diversity_rating": {
            "description": "Overall diversity rating based on the analysis",
            "enum": [
              "low",
              "moderate",
              "high",
              "excellent"
            ],
            "title": "Diversity Rating",
            "type": "string"
          },
          "key_observations": {
            "description": "Key observations about the dataset's diversity",
            "items": {
              "type": "string"
            },
            "title": "Key Observations",
            "type": "array"
          },
          "model_used": {
            "description": "The LLM model used for the analysis",
            "title": "Model Used",
            "type": "string"
          },
          "reasoning_trace": {
            "description": "Step-by-step reasoning trace showing how the model analyzed the dataset's diversity, similar to an ML engineer's thought process",
            "title": "Reasoning Trace",
            "type": "string"
          },
          "recommendations": {
            "description": "Actionable recommendations to improve diversity if needed",
            "items": {
              "type": "string"
            },
            "title": "Recommendations",
            "type": "array"
          },
          "summary": {
            "description": "Concise summary of the diversity assessment",
            "title": "Summary",
            "type": "string"
          }
        },
        "required": [
          "reasoning_trace",
          "summary",
          "diversity_rating",
          "model_used"
        ],
        "title": "DiversityLLMAnalysis",
        "type": "object"
      },
      "DiversityPoint": {
        "properties": {
          "coordinates": {
            "items": {
              "type": "number"
            },
            "title": "Coordinates",
            "type": "array"
          },
          "embedding": {
            "anyOf": [
              {
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embedding"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Labels"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          },
          "sample_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Index"
          },
          "similarity_to_centroid": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Similarity To Centroid"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          },
          "token_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Count"
          },
          "w": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "W"
          },
          "x": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "X"
          },
          "y": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Y"
          },
          "z": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Z"
          }
        },
        "required": [
          "coordinates"
        ],
        "title": "DiversityPoint",
        "type": "object"
      },
      "DiversityVisualization": {
        "properties": {
          "dimensions": {
            "title": "Dimensions",
            "type": "integer"
          },
          "method": {
            "enum": [
              "pca",
              "tsne"
            ],
            "title": "Method",
            "type": "string"
          },
          "points": {
            "items": {
              "$ref": "#/components/schemas/DiversityPoint"
            },
            "title": "Points",
            "type": "array"
          },
          "similarity_range": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "number"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Similarity Range"
          },
          "token_count_range": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "integer"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Count Range"
          },
          "tsne_perplexity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tsne Perplexity"
          }
        },
        "required": [
          "method",
          "dimensions",
          "points"
        ],
        "title": "DiversityVisualization",
        "type": "object"
      },
      "DomainLimitRequest": {
        "description": "Request body for checking domain signup limits.",
        "properties": {
          "domain": {
            "maxLength": 253,
            "minLength": 1,
            "title": "Domain",
            "type": "string"
          }
        },
        "required": [
          "domain"
        ],
        "title": "DomainLimitRequest",
        "type": "object"
      },
      "DomainLimitResponse": {
        "description": "Response describing whether another signup is allowed for a domain.",
        "properties": {
          "allowed": {
            "title": "Allowed",
            "type": "boolean"
          },
          "banned": {
            "default": false,
            "title": "Banned",
            "type": "boolean"
          }
        },
        "required": [
          "allowed"
        ],
        "title": "DomainLimitResponse",
        "type": "object"
      },
      "DomainReportRequest": {
        "description": "Request body for reporting a blocked domain false positive.",
        "properties": {
          "domain": {
            "maxLength": 253,
            "minLength": 1,
            "title": "Domain",
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "format": "email",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          }
        },
        "required": [
          "domain"
        ],
        "title": "DomainReportRequest",
        "type": "object"
      },
      "DuplicateSample": {
        "properties": {
          "duplicate_index": {
            "title": "Duplicate Index",
            "type": "integer"
          },
          "original_index": {
            "title": "Original Index",
            "type": "integer"
          },
          "preview": {
            "title": "Preview",
            "type": "string"
          }
        },
        "required": [
          "original_index",
          "duplicate_index",
          "preview"
        ],
        "title": "DuplicateSample",
        "type": "object"
      },
      "DuplicatesAnalysis": {
        "properties": {
          "duplicate_count": {
            "title": "Duplicate Count",
            "type": "integer"
          },
          "duplication_rate": {
            "title": "Duplication Rate",
            "type": "number"
          },
          "samples": {
            "items": {
              "$ref": "#/components/schemas/DuplicateSample"
            },
            "title": "Samples",
            "type": "array"
          }
        },
        "required": [
          "duplicate_count",
          "duplication_rate",
          "samples"
        ],
        "title": "DuplicatesAnalysis",
        "type": "object"
      },
      "EmailCanonicalRequest": {
        "description": "Request body for checking Gmail canonical duplicate status.",
        "properties": {
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "title": "EmailCanonicalRequest",
        "type": "object"
      },
      "EmailCanonicalResponse": {
        "description": "Response describing whether a canonical Gmail duplicate exists.",
        "properties": {
          "duplicate": {
            "title": "Duplicate",
            "type": "boolean"
          }
        },
        "required": [
          "duplicate"
        ],
        "title": "EmailCanonicalResponse",
        "type": "object"
      },
      "EmbeddingObject": {
        "description": "A single embedding vector and its position in the input list.",
        "properties": {
          "embedding": {
            "description": "The embedding vector.",
            "items": {
              "type": "number"
            },
            "title": "Embedding",
            "type": "array"
          },
          "index": {
            "description": "Position of this embedding in the input list.",
            "title": "Index",
            "type": "integer"
          },
          "object": {
            "const": "embedding",
            "default": "embedding",
            "title": "Object",
            "type": "string"
          }
        },
        "required": [
          "index",
          "embedding"
        ],
        "title": "EmbeddingObject",
        "type": "object"
      },
      "EmbeddingRequest": {
        "description": "OpenAI-compatible embeddings request payload.",
        "properties": {
          "dimensions": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional output dimensionality, when the model supports it.",
            "title": "Dimensions"
          },
          "encoding_format": {
            "const": "float",
            "default": "float",
            "description": "Format of the returned embeddings. Only float is supported.",
            "title": "Encoding Format",
            "type": "string"
          },
          "input": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "description": "Text or list of texts to embed.",
            "title": "Input"
          },
          "model": {
            "description": "Embedding model identifier.",
            "title": "Model",
            "type": "string"
          },
          "user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque end-user identifier for abuse monitoring.",
            "title": "User"
          }
        },
        "required": [
          "input",
          "model"
        ],
        "title": "EmbeddingRequest",
        "type": "object"
      },
      "EmbeddingResponse": {
        "description": "OpenAI-compatible embeddings response payload.",
        "properties": {
          "data": {
            "description": "One entry per input.",
            "items": {
              "$ref": "#/components/schemas/EmbeddingObject"
            },
            "title": "Data",
            "type": "array"
          },
          "model": {
            "description": "Model that produced the embeddings.",
            "title": "Model",
            "type": "string"
          },
          "object": {
            "const": "list",
            "default": "list",
            "title": "Object",
            "type": "string"
          },
          "usage": {
            "$ref": "#/components/schemas/EmbeddingUsage",
            "description": "Token usage for the request."
          }
        },
        "required": [
          "data",
          "model",
          "usage"
        ],
        "title": "EmbeddingResponse",
        "type": "object"
      },
      "EmbeddingUsage": {
        "description": "Token accounting reported by the provider.",
        "properties": {
          "prompt_tokens": {
            "description": "Tokens consumed by the input.",
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "total_tokens": {
            "description": "Total tokens billed for the request.",
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "prompt_tokens",
          "total_tokens"
        ],
        "title": "EmbeddingUsage",
        "type": "object"
      },
      "EmbeddingsRequest": {
        "description": "Embedding request payload.",
        "properties": {
          "model": {
            "default": "openai/text-embedding-3-small",
            "description": "Embedding model to use for encoding",
            "title": "Model",
            "type": "string"
          },
          "text": {
            "description": "Text to embed",
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "title": "EmbeddingsRequest",
        "type": "object"
      },
      "EmbeddingsResponse": {
        "description": "Embedding response payload.",
        "properties": {
          "embedding": {
            "items": {
              "type": "number"
            },
            "title": "Embedding",
            "type": "array"
          }
        },
        "required": [
          "embedding"
        ],
        "title": "EmbeddingsResponse",
        "type": "object"
      },
      "EncoderInferenceRequest": {
        "description": "Inference request for encoder (GLiNER) tasks.\n\nSupports entity extraction, text classification, JSON extraction,\nand multi-task schema extraction.  ``task`` is optional — when omitted\nthe unified schema path is used (the ``schema`` value is interpreted as\na combined dict or a bare entity list).\n\nAttributes:\n    model_id: Training job ID or explicit encoder base model ID.\n    task: Legacy encoder task type.  Omit for the unified path.\n    text: Input text or list of texts for batch processing.\n    schema_: Extraction/classification schema (format depends on task).\n    threshold: Confidence threshold for predictions.\n    include_confidence: Include confidence scores in results.\n    include_spans: Include character-level start/end positions.\n    format_results: Format results (False for raw extraction data).",
        "properties": {
          "format_results": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "description": "Format results (False for raw extraction data)",
            "title": "Format Results"
          },
          "include_confidence": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "description": "Include confidence scores in results",
            "title": "Include Confidence"
          },
          "include_spans": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "description": "Include character-level start/end positions",
            "title": "Include Spans"
          },
          "is_warmup": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": false,
            "description": "Whether this is a warmup request (not logged to history)",
            "title": "Is Warmup"
          },
          "model_id": {
            "description": "Training job ID of the fine-tuned model, or explicit encoder base model ID (for example 'fastino/gliner2-base-v1')",
            "title": "Model Id",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to associate with this inference. Required for base-model inferences to be picked up by LLMAJ sweeps.",
            "title": "Project Id"
          },
          "schema": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "additionalProperties": true,
                "type": "object"
              }
            ],
            "description": "Schema for extraction. The flat ``list[str]`` form is deprecated; use the unified dict shape for forward compatibility. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` response headers.",
            "title": "Schema"
          },
          "store": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "description": "Whether to store this inference in the history table. Default true — opt out with store=false.",
            "title": "Store"
          },
          "task": {
            "anyOf": [
              {
                "enum": [
                  "extract_entities",
                  "classify_text",
                  "extract_json",
                  "schema"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "**Deprecated** legacy encoder task hint. Omit for the unified schema path. Submitting a legacy value still succeeds but the response carries ``Deprecation: true`` and a ``Sunset`` header.",
            "title": "Task"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "description": "Text to process (single string or list for batch)",
            "title": "Text"
          },
          "threshold": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "default": 0.5,
            "description": "Confidence threshold",
            "title": "Threshold"
          }
        },
        "required": [
          "model_id",
          "text",
          "schema"
        ],
        "title": "EncoderInferenceRequest",
        "type": "object"
      },
      "EncoderInferenceResponse": {
        "description": "Response from an encoder (GLiNER) inference task.\n\nArgs:\n    type: Always ``\"encoder\"``.\n    inference_id: Unique ID for this inference record (for feedback/correlation).\n    result: Extraction/classification result (format depends on task).\n    model_id: Training job ID used for inference.\n    latency_ms: Server-side inference latency in milliseconds.\n    token_usage: Number of input tokens processed.\n    model_used: Model identifier (e.g. ``\"fastino/gliner2-base-v1\"``,\n        ``\"Qwen/Qwen3-8B\"``, or a training job ID).",
        "properties": {
          "inference_id": {
            "description": "Unique ID for this inference record (use for feedback/correlation)",
            "title": "Inference Id",
            "type": "string"
          },
          "latency_ms": {
            "description": "Inference latency in milliseconds",
            "title": "Latency Ms",
            "type": "number"
          },
          "model_id": {
            "description": "Training job ID used for inference",
            "title": "Model Id",
            "type": "string"
          },
          "model_used": {
            "description": "Model identifier (for example 'fastino/gliner2-base-v1', 'Qwen/Qwen3-8B', or a training job ID)",
            "title": "Model Used",
            "type": "string"
          },
          "result": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "items": {},
                "type": "array"
              }
            ],
            "description": "Encoder inference result (format depends on task)",
            "title": "Result"
          },
          "token_usage": {
            "description": "Number of input tokens processed",
            "title": "Token Usage",
            "type": "integer"
          },
          "type": {
            "const": "encoder",
            "default": "encoder",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "inference_id",
          "result",
          "model_id",
          "latency_ms",
          "token_usage",
          "model_used"
        ],
        "title": "EncoderInferenceResponse",
        "type": "object"
      },
      "EntityCount": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "percentage": {
            "title": "Percentage",
            "type": "number"
          }
        },
        "required": [
          "label",
          "count",
          "percentage"
        ],
        "title": "EntityCount",
        "type": "object"
      },
      "EvaluationCreate": {
        "description": "Request to create a new model evaluation.\n\nSupports both single dataset (dataset_name) and multiple datasets (dataset_names).\nSupports both single model (base_model) and multiple models (base_model + comparison_models).\nWhen multiple datasets/models are provided, one evaluation is created per dataset x model combination.",
        "properties": {
          "base_model": {
            "description": "Primary model to evaluate (required). Can be a training job ID, explicit GLiNER model ID (e.g. 'fastino/gliner2-base-v1'), decoder base model ID (e.g. 'base:Qwen/Qwen3-8B'), or LLM model ID",
            "title": "Base Model",
            "type": "string"
          },
          "comparison_models": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional list of models to compare against (e.g., ['fastino/gliner2-base-v1', 'gpt-4o']). Backend routing is determined from the model ID.",
            "title": "Comparison Models"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of a single dataset to evaluate on (use dataset_names for multiple)",
            "title": "Dataset Name"
          },
          "dataset_names": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "List of dataset names to evaluate on (creates one evaluation per dataset)",
            "title": "Dataset Names"
          },
          "dataset_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Dataset Version"
          },
          "label_column": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the label/tags column",
            "title": "Label Column"
          },
          "max_examples": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": 100,
            "description": "Max examples for LLM evaluation",
            "title": "Max Examples"
          },
          "max_tokens": {
            "anyOf": [
              {
                "maximum": 131072.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional max generation tokens for decoder evaluations",
            "title": "Max Tokens"
          },
          "model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "[DEPRECATED] Use base_model instead. Kept for backward compatibility.",
            "title": "Model Id"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional project ID to associate the evaluation with",
            "title": "Project Id"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": 42,
            "description": "Random seed for sampling",
            "title": "Seed"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Task type: 'classification', 'ner', 'json_extraction', or 'decoder'",
            "title": "Task Type"
          },
          "text_column": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the text column",
            "title": "Text Column"
          }
        },
        "required": [
          "base_model"
        ],
        "title": "EvaluationCreate",
        "type": "object"
      },
      "EvaluationCreateResponse": {
        "description": "Response for creating evaluations (supports single or multiple datasets)",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "evaluations": {
            "items": {
              "$ref": "#/components/schemas/EvaluationResponse"
            },
            "title": "Evaluations",
            "type": "array"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "evaluations",
          "count"
        ],
        "title": "EvaluationCreateResponse",
        "type": "object"
      },
      "EvaluationDatasetRow": {
        "description": "Dataset row rendered under the \"Evaluation datasets\" section.\n\nExtends ``TrainingDatasetRow`` with the latest completed evaluation\nagainst the model in context (project or base model).",
        "properties": {
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain type of the dataset (ner, classification, custom, decoder).",
            "title": "Dataset Type"
          },
          "generation_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the dataset was created: synthesize, upload, auto_relabel, manual_relabel, grow, external.",
            "title": "Generation Type"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "latest_evaluation": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DatasetEvaluationSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "sample_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Size"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "version_number": {
            "title": "Version Number",
            "type": "string"
          }
        },
        "required": [
          "id",
          "dataset_name",
          "version_number"
        ],
        "title": "EvaluationDatasetRow",
        "type": "object"
      },
      "EvaluationListResponse": {
        "description": "Response for listing evaluations",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "evaluations": {
            "items": {
              "$ref": "#/components/schemas/EvaluationResponse"
            },
            "title": "Evaluations",
            "type": "array"
          },
          "has_more": {
            "default": false,
            "title": "Has More",
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "evaluations",
          "count"
        ],
        "title": "EvaluationListResponse",
        "type": "object"
      },
      "EvaluationResponse": {
        "description": "Response for a single evaluation",
        "properties": {
          "accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy"
          },
          "bleu_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bleu Score"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "title": "Dataset Version",
            "type": "string"
          },
          "error_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Count"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "error_sample": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Sample"
          },
          "evaluation_time_ms": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Evaluation Time Ms"
          },
          "f1_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "F1 Score"
          },
          "failed_examples": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failed Examples"
          },
          "hamming_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hamming Loss"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "job_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Reference"
          },
          "max_examples": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Examples"
          },
          "max_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tokens"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Name"
          },
          "precision_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Precision Score"
          },
          "predictions": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Predictions"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "recall_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recall Score"
          },
          "rouge_l_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rouge L Score"
          },
          "sample_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Count"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "subset_accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subset Accuracy"
          },
          "total_cost_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Cost Usd"
          },
          "total_latency_ms": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Latency Ms"
          },
          "total_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Tokens"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "validation_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation Loss"
          }
        },
        "required": [
          "id",
          "user_id",
          "model_id",
          "dataset_name",
          "dataset_version",
          "status",
          "created_at"
        ],
        "title": "EvaluationResponse",
        "type": "object"
      },
      "EvaluationSummary": {
        "description": "Subset of an evaluation row surfaced on the models UI.\n\nField set mirrors the existing frontend ``EvaluationSummary`` type so\nthe TypeScript shape is unchanged.",
        "properties": {
          "accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy"
          },
          "bleu_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bleu Score"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dataset Name"
          },
          "dataset_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dataset Version"
          },
          "f1_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "F1 Score"
          },
          "hamming_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hamming Loss"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "precision_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Precision Score"
          },
          "recall_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recall Score"
          },
          "rouge_l_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rouge L Score"
          },
          "sample_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Count"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "subset_accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subset Accuracy"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task Type"
          },
          "validation_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation Loss"
          }
        },
        "required": [
          "id",
          "status"
        ],
        "title": "EvaluationSummary",
        "type": "object"
      },
      "ExpandConstraintChoicesRequest": {
        "description": "Expand constraint choices request",
        "properties": {
          "constraint": {
            "$ref": "#/components/schemas/ConstraintRequest",
            "description": "Constraint to expand"
          },
          "max_count": {
            "default": 10,
            "description": "Maximum number of choices after expansion",
            "maximum": 50.0,
            "minimum": 2.0,
            "title": "Max Count",
            "type": "integer"
          },
          "task_description": {
            "description": "Task description for context",
            "title": "Task Description",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "constraint",
          "task_description"
        ],
        "title": "ExpandConstraintChoicesRequest",
        "type": "object"
      },
      "ExpandConstraintChoicesResponse": {
        "description": "Expand constraint choices response",
        "properties": {
          "constraint": {
            "$ref": "#/components/schemas/ConstraintRequest"
          },
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "expanded_choices": {
            "items": {
              "type": "string"
            },
            "title": "Expanded Choices",
            "type": "array"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "token_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated tokens used for expansion",
            "title": "Token Usage"
          }
        },
        "required": [
          "success",
          "constraint",
          "expanded_choices",
          "count"
        ],
        "title": "ExpandConstraintChoicesResponse",
        "type": "object"
      },
      "FeatureFlagsResponse": {
        "description": "Resolved boolean feature flags for the requesting user.\n\nField naming follows the canonical agent names in the product:\n\n- ``research_agent_enabled``: Deep-research / multi-step research agent\n  (Datadog key ``research_agent_enabled``; renamed from the legacy\n  ``auto_agent_enabled``).\n- ``mle_agent_enabled``: Claude-powered MLE chat agent.\n- ``continuous_adaptation_agent_enabled``: Autonomous fine-tuning loop\n  (Datadog key ``continuous_adaptation_agent_enabled``; renamed from\n  the legacy ``data_engine_agent_enabled``).\n- ``usage_insights_ui_enabled``: Customer-facing usage-aware clustering\n  insights UI (ENG-2110). Decoupled from the backend classify pipeline so\n  the UI can be hidden while the backend keeps computing insights.\n- ``observability_enabled``: Coding-agent cost Observability page and the\n  ``/observability`` API. Off by default; enabled per-team via Datadog\n  targeting (local dev bypasses the gate).\n- ``pioneer_openrouter_provider_enabled``: Whether the OpenRouter provider\n  is allowed for inference registration and routing (Datadog key\n  ``pioneer_openrouter_provider_enabled``). Surfaced here so\n  OpenRouter-specific synthetics can self-gate against the same flag\n  (ENG-4977): when the flag is off, probes that exercise the OpenRouter\n  path exit green rather than paging on a policy-disabled provider.",
        "properties": {
          "billing_credits_page_enabled": {
            "title": "Billing Credits Page Enabled",
            "type": "boolean"
          },
          "continuous_adaptation_agent_enabled": {
            "title": "Continuous Adaptation Agent Enabled",
            "type": "boolean"
          },
          "mle_agent_enabled": {
            "title": "Mle Agent Enabled",
            "type": "boolean"
          },
          "observability_enabled": {
            "title": "Observability Enabled",
            "type": "boolean"
          },
          "pioneer_openrouter_provider_enabled": {
            "title": "Pioneer Openrouter Provider Enabled",
            "type": "boolean"
          },
          "research_agent_enabled": {
            "title": "Research Agent Enabled",
            "type": "boolean"
          },
          "usage_insights_ui_enabled": {
            "title": "Usage Insights Ui Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "research_agent_enabled",
          "mle_agent_enabled",
          "continuous_adaptation_agent_enabled",
          "billing_credits_page_enabled",
          "usage_insights_ui_enabled",
          "observability_enabled",
          "pioneer_openrouter_provider_enabled"
        ],
        "title": "FeatureFlagsResponse",
        "type": "object"
      },
      "GenerateAsyncResponse": {
        "description": "Response from async generation job creation (HTTP 202).\n\nReturned immediately when a background generation job is started.\nThe job_id (which is the dataset_id) can be used to poll for status.",
        "properties": {
          "dataset_name": {
            "description": "Name of the dataset being generated",
            "title": "Dataset Name",
            "type": "string"
          },
          "is_seed": {
            "default": false,
            "description": "Whether this is a seed generation job",
            "title": "Is Seed",
            "type": "boolean"
          },
          "job_id": {
            "description": "Job ID (same as dataset_id) for polling status",
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "default": "Generation job started",
            "description": "Human-readable status message",
            "title": "Message",
            "type": "string"
          },
          "status": {
            "default": "generating",
            "description": "Initial job status: queued or generating",
            "title": "Status",
            "type": "string"
          },
          "task_type": {
            "description": "Generation task type: ner, classification, or custom",
            "title": "Task Type",
            "type": "string"
          }
        },
        "required": [
          "job_id",
          "dataset_name",
          "task_type"
        ],
        "title": "GenerateAsyncResponse",
        "type": "object"
      },
      "GenerateClassificationConstraintsRequest": {
        "description": "Classification constraint generation request",
        "properties": {
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for generation context",
            "title": "Domain Description"
          },
          "labels": {
            "description": "List of classification labels",
            "items": {
              "type": "string"
            },
            "maxItems": 250,
            "minItems": 1,
            "title": "Labels",
            "type": "array"
          },
          "min_criteria": {
            "default": 5,
            "description": "Minimum number of constraints to generate",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Min Criteria",
            "type": "integer"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "labels"
        ],
        "title": "GenerateClassificationConstraintsRequest",
        "type": "object"
      },
      "GenerateConstraintsResponse": {
        "description": "Constraint generation response",
        "properties": {
          "constraints": {
            "items": {
              "$ref": "#/components/schemas/ConstraintRequest"
            },
            "title": "Constraints",
            "type": "array"
          },
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "token_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated tokens used for constraint generation",
            "title": "Token Usage"
          }
        },
        "required": [
          "success",
          "constraints",
          "count"
        ],
        "title": "GenerateConstraintsResponse",
        "type": "object"
      },
      "GenerateInferenceRequest": {
        "description": "Inference request for decoder text generation.\n\nRequires a ``messages`` array in chat format. The last message must\nhave role ``\"user\"`` so the model generates an assistant reply.\n\nArgs:\n    model_id: Training job ID of the fine-tuned decoder model.\n    task: Must be ``\"generate\"``.\n    messages: Chat messages in ``[{role, content}]`` format.\n    max_tokens: Maximum tokens to generate.\n    temperature: Sampling temperature.\n    top_p: Top-p sampling parameter.\n    reasoning: Opt-in reasoning / extended-thinking controls. See\n        :class:`ReasoningRequest` for the full field set.\n    include_reasoning_trace: Include `<think>` trace text separately in the\n        response when present.",
        "properties": {
          "effort": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RoutingEffort"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request routing-effort tier (low/medium/high/xhigh/max) for router models. Overrides the router's stored policy for this request only; ignored for non-router models."
          },
          "include_reasoning_trace": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": false,
            "description": "When true, return extracted <think> reasoning trace separately from completion when available",
            "title": "Include Reasoning Trace"
          },
          "is_warmup": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": false,
            "description": "Whether this is a warmup request (not logged to history)",
            "title": "Is Warmup"
          },
          "max_tokens": {
            "anyOf": [
              {
                "maximum": 131072.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum tokens to generate",
            "title": "Max Tokens"
          },
          "messages": {
            "description": "Chat messages in [{role, content}] format",
            "items": {
              "$ref": "#/components/schemas/schemas__inference__ChatMessage"
            },
            "minItems": 1,
            "title": "Messages",
            "type": "array"
          },
          "model_id": {
            "description": "Training job ID of the fine-tuned decoder model",
            "title": "Model Id",
            "type": "string"
          },
          "models": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request candidate-model subset the router may select between. Overrides the router's stored candidate set for this request only; ignored for non-router models.",
            "title": "Models"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to associate with this inference. Required for base-model inferences to be picked up by LLMAJ sweeps.",
            "title": "Project Id"
          },
          "reasoning": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReasoningRequest"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opt-in reasoning / extended-thinking controls. Honored on Anthropic (native + Bedrock), OpenAI / Fireworks (effort tier only), and OpenRouter. Each field maps to the corresponding wire shape on the resolved upstream; see ReasoningRequest for per-field semantics."
          },
          "store": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "description": "Whether to store this inference in the history table. Default true — opt out with store=false.",
            "title": "Store"
          },
          "task": {
            "const": "generate",
            "description": "Must be 'generate'",
            "title": "Task",
            "type": "string"
          },
          "temperature": {
            "anyOf": [
              {
                "maximum": 2.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Sampling temperature",
            "title": "Temperature"
          },
          "top_p": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Top-p sampling parameter",
            "title": "Top P"
          }
        },
        "required": [
          "model_id",
          "task",
          "messages"
        ],
        "title": "GenerateInferenceRequest",
        "type": "object"
      },
      "GenerateInferenceResponse": {
        "description": "Response from a decoder text generation task.\n\nArgs:\n    type: Always ``\"decoder\"``.\n    inference_id: Unique ID for this inference record (for feedback/correlation).\n    completion: Generated text from the model.\n    reasoning_trace: Optional extracted `<think>` trace text when requested.\n    model_id: Training job ID used for inference.\n    latency_ms: Server-side inference latency in milliseconds.",
        "properties": {
          "completion": {
            "description": "Generated text completion",
            "title": "Completion",
            "type": "string"
          },
          "inference_id": {
            "description": "Unique ID for this inference record (use for feedback/correlation)",
            "title": "Inference Id",
            "type": "string"
          },
          "latency_ms": {
            "description": "Inference latency in milliseconds",
            "title": "Latency Ms",
            "type": "number"
          },
          "model_id": {
            "description": "Training job ID used for inference",
            "title": "Model Id",
            "type": "string"
          },
          "reasoning_trace": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional extracted <think> reasoning trace text when requested",
            "title": "Reasoning Trace"
          },
          "type": {
            "const": "decoder",
            "default": "decoder",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "inference_id",
          "completion",
          "model_id",
          "latency_ms"
        ],
        "title": "GenerateInferenceResponse",
        "type": "object"
      },
      "GenerateJobStatus": {
        "description": "Response from job status polling endpoint.\n\nReturns current status and, when complete, the generated data.",
        "properties": {
          "count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of generated rows (only present when status is 'ready')",
            "title": "Count"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Job creation timestamp",
            "title": "Created At"
          },
          "data": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Generated data rows (only present when status is 'ready')",
            "title": "Data"
          },
          "dataset": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset info (only present when status is 'ready')",
            "title": "Dataset"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Error message (only present when status is 'failed')",
            "title": "Error"
          },
          "is_seed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether this is a seed dataset",
            "title": "Is Seed"
          },
          "job_id": {
            "description": "Job ID (same as dataset_id)",
            "title": "Job Id",
            "type": "string"
          },
          "status": {
            "description": "Job status: queued, generating, ready, failed",
            "title": "Status",
            "type": "string"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Generation task type: ner, classification, or custom",
            "title": "Task Type"
          },
          "token_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated tokens used (only present when status is 'ready')",
            "title": "Token Usage"
          }
        },
        "required": [
          "job_id",
          "status"
        ],
        "title": "GenerateJobStatus",
        "type": "object"
      },
      "GenerateNERConstraintsRequest": {
        "description": "NER constraint generation request",
        "properties": {
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for generation context",
            "title": "Domain Description"
          },
          "labels": {
            "description": "List of entity labels",
            "items": {
              "type": "string"
            },
            "title": "Labels",
            "type": "array"
          },
          "min_criteria": {
            "default": 5,
            "description": "Minimum number of constraints to generate",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Min Criteria",
            "type": "integer"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "labels"
        ],
        "title": "GenerateNERConstraintsRequest",
        "type": "object"
      },
      "GenerateRecordsConstraintsRequest": {
        "description": "Records constraint generation request",
        "properties": {
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for generation context",
            "title": "Domain Description"
          },
          "fields": {
            "description": "Field definitions for structured records",
            "items": {
              "$ref": "#/components/schemas/RecordField"
            },
            "title": "Fields",
            "type": "array"
          },
          "min_criteria": {
            "default": 5,
            "description": "Minimum number of constraints to generate",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Min Criteria",
            "type": "integer"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "fields"
        ],
        "title": "GenerateRecordsConstraintsRequest",
        "type": "object"
      },
      "GenerateRequest": {
        "description": "Unified async generation request for all task types.\n\nUse ``task_type`` to specify what kind of dataset to generate.\nAll generation goes through SQS with BackgroundTasks fallback.\n\nTask-specific required fields:\n- ``ner``: requires ``labels``\n- ``classification``: requires ``labels``\n- ``custom``: requires ``prompt``\n- ``decoder``: requires ``domain_description``\n- ``records``: requires ``fields``\n- ``fields``: requires ``input_fields`` and ``output_fields``",
        "properties": {
          "batch_size": {
            "default": 5,
            "description": "Batch size for generation API calls",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Batch Size",
            "type": "integer"
          },
          "class_balance": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "number"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional class distribution map (classification only)",
            "title": "Class Balance"
          },
          "classified_examples": {
            "anyOf": [
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/NERClassifiedExample"
                    },
                    {
                      "$ref": "#/components/schemas/ClassifiedExample"
                    }
                  ]
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Seed examples for generation. NER: {text, entities: [[span, label], ...], feedback?}. Classification: {text, label, feedback?}.",
            "title": "Classified Examples"
          },
          "config_num_examples": {
            "default": 5,
            "description": "Number of examples to use for config generation",
            "maximum": 20.0,
            "minimum": 0.0,
            "title": "Config Num Examples",
            "type": "integer"
          },
          "constraints": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ConstraintRequest"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom constraints applied to all generated examples",
            "title": "Constraints"
          },
          "dataset_name": {
            "description": "Name for the generated dataset",
            "minLength": 1,
            "title": "Dataset Name",
            "type": "string"
          },
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for generation context (required for decoder)",
            "title": "Domain Description"
          },
          "fields": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RecordField"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Field definitions for structured records (required for records)",
            "title": "Fields"
          },
          "generation_profile": {
            "default": "auto",
            "description": "Queue/runtime execution profile. 'auto' selects a task-aware default.",
            "enum": [
              "auto",
              "fast",
              "balanced",
              "quality"
            ],
            "title": "Generation Profile",
            "type": "string"
          },
          "include_reasoning_trace": {
            "default": false,
            "description": "Whether to include reasoning traces (<think> blocks) in generated outputs for decoder tasks. Ignored when task_type is not 'decoder'.",
            "title": "Include Reasoning Trace",
            "type": "boolean"
          },
          "infer_output_format": {
            "default": false,
            "description": "Infer output format from prompt when output_format is absent",
            "title": "Infer Output Format",
            "type": "boolean"
          },
          "input_fields": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RecordField"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Input field definitions (required for fields)",
            "title": "Input Fields"
          },
          "instruction": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "System instruction for decoder chat format",
            "title": "Instruction"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 250,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Entity/classification labels (required for ner and classification)",
            "title": "Labels"
          },
          "min_criteria": {
            "default": 10,
            "description": "Minimum diversity criteria to generate",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Min Criteria",
            "type": "integer"
          },
          "multi_label": {
            "default": false,
            "description": "Enable multi-label classification (classification only)",
            "title": "Multi Label",
            "type": "boolean"
          },
          "multiplicator": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MultiplicatorRequest"
              },
              {
                "type": "null"
              }
            ],
            "description": "Multiplicator for balanced distribution across choices"
          },
          "negative_ratio": {
            "anyOf": [
              {
                "maximum": 50.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percentage of rows with no labels (NER negative samples)",
            "title": "Negative Ratio"
          },
          "num_examples": {
            "default": 10,
            "description": "Number of examples to generate",
            "maximum": 5000.0,
            "minimum": 1.0,
            "title": "Num Examples",
            "type": "integer"
          },
          "output_fields": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RecordField"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Output field definitions (required for fields)",
            "title": "Output Fields"
          },
          "output_format": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Expected output schema for custom generation",
            "title": "Output Format"
          },
          "project_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to assign the dataset to",
            "title": "Project Id"
          },
          "prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Natural language prompt describing the task (required for custom)",
            "title": "Prompt"
          },
          "quality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Generation quality: 'light', 'medium', or 'heavy'",
            "title": "Quality"
          },
          "reasoning_effort": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Reasoning effort for the underlying LLM (e.g., 'low', 'medium', 'high')",
            "title": "Reasoning Effort"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Random seed for reproducibility",
            "title": "Seed"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session ID for log streaming",
            "title": "Session Id"
          },
          "split_ratio": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SplitRatioConfig"
              },
              {
                "type": "null"
              }
            ],
            "description": "Split ratio when type is 'split'. Ignored otherwise."
          },
          "target_choices": {
            "default": 15,
            "description": "Number of choices to expand for diversity",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Target Choices",
            "type": "integer"
          },
          "task_type": {
            "description": "Type of generation task",
            "enum": [
              "ner",
              "classification",
              "custom",
              "decoder",
              "records",
              "fields"
            ],
            "title": "Task Type",
            "type": "string"
          },
          "temperature": {
            "default": 0.7,
            "description": "Generation temperature",
            "maximum": 2.0,
            "minimum": 0.0,
            "title": "Temperature",
            "type": "number"
          },
          "type": {
            "default": "training",
            "description": "Dataset type tag: 'training', 'evaluation', or 'split'",
            "title": "Type",
            "type": "string"
          },
          "use_meta_felix": {
            "default": true,
            "description": "Use MetaFelix for auto-generating diversity criteria",
            "title": "Use Meta Felix",
            "type": "boolean"
          },
          "visibility": {
            "default": "private",
            "description": "Dataset visibility: 'private' or 'public'",
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "task_type",
          "dataset_name"
        ],
        "title": "GenerateRequest",
        "type": "object"
      },
      "GenerateResponse": {
        "description": "Generation response",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "data": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Data",
            "type": "array"
          },
          "dataset": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset info if saved to S3/database",
            "title": "Dataset"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "task_type": {
            "title": "Task Type",
            "type": "string"
          },
          "token_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated tokens used for generation",
            "title": "Token Usage"
          }
        },
        "required": [
          "success",
          "data",
          "count",
          "task_type"
        ],
        "title": "GenerateResponse",
        "type": "object"
      },
      "GlinerJobStatus": {
        "description": "Response from job status check.",
        "properties": {
          "completed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "result": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "token_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Usage"
          }
        },
        "required": [
          "job_id",
          "status",
          "created_at"
        ],
        "title": "GlinerJobStatus",
        "type": "object"
      },
      "GlinerRequest": {
        "description": "Request for GLiNER-2 processing (sync).",
        "properties": {
          "format_results": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Format Results"
          },
          "include_confidence": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Include Confidence"
          },
          "include_spans": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Include Spans"
          },
          "schema": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "additionalProperties": true,
                "type": "object"
              }
            ],
            "description": "Extraction schema. The flat ``list[str]`` of entity labels is deprecated; use the unified dict shape (``entities`` / ``classifications`` / ``structures`` / ``relations``) for forward compatibility. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.",
            "title": "Schema"
          },
          "task": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "**Deprecated** legacy task hint. One of: 'extract_entities', 'classify_text', 'extract_json', 'schema'. Omit for the unified GLiNER2 path. Submitting a legacy task value still succeeds but the response carries ``Deprecation: true`` and a ``Sunset`` header.",
            "title": "Task"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "title": "Text"
          },
          "threshold": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "default": 0.5,
            "title": "Threshold"
          }
        },
        "required": [
          "text",
          "schema"
        ],
        "title": "GlinerRequest",
        "type": "object"
      },
      "GlinerResponse": {
        "description": "Response from GLiNER-2 processing.",
        "properties": {
          "result": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "items": {},
                "type": "array"
              }
            ],
            "title": "Result"
          },
          "token_usage": {
            "title": "Token Usage",
            "type": "integer"
          }
        },
        "required": [
          "result",
          "token_usage"
        ],
        "title": "GlinerResponse",
        "type": "object"
      },
      "GrowDatasetRequest": {
        "description": "Request to grow an existing dataset by generating new examples.\n\nSupports both classification and NER datasets. When class_balance is enabled,\ngenerates equal examples per class. Otherwise, generates equal examples per\nsource example from the original dataset.",
        "properties": {
          "class_balance": {
            "default": true,
            "description": "If True, balance classes equally. If False, generate equal examples per source example.",
            "title": "Class Balance",
            "type": "boolean"
          },
          "dataset_id": {
            "description": "ID of the existing dataset to grow from",
            "title": "Dataset Id",
            "type": "string"
          },
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Override domain description for generation context",
            "title": "Domain Description"
          },
          "new_dataset_name": {
            "description": "Name for the new grown dataset",
            "maxLength": 255,
            "minLength": 1,
            "title": "New Dataset Name",
            "type": "string"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session ID for log streaming",
            "title": "Session Id"
          },
          "target_size": {
            "description": "Total number of examples in the final dataset",
            "maximum": 100000.0,
            "minimum": 1.0,
            "title": "Target Size",
            "type": "integer"
          },
          "temperature": {
            "default": 0.7,
            "description": "Generation temperature",
            "maximum": 2.0,
            "minimum": 0.0,
            "title": "Temperature",
            "type": "number"
          }
        },
        "required": [
          "dataset_id",
          "new_dataset_name",
          "target_size"
        ],
        "title": "GrowDatasetRequest",
        "type": "object"
      },
      "GrowDatasetResponse": {
        "description": "Response from dataset grow operation.",
        "properties": {
          "dataset": {
            "additionalProperties": true,
            "description": "New dataset info (id, name, path, version)",
            "title": "Dataset",
            "type": "object"
          },
          "distribution": {
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Number of examples generated per class/label",
            "title": "Distribution",
            "type": "object"
          },
          "generated_count": {
            "description": "Number of new examples generated",
            "title": "Generated Count",
            "type": "integer"
          },
          "new_size": {
            "description": "Total number of examples in the new dataset",
            "title": "New Size",
            "type": "integer"
          },
          "original_size": {
            "description": "Number of examples in the original dataset",
            "title": "Original Size",
            "type": "integer"
          },
          "success": {
            "description": "Whether the operation succeeded",
            "title": "Success",
            "type": "boolean"
          },
          "token_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated tokens used for generation",
            "title": "Token Usage"
          }
        },
        "required": [
          "success",
          "dataset",
          "original_size",
          "new_size",
          "generated_count",
          "distribution"
        ],
        "title": "GrowDatasetResponse",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "HarnessCoverage": {
        "description": "Category-coverage gating for one harness family.",
        "properties": {
          "coverage": {
            "enum": [
              "full",
              "partial",
              "excluded"
            ],
            "title": "Coverage",
            "type": "string"
          },
          "harness": {
            "title": "Harness",
            "type": "string"
          }
        },
        "required": [
          "harness",
          "coverage"
        ],
        "title": "HarnessCoverage",
        "type": "object"
      },
      "HarnessRollup": {
        "description": "Per-harness rollup — the headline table of the observability page.",
        "properties": {
          "category_coverage": {
            "enum": [
              "full",
              "partial",
              "excluded"
            ],
            "title": "Category Coverage",
            "type": "string"
          },
          "direct_spend": {
            "default": 0.0,
            "description": "Spend for this harness on raw direct-model calls (USD).",
            "title": "Direct Spend",
            "type": "number"
          },
          "harness": {
            "title": "Harness",
            "type": "string"
          },
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "median_cost_per_session": {
            "description": "Median ``total_cost`` across ``session`` tasks (one-shots excluded).",
            "title": "Median Cost Per Session",
            "type": "number"
          },
          "models_used": {
            "items": {
              "type": "string"
            },
            "title": "Models Used",
            "type": "array"
          },
          "one_shot_count": {
            "title": "One Shot Count",
            "type": "integer"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "p90_cost_per_session": {
            "description": "90th-percentile ``total_cost`` across ``session`` tasks.",
            "title": "P90 Cost Per Session",
            "type": "number"
          },
          "routed_spend": {
            "default": 0.0,
            "description": "Spend for this harness served via the router (USD).",
            "title": "Routed Spend",
            "type": "number"
          },
          "session_count": {
            "title": "Session Count",
            "type": "integer"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "surfaces": {
            "items": {
              "$ref": "#/components/schemas/HarnessSurfaceBreakdown"
            },
            "title": "Surfaces",
            "type": "array"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "harness",
          "category_coverage",
          "spend",
          "task_count",
          "session_count",
          "one_shot_count",
          "median_cost_per_session",
          "p90_cost_per_session",
          "input_tokens",
          "output_tokens",
          "total_tokens",
          "models_used",
          "surfaces"
        ],
        "title": "HarnessRollup",
        "type": "object"
      },
      "HarnessSlice": {
        "description": "Spend / task count attributed to one harness family.",
        "properties": {
          "harness": {
            "title": "Harness",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          }
        },
        "required": [
          "harness",
          "spend",
          "task_count"
        ],
        "title": "HarnessSlice",
        "type": "object"
      },
      "HarnessSurfaceBreakdown": {
        "description": "Spend / task split for one sub-surface within a harness family.",
        "properties": {
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "surface": {
            "description": "e.g. codex ``desktop``/``tui``/``exec``/``vscode``.",
            "title": "Surface",
            "type": "string"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          }
        },
        "required": [
          "surface",
          "spend",
          "task_count"
        ],
        "title": "HarnessSurfaceBreakdown",
        "type": "object"
      },
      "HarnessesResponse": {
        "description": "All per-harness rollups plus the data-quality envelope.",
        "properties": {
          "harnesses": {
            "items": {
              "$ref": "#/components/schemas/HarnessRollup"
            },
            "title": "Harnesses",
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          }
        },
        "required": [
          "harnesses",
          "meta"
        ],
        "title": "HarnessesResponse",
        "type": "object"
      },
      "HistogramBucket": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "range": {
            "title": "Range",
            "type": "string"
          }
        },
        "required": [
          "range",
          "count"
        ],
        "title": "HistogramBucket",
        "type": "object"
      },
      "HourOfDayPoint": {
        "description": "Spend / tokens for one (hour-of-day, key) cell of the usage-pattern chart.",
        "properties": {
          "hour": {
            "description": "Hour of day, 0-23 (UTC).",
            "maximum": 23.0,
            "minimum": 0.0,
            "title": "Hour",
            "type": "integer"
          },
          "key": {
            "description": "Series key — a harness family or a model name.",
            "title": "Key",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "hour",
          "key",
          "spend",
          "total_tokens"
        ],
        "title": "HourOfDayPoint",
        "type": "object"
      },
      "HuggingFaceDisconnectResponse": {
        "description": "Response for disconnecting a HuggingFace connection.",
        "properties": {
          "success": {
            "description": "Whether the disconnect succeeded.",
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "title": "HuggingFaceDisconnectResponse",
        "type": "object"
      },
      "HuggingFaceOAuthStateRequest": {
        "description": "Request body for creating a HuggingFace OAuth state token.",
        "properties": {
          "redirect_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional post-connect redirect URL.",
            "title": "Redirect Url"
          }
        },
        "title": "HuggingFaceOAuthStateRequest",
        "type": "object"
      },
      "HuggingFaceOAuthStateResponse": {
        "description": "Response containing the generated HuggingFace OAuth state token.",
        "properties": {
          "state_token": {
            "description": "Generated state token.",
            "title": "State Token",
            "type": "string"
          }
        },
        "required": [
          "state_token"
        ],
        "title": "HuggingFaceOAuthStateResponse",
        "type": "object"
      },
      "HuggingFacePullPreviewResponse": {
        "description": "Response containing preview data from a HuggingFace dataset pull (without saving).",
        "properties": {
          "columns": {
            "description": "List of column names",
            "items": {
              "type": "string"
            },
            "title": "Columns",
            "type": "array"
          },
          "dataset_type": {
            "description": "Inferred dataset type (classification, ner, custom)",
            "title": "Dataset Type",
            "type": "string"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset metadata from HuggingFace",
            "title": "Metadata"
          },
          "preview_rows": {
            "description": "Sample rows from the dataset (first 50 rows)",
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Preview Rows",
            "type": "array"
          },
          "schema_": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Inferred schema mapping column names to data types",
            "title": "Schema"
          },
          "total_rows": {
            "description": "Total number of rows in the dataset",
            "title": "Total Rows",
            "type": "integer"
          }
        },
        "required": [
          "preview_rows",
          "total_rows",
          "columns",
          "dataset_type"
        ],
        "title": "HuggingFacePullPreviewResponse",
        "type": "object"
      },
      "HuggingFacePullRequest": {
        "description": "Request to pull dataset from HuggingFace Hub.",
        "properties": {
          "column_mapping": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Column mapping from source to standard names",
            "title": "Column Mapping"
          },
          "dataset_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset type (ner, classification, custom)",
            "title": "Dataset Type"
          },
          "hf_token": {
            "description": "HuggingFace API token",
            "title": "Hf Token",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name for the local dataset (defaults to repo name)",
            "title": "Name"
          },
          "repo_id": {
            "description": "HuggingFace repo ID to pull from",
            "title": "Repo Id",
            "type": "string"
          },
          "revision": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Specific revision/branch to pull",
            "title": "Revision"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session ID for SSE log streaming",
            "title": "Session Id"
          }
        },
        "required": [
          "repo_id",
          "hf_token"
        ],
        "title": "HuggingFacePullRequest",
        "type": "object"
      },
      "HuggingFacePushModelRequest": {
        "description": "Request to push a trained model to HuggingFace Hub",
        "properties": {
          "commit_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional commit message for the push",
            "title": "Commit Message"
          },
          "hf_token": {
            "description": "HuggingFace API token with write permissions",
            "title": "Hf Token",
            "type": "string"
          },
          "private": {
            "default": true,
            "description": "Whether repo should be private",
            "title": "Private",
            "type": "boolean"
          },
          "repo_id": {
            "description": "HuggingFace repo ID (e.g., 'username/model-name')",
            "title": "Repo Id",
            "type": "string"
          }
        },
        "required": [
          "repo_id",
          "hf_token"
        ],
        "title": "HuggingFacePushModelRequest",
        "type": "object"
      },
      "HuggingFacePushRequest": {
        "description": "Request to push dataset to HuggingFace Hub.",
        "properties": {
          "commit_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Commit message for the push",
            "title": "Commit Message"
          },
          "hf_token": {
            "description": "HuggingFace API token",
            "title": "Hf Token",
            "type": "string"
          },
          "private": {
            "default": true,
            "description": "Whether repo should be private",
            "title": "Private",
            "type": "boolean"
          },
          "repo_id": {
            "description": "HuggingFace repo ID (e.g., 'user/dataset')",
            "title": "Repo Id",
            "type": "string"
          }
        },
        "required": [
          "repo_id",
          "hf_token"
        ],
        "title": "HuggingFacePushRequest",
        "type": "object"
      },
      "ImageContentBlock": {
        "description": "Anthropic image content block.",
        "properties": {
          "source": {
            "$ref": "#/components/schemas/ImageSource"
          },
          "type": {
            "const": "image",
            "default": "image",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "source"
        ],
        "title": "ImageContentBlock",
        "type": "object"
      },
      "ImageSource": {
        "description": "Anthropic image source (base64 or HTTPS URL).",
        "properties": {
          "data": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          },
          "media_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Media Type"
          },
          "type": {
            "enum": [
              "base64",
              "url"
            ],
            "title": "Type",
            "type": "string"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          }
        },
        "required": [
          "type"
        ],
        "title": "ImageSource",
        "type": "object"
      },
      "ImprovePromptRequest": {
        "description": "Request to improve a dataset generation prompt.",
        "properties": {
          "data_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The dataset type (classification, entity_extraction, json_extraction)",
            "title": "Data Type"
          },
          "prompt": {
            "description": "The user's original prompt to improve",
            "minLength": 1,
            "title": "Prompt",
            "type": "string"
          }
        },
        "required": [
          "prompt"
        ],
        "title": "ImprovePromptRequest",
        "type": "object"
      },
      "ImprovePromptResponse": {
        "description": "Response containing the improved prompt.",
        "properties": {
          "improved_prompt": {
            "title": "Improved Prompt",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "summary": {
            "description": "Short summary of what was improved",
            "title": "Summary",
            "type": "string"
          }
        },
        "required": [
          "success",
          "improved_prompt",
          "summary"
        ],
        "title": "ImprovePromptResponse",
        "type": "object"
      },
      "ImprovementCandidate": {
        "description": "A deployable adapter candidate for the monitoring homepage.\n\nAttributes:\n    project_id: Project that owns the candidate adapter.\n    project_name: Display name of the project.\n    training_job_id: Training job backing the adapter.\n    adapter_name: Display name of the adapter.\n    base_model: Base model used by the adapter.\n    score: Backend-computed priority score.\n    score_name: Metric name used for the score.\n    eval_metrics: Raw evaluation metrics for display details.\n    eval_sample_count: Number of examples used by the evaluation.\n    evaluated_at: Evaluation completion timestamp.\n    training_completed_at: Training completion timestamp.\n    source: Selection source.\n    agent_run_id: Agent run that selected the candidate, if applicable.\n    agent_remarks: Agent remarks, if applicable.",
        "properties": {
          "adapter_name": {
            "title": "Adapter Name",
            "type": "string"
          },
          "agent_remarks": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Remarks"
          },
          "agent_run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Run Id"
          },
          "base_model": {
            "title": "Base Model",
            "type": "string"
          },
          "eval_metrics": {
            "additionalProperties": true,
            "title": "Eval Metrics",
            "type": "object"
          },
          "eval_sample_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Eval Sample Count"
          },
          "evaluated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Evaluated At"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "project_name": {
            "title": "Project Name",
            "type": "string"
          },
          "score": {
            "title": "Score",
            "type": "number"
          },
          "score_name": {
            "title": "Score Name",
            "type": "string"
          },
          "source": {
            "enum": [
              "agent_selected",
              "evaluation_fallback"
            ],
            "title": "Source",
            "type": "string"
          },
          "training_completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Training Completed At"
          },
          "training_job_id": {
            "title": "Training Job Id",
            "type": "string"
          }
        },
        "required": [
          "project_id",
          "project_name",
          "training_job_id",
          "adapter_name",
          "base_model",
          "score",
          "score_name",
          "eval_metrics",
          "source"
        ],
        "title": "ImprovementCandidate",
        "type": "object"
      },
      "ImprovementCandidatesResponse": {
        "description": "Response for listing monitoring improvement candidates.\n\nAttributes:\n    candidates: Improvement candidates after workspace-level filtering.",
        "properties": {
          "candidates": {
            "items": {
              "$ref": "#/components/schemas/ImprovementCandidate"
            },
            "title": "Candidates",
            "type": "array"
          }
        },
        "required": [
          "candidates"
        ],
        "title": "ImprovementCandidatesResponse",
        "type": "object"
      },
      "ImprovementTimeseriesResponse": {
        "description": "Grouped training-job + evals + base-model-eval for a project.\n\nThe ``adapters`` list is ordered by training-job creation date\ndescending (newest first). Re-sorting for display (e.g. ascending\nby score) is handled on the frontend.\n\nAttributes:\n    base_model_id: The shared base-model string used by adapters in\n        this project (e.g. ``\"base:Qwen/Qwen3-8B\"``).  None when the\n        project has no training jobs yet.\n    base_model_eval: Latest completed evaluation against the base model.\n        None when no base-model evaluation exists.\n    adapters: Training jobs with their evaluations, newest first.",
        "properties": {
          "adapters": {
            "items": {
              "$ref": "#/components/schemas/AdapterTimeseriesEntry"
            },
            "title": "Adapters",
            "type": "array"
          },
          "base_model_eval": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EvaluationResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "base_model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Model Id"
          }
        },
        "required": [
          "adapters"
        ],
        "title": "ImprovementTimeseriesResponse",
        "type": "object"
      },
      "InferAdvancedRequest": {
        "description": "Request to infer constraints and multiplicator from a prompt.",
        "properties": {
          "data_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The dataset type (classification, entity_extraction, json_extraction)",
            "title": "Data Type"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "The labels / entity types / classes for the dataset",
            "title": "Labels"
          },
          "prompt": {
            "description": "The user's dataset generation prompt",
            "minLength": 1,
            "title": "Prompt",
            "type": "string"
          }
        },
        "required": [
          "prompt"
        ],
        "title": "InferAdvancedRequest",
        "type": "object"
      },
      "InferAdvancedResponse": {
        "description": "Response containing inferred constraints and multiplicator.",
        "properties": {
          "constraints": {
            "description": "Suggested constraints for the generation",
            "items": {
              "$ref": "#/components/schemas/InferredConstraint"
            },
            "title": "Constraints",
            "type": "array"
          },
          "multiplicator": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InferredMultiplicator"
              },
              {
                "type": "null"
              }
            ],
            "description": "Suggested multiplicator for balanced distribution"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "title": "InferAdvancedResponse",
        "type": "object"
      },
      "InferClassificationLabelsRequest": {
        "description": "Classification label inference request",
        "properties": {
          "domain_description": {
            "description": "Domain description for inferring classification labels",
            "title": "Domain Description",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "domain_description"
        ],
        "title": "InferClassificationLabelsRequest",
        "type": "object"
      },
      "InferFieldsRequest": {
        "description": "Request to infer fields from domain description",
        "properties": {
          "domain_description": {
            "description": "Domain description for field inference",
            "title": "Domain Description",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "domain_description"
        ],
        "title": "InferFieldsRequest",
        "type": "object"
      },
      "InferFieldsResponse": {
        "description": "Field inference response",
        "properties": {
          "input_fields": {
            "items": {
              "$ref": "#/components/schemas/RecordField"
            },
            "title": "Input Fields",
            "type": "array"
          },
          "mode": {
            "title": "Mode",
            "type": "string"
          },
          "output_fields": {
            "items": {
              "$ref": "#/components/schemas/RecordField"
            },
            "title": "Output Fields",
            "type": "array"
          },
          "reasoning": {
            "title": "Reasoning",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "input_fields",
          "output_fields",
          "mode",
          "reasoning"
        ],
        "title": "InferFieldsResponse",
        "type": "object"
      },
      "InferLabelsResponse": {
        "description": "Label inference response",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "labels": {
            "items": {
              "type": "string"
            },
            "title": "Labels",
            "type": "array"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "labels",
          "count"
        ],
        "title": "InferLabelsResponse",
        "type": "object"
      },
      "InferNERLabelsRequest": {
        "description": "NER label inference request",
        "properties": {
          "domain_description": {
            "description": "Domain description for inferring entity types",
            "title": "Domain Description",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "domain_description"
        ],
        "title": "InferNERLabelsRequest",
        "type": "object"
      },
      "InferenceClusterBaseModelGroup": {
        "description": "Cluster groups for one base model.\n\nAttributes:\n    base_model: Base model identifier.\n    variants: Variant groups under this base model.",
        "properties": {
          "base_model": {
            "title": "Base Model",
            "type": "string"
          },
          "variants": {
            "items": {
              "$ref": "#/components/schemas/InferenceClusterVariantGroup"
            },
            "title": "Variants",
            "type": "array"
          }
        },
        "required": [
          "base_model"
        ],
        "title": "InferenceClusterBaseModelGroup",
        "type": "object"
      },
      "InferenceClusterCard": {
        "description": "Cluster summary returned in project cluster lists.\n\nAttributes:\n    id: Cluster ID.\n    rank: Rank within the selected project/model/window.\n    status: Cluster lifecycle status.\n    severity: User-facing severity bucket.\n    failure_label: Display label for the failure mode.\n    summary: Short explanation of why this cluster failed.\n    metrics: Metrics for the selected window.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "failure_facts": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Failure Facts",
            "type": "array"
          },
          "failure_label": {
            "title": "Failure Label",
            "type": "string"
          },
          "failure_label_slug": {
            "title": "Failure Label Slug",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_member_added_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Member Added At"
          },
          "last_refresh_error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Refresh Error Message"
          },
          "last_refresh_failed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Refresh Failed At"
          },
          "last_refreshed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Refreshed At"
          },
          "metrics": {
            "$ref": "#/components/schemas/InferenceClusterMetrics"
          },
          "rank": {
            "title": "Rank",
            "type": "integer"
          },
          "representative_examples": {
            "items": {
              "$ref": "#/components/schemas/InferenceClusterExample"
            },
            "title": "Representative Examples",
            "type": "array"
          },
          "root_cause_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Root Cause Label"
          },
          "root_cause_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Root Cause Slug"
          },
          "root_causes": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Root Causes",
            "type": "array"
          },
          "severity": {
            "enum": [
              "high",
              "mid",
              "low"
            ],
            "title": "Severity",
            "type": "string"
          },
          "status": {
            "enum": [
              "open",
              "reopened",
              "resolved",
              "ignored"
            ],
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "task_domain_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task Domain Label"
          },
          "task_domain_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task Domain Slug"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "usage_taxonomy_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usage Taxonomy Label"
          },
          "usage_taxonomy_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usage Taxonomy Slug"
          }
        },
        "required": [
          "id",
          "rank",
          "status",
          "severity",
          "failure_label",
          "failure_label_slug",
          "summary",
          "created_at",
          "updated_at"
        ],
        "title": "InferenceClusterCard",
        "type": "object"
      },
      "InferenceClusterDetail": {
        "description": "Detailed response for a single cluster.\n\nAttributes:\n    project_id: Project ID that owns the cluster.\n    base_model: Base model identifier.\n    variant_type: Base or adapter variant.\n    model_id: Inference model ID.\n    training_job_id: Training job ID for adapter variants.\n    metrics_by_window: All persisted window metrics.\n    member_count: Total active member count.",
        "properties": {
          "base_model": {
            "title": "Base Model",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "failure_facts": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Failure Facts",
            "type": "array"
          },
          "failure_label": {
            "title": "Failure Label",
            "type": "string"
          },
          "failure_label_slug": {
            "title": "Failure Label Slug",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_member_added_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Member Added At"
          },
          "last_refresh_error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Refresh Error Message"
          },
          "last_refresh_failed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Refresh Failed At"
          },
          "last_refreshed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Refreshed At"
          },
          "member_count": {
            "default": 0,
            "title": "Member Count",
            "type": "integer"
          },
          "metrics": {
            "$ref": "#/components/schemas/InferenceClusterMetrics"
          },
          "metrics_by_window": {
            "additionalProperties": true,
            "title": "Metrics By Window",
            "type": "object"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "rank": {
            "title": "Rank",
            "type": "integer"
          },
          "representative_examples": {
            "items": {
              "$ref": "#/components/schemas/InferenceClusterExample"
            },
            "title": "Representative Examples",
            "type": "array"
          },
          "representative_inference_ids": {
            "items": {
              "type": "string"
            },
            "title": "Representative Inference Ids",
            "type": "array"
          },
          "root_cause_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Root Cause Label"
          },
          "root_cause_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Root Cause Slug"
          },
          "root_causes": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Root Causes",
            "type": "array"
          },
          "severity": {
            "enum": [
              "high",
              "mid",
              "low"
            ],
            "title": "Severity",
            "type": "string"
          },
          "status": {
            "enum": [
              "open",
              "reopened",
              "resolved",
              "ignored"
            ],
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "task_domain_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task Domain Label"
          },
          "task_domain_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task Domain Slug"
          },
          "training_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Training Job Id"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "usage_taxonomy_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usage Taxonomy Label"
          },
          "usage_taxonomy_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usage Taxonomy Slug"
          },
          "variant_type": {
            "enum": [
              "base",
              "adapter"
            ],
            "title": "Variant Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "rank",
          "status",
          "severity",
          "failure_label",
          "failure_label_slug",
          "summary",
          "created_at",
          "updated_at",
          "project_id",
          "base_model",
          "variant_type",
          "model_id"
        ],
        "title": "InferenceClusterDetail",
        "type": "object"
      },
      "InferenceClusterExample": {
        "description": "Compact inference record used in cluster card/examples responses.\n\nAttributes:\n    id: Inference ID.\n    created_at: When the inference was recorded.\n    input: Raw input stored on the inference.\n    output: Model output stored on the inference. May be a structured dict\n        for parser-style models or a plain string for free-form decoder\n        outputs and refusals.\n    llmaj_verdict: LLMAJ verdict for this inference.\n    llmaj_score: Optional LLMAJ score.\n    llmaj_reasoning: Judge explanation for the verdict.\n    llmaj_corrected_output: Optional judge-provided corrected output.",
        "properties": {
          "base_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Model"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "full_record": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Full Record"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "input": {
            "title": "Input",
            "type": "string"
          },
          "llmaj_corrected_output": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Llmaj Corrected Output"
          },
          "llmaj_reasoning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llmaj Reasoning"
          },
          "llmaj_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llmaj Score"
          },
          "llmaj_verdict": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Llmaj Verdict"
          },
          "model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Id"
          },
          "output": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Output"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "training_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Training Job Id"
          }
        },
        "required": [
          "id",
          "input",
          "provider"
        ],
        "title": "InferenceClusterExample",
        "type": "object"
      },
      "InferenceClusterInferencesResponse": {
        "description": "Paginated inference list for cluster members or pass context.\n\nAttributes:\n    cluster_id: Cluster ID.\n    role: Which inference set was returned.\n    inferences: Paginated inference records.\n    total: Total records matching this request.\n    limit: Page limit.\n    offset: Page offset.",
        "properties": {
          "cluster_id": {
            "title": "Cluster Id",
            "type": "string"
          },
          "inferences": {
            "items": {
              "$ref": "#/components/schemas/InferenceClusterExample"
            },
            "title": "Inferences",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "role": {
            "enum": [
              "members",
              "pass_context"
            ],
            "title": "Role",
            "type": "string"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "cluster_id",
          "role",
          "inferences",
          "total",
          "limit",
          "offset"
        ],
        "title": "InferenceClusterInferencesResponse",
        "type": "object"
      },
      "InferenceClusterMetrics": {
        "description": "Windowed metrics for a cluster.\n\nAttributes:\n    not_pass_count: Number of fail or uncertain inferences.\n    fail_count: Number of fail verdicts.\n    uncertain_count: Number of uncertain verdicts.\n    affected_rate: Fraction of judged inferences affected by the cluster\n        (``not_pass_count / total_judged``).\n    total_judged: Denominator used to compute ``affected_rate`` — the\n        number of same-scope judged inferences in the window. Surfaced\n        so dashboard cards can render ``n / N`` and the frontend can\n        verify that all cards in the same group share the same\n        denominator.",
        "properties": {
          "affected_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Affected Rate"
          },
          "fail_count": {
            "default": 0,
            "title": "Fail Count",
            "type": "integer"
          },
          "not_pass_count": {
            "default": 0,
            "title": "Not Pass Count",
            "type": "integer"
          },
          "total_judged": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Judged"
          },
          "uncertain_count": {
            "default": 0,
            "title": "Uncertain Count",
            "type": "integer"
          }
        },
        "title": "InferenceClusterMetrics",
        "type": "object"
      },
      "InferenceClusterUpdate": {
        "description": "Request body for updating a cluster.\n\nAttributes:\n    status: New cluster lifecycle status.",
        "properties": {
          "status": {
            "enum": [
              "open",
              "reopened",
              "resolved",
              "ignored"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "title": "InferenceClusterUpdate",
        "type": "object"
      },
      "InferenceClusterVariantGroup": {
        "description": "Clusters for one base or adapter variant.\n\nAttributes:\n    variant_type: Whether the variant is a base model or adapter.\n    model_id: Model ID used by the inference rows.\n    training_job_id: Adapter training job ID, when applicable.\n    clusters: Ranked cluster cards for this variant.",
        "properties": {
          "clusters": {
            "items": {
              "$ref": "#/components/schemas/InferenceClusterCard"
            },
            "title": "Clusters",
            "type": "array"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          },
          "training_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Training Job Id"
          },
          "variant_type": {
            "enum": [
              "base",
              "adapter"
            ],
            "title": "Variant Type",
            "type": "string"
          }
        },
        "required": [
          "variant_type",
          "model_id"
        ],
        "title": "InferenceClusterVariantGroup",
        "type": "object"
      },
      "InferenceFeedbackRequest": {
        "description": "Request to submit human feedback on a specific inference.\n\nArgs:\n    verdict: Human judgment — correct or incorrect.\n    corrected_output: Expected output when verdict is incorrect.\n    notes: Optional free-text notes from the reviewer.",
        "properties": {
          "corrected_output": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Expected output for incorrect verdicts (JSON structure matching task output)",
            "title": "Corrected Output"
          },
          "notes": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional reviewer notes",
            "title": "Notes"
          },
          "verdict": {
            "description": "Human judgment: 'correct' or 'incorrect'",
            "enum": [
              "correct",
              "incorrect"
            ],
            "title": "Verdict",
            "type": "string"
          }
        },
        "required": [
          "verdict"
        ],
        "title": "InferenceFeedbackRequest",
        "type": "object"
      },
      "InferenceFeedbackResponse": {
        "description": "Response after submitting human feedback.\n\nArgs:\n    inference_id: The inference that was annotated.\n    human_verdict: The stored verdict.\n    human_feedback_at: Timestamp of the feedback submission.",
        "properties": {
          "human_feedback_at": {
            "description": "When the feedback was submitted",
            "format": "date-time",
            "title": "Human Feedback At",
            "type": "string"
          },
          "human_verdict": {
            "description": "Stored human verdict",
            "title": "Human Verdict",
            "type": "string"
          },
          "inference_id": {
            "description": "Inference ID that was annotated",
            "title": "Inference Id",
            "type": "string"
          }
        },
        "required": [
          "inference_id",
          "human_verdict",
          "human_feedback_at"
        ],
        "title": "InferenceFeedbackResponse",
        "type": "object"
      },
      "InferenceListResponse": {
        "description": "Response for listing inference history.",
        "properties": {
          "inferences": {
            "description": "List of inference records",
            "items": {
              "$ref": "#/components/schemas/InferenceRecord"
            },
            "title": "Inferences",
            "type": "array"
          },
          "limit": {
            "description": "Page size limit",
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "description": "Current offset",
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "description": "Total count of inferences matching filters",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "inferences",
          "total",
          "limit",
          "offset"
        ],
        "title": "InferenceListResponse",
        "type": "object"
      },
      "InferenceRecord": {
        "description": "Stored inference record from the database.\n\nAttributes:\n    status: Inference outcome -- 'success' or 'failed'.\n    error_type: Failure category when status is 'failed'.\n    error_message: Error detail when status is 'failed'.",
        "properties": {
          "base_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "HuggingFace base model ID",
            "title": "Base Model"
          },
          "cache_read_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Input tokens served from the provider prompt cache (cache hit).",
            "title": "Cache Read Tokens"
          },
          "cache_write_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Input tokens written into the provider prompt cache (cache creation). Zero for providers that bill writes as plain input.",
            "title": "Cache Write Tokens"
          },
          "created_at": {
            "description": "When the inference was made",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Error detail when status is failed",
            "title": "Error Message"
          },
          "error_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Failure category when status is failed (validation, timeout, model_not_ready, model_not_found, model_not_supported, capacity_exhausted, internal)",
            "title": "Error Type"
          },
          "human_corrected_output": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Expected output from human reviewer",
            "title": "Human Corrected Output"
          },
          "human_feedback_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When human feedback was submitted",
            "title": "Human Feedback At"
          },
          "human_feedback_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional reviewer notes",
            "title": "Human Feedback Notes"
          },
          "human_verdict": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Human reviewer verdict (correct/incorrect)",
            "title": "Human Verdict"
          },
          "id": {
            "description": "Unique inference ID",
            "title": "Id",
            "type": "string"
          },
          "input": {
            "description": "Input text",
            "title": "Input",
            "type": "string"
          },
          "input_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Non-cached input/prompt tokens, sourced from the metered requests row. None when no billing row was recorded.",
            "title": "Input Tokens"
          },
          "latency_ms": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Latency in milliseconds",
            "title": "Latency Ms"
          },
          "llmaj_judged_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Timestamp when LLMAJ judgment was recorded; None until judged.",
            "title": "Llmaj Judged At"
          },
          "llmaj_reasoning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "LLMAJ judge reasoning/explanation; None until judged.",
            "title": "Llmaj Reasoning"
          },
          "llmaj_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "LLMAJ judge confidence score in [0.0, 1.0]; None until judged.",
            "title": "Llmaj Score"
          },
          "llmaj_verdict": {
            "anyOf": [
              {
                "enum": [
                  "pass",
                  "fail",
                  "uncertain"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "LLMAJ judge verdict ('pass', 'fail', or 'uncertain'); None until judged.",
            "title": "Llmaj Verdict"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Extensible metadata (e.g. LLM judge results)",
            "title": "Metadata"
          },
          "model_id": {
            "description": "Model ID used for inference",
            "title": "Model Id",
            "type": "string"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Human-readable model name",
            "title": "Model Name"
          },
          "output": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Inference output (JSON)",
            "title": "Output"
          },
          "output_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Output/completion tokens, sourced from the metered requests row.",
            "title": "Output Tokens"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID the model belongs to",
            "title": "Project Id"
          },
          "provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Inference provider (aws, modal, fireworks, etc.)",
            "title": "Provider"
          },
          "source": {
            "default": "api",
            "description": "Source of the request (api or ui)",
            "title": "Source",
            "type": "string"
          },
          "status": {
            "default": "success",
            "description": "Inference status: success or failed",
            "title": "Status",
            "type": "string"
          },
          "task": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Task type (legacy; may be NULL for new inferences)",
            "title": "Task"
          },
          "tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Token count",
            "title": "Tokens"
          },
          "training_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Training job UUID that produced the model",
            "title": "Training Job Id"
          },
          "user_id": {
            "description": "User who made the inference",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "model_id",
          "input",
          "created_at"
        ],
        "title": "InferenceRecord",
        "type": "object"
      },
      "InferredConstraint": {
        "description": "A single inferred constraint.",
        "properties": {
          "choices": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional choice list",
            "title": "Choices"
          },
          "description": {
            "description": "Human-readable constraint description",
            "title": "Description",
            "type": "string"
          },
          "probability": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional probability",
            "title": "Probability"
          }
        },
        "required": [
          "description"
        ],
        "title": "InferredConstraint",
        "type": "object"
      },
      "InferredMultiplicator": {
        "description": "An inferred multiplicator dimension.",
        "properties": {
          "choices": {
            "description": "Choices to balance across",
            "items": {
              "type": "string"
            },
            "title": "Choices",
            "type": "array"
          },
          "prompt": {
            "description": "The dimension prompt, e.g. 'The sentiment should be'",
            "title": "Prompt",
            "type": "string"
          }
        },
        "required": [
          "prompt",
          "choices"
        ],
        "title": "InferredMultiplicator",
        "type": "object"
      },
      "InitializeTimezoneRequest": {
        "description": "Request to set the team timezone once, on first use.",
        "properties": {
          "timezone": {
            "description": "IANA timezone name to store when usage_reset_hour_changed_at is NULL.",
            "maxLength": 50,
            "title": "Timezone",
            "type": "string"
          }
        },
        "required": [
          "timezone"
        ],
        "title": "InitializeTimezoneRequest",
        "type": "object"
      },
      "InvitationActionResponse": {
        "description": "Response model for accepting or declining an invitation.",
        "properties": {
          "invitation_id": {
            "title": "Invitation Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "team_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Team Id"
          }
        },
        "required": [
          "success",
          "message",
          "invitation_id"
        ],
        "title": "InvitationActionResponse",
        "type": "object"
      },
      "InvitationStatus": {
        "description": "Status of a team invitation.",
        "enum": [
          "pending",
          "accepted",
          "declined",
          "expired"
        ],
        "title": "InvitationStatus",
        "type": "string"
      },
      "InvoiceLinkResponse": {
        "description": "Response containing an authorized Stripe Hosted Invoice Page URL.",
        "properties": {
          "url": {
            "description": "Stripe Hosted Invoice Page URL",
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "InvoiceLinkResponse",
        "type": "object"
      },
      "KeyCategorySlice": {
        "description": "Spend attributed to one category for a single API key.",
        "properties": {
          "category": {
            "title": "Category",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          }
        },
        "required": [
          "category",
          "spend"
        ],
        "title": "KeyCategorySlice",
        "type": "object"
      },
      "KeyDailyPoint": {
        "description": "One day of spend / tokens for a single key.",
        "properties": {
          "date": {
            "title": "Date",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "date",
          "spend",
          "total_tokens"
        ],
        "title": "KeyDailyPoint",
        "type": "object"
      },
      "KeyDetailResponse": {
        "description": "Drill-down for one API key: daily series, model / harness mix, recent tasks.",
        "properties": {
          "api_key_id": {
            "title": "Api Key Id",
            "type": "string"
          },
          "api_key_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key Name"
          },
          "daily": {
            "items": {
              "$ref": "#/components/schemas/KeyDailyPoint"
            },
            "title": "Daily",
            "type": "array"
          },
          "harness_mix": {
            "items": {
              "$ref": "#/components/schemas/HarnessSlice"
            },
            "title": "Harness Mix",
            "type": "array"
          },
          "key_creator_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Email of the team member who created the key.",
            "title": "Key Creator Email"
          },
          "key_creator_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Display name of the team member who created the key.",
            "title": "Key Creator Name"
          },
          "key_creator_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key Creator User Id"
          },
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          },
          "model_mix": {
            "items": {
              "$ref": "#/components/schemas/ModelSlice"
            },
            "title": "Model Mix",
            "type": "array"
          },
          "recent_tasks": {
            "items": {
              "$ref": "#/components/schemas/RecentTask"
            },
            "title": "Recent Tasks",
            "type": "array"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          }
        },
        "required": [
          "api_key_id",
          "api_key_name",
          "key_creator_user_id",
          "spend",
          "task_count",
          "daily",
          "model_mix",
          "harness_mix",
          "recent_tasks",
          "meta"
        ],
        "title": "KeyDetailResponse",
        "type": "object"
      },
      "KeyRollup": {
        "description": "Per-API-key rollup. Listed alphabetically by key name, never by spend.",
        "properties": {
          "api_key_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key Id"
          },
          "api_key_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key Name"
          },
          "category_mix": {
            "items": {
              "$ref": "#/components/schemas/KeyCategorySlice"
            },
            "title": "Category Mix",
            "type": "array"
          },
          "direct_spend": {
            "default": 0.0,
            "description": "Spend for this key on raw direct-model calls (USD).",
            "title": "Direct Spend",
            "type": "number"
          },
          "key_creator_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Email of the team member who created the key.",
            "title": "Key Creator Email"
          },
          "key_creator_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Display name of the team member who created the key.",
            "title": "Key Creator Name"
          },
          "key_creator_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key Creator User Id"
          },
          "primary_harness": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Harness family with the most spend for this key.",
            "title": "Primary Harness"
          },
          "primary_router_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Router this key mostly relies on ('direct' when it bypasses the router).",
            "title": "Primary Router Type"
          },
          "routed_spend": {
            "default": 0.0,
            "description": "Spend for this key served via the router (USD).",
            "title": "Routed Spend",
            "type": "number"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "api_key_id",
          "api_key_name",
          "key_creator_user_id",
          "spend",
          "total_tokens",
          "task_count",
          "primary_harness",
          "category_mix"
        ],
        "title": "KeyRollup",
        "type": "object"
      },
      "KeysResponse": {
        "description": "All per-key rollups (alphabetical by name) plus metadata.",
        "properties": {
          "keys": {
            "items": {
              "$ref": "#/components/schemas/KeyRollup"
            },
            "title": "Keys",
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          }
        },
        "required": [
          "keys",
          "meta"
        ],
        "title": "KeysResponse",
        "type": "object"
      },
      "LabelCheckResult": {
        "description": "Result of checking a single label",
        "properties": {
          "confidence": {
            "title": "Confidence",
            "type": "number"
          },
          "current_label": {
            "title": "Current Label",
            "type": "string"
          },
          "reasoning": {
            "title": "Reasoning",
            "type": "string"
          },
          "row_index": {
            "title": "Row Index",
            "type": "integer"
          },
          "suggested_label": {
            "title": "Suggested Label",
            "type": "string"
          },
          "text": {
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "row_index",
          "text",
          "current_label",
          "suggested_label",
          "confidence",
          "reasoning"
        ],
        "title": "LabelCheckResult",
        "type": "object"
      },
      "LabelCorrelation": {
        "properties": {
          "labels": {
            "items": {
              "type": "string"
            },
            "title": "Labels",
            "type": "array"
          },
          "matrix": {
            "items": {
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            "title": "Matrix",
            "type": "array"
          }
        },
        "required": [
          "labels",
          "matrix"
        ],
        "title": "LabelCorrelation",
        "type": "object"
      },
      "LabelDistribution": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "percentage": {
            "title": "Percentage",
            "type": "number"
          }
        },
        "required": [
          "label",
          "count",
          "percentage"
        ],
        "title": "LabelDistribution",
        "type": "object"
      },
      "LabelExistingClassificationRequest": {
        "description": "Label existing texts for classification",
        "properties": {
          "batch_size": {
            "default": 5,
            "description": "Number of samples to generate per API call",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Batch Size",
            "type": "integer"
          },
          "class_balance": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "number"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional class distribution (must sum to 1.0)",
            "title": "Class Balance"
          },
          "config_num_examples": {
            "default": 5,
            "description": "Number of examples to generate for config",
            "maximum": 20.0,
            "minimum": 0.0,
            "title": "Config Num Examples",
            "type": "integer"
          },
          "constraints": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ConstraintRequest"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom constraints",
            "title": "Constraints"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name for the saved dataset (required if save_dataset=True)",
            "title": "Dataset Name"
          },
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for generation context",
            "title": "Domain Description"
          },
          "inputs": {
            "description": "List of texts to label",
            "items": {
              "type": "string"
            },
            "maxItems": 1000,
            "minItems": 1,
            "title": "Inputs",
            "type": "array"
          },
          "labels": {
            "description": "List of classification labels",
            "items": {
              "type": "string"
            },
            "title": "Labels",
            "type": "array"
          },
          "multi_label": {
            "default": false,
            "description": "Enable multi-label classification (samples can have multiple labels)",
            "title": "Multi Label",
            "type": "boolean"
          },
          "project_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to assign the dataset to",
            "title": "Project Id"
          },
          "save_dataset": {
            "default": false,
            "description": "Save generated dataset to S3 and database",
            "title": "Save Dataset",
            "type": "boolean"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Random seed for reproducibility",
            "title": "Seed"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session ID for log streaming",
            "title": "Session Id"
          },
          "temperature": {
            "default": 0.7,
            "description": "Generation temperature",
            "maximum": 2.0,
            "minimum": 0.0,
            "title": "Temperature",
            "type": "number"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "labels",
          "inputs"
        ],
        "title": "LabelExistingClassificationRequest",
        "type": "object"
      },
      "LabelExistingFieldsRequest": {
        "description": "Label existing data with custom input/output fields",
        "properties": {
          "config_num_examples": {
            "default": 5,
            "description": "Number of examples to generate for config",
            "maximum": 20.0,
            "minimum": 0.0,
            "title": "Config Num Examples",
            "type": "integer"
          },
          "constraints": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ConstraintRequest"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom constraints",
            "title": "Constraints"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name for the saved dataset (required if save_dataset=True)",
            "title": "Dataset Name"
          },
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for generation context",
            "title": "Domain Description"
          },
          "input_fields": {
            "description": "Input field definitions",
            "items": {
              "$ref": "#/components/schemas/RecordField"
            },
            "title": "Input Fields",
            "type": "array"
          },
          "inputs": {
            "description": "List of input data dictionaries",
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "maxItems": 1000,
            "minItems": 1,
            "title": "Inputs",
            "type": "array"
          },
          "output_fields": {
            "description": "Output field definitions",
            "items": {
              "$ref": "#/components/schemas/RecordField"
            },
            "title": "Output Fields",
            "type": "array"
          },
          "project_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to assign the dataset to",
            "title": "Project Id"
          },
          "save_dataset": {
            "default": false,
            "description": "Save generated dataset to S3 and database",
            "title": "Save Dataset",
            "type": "boolean"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Random seed for reproducibility",
            "title": "Seed"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session ID for log streaming",
            "title": "Session Id"
          },
          "temperature": {
            "default": 0.7,
            "description": "Generation temperature",
            "maximum": 2.0,
            "minimum": 0.0,
            "title": "Temperature",
            "type": "number"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "input_fields",
          "output_fields",
          "inputs"
        ],
        "title": "LabelExistingFieldsRequest",
        "type": "object"
      },
      "LabelExistingNERRequest": {
        "description": "Label existing texts for NER",
        "properties": {
          "config_num_examples": {
            "default": 5,
            "description": "Number of examples to generate for config",
            "maximum": 20.0,
            "minimum": 0.0,
            "title": "Config Num Examples",
            "type": "integer"
          },
          "constraints": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ConstraintRequest"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom constraints",
            "title": "Constraints"
          },
          "dataset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name for the saved dataset (required if save_dataset=True)",
            "title": "Dataset Name"
          },
          "domain_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain description for generation context",
            "title": "Domain Description"
          },
          "inputs": {
            "description": "List of texts to label",
            "items": {
              "type": "string"
            },
            "maxItems": 1000,
            "minItems": 1,
            "title": "Inputs",
            "type": "array"
          },
          "labels": {
            "description": "List of entity labels (e.g., ['PERSON', 'ORG', 'LOC'])",
            "items": {
              "type": "string"
            },
            "title": "Labels",
            "type": "array"
          },
          "project_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to assign the dataset to",
            "title": "Project Id"
          },
          "save_dataset": {
            "default": false,
            "description": "Save generated dataset to S3 and database",
            "title": "Save Dataset",
            "type": "boolean"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Random seed for reproducibility",
            "title": "Seed"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session ID for log streaming",
            "title": "Session Id"
          },
          "temperature": {
            "default": 0.7,
            "description": "Generation temperature",
            "maximum": 2.0,
            "minimum": 0.0,
            "title": "Temperature",
            "type": "number"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID (optional, uses authenticated user if not provided)",
            "title": "User Id"
          }
        },
        "required": [
          "labels",
          "inputs"
        ],
        "title": "LabelExistingNERRequest",
        "type": "object"
      },
      "LatencyTimeseriesPoint": {
        "description": "One bucket of aggregated response latency.",
        "properties": {
          "avg_latency_ms": {
            "title": "Avg Latency Ms",
            "type": "number"
          },
          "bucket_date": {
            "description": "ISO date or datetime string",
            "title": "Bucket Date",
            "type": "string"
          },
          "p50_latency_ms": {
            "title": "P50 Latency Ms",
            "type": "number"
          },
          "p95_latency_ms": {
            "title": "P95 Latency Ms",
            "type": "number"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          }
        },
        "required": [
          "bucket_date",
          "avg_latency_ms",
          "p50_latency_ms",
          "p95_latency_ms",
          "request_count"
        ],
        "title": "LatencyTimeseriesPoint",
        "type": "object"
      },
      "LatencyTimeseriesResponse": {
        "description": "Latency timeseries for charts.",
        "properties": {
          "points": {
            "items": {
              "$ref": "#/components/schemas/LatencyTimeseriesPoint"
            },
            "title": "Points",
            "type": "array"
          }
        },
        "required": [
          "points"
        ],
        "title": "LatencyTimeseriesResponse",
        "type": "object"
      },
      "LeaderboardEntriesResponse": {
        "description": "Response containing leaderboard entries.",
        "properties": {
          "dataset_id": {
            "title": "Dataset Id",
            "type": "string"
          },
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "entries": {
            "items": {
              "$ref": "#/components/schemas/LeaderboardEntry"
            },
            "title": "Entries",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          },
          "total_entries": {
            "title": "Total Entries",
            "type": "integer"
          }
        },
        "required": [
          "dataset_id",
          "dataset_name",
          "entries",
          "total_entries"
        ],
        "title": "LeaderboardEntriesResponse",
        "type": "object"
      },
      "LeaderboardEntry": {
        "description": "A single leaderboard entry.",
        "properties": {
          "accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "dataset_id": {
            "title": "Dataset Id",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "evaluation_id": {
            "title": "Evaluation Id",
            "type": "string"
          },
          "f1_score": {
            "title": "F1 Score",
            "type": "number"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Id"
          },
          "model_name": {
            "title": "Model Name",
            "type": "string"
          },
          "precision_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Precision Score"
          },
          "rank": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rank"
          },
          "recall_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recall Score"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "dataset_id",
          "evaluation_id",
          "user_id",
          "display_name",
          "model_name",
          "f1_score",
          "created_at",
          "updated_at"
        ],
        "title": "LeaderboardEntry",
        "type": "object"
      },
      "LeaderboardSubmission": {
        "description": "Request to submit an evaluation to the leaderboard.",
        "properties": {
          "display_name": {
            "description": "Display name for leaderboard",
            "maxLength": 50,
            "minLength": 1,
            "title": "Display Name",
            "type": "string"
          },
          "evaluation_id": {
            "description": "ID of the completed evaluation",
            "title": "Evaluation Id",
            "type": "string"
          }
        },
        "required": [
          "evaluation_id",
          "display_name"
        ],
        "title": "LeaderboardSubmission",
        "type": "object"
      },
      "LeaderboardSubmitResponse": {
        "description": "Response after submitting to leaderboard.",
        "properties": {
          "entry": {
            "$ref": "#/components/schemas/LeaderboardEntry"
          },
          "is_new_best": {
            "default": false,
            "title": "Is New Best",
            "type": "boolean"
          },
          "rank": {
            "title": "Rank",
            "type": "integer"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "entry",
          "rank"
        ],
        "title": "LeaderboardSubmitResponse",
        "type": "object"
      },
      "LeaveTeamRequest": {
        "description": "Optional transfer plan accompanying a leave-team request.\n\nThe plan resolves every row the leaving user owns in the team:\ntransfer to another current member (any role) by user UUID, or\n``\"delete\"`` to remove the row inside the leave transaction.\nSole-member leaves omit the plan entirely.\n\nAttributes:\n    transfer_plan: ``{resource_type: {row_id: target_user_id|\"delete\"}}``.\n        Empty/absent when the user owns nothing or is the sole\n        member of the team.",
        "properties": {
          "transfer_plan": {
            "additionalProperties": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "title": "Transfer Plan",
            "type": "object"
          }
        },
        "title": "LeaveTeamRequest",
        "type": "object"
      },
      "ListAPIKeysResponse": {
        "description": "Response model for listing API keys.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "keys": {
            "items": {
              "$ref": "#/components/schemas/APIKeyInfo"
            },
            "title": "Keys",
            "type": "array"
          }
        },
        "required": [
          "keys",
          "count"
        ],
        "title": "ListAPIKeysResponse",
        "type": "object"
      },
      "ListBenchmarksResponse": {
        "description": "Response listing available benchmarks",
        "properties": {
          "benchmarks": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/BenchmarkInfo"
              },
              "type": "array"
            },
            "title": "Benchmarks",
            "type": "object"
          },
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "benchmarks",
          "count"
        ],
        "title": "ListBenchmarksResponse",
        "type": "object"
      },
      "MessageHistoryItem": {
        "description": "A single message in conversation history.\n\nArgs:\n    role: Message author role.\n    content: Message text content.",
        "properties": {
          "content": {
            "description": "Message content",
            "minLength": 1,
            "title": "Content",
            "type": "string"
          },
          "role": {
            "description": "Message role: 'user' or 'assistant'",
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "title": "MessageHistoryItem",
        "type": "object"
      },
      "ModelBenchmarksResponse": {
        "description": "Roster benchmarks and axis means for a single base model.",
        "properties": {
          "agentic": {
            "description": "Agentic benchmarks, strongest first",
            "items": {
              "$ref": "#/components/schemas/BenchmarkScore"
            },
            "title": "Agentic",
            "type": "array"
          },
          "axes": {
            "description": "Per-axis summaries",
            "items": {
              "$ref": "#/components/schemas/BenchmarkAxisSummary"
            },
            "title": "Axes",
            "type": "array"
          },
          "coding": {
            "description": "Coding benchmarks, strongest first",
            "items": {
              "$ref": "#/components/schemas/BenchmarkScore"
            },
            "title": "Coding",
            "type": "array"
          },
          "model_id": {
            "description": "Canonical catalog model ID",
            "title": "Model Id",
            "type": "string"
          },
          "source_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Attribution for the underlying figures",
            "title": "Source Note"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Most recent time we refreshed these figures",
            "title": "Updated At"
          }
        },
        "required": [
          "model_id"
        ],
        "title": "ModelBenchmarksResponse",
        "type": "object"
      },
      "ModelDatasetsResponse": {
        "description": "Datasets scoped to either a project or a base model.\n\nTraining rows come from ``datasets.type = 'training'``; evaluation\nrows come from ``datasets.type IN ('evaluation', 'benchmark')`` and\ncarry their most recent completed evaluation against the model.",
        "properties": {
          "evaluation_datasets": {
            "items": {
              "$ref": "#/components/schemas/EvaluationDatasetRow"
            },
            "title": "Evaluation Datasets",
            "type": "array"
          },
          "training_datasets": {
            "items": {
              "$ref": "#/components/schemas/TrainingDatasetRow"
            },
            "title": "Training Datasets",
            "type": "array"
          }
        },
        "title": "ModelDatasetsResponse",
        "type": "object"
      },
      "ModelDownloadResponse": {
        "description": "Response with presigned URL for model download",
        "properties": {
          "download_url": {
            "title": "Download Url",
            "type": "string"
          },
          "expires_in_seconds": {
            "default": 3600,
            "title": "Expires In Seconds",
            "type": "integer"
          },
          "file_name": {
            "title": "File Name",
            "type": "string"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "default": "Download URL generated successfully",
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "job_id",
          "download_url",
          "file_name"
        ],
        "title": "ModelDownloadResponse",
        "type": "object"
      },
      "ModelLatencyTimeseriesPoint": {
        "description": "One bucket of per-model latency for charts.",
        "properties": {
          "avg_latency_ms": {
            "title": "Avg Latency Ms",
            "type": "number"
          },
          "bucket_date": {
            "description": "ISO date or datetime string",
            "title": "Bucket Date",
            "type": "string"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          }
        },
        "required": [
          "bucket_date",
          "model",
          "avg_latency_ms",
          "request_count"
        ],
        "title": "ModelLatencyTimeseriesPoint",
        "type": "object"
      },
      "ModelLatencyTimeseriesResponse": {
        "description": "Per-model latency timeseries for charts.",
        "properties": {
          "points": {
            "items": {
              "$ref": "#/components/schemas/ModelLatencyTimeseriesPoint"
            },
            "title": "Points",
            "type": "array"
          }
        },
        "required": [
          "points"
        ],
        "title": "ModelLatencyTimeseriesResponse",
        "type": "object"
      },
      "ModelMetrics": {
        "description": "Per-model metrics shown on the Models page and overview surfaces.\n\nCounts and latency are computed over the **last 24 hours** of\n``public.inferences`` rows. ``latest_evaluation`` is all-time and may\nbe ``None`` when the model has never been evaluated.\n\nAll counts and aggregates are **scoped to the requesting team** via the\nRLS-applied ``get_session()`` path — these are not cross-tenant fleet\nmetrics for base catalog ids.",
        "properties": {
          "avg_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Average latency over the last 24 hours, or null when no latency was recorded.",
            "title": "Avg Latency Ms"
          },
          "error_count": {
            "default": 0,
            "description": "Inferences in the last 24 hours with status = 'failed'.",
            "title": "Error Count",
            "type": "integer"
          },
          "inference_count": {
            "default": 0,
            "description": "Number of inference rows in the last 24 hours. For a training-job id associated with a project, counts every inference against any model in that project (scoped by project_id). For orphan training jobs, counts by training_job_id. For base catalog ids, counts direct-base calls where model_id matches.",
            "title": "Inference Count",
            "type": "integer"
          },
          "inference_count_all_time": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "All-time inference count with no time window, scoped to the requesting team. Shown as the caption below the 24h count on the monitoring KPI grid.",
            "title": "Inference Count All Time"
          },
          "inference_count_prev_24h": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Inference count for the 24h window immediately before the current window (i.e. 48h ago to 24h ago). Used to compute the trend arrow on the KPI grid. Scoped to the requesting team.",
            "title": "Inference Count Prev 24H"
          },
          "last_inference_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Most recent inference ``created_at`` observed in the last 24 hours, or null.",
            "title": "Last Inference At"
          },
          "latest_evaluation": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EvaluationSummary"
              },
              {
                "type": "null"
              }
            ],
            "description": "Most recent evaluation for this model id (all-time, status='complete')."
          },
          "median_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Median (p50) latency in milliseconds over the last 24 hours. Shown as the caption below p99 on the monitoring KPI grid.",
            "title": "Median Latency Ms"
          },
          "open_issue_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Count of inferences in the last 24h where ``llmaj_verdict = 'incorrect'`` OR ``human_verdict = 'incorrect'``. Shown as the footer on the task model 'Inferences / 24hrs' stat card.",
            "title": "Open Issue Count"
          },
          "p99_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "p99 latency in milliseconds over the last 24 hours. Distinct from ``avg_latency_ms``. Computed via Postgres ``percentile_cont(0.99) WITHIN GROUP (ORDER BY latency_ms)`` over the team's inferences.",
            "title": "P99 Latency Ms"
          },
          "p99_latency_ms_prev_24h": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "p99 latency for the prior 24h window. Used for the latency trend arrow on the KPI grid.",
            "title": "P99 Latency Ms Prev 24H"
          },
          "spend_24h_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated spend in USD attributed to this model in the last 24 hours. Computed as SUM(inferences.tokens) x input_price_per_million / 1_000_000 via the ``pricing.resolver`` lookup. Returns null when pricing is unavailable for the resolved model.",
            "title": "Spend 24H Usd"
          },
          "spend_per_1k_calls_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Average cost per 1,000 inferences over the last 24 hours. Shown as the secondary caption on the Spend / 24h KPI cell. Null when ``spend_24h_usd`` is null or there are no inferences in the window.",
            "title": "Spend Per 1K Calls Usd"
          },
          "spend_prev_24h_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Spend for the prior 24h window. Used for the spend trend arrow.",
            "title": "Spend Prev 24H Usd"
          }
        },
        "title": "ModelMetrics",
        "type": "object"
      },
      "ModelMetricsRequest": {
        "description": "Batch request body for model metrics lookup.",
        "properties": {
          "model_ids": {
            "description": "Model identifiers to compute metrics for. Accepts training-job UUIDs and base catalog ids.",
            "items": {
              "type": "string"
            },
            "maxItems": 200,
            "minItems": 0,
            "title": "Model Ids",
            "type": "array"
          },
          "since": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Inclusive start of the rollup window (UTC). Defaults to 24 hours ago, preserving the legacy last-24h behaviour. Drives the page-level date picker on the models / routers surfaces.",
            "title": "Since"
          },
          "until": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Exclusive end of the rollup window (UTC). Defaults to now.",
            "title": "Until"
          }
        },
        "required": [
          "model_ids"
        ],
        "title": "ModelMetricsRequest",
        "type": "object"
      },
      "ModelMetricsResponse": {
        "description": "Batch response mapping input model id -> ModelMetrics.\n\nEvery requested id is present in ``metrics``; ids with no matching\ninference rows in the last 24 hours map to a zero-filled ``ModelMetrics``.",
        "properties": {
          "metrics": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ModelMetrics"
            },
            "title": "Metrics",
            "type": "object"
          }
        },
        "title": "ModelMetricsResponse",
        "type": "object"
      },
      "ModelRollup": {
        "description": "Spend / tokens by model across coding-harness traffic.\n\nTask cost/tokens are stored at task granularity; a task that used more than\none model attributes its full cost to *each* model in ``models_used`` (rare),\nso per-model spend can slightly exceed the single-model sum. Documented so the\nUI can footnote it.",
        "properties": {
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "model",
          "spend",
          "input_tokens",
          "output_tokens",
          "total_tokens",
          "task_count"
        ],
        "title": "ModelRollup",
        "type": "object"
      },
      "ModelSlice": {
        "description": "Spend / tokens attributed to one model.",
        "properties": {
          "model": {
            "title": "Model",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "model",
          "spend",
          "total_tokens"
        ],
        "title": "ModelSlice",
        "type": "object"
      },
      "ModelUsageTimeseriesPoint": {
        "description": "One bucket of per-model usage for stacked bar charts.",
        "properties": {
          "bucket_date": {
            "description": "ISO date or datetime string",
            "title": "Bucket Date",
            "type": "string"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          }
        },
        "required": [
          "bucket_date",
          "model",
          "request_count"
        ],
        "title": "ModelUsageTimeseriesPoint",
        "type": "object"
      },
      "ModelUsageTimeseriesResponse": {
        "description": "Per-model usage series for stacked bar charts.",
        "properties": {
          "points": {
            "items": {
              "$ref": "#/components/schemas/ModelUsageTimeseriesPoint"
            },
            "title": "Points",
            "type": "array"
          }
        },
        "required": [
          "points"
        ],
        "title": "ModelUsageTimeseriesResponse",
        "type": "object"
      },
      "ModelWithEvaluation": {
        "description": "A model with its evaluation result for a specific dataset",
        "properties": {
          "evaluation": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EvaluationResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "is_base_model": {
            "default": false,
            "title": "Is Base Model",
            "type": "boolean"
          },
          "model_id": {
            "title": "Model Id",
            "type": "string"
          },
          "model_name": {
            "title": "Model Name",
            "type": "string"
          }
        },
        "required": [
          "model_id",
          "model_name"
        ],
        "title": "ModelWithEvaluation",
        "type": "object"
      },
      "ModelsResponse": {
        "description": "All per-model rollups plus metadata.",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          },
          "models": {
            "items": {
              "$ref": "#/components/schemas/ModelRollup"
            },
            "title": "Models",
            "type": "array"
          }
        },
        "required": [
          "models",
          "meta"
        ],
        "title": "ModelsResponse",
        "type": "object"
      },
      "ModificationSummary": {
        "description": "Summary of modifications applied during augmentation.",
        "properties": {
          "duplicates_removed": {
            "default": 0,
            "title": "Duplicates Removed",
            "type": "integer"
          },
          "final_count": {
            "default": 0,
            "title": "Final Count",
            "type": "integer"
          },
          "original_count": {
            "default": 0,
            "title": "Original Count",
            "type": "integer"
          },
          "outliers_removed": {
            "default": 0,
            "title": "Outliers Removed",
            "type": "integer"
          },
          "samples_generated": {
            "default": 0,
            "title": "Samples Generated",
            "type": "integer"
          }
        },
        "title": "ModificationSummary",
        "type": "object"
      },
      "MultiplicatorRequest": {
        "description": "Multiplicator for balanced dataset distribution",
        "properties": {
          "choices": {
            "description": "List of choices to balance across",
            "items": {
              "type": "string"
            },
            "title": "Choices",
            "type": "array"
          },
          "prompt": {
            "description": "Multiplicator prompt (e.g., 'The sentiment should be')",
            "title": "Prompt",
            "type": "string"
          }
        },
        "required": [
          "prompt",
          "choices"
        ],
        "title": "MultiplicatorRequest",
        "type": "object"
      },
      "NERClassifiedExample": {
        "description": "NER example with optional user feedback for improving generation.",
        "properties": {
          "entities": {
            "description": "List of (entity_text, entity_type) tuples",
            "items": {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "string"
                },
                {
                  "type": "string"
                }
              ],
              "type": "array"
            },
            "title": "Entities",
            "type": "array"
          },
          "feedback": {
            "anyOf": [
              {
                "enum": [
                  "positive",
                  "negative"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User feedback: positive (upvote) or negative (downvote)",
            "title": "Feedback"
          },
          "text": {
            "description": "Example text",
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "text",
          "entities"
        ],
        "title": "NERClassifiedExample",
        "type": "object"
      },
      "ObservabilityMeta": {
        "description": "Data-quality envelope attached to every observability response.\n\nLets the UI label boundaries instead of silently under-reporting: the\ncategory window (classification only runs over recent inline payloads), the\nper-harness payload coverage, and the earliest date harness attribution is\navailable (before which no data exists, so a picker must not offer it).",
        "properties": {
          "category_window_days": {
            "description": "Category classification only covers the last N days of inline payloads.",
            "title": "Category Window Days",
            "type": "integer"
          },
          "category_window_start": {
            "description": "UTC start of the category-classification window (now - category_window_days).",
            "format": "date-time",
            "title": "Category Window Start",
            "type": "string"
          },
          "coverage_start_date": {
            "description": "Earliest UTC date with caller metadata / harness attribution; date ranges before this return nothing.",
            "format": "date-time",
            "title": "Coverage Start Date",
            "type": "string"
          },
          "generated_at": {
            "description": "UTC time this response was computed.",
            "format": "date-time",
            "title": "Generated At",
            "type": "string"
          },
          "harness_coverage": {
            "description": "Per-harness category-coverage gating for UI labelling.",
            "items": {
              "$ref": "#/components/schemas/HarnessCoverage"
            },
            "title": "Harness Coverage",
            "type": "array"
          }
        },
        "required": [
          "category_window_days",
          "category_window_start",
          "coverage_start_date",
          "harness_coverage",
          "generated_at"
        ],
        "title": "ObservabilityMeta",
        "type": "object"
      },
      "ObservabilitySummary": {
        "description": "Headline totals for the overview, with a previous-period trend.\n\n``engineering_spend`` excludes ``non_coding`` tasks; the gap between\n``total_spend`` and ``engineering_spend`` is the \"coding-agent traffic is not\nall software-engineering spend\" finding the overview must surface.",
        "properties": {
          "active_harnesses": {
            "title": "Active Harnesses",
            "type": "integer"
          },
          "active_keys": {
            "title": "Active Keys",
            "type": "integer"
          },
          "daily": {
            "items": {
              "$ref": "#/components/schemas/SummaryDailyPoint"
            },
            "title": "Daily",
            "type": "array"
          },
          "direct_spend": {
            "default": 0.0,
            "description": "Spend on raw direct-model calls that bypass the router (USD).",
            "title": "Direct Spend",
            "type": "number"
          },
          "engineering_spend": {
            "title": "Engineering Spend",
            "type": "number"
          },
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          },
          "non_coding_spend": {
            "title": "Non Coding Spend",
            "type": "number"
          },
          "one_shot_count": {
            "title": "One Shot Count",
            "type": "integer"
          },
          "previous_total_spend": {
            "description": "Total spend over the immediately preceding window of equal length.",
            "title": "Previous Total Spend",
            "type": "number"
          },
          "routed_spend": {
            "default": 0.0,
            "description": "Spend served via the Pioneer model router (USD).",
            "title": "Routed Spend",
            "type": "number"
          },
          "session_count": {
            "title": "Session Count",
            "type": "integer"
          },
          "spend_trend_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percent change vs previous period; null when previous is zero.",
            "title": "Spend Trend Pct"
          },
          "task_count": {
            "title": "Task Count",
            "type": "integer"
          },
          "total_spend": {
            "title": "Total Spend",
            "type": "number"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "total_spend",
          "engineering_spend",
          "non_coding_spend",
          "total_tokens",
          "task_count",
          "session_count",
          "one_shot_count",
          "active_keys",
          "active_harnesses",
          "previous_total_spend",
          "daily",
          "meta"
        ],
        "title": "ObservabilitySummary",
        "type": "object"
      },
      "OutlierSample": {
        "properties": {
          "fingerprint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Content-based SHA-256 fingerprint for stable identification",
            "title": "Fingerprint"
          },
          "index": {
            "title": "Index",
            "type": "integer"
          },
          "sample": {
            "additionalProperties": true,
            "title": "Sample",
            "type": "object"
          },
          "type": {
            "title": "Type",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          },
          "z_score": {
            "title": "Z Score",
            "type": "number"
          }
        },
        "required": [
          "index",
          "value",
          "z_score",
          "type",
          "sample"
        ],
        "title": "OutlierSample",
        "type": "object"
      },
      "OutlierThresholds": {
        "properties": {
          "lower_bound_length": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lower Bound Length"
          },
          "mean_length": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Length"
          },
          "upper_bound_length": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Upper Bound Length"
          }
        },
        "title": "OutlierThresholds",
        "type": "object"
      },
      "OutliersAnalysis": {
        "properties": {
          "outlier_count": {
            "title": "Outlier Count",
            "type": "integer"
          },
          "samples": {
            "items": {
              "$ref": "#/components/schemas/OutlierSample"
            },
            "title": "Samples",
            "type": "array"
          },
          "thresholds": {
            "$ref": "#/components/schemas/OutlierThresholds"
          }
        },
        "required": [
          "outlier_count",
          "thresholds",
          "samples"
        ],
        "title": "OutliersAnalysis",
        "type": "object"
      },
      "OverageSettingsResponse": {
        "description": "Current overage billing settings for a team.",
        "properties": {
          "charge_threshold": {
            "description": "Trigger charge when remaining credits drop below this",
            "title": "Charge Threshold",
            "type": "number"
          },
          "credit_limit": {
            "description": "Plan's included credit allowance per period",
            "title": "Credit Limit",
            "type": "number"
          },
          "current_month_charged": {
            "description": "Credits charged via overages this month",
            "title": "Current Month Charged",
            "type": "number"
          },
          "current_month_start": {
            "description": "ISO timestamp of current billing month start",
            "title": "Current Month Start",
            "type": "string"
          },
          "current_period_requests": {
            "default": 0,
            "description": "Number of inference requests in current billing period",
            "title": "Current Period Requests",
            "type": "integer"
          },
          "current_period_usage": {
            "description": "Credits consumed in current billing period",
            "title": "Current Period Usage",
            "type": "number"
          },
          "max_monthly_spend": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Monthly overage cap in credits (null = unlimited)",
            "title": "Max Monthly Spend"
          },
          "max_overage_hard_cap": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Platform hard cap on daily overage spend in credits (null = no platform cap)",
            "title": "Max Overage Hard Cap"
          },
          "overage_enabled": {
            "title": "Overage Enabled",
            "type": "boolean"
          },
          "paid_credit_balance": {
            "default": 0,
            "description": "Persistent paid credit wallet balance (carries over indefinitely)",
            "title": "Paid Credit Balance",
            "type": "number"
          },
          "today_usage": {
            "default": 0.0,
            "description": "Credits consumed since midnight today in the team's usage_reset_timezone (falls back to UTC for invalid timezone names), regardless of plan reset interval.",
            "title": "Today Usage",
            "type": "number"
          },
          "topup_amount": {
            "description": "Credits added per top-up charge (1 credit = $0.01)",
            "title": "Topup Amount",
            "type": "number"
          },
          "topup_mode": {
            "default": "by",
            "description": "Top-up mode: 'by' adds a fixed amount, 'to' restores balance to topup_amount",
            "title": "Topup Mode",
            "type": "string"
          },
          "usage_reset_hour": {
            "default": 0,
            "description": "Local hour when daily credits reset. 0-23 in usage_reset_timezone.",
            "title": "Usage Reset Hour",
            "type": "integer"
          },
          "usage_reset_hour_changed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO timestamp of last reset-hour change. Null if never changed.",
            "title": "Usage Reset Hour Changed At"
          },
          "usage_reset_timezone": {
            "default": "UTC",
            "description": "IANA timezone used to interpret usage_reset_hour.",
            "title": "Usage Reset Timezone",
            "type": "string"
          }
        },
        "required": [
          "overage_enabled",
          "topup_amount",
          "charge_threshold",
          "max_monthly_spend",
          "current_month_charged",
          "current_month_start",
          "credit_limit",
          "current_period_usage"
        ],
        "title": "OverageSettingsResponse",
        "type": "object"
      },
      "OwnedResourceItem": {
        "description": "One row the leaving user owns in a team.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          }
        },
        "required": [
          "id",
          "label"
        ],
        "title": "OwnedResourceItem",
        "type": "object"
      },
      "OwnedResourcesResponse": {
        "description": "Response for ``GET /teams/{team_id}/owned-resources``.\n\nEach key in ``owned`` is a stable resource-type identifier\n(``projects``, ``datasets``, ``training_jobs``, ``model_evaluations``,\n``agent_runs``). Resource types with zero owned rows are omitted\nso the frontend can render an empty-state card directly when\n``len(owned) == 0`` (and also includes ``is_sole_member`` so the\nUI can route to the destructive sole-member-leave flow without a\nsecond round-trip).",
        "properties": {
          "is_sole_member": {
            "title": "Is Sole Member",
            "type": "boolean"
          },
          "owned": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/OwnedResourceItem"
              },
              "type": "array"
            },
            "title": "Owned",
            "type": "object"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "is_sole_member",
          "owned"
        ],
        "title": "OwnedResourcesResponse",
        "type": "object"
      },
      "PIIFinding": {
        "description": "A single PII finding",
        "properties": {
          "column": {
            "title": "Column",
            "type": "string"
          },
          "end": {
            "title": "End",
            "type": "integer"
          },
          "entity_type": {
            "title": "Entity Type",
            "type": "string"
          },
          "row_index": {
            "title": "Row Index",
            "type": "integer"
          },
          "score": {
            "title": "Score",
            "type": "number"
          },
          "start": {
            "title": "Start",
            "type": "integer"
          },
          "text": {
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "row_index",
          "column",
          "entity_type",
          "text",
          "start",
          "end",
          "score"
        ],
        "title": "PIIFinding",
        "type": "object"
      },
      "PaymentMethodInfo": {
        "description": "Information about a payment method.\n\n``brand`` and ``last4`` are always populated with a display-ready value\n(for non-card types like Link or bank accounts, the brand is the\nprovider name and ``last4`` may be an empty string). ``exp_month`` and\n``exp_year`` are only present for card-backed payment methods.\n``billing_name`` and ``billing_address`` mirror the Stripe billing\ndetails on file and are display-only.",
        "properties": {
          "billing_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BillingAddress"
              },
              {
                "type": "null"
              }
            ]
          },
          "billing_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Name"
          },
          "brand": {
            "title": "Brand",
            "type": "string"
          },
          "exp_month": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exp Month"
          },
          "exp_year": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exp Year"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last4": {
            "title": "Last4",
            "type": "string"
          },
          "type": {
            "default": "card",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "brand",
          "last4"
        ],
        "title": "PaymentMethodInfo",
        "type": "object"
      },
      "PendingInvitationsResponse": {
        "description": "Response model for pending invitations for the current user.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "invitations": {
            "items": {
              "$ref": "#/components/schemas/TeamInvitationResponse"
            },
            "title": "Invitations",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "invitations",
          "count"
        ],
        "title": "PendingInvitationsResponse",
        "type": "object"
      },
      "PioneerExtension": {
        "description": "Pioneer-specific extension fields appended to OpenAI-compatible responses.\n\nOpenAI's API contract reserves the unprefixed top-level keys (``id``,\n``choices``, ``usage``, …); custom data must live under a clearly\nnamespaced key. ``x_pioneer`` is that key.\n\nAttributes:\n    inference_id: The Pioneer-side identifier of the persisted\n        ``inferences`` row associated with this completion. Present\n        when persistence is enabled (``extra_body.store == True``)\n        and the row was successfully recorded; ``None`` for ad-hoc\n        requests that opted out of persistence. The frontend uses\n        this to poll ``GET /inferences/{id}`` for asynchronous\n        judge results without coupling the inference response\n        latency to the judge.\n    routed_model: Backend catalog model selected by a router project\n        (for example ``pioneer/auto``). ``None`` when the request\n        was not routed or the routed model matches the requested id.\n    savings: Routed-vs-frontier per-1M-token savings rate diff (same\n        wire shape as the Anthropic ``pioneer_savings`` extension). The\n        Codex routing-savings hook multiplies these rates by per-turn\n        token usage to surface cumulative money saved. ``None`` when the\n        request was not routed below the frontier reference model.",
        "properties": {
          "inference_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Inference Id"
          },
          "routed_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Routed Model"
          },
          "savings": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Savings"
          }
        },
        "title": "PioneerExtension",
        "type": "object"
      },
      "PlanInfoResponse": {
        "description": "Response model for plan information.",
        "properties": {
          "credit_limit": {
            "title": "Credit Limit",
            "type": "number"
          },
          "exceeds_limit": {
            "title": "Exceeds Limit",
            "type": "boolean"
          },
          "payment_plan": {
            "title": "Payment Plan",
            "type": "string"
          },
          "remaining_credits": {
            "title": "Remaining Credits",
            "type": "number"
          },
          "total_usage": {
            "title": "Total Usage",
            "type": "number"
          },
          "user_limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Limit"
          }
        },
        "required": [
          "payment_plan",
          "credit_limit",
          "user_limit",
          "total_usage",
          "remaining_credits",
          "exceeds_limit"
        ],
        "title": "PlanInfoResponse",
        "type": "object"
      },
      "PresetDetail": {
        "description": "Preset detail with full configuration",
        "properties": {
          "config": {
            "additionalProperties": true,
            "title": "Config",
            "type": "object"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tags": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "task_type": {
            "title": "Task Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "task_type",
          "config"
        ],
        "title": "PresetDetail",
        "type": "object"
      },
      "PresetMetadata": {
        "description": "Preset metadata",
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tags": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "task_type": {
            "title": "Task Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "task_type"
        ],
        "title": "PresetMetadata",
        "type": "object"
      },
      "ProjectCreate": {
        "description": "Request model for creating a project.",
        "properties": {
          "active_model_id": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Active model ID for inference",
            "title": "Active Model Id"
          },
          "adaptive_cadence": {
            "$ref": "#/components/schemas/AdaptiveCadence",
            "default": "weekly",
            "description": "How often the autonomous adaptive finetuning agent runs for this project (off / daily / weekly / monthly). autonomy_enabled is derived from this: daily/weekly/monthly → True, off → False. Defaults to weekly."
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 1000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional project description",
            "title": "Description"
          },
          "example": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Generated API example for the project",
            "title": "Example"
          },
          "icon": {
            "default": "folder",
            "description": "Icon identifier for the project",
            "maxLength": 50,
            "title": "Icon",
            "type": "string"
          },
          "name": {
            "description": "Name for the project",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "observations": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text agent notes about patterns observed",
            "title": "Observations"
          },
          "repo": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional repository reference or URL",
            "title": "Repo"
          },
          "router_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When set, makes this project a router that selects a model per request. Must be a registered router id.",
            "title": "Router Type"
          },
          "routing_params": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Router policy configuration; validated against the router_type schema.",
            "title": "Routing Params"
          },
          "selected_model_id": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "[Deprecated] Use active_model_id instead.",
            "title": "Selected Model Id"
          },
          "tag": {
            "anyOf": [
              {
                "maxLength": 100,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Short kebab-case label set by clustering agent",
            "title": "Tag"
          },
          "team_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Team ID to assign this project to. Defaults to the user's personal team when omitted.",
            "title": "Team Id"
          },
          "visibility": {
            "default": "private",
            "description": "Who can see this project: private (creator only) or team (all team members).",
            "enum": [
              "private",
              "team"
            ],
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "ProjectCreate",
        "type": "object"
      },
      "ProjectDatasetCountResponse": {
        "description": "Response model for getting dataset count for a project.",
        "properties": {
          "can_delete": {
            "title": "Can Delete",
            "type": "boolean"
          },
          "dataset_count": {
            "title": "Dataset Count",
            "type": "integer"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          }
        },
        "required": [
          "project_id",
          "dataset_count",
          "can_delete"
        ],
        "title": "ProjectDatasetCountResponse",
        "type": "object"
      },
      "ProjectDeleteResponse": {
        "description": "Response model for deleting a project.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message",
          "project_id"
        ],
        "title": "ProjectDeleteResponse",
        "type": "object"
      },
      "ProjectInferenceClusterSummary": {
        "description": "Project-level cluster summary for the selected window.\n\nAttributes:\n    active_cluster_count: Number of active clusters returned.\n    open_count: Number of open clusters.\n    reopened_count: Number of reopened clusters.\n    not_pass_count: Total fail or uncertain member count.\n    fail_count: Total fail count.\n    uncertain_count: Total uncertain count.",
        "properties": {
          "active_cluster_count": {
            "default": 0,
            "title": "Active Cluster Count",
            "type": "integer"
          },
          "fail_count": {
            "default": 0,
            "title": "Fail Count",
            "type": "integer"
          },
          "not_pass_count": {
            "default": 0,
            "title": "Not Pass Count",
            "type": "integer"
          },
          "open_count": {
            "default": 0,
            "title": "Open Count",
            "type": "integer"
          },
          "reopened_count": {
            "default": 0,
            "title": "Reopened Count",
            "type": "integer"
          },
          "uncertain_count": {
            "default": 0,
            "title": "Uncertain Count",
            "type": "integer"
          }
        },
        "title": "ProjectInferenceClusterSummary",
        "type": "object"
      },
      "ProjectInferenceClustersResponse": {
        "description": "Response for listing all project inference clusters.\n\nAttributes:\n    project_id: Project ID.\n    window: Metrics window used for ranking and counts.\n    summary: Project-level cluster summary.\n    base_models: Clusters grouped by base model and variant.",
        "properties": {
          "base_models": {
            "items": {
              "$ref": "#/components/schemas/InferenceClusterBaseModelGroup"
            },
            "title": "Base Models",
            "type": "array"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "split_rationale": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Split Rationale"
          },
          "suggested_project_split": {
            "default": false,
            "title": "Suggested Project Split",
            "type": "boolean"
          },
          "summary": {
            "$ref": "#/components/schemas/ProjectInferenceClusterSummary"
          },
          "usage_aware_clustering_enabled": {
            "default": false,
            "title": "Usage Aware Clustering Enabled",
            "type": "boolean"
          },
          "usage_drift_detected": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usage Drift Detected"
          },
          "usage_summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usage Summary"
          },
          "window": {
            "enum": [
              "24h",
              "7d",
              "30d",
              "all"
            ],
            "title": "Window",
            "type": "string"
          }
        },
        "required": [
          "project_id",
          "window",
          "summary"
        ],
        "title": "ProjectInferenceClustersResponse",
        "type": "object"
      },
      "ProjectListResponse": {
        "description": "Response model for listing projects.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "projects": {
            "items": {
              "$ref": "#/components/schemas/ProjectResponse"
            },
            "title": "Projects",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "projects",
          "count"
        ],
        "title": "ProjectListResponse",
        "type": "object"
      },
      "ProjectResponse": {
        "description": "Response model for a single project.",
        "properties": {
          "active_model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active Model Id"
          },
          "adaptive_cadence": {
            "$ref": "#/components/schemas/AdaptiveCadence",
            "default": "weekly"
          },
          "autonomy_enabled": {
            "default": true,
            "title": "Autonomy Enabled",
            "type": "boolean"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "example": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Example"
          },
          "icon": {
            "default": "folder",
            "title": "Icon",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "observations": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Observations"
          },
          "repo": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Repo"
          },
          "router_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Router Type"
          },
          "routing_params": {
            "additionalProperties": true,
            "title": "Routing Params",
            "type": "object"
          },
          "selected_model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Deprecated alias for active_model_id -- kept for backward compat.",
            "readOnly": true,
            "title": "Selected Model Id"
          },
          "tag": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tag"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "visibility": {
            "default": "private",
            "title": "Visibility",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "name",
          "team_id",
          "created_at",
          "updated_at",
          "selected_model_id"
        ],
        "title": "ProjectResponse",
        "type": "object"
      },
      "ProjectUpdate": {
        "additionalProperties": false,
        "description": "Request model for updating a project.\n\n``autonomy_enabled`` is not an accepted field — it is derived from\n``adaptive_cadence`` and must not be sent directly. Sending an unknown\nfield (e.g. the old ``autonomy_enabled``) raises a 422 so callers learn to\nmigrate to ``adaptive_cadence``.",
        "properties": {
          "active_model_id": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Active model ID for inference",
            "title": "Active Model Id"
          },
          "adaptive_cadence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AdaptiveCadence"
              },
              {
                "type": "null"
              }
            ],
            "description": "How often the autonomous adaptive finetuning agent runs for this project (off / daily / weekly / monthly). autonomy_enabled is derived from this field: any enabled cadence (daily/weekly/monthly) sets autonomy_enabled=True; off sets it False."
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 1000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New project description",
            "title": "Description"
          },
          "icon": {
            "anyOf": [
              {
                "maxLength": 50,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New icon identifier for the project",
            "title": "Icon"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 100,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New name for the project",
            "title": "Name"
          },
          "observations": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text agent notes about patterns observed",
            "title": "Observations"
          },
          "repo": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New repository reference or URL",
            "title": "Repo"
          },
          "router_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When set, makes this project a router that selects a model per request. Must be a registered router id.",
            "title": "Router Type"
          },
          "routing_params": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Router policy configuration; validated against the router_type schema.",
            "title": "Routing Params"
          },
          "selected_model_id": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "[Deprecated] Use active_model_id instead.",
            "title": "Selected Model Id"
          },
          "tag": {
            "anyOf": [
              {
                "maxLength": 100,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Short kebab-case label set by clustering agent",
            "title": "Tag"
          },
          "visibility": {
            "anyOf": [
              {
                "enum": [
                  "private",
                  "team"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Who can see this project: private (creator only) or team (all team members).",
            "title": "Visibility"
          }
        },
        "title": "ProjectUpdate",
        "type": "object"
      },
      "PromptTokensDetails": {
        "description": "Per-input-class breakdown for OpenAI-shape usage payloads.\n\nMirrors OpenAI's ``prompt_tokens_details`` block and OpenRouter's\ncache-creation extension so clients reading\n``usage.prompt_tokens_details.cached_tokens`` /\n``cache_write_tokens`` keep working when Pioneer relays a cache-aware\nupstream response. Both counts are subsets of ``prompt_tokens`` on the\nwire — that's the upstream contract Pioneer relays faithfully.\n\nAttributes:\n    cached_tokens: Input tokens served from the upstream prompt cache\n        (cache read).\n    cache_write_tokens: Input tokens written into the upstream prompt\n        cache (cache creation). ``0`` for upstreams that bill writes\n        as plain input (OpenAI, Fireworks, vLLM).",
        "properties": {
          "cache_write_tokens": {
            "default": 0,
            "title": "Cache Write Tokens",
            "type": "integer"
          },
          "cached_tokens": {
            "default": 0,
            "title": "Cached Tokens",
            "type": "integer"
          }
        },
        "title": "PromptTokensDetails",
        "type": "object"
      },
      "PublicCheckoutRequest": {
        "description": "Request for unauthenticated checkout via a shareable link.",
        "properties": {
          "cancel_url": {
            "description": "URL to redirect to if user cancels",
            "title": "Cancel Url",
            "type": "string"
          },
          "captcha_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "hCaptcha response token for bot verification",
            "title": "Captcha Token"
          },
          "email": {
            "anyOf": [
              {
                "format": "email",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Email address to pre-fill in Stripe checkout",
            "title": "Email"
          },
          "plan": {
            "description": "Target plan to subscribe to",
            "enum": [
              "pro",
              "enterprise"
            ],
            "title": "Plan",
            "type": "string"
          },
          "success_url": {
            "description": "URL to redirect to after successful payment",
            "title": "Success Url",
            "type": "string"
          }
        },
        "required": [
          "plan",
          "success_url",
          "cancel_url"
        ],
        "title": "PublicCheckoutRequest",
        "type": "object"
      },
      "PublicCheckoutResponse": {
        "description": "Response from the unauthenticated checkout endpoint.",
        "properties": {
          "checkout_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Checkout Url"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "PublicCheckoutResponse",
        "type": "object"
      },
      "PurchaseCreditsRequest": {
        "description": "Request to start a credit purchase via Stripe Checkout.",
        "properties": {
          "amount_usd": {
            "description": "Amount in USD to purchase (max $500 per transaction)",
            "exclusiveMinimum": 0.0,
            "maximum": 500.0,
            "title": "Amount Usd",
            "type": "number"
          },
          "cancel_url": {
            "description": "URL Stripe redirects to if the purchase is cancelled",
            "title": "Cancel Url",
            "type": "string"
          },
          "success_url": {
            "description": "URL Stripe redirects to after a successful payment",
            "title": "Success Url",
            "type": "string"
          }
        },
        "required": [
          "amount_usd",
          "success_url",
          "cancel_url"
        ],
        "title": "PurchaseCreditsRequest",
        "type": "object"
      },
      "PurchaseCreditsResponse": {
        "description": "Response after starting a credit purchase.\n\nCredits are granted asynchronously by the ``checkout.session.completed``\nwebhook once Stripe confirms the payment, so this response only carries the\nhosted Checkout URL to redirect the user to.",
        "properties": {
          "checkout_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stripe-hosted Checkout URL to redirect the user to",
            "title": "Checkout Url"
          },
          "message": {
            "default": "",
            "description": "Human-readable status detail",
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "title": "PurchaseCreditsResponse",
        "type": "object"
      },
      "PushDatasetToHubResponse": {
        "description": "Response model for pushing dataset to HuggingFace Hub",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "repo_id": {
            "title": "Repo Id",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "url": {
            "title": "Url",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "success",
          "url",
          "repo_id",
          "version",
          "message"
        ],
        "title": "PushDatasetToHubResponse",
        "type": "object"
      },
      "PushModelToHubResponse": {
        "description": "Response model for pushing model to HuggingFace Hub",
        "properties": {
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "repo_id": {
            "title": "Repo Id",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "success",
          "url",
          "repo_id",
          "job_id",
          "message"
        ],
        "title": "PushModelToHubResponse",
        "type": "object"
      },
      "QualityMetricsResponse": {
        "description": "LLMAJ quality metrics aggregation for a project.",
        "properties": {
          "fail_count": {
            "default": 0,
            "description": "Inferences with llmaj_verdict='fail'.",
            "title": "Fail Count",
            "type": "integer"
          },
          "fail_rate": {
            "default": 0.0,
            "description": "Fail count / total judged.",
            "title": "Fail Rate",
            "type": "number"
          },
          "pass_count": {
            "default": 0,
            "description": "Inferences with llmaj_verdict='pass'.",
            "title": "Pass Count",
            "type": "integer"
          },
          "pass_rate": {
            "default": 0.0,
            "description": "Pass count / total judged.",
            "title": "Pass Rate",
            "type": "number"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "total_judged": {
            "default": 0,
            "description": "Total inferences with any llmaj_verdict.",
            "title": "Total Judged",
            "type": "integer"
          },
          "uncertain_count": {
            "default": 0,
            "description": "Inferences with llmaj_verdict='uncertain'.",
            "title": "Uncertain Count",
            "type": "integer"
          }
        },
        "required": [
          "project_id"
        ],
        "title": "QualityMetricsResponse",
        "type": "object"
      },
      "QualityTimeSeriesBucket": {
        "description": "A single time-bucket sample of LLMAJ-derived quality metrics.\n\nComputed from ``public.inferences`` rows whose ``llmaj_verdict`` /\n``llmaj_score`` columns are populated by the asynchronous LLM-as-Judge\npipeline (see ``brain/services/data_engine/llmaj/handler.py``).",
        "properties": {
          "llmaj_correct_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Fraction of judged inferences in this bucket where ``llmaj_verdict = 'pass'``. Null when no inference in the bucket has a verdict.",
            "title": "Llmaj Correct Pct"
          },
          "llmaj_score_avg": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Average ``llmaj_score`` over inferences in this bucket. Null when no inference in the bucket has a score.",
            "title": "Llmaj Score Avg"
          },
          "sample_count": {
            "default": 0,
            "description": "Number of inferences in this bucket with a non-null ``llmaj_score``.",
            "title": "Sample Count",
            "type": "integer"
          },
          "ts": {
            "description": "Bucket start (date_trunc'd) in UTC.",
            "format": "date-time",
            "title": "Ts",
            "type": "string"
          }
        },
        "required": [
          "ts"
        ],
        "title": "QualityTimeSeriesBucket",
        "type": "object"
      },
      "QualityTimeSeriesResponse": {
        "description": "Bucketed LLMAJ quality timeseries for a single model scope.\n\nReturns LLM-as-Judge pass-rate and score buckets for the requested\n``model_id`` over the requested window. Buckets are ordered by\n``ts`` descending. Empty windows return ``series=[]`` rather than 404.\n\nNo cross-model \"vs base\" comparison is provided. The codebase has no\npaired-evaluation pipeline, so a meaningful task-vs-base comparison\ncannot be derived from existing ``inferences`` data alone.",
        "properties": {
          "interval": {
            "description": "``date_trunc`` bucket size used for the aggregation.",
            "enum": [
              "day",
              "week"
            ],
            "title": "Interval",
            "type": "string"
          },
          "model_id": {
            "description": "Echo of the requested model id.",
            "title": "Model Id",
            "type": "string"
          },
          "series": {
            "description": "Buckets ordered by ``ts`` descending.",
            "items": {
              "$ref": "#/components/schemas/QualityTimeSeriesBucket"
            },
            "title": "Series",
            "type": "array"
          },
          "since": {
            "description": "Inclusive start of the window (UTC).",
            "format": "date-time",
            "title": "Since",
            "type": "string"
          },
          "until": {
            "description": "Exclusive end of the window (UTC).",
            "format": "date-time",
            "title": "Until",
            "type": "string"
          }
        },
        "required": [
          "model_id",
          "interval",
          "since",
          "until"
        ],
        "title": "QualityTimeSeriesResponse",
        "type": "object"
      },
      "RLConfig": {
        "properties": {
          "dpo_beta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dpo Beta"
          },
          "extras": {
            "additionalProperties": true,
            "title": "Extras",
            "type": "object"
          },
          "group_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Group Size"
          },
          "kl_beta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kl Beta"
          },
          "logging_steps": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logging Steps"
          },
          "loss_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Loss Type"
          },
          "max_completion_length": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Completion Length"
          },
          "max_steps": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Steps"
          },
          "reward_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reward Type"
          },
          "sampling_temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sampling Temperature"
          }
        },
        "title": "RLConfig",
        "type": "object"
      },
      "ReasoningRequest": {
        "additionalProperties": false,
        "description": "Opt-in reasoning / extended-thinking controls for decoder requests.\n\nSingle typed surface for every reasoning-capable upstream. Pioneer\nnormalizes this object into the canonical ``ReasoningConfig`` slot at\nthe adapter boundary and each provider renders its native wire field:\n\n* Anthropic / Bedrock — ``thinking={\"type\":\"enabled\",\"budget_tokens\":N}``\n  or ``thinking={\"type\":\"adaptive\",\"effort\":tier}`` (with optional\n  ``display``). The renderer auto-upgrades manual configs to adaptive\n  on models that require it (Opus 4.7+ / Mythos).\n* OpenAI direct / Fireworks / Modal vLLM — top-level\n  ``reasoning_effort`` tier (effort only; no per-call budget).\n* OpenRouter — normalized ``reasoning`` object preserving every field.\n\nPioneer does not enable reasoning by default. Sending this object is\nopt-in; omit it for the model's default behavior.",
        "properties": {
          "display": {
            "anyOf": [
              {
                "enum": [
                  "summarized",
                  "omitted"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Anthropic extended-thinking response display control (summarized/omitted). Anthropic-specific; ignored on other providers. `omitted` skips thinking-text streaming for faster time-to-first-text; signature is still preserved for multi-turn continuity. Valid only when `enabled=true`.",
            "title": "Display"
          },
          "effort": {
            "anyOf": [
              {
                "enum": [
                  "minimal",
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max",
                  "none"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "OpenAI/Grok-style reasoning effort tier (minimal/low/medium/high/xhigh/max, or 'none' to disable). Honored natively by OpenAI, Fireworks, Grok; translated into `budget_tokens` for Anthropic manual mode or into `effort` for Anthropic adaptive mode. `max` is the deepest tier (GLM-5.2's native default). Mutually exclusive with `max_tokens`.",
            "title": "Effort"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "description": "Whether reasoning is enabled. Set to false to explicitly turn thinking off on models that have it on by default (Anthropic `thinking={\"type\": \"disabled\"}`, Fireworks `reasoning_effort=\"none\"`).",
            "title": "Enabled"
          },
          "exclude": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": false,
            "description": "When true, the model still reasons internally but reasoning tokens are not returned to the caller. Honored by OpenRouter; ignored by providers that do not surface a reasoning response channel.",
            "title": "Exclude"
          },
          "max_tokens": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Anthropic-style reasoning budget in tokens. Honored natively by Anthropic / Bedrock manual mode (`thinking.budget_tokens`) and by OpenRouter; ignored by OpenAI/Fireworks. On models that require adaptive mode (Opus 4.7+), Pioneer translates this into the nearest `effort` tier instead of returning a 400. Mutually exclusive with `effort`.",
            "title": "Max Tokens"
          },
          "mode": {
            "anyOf": [
              {
                "enum": [
                  "manual",
                  "adaptive"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Anthropic extended-thinking dispatch mode (manual/adaptive). Anthropic-specific; ignored on other providers. Leave unset to let Pioneer pick the per-model default and auto-upgrade where the model requires adaptive.",
            "title": "Mode"
          }
        },
        "title": "ReasoningRequest",
        "type": "object"
      },
      "RecentTask": {
        "description": "A single recent task row for the key drill-down.",
        "properties": {
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category"
          },
          "ended_at": {
            "format": "date-time",
            "title": "Ended At",
            "type": "string"
          },
          "harness": {
            "title": "Harness",
            "type": "string"
          },
          "harness_surface": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Harness Surface"
          },
          "models_used": {
            "items": {
              "type": "string"
            },
            "title": "Models Used",
            "type": "array"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "task_id": {
            "title": "Task Id",
            "type": "string"
          },
          "task_type": {
            "title": "Task Type",
            "type": "string"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "task_id",
          "started_at",
          "ended_at",
          "harness",
          "harness_surface",
          "category",
          "task_type",
          "request_count",
          "spend",
          "total_tokens",
          "models_used"
        ],
        "title": "RecentTask",
        "type": "object"
      },
      "RecheckBillingResponse": {
        "description": "Result of a manual Stripe billing-state recheck for a team.",
        "properties": {
          "card_fingerprint_present": {
            "title": "Card Fingerprint Present",
            "type": "boolean"
          },
          "card_verified": {
            "title": "Card Verified",
            "type": "boolean"
          },
          "changed": {
            "title": "Changed",
            "type": "boolean"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "card_verified",
          "card_fingerprint_present",
          "changed",
          "message"
        ],
        "title": "RecheckBillingResponse",
        "type": "object"
      },
      "RecordField": {
        "description": "Record field definition",
        "properties": {
          "allowed_values": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Values"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "type": {
            "default": "str",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "RecordField",
        "type": "object"
      },
      "RemovePaymentMethodRequest": {
        "description": "Request model for removing a payment method.",
        "properties": {
          "payment_method_id": {
            "description": "Stripe payment method ID to remove",
            "title": "Payment Method Id",
            "type": "string"
          }
        },
        "required": [
          "payment_method_id"
        ],
        "title": "RemovePaymentMethodRequest",
        "type": "object"
      },
      "RemoveTeamPaymentMethodRequest": {
        "description": "Request model for removing a team payment method.",
        "properties": {
          "payment_method_id": {
            "description": "Stripe payment method ID to remove",
            "title": "Payment Method Id",
            "type": "string"
          }
        },
        "required": [
          "payment_method_id"
        ],
        "title": "RemoveTeamPaymentMethodRequest",
        "type": "object"
      },
      "ResponsesReasoningRequest": {
        "additionalProperties": true,
        "description": "Opt-in reasoning controls in OpenAI Responses format.",
        "properties": {
          "effort": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional reasoning effort hint, such as 'low', 'medium', or 'high'.",
            "title": "Effort"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "OpenRouter-style switch for enabling reasoning on capable models.",
            "title": "Enabled"
          },
          "exclude": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "When supported by the upstream provider, exclude reasoning text from the response while still allowing the model to use reasoning.",
            "title": "Exclude"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional Responses-style reasoning summary mode.",
            "title": "Summary"
          }
        },
        "title": "ResponsesReasoningRequest",
        "type": "object"
      },
      "ResponsesRequest": {
        "additionalProperties": true,
        "description": "OpenAI-compatible Responses API request.\n\n``input`` accepts either a plain string (convenience shorthand used by the\nOpenAI SDK for simple text prompts) or a list of input items.",
        "properties": {
          "effort": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RoutingEffort"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request routing-effort tier (low/medium/high/xhigh/max) for router models like ``pioneer/auto``. Overrides the router's stored policy for this request only; ignored for non-router models."
          },
          "extra_body": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Body"
          },
          "extra_headers": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Headers"
          },
          "include": {
            "items": {
              "type": "string"
            },
            "title": "Include",
            "type": "array"
          },
          "include_confidence": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Include Confidence"
          },
          "include_spans": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "default": true,
            "title": "Include Spans"
          },
          "input": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            ],
            "title": "Input"
          },
          "instructions": {
            "default": "",
            "title": "Instructions",
            "type": "string"
          },
          "max_output_tokens": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Output Tokens"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "models": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request candidate-model subset the router may select between. Overrides the router's stored candidate set for this request only; ignored for non-router models.",
            "title": "Models"
          },
          "parallel_tool_calls": {
            "default": false,
            "title": "Parallel Tool Calls",
            "type": "boolean"
          },
          "previous_response_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pioneer inference ID or stored Responses wire ID to continue from. When present, Pioneer reconstructs the prior turn from inference history and prepends it to the new input.",
            "title": "Previous Response Id"
          },
          "prompt_cache_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt Cache Key"
          },
          "reasoning": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResponsesReasoningRequest"
              },
              {
                "type": "null"
              }
            ]
          },
          "service_tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Service Tier"
          },
          "store": {
            "default": true,
            "description": "Whether to store response state for turn-to-turn continuation. When true, Pioneer preserves the response for previous_response_id replay, including available tool-call and reasoning context.",
            "title": "Store",
            "type": "boolean"
          },
          "stream": {
            "default": false,
            "title": "Stream",
            "type": "boolean"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "**Deprecated.** Legacy task hint (``extract_entities`` / ``classify_text`` / ``extract_json`` / ``ner`` / ``schema``). The unified schema on ``text.format.schema`` disambiguates the task automatically. Submitting this field emits ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers on the response.",
            "title": "Task Type"
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "text": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResponsesTextRequest"
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_choice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "additionalProperties": true,
                "type": "object"
              }
            ],
            "default": "auto",
            "title": "Tool Choice"
          },
          "tools": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Tools",
            "type": "array"
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P"
          }
        },
        "required": [
          "model"
        ],
        "title": "ResponsesRequest",
        "type": "object"
      },
      "ResponsesTextFormatRequest": {
        "additionalProperties": true,
        "description": "Structured-output controls for Responses text formatting.",
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "schema": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schema"
          },
          "strict": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strict"
          },
          "type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Type"
          }
        },
        "title": "ResponsesTextFormatRequest",
        "type": "object"
      },
      "ResponsesTextRequest": {
        "additionalProperties": true,
        "description": "Responses text controls.",
        "properties": {
          "format": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResponsesTextFormatRequest"
              },
              {
                "type": "null"
              }
            ]
          },
          "verbosity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verbosity"
          }
        },
        "title": "ResponsesTextRequest",
        "type": "object"
      },
      "RouteRequest": {
        "additionalProperties": false,
        "description": "One routing request for a named model-selection router.\n\nEither ``messages`` (OpenAI-shape chat turns) or ``prompt`` (a single user\nstring) identifies the request text; ``messages`` wins when both are set.\nExactly one of the two must be non-empty. Every routing knob is optional and\nfalls back to the router's deployed default.\n\nAttributes:\n    router_type: Registry id of the router to score with (e.g. ``general``).\n    messages: OpenAI-shape chat messages to route.\n    prompt: Single user prompt, used when ``messages`` is absent.\n    threshold: Minimum calibrated success probability for a candidate\n        (code/auto router family only; ignored where unused).\n    max_regret: Allowed probability gap below the top candidate\n        (code/auto router family only; ignored where unused).\n    alpha: LinUCB exploration weight (router-specific; ignored where unused).\n    lambda_cost: Cost weight in the general router's ``q - cost*lambda``\n        policy (general router only; ignored where unused).\n    allowed_models: Optional catalog-id subset the router may select between.\n    actual_model: Catalog model the caller would otherwise use, for regret.",
        "properties": {
          "actual_model": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actual Model"
          },
          "allowed_models": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Models"
          },
          "alpha": {
            "anyOf": [
              {
                "maximum": 10.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha"
          },
          "lambda_cost": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lambda Cost"
          },
          "max_regret": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Regret"
          },
          "messages": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Messages"
          },
          "prompt": {
            "anyOf": [
              {
                "maxLength": 100000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt"
          },
          "router_type": {
            "minLength": 1,
            "title": "Router Type",
            "type": "string"
          },
          "threshold": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Threshold"
          }
        },
        "required": [
          "router_type"
        ],
        "title": "RouteRequest",
        "type": "object"
      },
      "RouteResponse": {
        "additionalProperties": false,
        "description": "A router's decision for one request.\n\nEvery model id is a standard Pioneer catalog id (the router normalizes its\ninternal slugs before responding).\n\nAttributes:\n    model: Chosen catalog model id, or ``None`` when the router declined.\n    confidence: Calibrated success probability of the chosen candidate.\n    expected_cost_usd: Router's expected cost for the chosen candidate.\n    rule: Decision-rule label that fired.\n    reason_codes: Diagnostic reason codes the router attached.\n    policy_version: Deployed policy version that produced the decision.\n    candidates: Per-candidate score rows the router considered.",
        "properties": {
          "candidates": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Candidates",
            "type": "array"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "expected_cost_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Cost Usd"
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model"
          },
          "policy_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Policy Version"
          },
          "reason_codes": {
            "items": {
              "type": "string"
            },
            "title": "Reason Codes",
            "type": "array"
          },
          "rule": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rule"
          }
        },
        "title": "RouteResponse",
        "type": "object"
      },
      "RoutedSavingsItem": {
        "description": "Routed-savings rollup for one project (or the overall total).\n\nCosts are the router's expected-cost basis recorded per inference, where\n``savings_usd`` is the benefit of the chosen model relative to the most\nexpensive candidate the router considered — not a billed-dollar figure.",
        "properties": {
          "expected_cost_usd": {
            "default": 0.0,
            "title": "Expected Cost Usd",
            "type": "number"
          },
          "fallback_count": {
            "default": 0,
            "title": "Fallback Count",
            "type": "integer"
          },
          "most_expensive_cost_usd": {
            "default": 0.0,
            "title": "Most Expensive Cost Usd",
            "type": "number"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Router project UUID; None for the overall rollup row",
            "title": "Project Id"
          },
          "routed_request_count": {
            "default": 0,
            "title": "Routed Request Count",
            "type": "integer"
          },
          "savings_ratio": {
            "default": 0.0,
            "description": "savings_usd / most_expensive_cost_usd, 0 when no baseline",
            "title": "Savings Ratio",
            "type": "number"
          },
          "savings_usd": {
            "default": 0.0,
            "title": "Savings Usd",
            "type": "number"
          }
        },
        "title": "RoutedSavingsItem",
        "type": "object"
      },
      "RoutedSavingsResponse": {
        "description": "Routed-savings report: overall rollup plus a per-project breakdown.",
        "properties": {
          "overall": {
            "$ref": "#/components/schemas/RoutedSavingsItem"
          },
          "per_project": {
            "items": {
              "$ref": "#/components/schemas/RoutedSavingsItem"
            },
            "title": "Per Project",
            "type": "array"
          }
        },
        "required": [
          "overall",
          "per_project"
        ],
        "title": "RoutedSavingsResponse",
        "type": "object"
      },
      "RoutedSavingsTimeseriesPoint": {
        "description": "One time-bucketed row from the routed-savings timeseries.",
        "properties": {
          "baseline_cost_usd": {
            "default": 0.0,
            "title": "Baseline Cost Usd",
            "type": "number"
          },
          "bucket_date": {
            "title": "Bucket Date",
            "type": "string"
          },
          "routed_cost_usd": {
            "default": 0.0,
            "title": "Routed Cost Usd",
            "type": "number"
          },
          "routed_request_count": {
            "default": 0,
            "title": "Routed Request Count",
            "type": "integer"
          },
          "savings_usd": {
            "default": 0.0,
            "title": "Savings Usd",
            "type": "number"
          }
        },
        "required": [
          "bucket_date"
        ],
        "title": "RoutedSavingsTimeseriesPoint",
        "type": "object"
      },
      "RoutedSavingsTimeseriesResponse": {
        "description": "Timeseries of router savings bucketed by day.\n\n``router_on`` reports whether routing is live for the caller's team. When\ntrue the points are realized savings stamped on routed inferences (blue,\n\"actual\"). When false the points are an *estimate* of what the router could\nhave saved, derived from the user's real billed spend repriced against a\nreference model (orange, \"estimated\").",
        "properties": {
          "points": {
            "items": {
              "$ref": "#/components/schemas/RoutedSavingsTimeseriesPoint"
            },
            "title": "Points",
            "type": "array"
          },
          "router_on": {
            "default": true,
            "title": "Router On",
            "type": "boolean"
          }
        },
        "required": [
          "points"
        ],
        "title": "RoutedSavingsTimeseriesResponse",
        "type": "object"
      },
      "RouterHarnessSplit": {
        "description": "Router vs raw spend split for one harness family.",
        "properties": {
          "direct_spend": {
            "title": "Direct Spend",
            "type": "number"
          },
          "harness": {
            "title": "Harness",
            "type": "string"
          },
          "routed_spend": {
            "title": "Routed Spend",
            "type": "number"
          }
        },
        "required": [
          "harness",
          "routed_spend",
          "direct_spend"
        ],
        "title": "RouterHarnessSplit",
        "type": "object"
      },
      "RouterMemberSplit": {
        "description": "Router vs raw spend split for one API key / team member.",
        "properties": {
          "api_key_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key Id"
          },
          "api_key_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key Name"
          },
          "direct_spend": {
            "title": "Direct Spend",
            "type": "number"
          },
          "key_creator_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key Creator Email"
          },
          "key_creator_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key Creator Name"
          },
          "key_creator_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key Creator User Id"
          },
          "routed_spend": {
            "title": "Routed Spend",
            "type": "number"
          }
        },
        "required": [
          "api_key_id",
          "api_key_name",
          "key_creator_user_id",
          "key_creator_name",
          "key_creator_email",
          "routed_spend",
          "direct_spend"
        ],
        "title": "RouterMemberSplit",
        "type": "object"
      },
      "RouterMeta": {
        "description": "Metadata describing one router type's selectable policy surface.",
        "properties": {
          "candidate_models": {
            "description": "Ordered catalog ids the router may select between.",
            "items": {
              "type": "string"
            },
            "title": "Candidate Models",
            "type": "array"
          },
          "effort_presets": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "description": "Per-effort policy partials the backend applies per request.",
            "title": "Effort Presets",
            "type": "object"
          }
        },
        "required": [
          "candidate_models",
          "effort_presets"
        ],
        "title": "RouterMeta",
        "type": "object"
      },
      "RouterMetaResponse": {
        "description": "Per-router effort presets and candidate models, plus the effort order.",
        "properties": {
          "efforts": {
            "description": "Routing-effort tiers in ascending cost/quality order.",
            "items": {
              "type": "string"
            },
            "title": "Efforts",
            "type": "array"
          },
          "routers": {
            "additionalProperties": {
              "$ref": "#/components/schemas/RouterMeta"
            },
            "description": "Metadata keyed by router type value.",
            "title": "Routers",
            "type": "object"
          }
        },
        "required": [
          "efforts",
          "routers"
        ],
        "title": "RouterMetaResponse",
        "type": "object"
      },
      "RouterSlice": {
        "description": "Spend / request count for one router (or the synthetic ``direct`` bucket).",
        "properties": {
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "router_type": {
            "description": "Model-selection router (code/auto_v1.1/auto_v1.2/general) or ``direct`` for raw calls that bypass the router.",
            "title": "Router Type",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          }
        },
        "required": [
          "router_type",
          "spend",
          "request_count"
        ],
        "title": "RouterSlice",
        "type": "object"
      },
      "RouterUsageResponse": {
        "description": "Model-router vs raw-model usage across coding-agent traffic.\n\nSeparates spend served through the Pioneer model router (optimized model\nselection) from raw direct-model calls that bypass it, so leaders can see\nrouter adoption and the raw-spend governance opportunity. ``router_mix``\nincludes the synthetic ``direct`` bucket as a first-class slice.",
        "properties": {
          "by_harness": {
            "items": {
              "$ref": "#/components/schemas/RouterHarnessSplit"
            },
            "title": "By Harness",
            "type": "array"
          },
          "by_member": {
            "items": {
              "$ref": "#/components/schemas/RouterMemberSplit"
            },
            "title": "By Member",
            "type": "array"
          },
          "direct_request_count": {
            "title": "Direct Request Count",
            "type": "integer"
          },
          "direct_spend": {
            "title": "Direct Spend",
            "type": "number"
          },
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          },
          "routed_request_count": {
            "title": "Routed Request Count",
            "type": "integer"
          },
          "routed_spend": {
            "title": "Routed Spend",
            "type": "number"
          },
          "router_mix": {
            "items": {
              "$ref": "#/components/schemas/RouterSlice"
            },
            "title": "Router Mix",
            "type": "array"
          },
          "total_spend": {
            "title": "Total Spend",
            "type": "number"
          }
        },
        "required": [
          "total_spend",
          "routed_spend",
          "direct_spend",
          "routed_request_count",
          "direct_request_count",
          "router_mix",
          "by_harness",
          "by_member",
          "meta"
        ],
        "title": "RouterUsageResponse",
        "type": "object"
      },
      "RoutingEffort": {
        "description": "Per-request routing-effort tier, ascending in cost and quality.\n\nA router-agnostic label the caller sends as the ``effort`` param (or as a\n``model`` suffix). Each router type maps these tiers to its own concrete\npolicy via its :class:`RouterProfile`.",
        "enum": [
          "low",
          "medium",
          "high",
          "xhigh",
          "max"
        ],
        "title": "RoutingEffort",
        "type": "string"
      },
      "RowUpdate": {
        "description": "A single row update specification.",
        "properties": {
          "changes": {
            "additionalProperties": true,
            "description": "Column name to new value mapping",
            "title": "Changes",
            "type": "object"
          },
          "row_index": {
            "description": "Zero-based index of the row to update",
            "title": "Row Index",
            "type": "integer"
          }
        },
        "required": [
          "row_index",
          "changes"
        ],
        "title": "RowUpdate",
        "type": "object"
      },
      "SeatChangePreview": {
        "description": "Preview of a seat-count change before it is applied.",
        "properties": {
          "current_seats": {
            "description": "Current number of seats",
            "title": "Current Seats",
            "type": "integer"
          },
          "interval": {
            "description": "Billing interval: 'month' or 'year'",
            "title": "Interval",
            "type": "string"
          },
          "new_seats": {
            "description": "Seat count after the change",
            "title": "New Seats",
            "type": "integer"
          },
          "new_total": {
            "description": "New total cost per interval in whole dollars",
            "title": "New Total",
            "type": "integer"
          },
          "proration_amount": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated proration charge in whole dollars, if available",
            "title": "Proration Amount"
          },
          "unit_price": {
            "description": "Price per seat in whole dollars",
            "title": "Unit Price",
            "type": "integer"
          }
        },
        "required": [
          "current_seats",
          "new_seats",
          "unit_price",
          "interval",
          "new_total"
        ],
        "title": "SeatChangePreview",
        "type": "object"
      },
      "SetActiveTeamRequest": {
        "description": "Request body for POST /users/me/active-team.",
        "properties": {
          "team_id": {
            "format": "uuid",
            "title": "Team Id",
            "type": "string"
          }
        },
        "required": [
          "team_id"
        ],
        "title": "SetActiveTeamRequest",
        "type": "object"
      },
      "SetupPaymentMethodRequest": {
        "description": "Request model for setting up a payment method.\n\nOn the initial attempt the frontend sends only ``payment_method_id`` and\nthe backend creates a $1 pre-auth PaymentIntent to verify the card. If\nthe issuer requires SCA the response carries ``requires_action=True``\nand a ``client_secret`` / ``payment_intent_id`` pair. The frontend then\ndrives the 3DS challenge via ``stripe.handleNextAction`` and re-calls\nthis endpoint with BOTH ``payment_method_id`` AND ``payment_intent_id``;\nthe backend retrieves and finalizes that existing PI (rather than\ncreating a new one) so we read the post-3DS state instead of Stripe's\nidempotent replay of the original ``requires_action`` body.",
        "properties": {
          "payment_intent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set only on the post-3DS retry to finalize the existing verification PaymentIntent. Must match the ``payment_intent_id`` returned in the previous ``requires_action`` response.",
            "title": "Payment Intent Id"
          },
          "payment_method_id": {
            "description": "Stripe payment method ID from Stripe.js",
            "title": "Payment Method Id",
            "type": "string"
          }
        },
        "required": [
          "payment_method_id"
        ],
        "title": "SetupPaymentMethodRequest",
        "type": "object"
      },
      "SetupPaymentMethodResponse": {
        "description": "Response model for payment method setup.\n\nWhen the issuer requires SCA / 3DS on the verification PaymentIntent\nthe response sets ``requires_action=True`` and ships ``client_secret``\nso the frontend can complete the 3DS challenge via\n``stripe.handleNextAction`` and re-invoke the same endpoint. The\nbackend re-creates the PaymentIntent with the same idempotency key,\nStripe returns the same (now-confirmed) intent, and we finalize.",
        "properties": {
          "client_secret": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Secret"
          },
          "customer_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Id"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "payment_intent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Intent Id"
          },
          "requires_action": {
            "default": false,
            "title": "Requires Action",
            "type": "boolean"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "SetupPaymentMethodResponse",
        "type": "object"
      },
      "SetupTeamPaymentMethodRequest": {
        "description": "Request model for setting up a team payment method.\n\nSee ``SetupPaymentMethodRequest`` for the two-call SCA protocol.",
        "properties": {
          "payment_intent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set only on the post-3DS retry to finalize the existing verification PaymentIntent. Must match the ``payment_intent_id`` returned in the previous ``requires_action`` response.",
            "title": "Payment Intent Id"
          },
          "payment_method_id": {
            "description": "Stripe payment method ID from Stripe.js",
            "title": "Payment Method Id",
            "type": "string"
          }
        },
        "required": [
          "payment_method_id"
        ],
        "title": "SetupTeamPaymentMethodRequest",
        "type": "object"
      },
      "SignupAttributionRequest": {
        "description": "First-touch marketing attribution captured at signup.\n\nAll fields are optional. Only non-null values are persisted, and each field\nis written once (first non-null wins) so a later sign-in never overwrites\nthe original campaign. Values are length-bounded since they originate from\nuntrusted URL/cookie input.\n\nAttributes:\n    utm_source: Traffic source (e.g. 'google').\n    utm_medium: Marketing medium (e.g. 'cpc').\n    utm_campaign: Campaign name.\n    utm_content: Ad/content variant.\n    utm_term: Paid keyword (reserved for future use).\n    gclid: Google click id for ads conversion attribution.\n    twclid: X/Twitter click id for ads conversion attribution.\n    rdt_cid: Reddit click id for ads conversion attribution.",
        "properties": {
          "gclid": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gclid"
          },
          "rdt_cid": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rdt Cid"
          },
          "twclid": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Twclid"
          },
          "utm_campaign": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Campaign"
          },
          "utm_content": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Content"
          },
          "utm_medium": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Medium"
          },
          "utm_source": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Source"
          },
          "utm_term": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Term"
          }
        },
        "title": "SignupAttributionRequest",
        "type": "object"
      },
      "SignupAttributionResponse": {
        "description": "Response for POST /users/me/attribution.\n\nAttributes:\n    success: Whether the request was processed without error.\n    recorded: Whether any attribution field was newly written (False when\n        nothing was supplied or every field was already set).",
        "properties": {
          "recorded": {
            "title": "Recorded",
            "type": "boolean"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "recorded"
        ],
        "title": "SignupAttributionResponse",
        "type": "object"
      },
      "SpanFrequency": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "text": {
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "text",
          "count"
        ],
        "title": "SpanFrequency",
        "type": "object"
      },
      "SplitRatio": {
        "properties": {
          "train": {
            "title": "Train",
            "type": "number"
          },
          "val": {
            "title": "Val",
            "type": "number"
          }
        },
        "required": [
          "train",
          "val"
        ],
        "title": "SplitRatio",
        "type": "object"
      },
      "SplitRatioConfig": {
        "description": "Split ratio configuration for train/eval split datasets.\n\nValues are decimals (e.g. 0.8 for 80% training, 0.2 for 20% evaluation).",
        "properties": {
          "evaluation": {
            "default": 0.2,
            "description": "Fraction of data for evaluation (0.05–0.95)",
            "maximum": 0.95,
            "minimum": 0.05,
            "title": "Evaluation",
            "type": "number"
          },
          "training": {
            "default": 0.8,
            "description": "Fraction of data for training (0.05–0.95)",
            "maximum": 0.95,
            "minimum": 0.05,
            "title": "Training",
            "type": "number"
          }
        },
        "title": "SplitRatioConfig",
        "type": "object"
      },
      "SplitsAnalysis": {
        "properties": {
          "split_ratio_actual": {
            "$ref": "#/components/schemas/SplitRatio"
          },
          "train_count": {
            "title": "Train Count",
            "type": "integer"
          },
          "train_distribution": {
            "items": {
              "$ref": "#/components/schemas/LabelDistribution"
            },
            "title": "Train Distribution",
            "type": "array"
          },
          "val_count": {
            "title": "Val Count",
            "type": "integer"
          },
          "val_distribution": {
            "items": {
              "$ref": "#/components/schemas/LabelDistribution"
            },
            "title": "Val Distribution",
            "type": "array"
          }
        },
        "required": [
          "train_count",
          "val_count",
          "train_distribution",
          "val_distribution",
          "split_ratio_actual"
        ],
        "title": "SplitsAnalysis",
        "type": "object"
      },
      "StopJobResponse": {
        "description": "Response after stopping a training job",
        "properties": {
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message",
          "job_id",
          "status"
        ],
        "title": "StopJobResponse",
        "type": "object"
      },
      "SuccessResponse": {
        "description": "Generic success response.",
        "properties": {
          "data": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "title": "SuccessResponse",
        "type": "object"
      },
      "SummaryDailyPoint": {
        "description": "One day of coding-harness spend, split by software-engineering intent.",
        "properties": {
          "date": {
            "description": "UTC calendar day, ``YYYY-MM-DD``.",
            "title": "Date",
            "type": "string"
          },
          "direct_spend": {
            "default": 0.0,
            "description": "Spend that day on raw direct-model calls (USD).",
            "title": "Direct Spend",
            "type": "number"
          },
          "engineering_spend": {
            "description": "Spend that quarter excluding ``non_coding`` tasks (USD).",
            "title": "Engineering Spend",
            "type": "number"
          },
          "routed_spend": {
            "default": 0.0,
            "description": "Spend that day served via the model router (USD).",
            "title": "Routed Spend",
            "type": "number"
          },
          "spend": {
            "description": "Total coding-harness spend (USD) that day.",
            "title": "Spend",
            "type": "number"
          }
        },
        "required": [
          "date",
          "spend",
          "engineering_spend"
        ],
        "title": "SummaryDailyPoint",
        "type": "object"
      },
      "SupportContactRequest": {
        "description": "A user-submitted support request from the in-app Support modal.",
        "properties": {
          "category": {
            "maxLength": 60,
            "minLength": 1,
            "title": "Category",
            "type": "string"
          },
          "message": {
            "maxLength": 5000,
            "minLength": 1,
            "title": "Message",
            "type": "string"
          },
          "subject": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Subject",
            "type": "string"
          },
          "team_name": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Team Name"
          }
        },
        "required": [
          "category",
          "subject",
          "message"
        ],
        "title": "SupportContactRequest",
        "type": "object"
      },
      "SynthesisLogCreate": {
        "description": "Request body for creating a single synthesis log entry.",
        "properties": {
          "content": {
            "additionalProperties": true,
            "description": "Flexible payload keyed by entry_type",
            "title": "Content",
            "type": "object"
          },
          "dataset_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset ID, set when already linked",
            "title": "Dataset Id"
          },
          "entry_type": {
            "description": "Type of log entry",
            "enum": [
              "prompt",
              "seed_generation",
              "seed_feedback",
              "prompt_update",
              "expansion",
              "finalization"
            ],
            "title": "Entry Type",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID for the session",
            "title": "Project Id"
          },
          "session_id": {
            "description": "UUID grouping all entries for one synthesis session",
            "title": "Session Id",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "entry_type"
        ],
        "title": "SynthesisLogCreate",
        "type": "object"
      },
      "SynthesisLogDatasetResponse": {
        "description": "Response containing all synthesis log entries linked to a dataset.",
        "properties": {
          "dataset_id": {
            "title": "Dataset Id",
            "type": "string"
          },
          "entries": {
            "items": {
              "$ref": "#/components/schemas/SynthesisLogEntry"
            },
            "title": "Entries",
            "type": "array"
          }
        },
        "required": [
          "dataset_id",
          "entries"
        ],
        "title": "SynthesisLogDatasetResponse",
        "type": "object"
      },
      "SynthesisLogEntry": {
        "description": "Single synthesis log entry returned from the API.",
        "properties": {
          "content": {
            "additionalProperties": true,
            "title": "Content",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "dataset_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dataset Id"
          },
          "entry_type": {
            "enum": [
              "prompt",
              "seed_generation",
              "seed_feedback",
              "prompt_update",
              "expansion",
              "finalization"
            ],
            "title": "Entry Type",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "session_id",
          "entry_type",
          "content",
          "created_at"
        ],
        "title": "SynthesisLogEntry",
        "type": "object"
      },
      "SynthesisLogLinkRequest": {
        "description": "Request body for linking a synthesis session to a dataset.",
        "properties": {
          "dataset_id": {
            "description": "Dataset UUID to associate with every entry in the session",
            "title": "Dataset Id",
            "type": "string"
          }
        },
        "required": [
          "dataset_id"
        ],
        "title": "SynthesisLogLinkRequest",
        "type": "object"
      },
      "SynthesisLogSessionResponse": {
        "description": "Response containing all entries for a synthesis session.",
        "properties": {
          "entries": {
            "items": {
              "$ref": "#/components/schemas/SynthesisLogEntry"
            },
            "title": "Entries",
            "type": "array"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "entries"
        ],
        "title": "SynthesisLogSessionResponse",
        "type": "object"
      },
      "SystemContentBlock": {
        "description": "A system content block in Anthropic format.",
        "properties": {
          "cache_control": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cache Control"
          },
          "text": {
            "default": "",
            "title": "Text",
            "type": "string"
          },
          "type": {
            "default": "text",
            "title": "Type",
            "type": "string"
          }
        },
        "title": "SystemContentBlock",
        "type": "object"
      },
      "TeamBillingFullStatusResponse": {
        "description": "Full billing status for a team (for billing/admin/owner roles).",
        "properties": {
          "billing_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BillingAddress"
              },
              {
                "type": "null"
              }
            ],
            "description": "Customer-level billing address on file in Stripe (display-only)."
          },
          "billing_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Customer-level billing name on file in Stripe (display-only).",
            "title": "Billing Name"
          },
          "cancel_at_period_end": {
            "default": false,
            "description": "True when the subscription is scheduled to cancel at the end of the current billing period.",
            "title": "Cancel At Period End",
            "type": "boolean"
          },
          "credit_limit": {
            "title": "Credit Limit",
            "type": "number"
          },
          "current_period_end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO timestamp when the current billing period ends. Present when cancel_at_period_end is true.",
            "title": "Current Period End"
          },
          "exceeds_free_tier": {
            "title": "Exceeds Free Tier",
            "type": "boolean"
          },
          "free_tier_remaining": {
            "title": "Free Tier Remaining",
            "type": "number"
          },
          "has_payment_method": {
            "title": "Has Payment Method",
            "type": "boolean"
          },
          "payment_methods": {
            "items": {
              "$ref": "#/components/schemas/PaymentMethodInfo"
            },
            "title": "Payment Methods",
            "type": "array"
          },
          "payment_plan": {
            "title": "Payment Plan",
            "type": "string"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          },
          "team_name": {
            "title": "Team Name",
            "type": "string"
          },
          "total_usage": {
            "title": "Total Usage",
            "type": "number"
          }
        },
        "required": [
          "team_id",
          "team_name",
          "payment_plan",
          "has_payment_method",
          "total_usage",
          "credit_limit",
          "free_tier_remaining",
          "exceeds_free_tier"
        ],
        "title": "TeamBillingFullStatusResponse",
        "type": "object"
      },
      "TeamBillingStatusResponse": {
        "description": "Response model for team billing status (limited info for team members).",
        "properties": {
          "has_payment_method": {
            "title": "Has Payment Method",
            "type": "boolean"
          },
          "owner_name": {
            "title": "Owner Name",
            "type": "string"
          },
          "payment_plan": {
            "title": "Payment Plan",
            "type": "string"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          },
          "team_name": {
            "title": "Team Name",
            "type": "string"
          }
        },
        "required": [
          "team_id",
          "team_name",
          "owner_name",
          "payment_plan",
          "has_payment_method"
        ],
        "title": "TeamBillingStatusResponse",
        "type": "object"
      },
      "TeamCreate": {
        "description": "Request model for creating a team.",
        "properties": {
          "name": {
            "description": "Name for the team",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "usage_reset_timezone": {
            "anyOf": [
              {
                "maxLength": 50,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "IANA timezone for the daily credit reset hour. Defaults to UTC when omitted.",
            "title": "Usage Reset Timezone"
          }
        },
        "required": [
          "name"
        ],
        "title": "TeamCreate",
        "type": "object"
      },
      "TeamDeleteResponse": {
        "description": "Response model for deleting a team.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          }
        },
        "required": [
          "success",
          "message",
          "team_id"
        ],
        "title": "TeamDeleteResponse",
        "type": "object"
      },
      "TeamInvitationCreate": {
        "description": "Request model for inviting a member to a team.",
        "properties": {
          "email": {
            "description": "Email address of the person to invite",
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/TeamRole",
            "default": "viewer",
            "description": "Role to assign to the invitee"
          }
        },
        "required": [
          "email"
        ],
        "title": "TeamInvitationCreate",
        "type": "object"
      },
      "TeamInvitationResponse": {
        "description": "Response model for a team invitation.",
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "title": "Email",
            "type": "string"
          },
          "email_sent": {
            "default": true,
            "description": "Whether the invitation email was successfully handed off to SendGrid. Only meaningful on the create-invite response; list endpoints do not track historical delivery and default to True.",
            "title": "Email Sent",
            "type": "boolean"
          },
          "expires_at": {
            "title": "Expires At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "invited_by": {
            "title": "Invited By",
            "type": "string"
          },
          "inviter_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Inviter Email"
          },
          "inviter_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Inviter Name"
          },
          "role": {
            "$ref": "#/components/schemas/TeamRole"
          },
          "status": {
            "$ref": "#/components/schemas/InvitationStatus"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          },
          "team_name": {
            "title": "Team Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "team_id",
          "team_name",
          "email",
          "role",
          "status",
          "invited_by",
          "created_at",
          "expires_at"
        ],
        "title": "TeamInvitationResponse",
        "type": "object"
      },
      "TeamInvitationsListResponse": {
        "description": "Response model for listing team invitations.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "invitations": {
            "items": {
              "$ref": "#/components/schemas/TeamInvitationResponse"
            },
            "title": "Invitations",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "invitations",
          "count"
        ],
        "title": "TeamInvitationsListResponse",
        "type": "object"
      },
      "TeamLeaveResponse": {
        "description": "Response model for leaving a team.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "new_active_team_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Active Team Id"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          }
        },
        "required": [
          "success",
          "message",
          "team_id"
        ],
        "title": "TeamLeaveResponse",
        "type": "object"
      },
      "TeamListResponse": {
        "description": "Response model for listing teams.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          },
          "teams": {
            "items": {
              "$ref": "#/components/schemas/TeamResponse"
            },
            "title": "Teams",
            "type": "array"
          }
        },
        "required": [
          "teams",
          "count"
        ],
        "title": "TeamListResponse",
        "type": "object"
      },
      "TeamMemberMfaStatus": {
        "description": "MFA enrollment status for a single team member.\n\n``has_mfa`` is True when the member has at least one verified TOTP\nfactor; failed admin-API lookups fall back to ``has_mfa=False`` with\nan empty ``email`` so the surface degrades rather than 500-ing.",
        "properties": {
          "email": {
            "title": "Email",
            "type": "string"
          },
          "has_mfa": {
            "title": "Has Mfa",
            "type": "boolean"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "has_mfa"
        ],
        "title": "TeamMemberMfaStatus",
        "type": "object"
      },
      "TeamMemberRemoveResponse": {
        "description": "Response model for removing a team member.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "success",
          "message",
          "user_id",
          "team_id"
        ],
        "title": "TeamMemberRemoveResponse",
        "type": "object"
      },
      "TeamMemberResponse": {
        "description": "Response model for a team member.\n\n``mfa_enabled`` and ``mfa_factor_count`` are sensitive targeting data\nand are populated only on the members-list response, and only for\ncallers holding ``MANAGE_BILLING`` — matching the gated\n``/teams/{id}/members/mfa-status`` surface. ``None`` means the field\nwas not populated (caller lacks the permission, or the endpoint does\nnot enrich it), never that MFA is disabled. Endpoints that do not\nenrich (e.g. role update) leave both fields ``None``.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "joined_at": {
            "title": "Joined At",
            "type": "string"
          },
          "mfa_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mfa Enabled"
          },
          "mfa_factor_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mfa Factor Count"
          },
          "role": {
            "$ref": "#/components/schemas/TeamRole"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          },
          "user_avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Avatar Url"
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          }
        },
        "required": [
          "id",
          "team_id",
          "user_id",
          "role",
          "joined_at"
        ],
        "title": "TeamMemberResponse",
        "type": "object"
      },
      "TeamMemberUsage": {
        "description": "Usage information for a team member.",
        "properties": {
          "email": {
            "title": "Email",
            "type": "string"
          },
          "full_name": {
            "title": "Full Name",
            "type": "string"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "total_credits": {
            "title": "Total Credits",
            "type": "number"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "full_name",
          "total_credits",
          "request_count"
        ],
        "title": "TeamMemberUsage",
        "type": "object"
      },
      "TeamMembersListResponse": {
        "description": "Response model for listing team members.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/TeamMemberResponse"
            },
            "title": "Members",
            "type": "array"
          },
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "members",
          "count"
        ],
        "title": "TeamMembersListResponse",
        "type": "object"
      },
      "TeamMembersMfaStatusResponse": {
        "description": "Response model for the gated members MFA-status surface.",
        "properties": {
          "members": {
            "items": {
              "$ref": "#/components/schemas/TeamMemberMfaStatus"
            },
            "title": "Members",
            "type": "array"
          }
        },
        "required": [
          "members"
        ],
        "title": "TeamMembersMfaStatusResponse",
        "type": "object"
      },
      "TeamResponse": {
        "description": "Response model for a single team.",
        "properties": {
          "capabilities": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "boolean"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Capabilities"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "current_user_role": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TeamRole"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "member_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Member Count"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "owner_id": {
            "title": "Owner Id",
            "type": "string"
          },
          "payment_plan": {
            "title": "Payment Plan",
            "type": "string"
          },
          "router_enabled": {
            "default": true,
            "title": "Router Enabled",
            "type": "boolean"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "zero_data_retention": {
            "default": false,
            "title": "Zero Data Retention",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "owner_id",
          "payment_plan",
          "created_at",
          "updated_at"
        ],
        "title": "TeamResponse",
        "type": "object"
      },
      "TeamRole": {
        "description": "Team member roles with hierarchical permissions.\n\nWire DTO mirror of the ORM ``TeamRoleType`` enum. Used only for API\nrequest/response serialization; authorization decisions route through the\nORM matrix (``database_tables.permissions``), never this enum.",
        "enum": [
          "owner",
          "billing",
          "admin",
          "editor",
          "viewer"
        ],
        "title": "TeamRole",
        "type": "string"
      },
      "TeamRoleUpdate": {
        "description": "Request model for updating a member's role.",
        "properties": {
          "role": {
            "$ref": "#/components/schemas/TeamRole",
            "description": "New role for the team member"
          }
        },
        "required": [
          "role"
        ],
        "title": "TeamRoleUpdate",
        "type": "object"
      },
      "TeamSettingsUpdate": {
        "description": "Allowed fields for PATCH /teams/{team_id}/settings.",
        "properties": {
          "router_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Enable the team's auto model-router",
            "title": "Router Enabled"
          },
          "zero_data_retention": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Enable account-level Zero Data Retention: inference is not persisted and upstream gateways are told not to retain data.",
            "title": "Zero Data Retention"
          }
        },
        "title": "TeamSettingsUpdate",
        "type": "object"
      },
      "TeamUpdate": {
        "description": "Request model for updating a team.",
        "properties": {
          "name": {
            "anyOf": [
              {
                "maxLength": 100,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "New name for the team",
            "title": "Name"
          }
        },
        "title": "TeamUpdate",
        "type": "object"
      },
      "TeamUsageResponse": {
        "description": "Response model for team member usage breakdown.",
        "properties": {
          "members": {
            "items": {
              "$ref": "#/components/schemas/TeamMemberUsage"
            },
            "title": "Members",
            "type": "array"
          },
          "team_id": {
            "title": "Team Id",
            "type": "string"
          },
          "team_name": {
            "title": "Team Name",
            "type": "string"
          },
          "total_usage": {
            "title": "Total Usage",
            "type": "number"
          }
        },
        "required": [
          "team_id",
          "team_name",
          "total_usage",
          "members"
        ],
        "title": "TeamUsageResponse",
        "type": "object"
      },
      "TerminateJobResponse": {
        "description": "Response after terminating a training job",
        "properties": {
          "deleted_checkpoints": {
            "title": "Deleted Checkpoints",
            "type": "integer"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message",
          "job_id",
          "deleted_checkpoints"
        ],
        "title": "TerminateJobResponse",
        "type": "object"
      },
      "TextCompletionChoice": {
        "description": "A single text completion choice.\n\nThe OpenAI ``/v1/completions`` chunk / response schema has no\nreasoning slot. Pioneer adopts the de facto vLLM extension and\nexposes upstream reasoning on ``reasoning_content`` so this surface\nstays symmetric with ``/v1/chat/completions``\n(:class:`ChatCompletionStreamDelta` and ``message.reasoning_content``).\nStock OpenAI SDK consumers reading only ``text`` ignore the unknown\nfield; reasoning-aware consumers drain both. The streaming-chunk\nrenderer at\n:class:`~services.inference.adapters.openai_text._TextStreamRenderer`\nemits ``choices[0].reasoning_content`` on the wire for thinking\ndeltas.",
        "properties": {
          "finish_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finish Reason"
          },
          "index": {
            "default": 0,
            "title": "Index",
            "type": "integer"
          },
          "logprobs": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logprobs"
          },
          "reasoning_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning Content"
          },
          "text": {
            "default": "",
            "title": "Text",
            "type": "string"
          }
        },
        "title": "TextCompletionChoice",
        "type": "object"
      },
      "TextCompletionRequest": {
        "description": "OpenAI-compatible text completion request.",
        "properties": {
          "echo": {
            "default": false,
            "title": "Echo",
            "type": "boolean"
          },
          "effort": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RoutingEffort"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request routing-effort tier (low/medium/high/xhigh/max) for router models like ``pioneer/auto``. Higher tiers prefer stronger, costlier models. Overrides the router's stored policy for this request only; ignored for non-router models."
          },
          "extra_body": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Body"
          },
          "include_confidence": {
            "default": true,
            "title": "Include Confidence",
            "type": "boolean"
          },
          "include_spans": {
            "default": true,
            "title": "Include Spans",
            "type": "boolean"
          },
          "logprobs": {
            "anyOf": [
              {
                "maximum": 20.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logprobs"
          },
          "max_tokens": {
            "anyOf": [
              {
                "maximum": 131072.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tokens"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "models": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-request candidate-model subset the router may select between. Overrides the router's stored candidate set for this request only; ignored for non-router models.",
            "title": "Models"
          },
          "prompt": {
            "title": "Prompt",
            "type": "string"
          },
          "reasoning": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opt-in reasoning / extended-thinking controls. Accepts the OpenRouter-normalized shape (``enabled``, ``max_tokens``, ``effort``, ``exclude``); ``effort`` and ``max_tokens`` are mutually exclusive. Pioneer extensions for Claude routes: ``mode`` (manual/adaptive) and ``display`` (summarized/omitted). Pioneer canonicalizes this and renders each provider's native field at the wire boundary.",
            "title": "Reasoning"
          },
          "schema": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Schema for the Pioneer encoder. **Deprecated when supplied as a flat list** of entity labels; use the unified dict shape instead. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.",
            "title": "Schema"
          },
          "stop": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop"
          },
          "store": {
            "default": true,
            "title": "Store",
            "type": "boolean"
          },
          "stream": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stream"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "**Deprecated.** Legacy task hint. The unified schema disambiguates the task automatically. Submitting this field emits ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.",
            "title": "Task Type"
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "title": "TextCompletionRequest",
        "type": "object"
      },
      "TextCompletionResponse": {
        "description": "OpenAI-compatible text completion response.",
        "properties": {
          "choices": {
            "items": {
              "$ref": "#/components/schemas/TextCompletionChoice"
            },
            "title": "Choices",
            "type": "array"
          },
          "created": {
            "title": "Created",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "object": {
            "default": "text_completion",
            "title": "Object",
            "type": "string"
          },
          "usage": {
            "$ref": "#/components/schemas/ChatCompletionUsage"
          },
          "x_pioneer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PioneerExtension"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "model",
          "choices",
          "usage"
        ],
        "title": "TextCompletionResponse",
        "type": "object"
      },
      "TimeseriesPoint": {
        "description": "Spend / tokens for one (bucket, key) cell of a stacked time series.",
        "properties": {
          "bucket": {
            "description": "ISO-8601 UTC bucket start; matches an entry in ``buckets``.",
            "title": "Bucket",
            "type": "string"
          },
          "key": {
            "description": "Series key — a harness family or a model name.",
            "title": "Key",
            "type": "string"
          },
          "spend": {
            "title": "Spend",
            "type": "number"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "bucket",
          "key",
          "spend",
          "total_tokens"
        ],
        "title": "TimeseriesPoint",
        "type": "object"
      },
      "TimeseriesResponse": {
        "description": "Harness-mix and model-mix over time, plus an hour-of-day usage profile.\n\n``*_over_time`` is a sparse long-format series over ``buckets`` (the complete\nordered time axis at ``granularity``, so the UI can zero-fill gaps and keep\ntime continuous). ``*_by_hour`` aggregates the whole window into 24 UTC\nhour-of-day buckets to expose daily usage patterns independent of the range.\n``harness_keys`` / ``model_keys`` are the distinct series, ordered by total\nspend, so the UI can pick a stable stacking order and cap the model legend.",
        "properties": {
          "buckets": {
            "description": "Complete ordered ISO-8601 UTC time axis at ``granularity``.",
            "items": {
              "type": "string"
            },
            "title": "Buckets",
            "type": "array"
          },
          "granularity": {
            "enum": [
              "hour",
              "day"
            ],
            "title": "Granularity",
            "type": "string"
          },
          "harness_by_hour": {
            "items": {
              "$ref": "#/components/schemas/HourOfDayPoint"
            },
            "title": "Harness By Hour",
            "type": "array"
          },
          "harness_keys": {
            "items": {
              "type": "string"
            },
            "title": "Harness Keys",
            "type": "array"
          },
          "harness_over_time": {
            "items": {
              "$ref": "#/components/schemas/TimeseriesPoint"
            },
            "title": "Harness Over Time",
            "type": "array"
          },
          "meta": {
            "$ref": "#/components/schemas/ObservabilityMeta"
          },
          "model_by_hour": {
            "items": {
              "$ref": "#/components/schemas/HourOfDayPoint"
            },
            "title": "Model By Hour",
            "type": "array"
          },
          "model_keys": {
            "items": {
              "type": "string"
            },
            "title": "Model Keys",
            "type": "array"
          },
          "model_over_time": {
            "items": {
              "$ref": "#/components/schemas/TimeseriesPoint"
            },
            "title": "Model Over Time",
            "type": "array"
          }
        },
        "required": [
          "granularity",
          "buckets",
          "harness_keys",
          "model_keys",
          "harness_over_time",
          "model_over_time",
          "harness_by_hour",
          "model_by_hour",
          "meta"
        ],
        "title": "TimeseriesResponse",
        "type": "object"
      },
      "TokenVolumeTimeseriesPoint": {
        "description": "One bucket of aggregated token volume.",
        "properties": {
          "bucket_date": {
            "description": "ISO date or datetime string",
            "title": "Bucket Date",
            "type": "string"
          },
          "input_tokens": {
            "title": "Input Tokens",
            "type": "integer"
          },
          "output_tokens": {
            "title": "Output Tokens",
            "type": "integer"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "bucket_date",
          "input_tokens",
          "output_tokens",
          "total_tokens",
          "request_count"
        ],
        "title": "TokenVolumeTimeseriesPoint",
        "type": "object"
      },
      "TokenVolumeTimeseriesResponse": {
        "description": "Token volume timeseries for charts.",
        "properties": {
          "points": {
            "items": {
              "$ref": "#/components/schemas/TokenVolumeTimeseriesPoint"
            },
            "title": "Points",
            "type": "array"
          }
        },
        "required": [
          "points"
        ],
        "title": "TokenVolumeTimeseriesResponse",
        "type": "object"
      },
      "ToolInfo": {
        "description": "Tool information.",
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "description"
        ],
        "title": "ToolInfo",
        "type": "object"
      },
      "ToolsResponse": {
        "description": "Response for tools endpoint.",
        "properties": {
          "client_type": {
            "title": "Client Type",
            "type": "string"
          },
          "tools": {
            "items": {
              "$ref": "#/components/schemas/ToolInfo"
            },
            "title": "Tools",
            "type": "array"
          }
        },
        "required": [
          "tools",
          "client_type"
        ],
        "title": "ToolsResponse",
        "type": "object"
      },
      "TrainingDatasetRow": {
        "description": "Dataset row rendered under the \"Training datasets\" section.",
        "properties": {
          "dataset_name": {
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Domain type of the dataset (ner, classification, custom, decoder).",
            "title": "Dataset Type"
          },
          "generation_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the dataset was created: synthesize, upload, auto_relabel, manual_relabel, grow, external.",
            "title": "Generation Type"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "sample_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Size"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "version_number": {
            "title": "Version Number",
            "type": "string"
          }
        },
        "required": [
          "id",
          "dataset_name",
          "version_number"
        ],
        "title": "TrainingDatasetRow",
        "type": "object"
      },
      "TrainingJobCreate": {
        "description": "Request to create a training job.",
        "properties": {
          "auto_data_sizing": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only. Opt-in: when true, downsample each training dataset to min(max_samples_per_dataset, max(min_samples_per_dataset, samples_per_label * num_labels)). When omitted or false, the full provided dataset is used (no silent downsampling). Defaults to false in the Modal container.",
            "title": "Auto Data Sizing"
          },
          "base_model": {
            "description": "HuggingFace model identifier (e.g. 'fastino/gliner2-base-v1', 'Qwen/Qwen3-8B').",
            "minLength": 1,
            "title": "Base Model",
            "type": "string"
          },
          "batch_size": {
            "default": 4,
            "description": "Training batch size. Prefer omitting this field so the training service applies the catalog default for ``base_model``. Explicit values equal to this Field default (4) that exceed the model's safe maximum are treated as legacy unset clients and clamped to the catalog default at the training service boundary; any other oversize value is rejected.",
            "minimum": 1.0,
            "title": "Batch Size",
            "type": "integer"
          },
          "datasets": {
            "description": "Datasets to train on (supports multi-dataset training)",
            "items": {
              "$ref": "#/components/schemas/DatasetReference"
            },
            "minItems": 1,
            "title": "Datasets",
            "type": "array"
          },
          "early_stopping_min_delta": {
            "default": 0.0001,
            "description": "Minimum validation loss improvement to count as progress. Prevents early stopping from triggering on noise.",
            "minimum": 0.0,
            "title": "Early Stopping Min Delta",
            "type": "number"
          },
          "early_stopping_patience": {
            "default": 3,
            "description": "Validation epochs without improvement before stopping. Requires validation_data_percentage > 0. Set to 0 to disable.",
            "minimum": 0.0,
            "title": "Early Stopping Patience",
            "type": "integer"
          },
          "encoder_learning_rate": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only: learning rate applied to encoder parameters. When omitted, falls back to `learning_rate`.",
            "title": "Encoder Learning Rate"
          },
          "gradient_accumulation_steps": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only: accumulate gradients over N mini-batches before each optimizer step. Effective batch size = batch_size * N.",
            "title": "Gradient Accumulation Steps"
          },
          "learning_rate": {
            "default": 2e-05,
            "description": "Peak learning rate for AdamW.",
            "exclusiveMinimum": 0.0,
            "title": "Learning Rate",
            "type": "number"
          },
          "lora_alpha": {
            "default": 32,
            "description": "LoRA alpha",
            "title": "Lora Alpha",
            "type": "integer"
          },
          "lora_dropout": {
            "default": 0.1,
            "description": "LoRA dropout",
            "title": "Lora Dropout",
            "type": "number"
          },
          "lora_r": {
            "default": 16,
            "description": "LoRA rank",
            "title": "Lora R",
            "type": "integer"
          },
          "lr_scheduler_type": {
            "default": "cosine",
            "description": "LR decay schedule after warmup: 'constant', 'linear', or 'cosine'.",
            "title": "Lr Scheduler Type",
            "type": "string"
          },
          "max_samples_per_dataset": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only: upper bound for auto-sized dataset cap.",
            "title": "Max Samples Per Dataset"
          },
          "min_samples_per_dataset": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only: lower bound for auto-sized dataset cap.",
            "title": "Min Samples Per Dataset"
          },
          "min_training_steps": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only: minimum number of optimizer steps; raises epoch count if the provided `nr_epochs` would yield fewer steps.",
            "title": "Min Training Steps"
          },
          "model_name": {
            "description": "User-friendly name for the trained model",
            "maxLength": 100,
            "minLength": 1,
            "title": "Model Name",
            "type": "string"
          },
          "nr_epochs": {
            "default": 100,
            "description": "Maximum training epochs. With early stopping enabled, training typically terminates well before this ceiling.",
            "minimum": 1.0,
            "title": "Nr Epochs",
            "type": "integer"
          },
          "profile_training": {
            "default": false,
            "description": "Enable structured training profiling for this run and persist a training_profile.json artifact.",
            "title": "Profile Training",
            "type": "boolean"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID to associate with this training job. When omitted, the job is anchored to the caller's auto-managed \"Default\" project so it is always deployable and fleet-eligible.",
            "title": "Project Id"
          },
          "provider_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pin training to a specific provider (e.g. 'fireworks', 'modal'). Bypasses automatic provider selection.",
            "title": "Provider Name"
          },
          "rl_config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Algorithm-specific hyperparameters for RL training. Supported keys (all optional unless noted, TRL-aligned defaults applied container-side): max_steps, kl_beta, group_size, sampling_temperature, max_completion_length, reward_type (GRPO; required, one of the built-in reward function names — see rl_training._BUILTIN_REWARDS); dpo_beta, loss_type (DPO); logging_steps (both; defaults to 25, lower for short smoke runs). When reward_type == 'llm_as_judge' (GRPO only) the judge call is routed through brain's '/v1/chat/completions' API authenticated with a per-run pio_sk_* key minted by ModalTrainingHandler._launch_and_monitor immediately before spawning the Modal function (the user never supplies the key — minted in the workqueue handler so the cleartext value never enters the SQS message body, injected into the Modal payload at spawn time, revoked from the post-training cleanup hook on terminal status). Additional knobs: llm_judge_model (HuggingFace model id, default 'meta-llama/Llama-3.1-8B-Instruct' — must resolve to a brain catalog entry via resolve_catalog_model_id), llm_judge_rubric (template string with {prompt}/{completion}/{answer} placeholders; falls back to a generic faithfulness/quality rubric scored 1-10 when absent), llm_judge_score_scale (raw max score for normalisation to [0,1], default 10), llm_judge_timeout_s (HTTP timeout per judge call, default 30), llm_judge_max_concurrent (parallelism cap on judge HTTP calls, default 8), llm_judge_max_retries (per-row retry budget on transient HTTP errors, default 1), llm_judge_retry_backoff_s (sleep between retries, default 2.0).",
            "title": "Rl Config"
          },
          "samples_per_label": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only: scaling factor used when computing the auto-sized per-dataset cap.",
            "title": "Samples Per Label"
          },
          "save_steps": {
            "default": 100,
            "description": "Save checkpoint every N steps",
            "minimum": 1.0,
            "title": "Save Steps",
            "type": "integer"
          },
          "system_prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Canonical system prompt written to every decoder training row. When populated, it is persisted on ``training_jobs.system_prompt`` and re-injected by inference providers for API-direct callers that omit the ``system`` message (train/serve alignment), and prefills the inference-page system-prompt editor. Leave null for PAFT datasets, mixed-prompt uploads, or any case where no single prompt should be pinned at serve time. Ignored for non-decoder tasks.",
            "title": "System Prompt"
          },
          "task_learning_rate": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "GLiNER only: learning rate applied to task-head parameters. When omitted, falls back to `learning_rate`.",
            "title": "Task Learning Rate"
          },
          "training_algorithm": {
            "default": "sft",
            "description": "Training algorithm: 'sft' (default), 'grpo', or 'dpo'. GRPO and DPO are dispatched to the Modal RL entrypoint. GRPO requires rl_config.reward_type from the built-in menu; DPO requires {prompt, chosen, rejected} columns and optional rl_config.dpo_beta / loss_type.",
            "enum": [
              "sft",
              "grpo",
              "dpo"
            ],
            "title": "Training Algorithm",
            "type": "string"
          },
          "training_type": {
            "default": "lora",
            "description": "Training type: 'full' or 'lora'",
            "enum": [
              "full",
              "lora"
            ],
            "title": "Training Type",
            "type": "string"
          },
          "validation_data_percentage": {
            "default": 0.2,
            "description": "Fraction of data held out for validation.",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Validation Data Percentage",
            "type": "number"
          },
          "wandb_api_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional W&B API key for logging",
            "title": "Wandb Api Key"
          },
          "warmup_ratio": {
            "default": 0.0,
            "description": "Fraction of total training steps for linear LR warmup. Ignored when warmup_steps is set.",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Warmup Ratio",
            "type": "number"
          },
          "warmup_steps": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Absolute number of linear LR warmup steps. When set, takes priority over warmup_ratio.",
            "title": "Warmup Steps"
          },
          "weight_decay": {
            "default": 0.01,
            "description": "AdamW weight decay (L2 penalty). 0 disables weight decay. Honoured by Modal decoder/dense-LoRA training paths. Not forwarded to GLiNER2 Modal training, which uses its own container default. Ignored by Fireworks managed SFT — Fireworks V2 rejects optimizerWeightDecay with HTTP 400 and applies its own server-side default (0).",
            "minimum": 0.0,
            "title": "Weight Decay",
            "type": "number"
          }
        },
        "required": [
          "model_name",
          "datasets",
          "base_model"
        ],
        "title": "TrainingJobCreate",
        "type": "object"
      },
      "TrainingJobListResponse": {
        "description": "List of training jobs response.",
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "has_more": {
            "default": false,
            "description": "True when more results exist beyond this page.",
            "title": "Has More",
            "type": "boolean"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "total": {
            "default": 0,
            "description": "Total number of matching jobs (before pagination).",
            "title": "Total",
            "type": "integer"
          },
          "training_jobs": {
            "items": {
              "$ref": "#/components/schemas/TrainingJobResponse"
            },
            "title": "Training Jobs",
            "type": "array"
          }
        },
        "required": [
          "success",
          "training_jobs",
          "count"
        ],
        "title": "TrainingJobListResponse",
        "type": "object"
      },
      "TrainingJobResponse": {
        "description": "Training job response model",
        "properties": {
          "base_model": {
            "title": "Base Model",
            "type": "string"
          },
          "batch_size": {
            "title": "Batch Size",
            "type": "integer"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "current_epoch": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Epoch currently in progress (1-indexed). Updated live during training.",
            "title": "Current Epoch"
          },
          "datasets": {
            "items": {
              "$ref": "#/components/schemas/DatasetReference"
            },
            "title": "Datasets",
            "type": "array"
          },
          "deployment_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Deprecated. Always returns None -- deployment_status no longer exists.\n\nKept for backward compat with clients that read this field.",
            "readOnly": true,
            "title": "Deployment Status"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "example": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Sample text to pre-load into inference input",
            "title": "Example"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "instance_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instance Type"
          },
          "is_terminal_status": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether this status is terminal for polling loops",
            "title": "Is Terminal Status"
          },
          "job_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Reference"
          },
          "labels": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Merged labels from training datasets (entity types for NER, class labels for classification)",
            "title": "Labels"
          },
          "learning_rate": {
            "title": "Learning Rate",
            "type": "number"
          },
          "metrics": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Training and evaluation metrics dictionary. Contains final_training_loss, final_validation_loss, best_validation_loss from training logs, and optional evaluation metrics (f1_score, precision_score, recall_score, accuracy) if an evaluation has been run.",
            "title": "Metrics"
          },
          "model_auto_selected": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Auto Selected"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "Unnamed Model",
            "title": "Model Name"
          },
          "model_selection_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Selection Reason"
          },
          "normalized_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Canonical status alias for compatibility handling (requested, running, complete, deployed, failed, cancelled)",
            "title": "Normalized Status"
          },
          "nr_epochs": {
            "title": "Nr Epochs",
            "type": "integer"
          },
          "progress_percent": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Overall training completion percentage (0-100). Updated live during training.",
            "title": "Progress Percent"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID this training job is associated with",
            "title": "Project Id"
          },
          "provider_deployments": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Provider-specific deployment metadata written by the training monitor. For Fireworks: {\"fireworks\": {\"deployment_name\": ...}}.",
            "title": "Provider Deployments"
          },
          "provider_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Training provider that handled this job (e.g. 'fireworks', 'modal').",
            "title": "Provider Name"
          },
          "root_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the original/root training job this version derives from",
            "title": "Root Job Id"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "task_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Task type derived from training datasets: 'ner', 'classification', 'custom', or 'decoder'",
            "title": "Task Type"
          },
          "trained_model_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trained Model Path"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "validation_data_percentage": {
            "title": "Validation Data Percentage",
            "type": "number"
          },
          "version_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Version number for this training job (e.g., '1', '2', '3')",
            "title": "Version Number"
          }
        },
        "required": [
          "id",
          "user_id",
          "datasets",
          "base_model",
          "validation_data_percentage",
          "nr_epochs",
          "learning_rate",
          "batch_size",
          "status",
          "created_at",
          "updated_at",
          "deployment_status"
        ],
        "title": "TrainingJobResponse",
        "type": "object"
      },
      "TrainingJobUpdate": {
        "additionalProperties": false,
        "description": "Thin PATCH body for ``PATCH /felix/training-jobs/{job_id}``.\n\nExposes only ``project_id``. Send ``null`` to unassign the training job\nfrom its current project. Unknown fields are rejected with HTTP 422.\n\nMovement semantics: this endpoint moves only the ``training_jobs.project_id``\nlabel. It does NOT cascade ``project_id`` updates to dependent rows\n(``deployments``, ``inferences``, ``model_evaluations``) which each carry\ntheir own ``project_id``. Those records remain attached to their original\nproject. Callers needing aggregate-model movement must update the\ndependents explicitly.",
        "properties": {
          "project_id": {
            "anyOf": [
              {
                "pattern": "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID (UUID) to assign the training job to, or null to unassign.",
            "title": "Project Id"
          }
        },
        "title": "TrainingJobUpdate",
        "type": "object"
      },
      "TrainingLogsResponse": {
        "description": "Response containing training output logs for a job",
        "properties": {
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "logs": {
            "items": {
              "$ref": "#/components/schemas/TrainingOutputLogEntry"
            },
            "title": "Logs",
            "type": "array"
          },
          "total_logs": {
            "title": "Total Logs",
            "type": "integer"
          }
        },
        "required": [
          "job_id",
          "logs",
          "total_logs"
        ],
        "title": "TrainingLogsResponse",
        "type": "object"
      },
      "TrainingOutputLogEntry": {
        "description": "Single training output log entry (stdout/stderr)",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "level": {
            "title": "Level",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "timestamp": {
            "format": "date-time",
            "title": "Timestamp",
            "type": "string"
          }
        },
        "required": [
          "id",
          "job_id",
          "timestamp",
          "level",
          "message",
          "source"
        ],
        "title": "TrainingOutputLogEntry",
        "type": "object"
      },
      "TrainingPipelineBranchRequest": {
        "additionalProperties": false,
        "description": "Request to branch a pipeline from an artifact-ready stage.",
        "properties": {
          "auto_deploy_final_stage": {
            "default": true,
            "title": "Auto Deploy Final Stage",
            "type": "boolean"
          },
          "from_stage_index": {
            "minimum": 0.0,
            "title": "From Stage Index",
            "type": "integer"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Name"
          },
          "stages": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineStageCreate"
            },
            "maxItems": 10,
            "minItems": 1,
            "title": "Stages",
            "type": "array"
          }
        },
        "required": [
          "from_stage_index",
          "stages"
        ],
        "title": "TrainingPipelineBranchRequest",
        "type": "object"
      },
      "TrainingPipelineControlResponse": {
        "description": "Response for pipeline lifecycle control actions.",
        "properties": {
          "active_stage_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active Stage Index"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "pipeline_id": {
            "title": "Pipeline Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "pipeline_id",
          "status",
          "message"
        ],
        "title": "TrainingPipelineControlResponse",
        "type": "object"
      },
      "TrainingPipelineCreate": {
        "additionalProperties": false,
        "description": "Request to create a multi-stage training pipeline.",
        "properties": {
          "auto_deploy_final_stage": {
            "default": true,
            "title": "Auto Deploy Final Stage",
            "type": "boolean"
          },
          "model_name": {
            "title": "Model Name",
            "type": "string"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "stages": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineStageCreate"
            },
            "maxItems": 10,
            "minItems": 1,
            "title": "Stages",
            "type": "array"
          }
        },
        "required": [
          "model_name",
          "stages"
        ],
        "title": "TrainingPipelineCreate",
        "type": "object"
      },
      "TrainingPipelineCreateResponse": {
        "description": "Created pipeline root and stage summary.",
        "properties": {
          "estimated_total_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Total Usd"
          },
          "pipeline_id": {
            "title": "Pipeline Id",
            "type": "string"
          },
          "stages": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineStageCreateResponse"
            },
            "title": "Stages",
            "type": "array"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "pipeline_id",
          "status",
          "stages"
        ],
        "title": "TrainingPipelineCreateResponse",
        "type": "object"
      },
      "TrainingPipelineDeployStageRequest": {
        "additionalProperties": false,
        "description": "Request to deploy one artifact-ready pipeline stage.",
        "properties": {
          "reason": {
            "default": "pipeline_stage_deploy",
            "title": "Reason",
            "type": "string"
          }
        },
        "title": "TrainingPipelineDeployStageRequest",
        "type": "object"
      },
      "TrainingPipelineDeploymentControlResponse": {
        "description": "Response for pipeline deployment and rollback controls.",
        "properties": {
          "base_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Model"
          },
          "deployment_id": {
            "title": "Deployment Id",
            "type": "string"
          },
          "pipeline_id": {
            "title": "Pipeline Id",
            "type": "string"
          },
          "project_id": {
            "title": "Project Id",
            "type": "string"
          },
          "stage_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stage Job Id"
          }
        },
        "required": [
          "pipeline_id",
          "project_id",
          "deployment_id"
        ],
        "title": "TrainingPipelineDeploymentControlResponse",
        "type": "object"
      },
      "TrainingPipelineDeploymentHistoryEntry": {
        "description": "Deployment or artifact history derived from a pipeline stage.",
        "properties": {
          "deployed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deployed At"
          },
          "normalized_adapter_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Normalized Adapter Path"
          },
          "provider_deployments": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider Deployments"
          },
          "provider_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider Name"
          },
          "stage_index": {
            "title": "Stage Index",
            "type": "integer"
          },
          "stage_job_id": {
            "title": "Stage Job Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "stage_job_id",
          "stage_index",
          "status"
        ],
        "title": "TrainingPipelineDeploymentHistoryEntry",
        "type": "object"
      },
      "TrainingPipelineDeploymentHistoryResponse": {
        "description": "Deployment history for one pipeline root.",
        "properties": {
          "deployments": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineDeploymentHistoryEntry"
            },
            "title": "Deployments",
            "type": "array"
          },
          "pipeline_id": {
            "title": "Pipeline Id",
            "type": "string"
          }
        },
        "required": [
          "pipeline_id",
          "deployments"
        ],
        "title": "TrainingPipelineDeploymentHistoryResponse",
        "type": "object"
      },
      "TrainingPipelineDetailResponse": {
        "description": "Detailed pipeline read response with stage lineage.",
        "properties": {
          "active_stage_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active Stage Index"
          },
          "branched_from_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Branched From Job Id"
          },
          "completed_stage_count": {
            "title": "Completed Stage Count",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "deployment_history": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineDeploymentHistoryEntry"
            },
            "title": "Deployment History",
            "type": "array"
          },
          "estimated_total_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Total Usd"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Name"
          },
          "paused_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paused At"
          },
          "pipeline_id": {
            "title": "Pipeline Id",
            "type": "string"
          },
          "pipeline_recipe": {
            "additionalProperties": true,
            "title": "Pipeline Recipe",
            "type": "object"
          },
          "progress_percent": {
            "title": "Progress Percent",
            "type": "integer"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "stages": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineStageRead"
            },
            "title": "Stages",
            "type": "array"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "status_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Message"
          },
          "total_stage_count": {
            "title": "Total Stage Count",
            "type": "integer"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "pipeline_id",
          "status",
          "total_stage_count",
          "completed_stage_count",
          "progress_percent",
          "created_at",
          "updated_at",
          "pipeline_recipe",
          "stages",
          "deployment_history"
        ],
        "title": "TrainingPipelineDetailResponse",
        "type": "object"
      },
      "TrainingPipelineEstimateResponse": {
        "description": "Read-only cost estimate for a training pipeline recipe.",
        "properties": {
          "assumptions": {
            "items": {
              "type": "string"
            },
            "title": "Assumptions",
            "type": "array"
          },
          "confidence": {
            "title": "Confidence",
            "type": "string"
          },
          "stages": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineStageEstimate"
            },
            "title": "Stages",
            "type": "array"
          },
          "total_estimated_minutes": {
            "title": "Total Estimated Minutes",
            "type": "integer"
          },
          "total_estimated_usd": {
            "title": "Total Estimated Usd",
            "type": "number"
          }
        },
        "required": [
          "total_estimated_usd",
          "total_estimated_minutes",
          "stages",
          "assumptions",
          "confidence"
        ],
        "title": "TrainingPipelineEstimateResponse",
        "type": "object"
      },
      "TrainingPipelineListItem": {
        "description": "Pipeline summary for list responses.",
        "properties": {
          "active_stage_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active Stage Index"
          },
          "completed_stage_count": {
            "title": "Completed Stage Count",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "estimated_total_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Total Usd"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Name"
          },
          "paused_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paused At"
          },
          "pipeline_id": {
            "title": "Pipeline Id",
            "type": "string"
          },
          "progress_percent": {
            "title": "Progress Percent",
            "type": "integer"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Id"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "status_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Message"
          },
          "total_stage_count": {
            "title": "Total Stage Count",
            "type": "integer"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "pipeline_id",
          "status",
          "total_stage_count",
          "completed_stage_count",
          "progress_percent",
          "created_at",
          "updated_at"
        ],
        "title": "TrainingPipelineListItem",
        "type": "object"
      },
      "TrainingPipelineListResponse": {
        "description": "Paginated pipeline list response.",
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "pipelines": {
            "items": {
              "$ref": "#/components/schemas/TrainingPipelineListItem"
            },
            "title": "Pipelines",
            "type": "array"
          }
        },
        "required": [
          "pipelines",
          "limit",
          "offset"
        ],
        "title": "TrainingPipelineListResponse",
        "type": "object"
      },
      "TrainingPipelineRollbackRequest": {
        "additionalProperties": false,
        "description": "Request to roll a pipeline project back to an existing deployment.",
        "properties": {
          "deployment_id": {
            "title": "Deployment Id",
            "type": "string"
          }
        },
        "required": [
          "deployment_id"
        ],
        "title": "TrainingPipelineRollbackRequest",
        "type": "object"
      },
      "TrainingPipelineStageCreate": {
        "additionalProperties": false,
        "description": "One requested stage in a training pipeline recipe.\n\nPipeline v1 accepts only routing, dependency, and dataset shape fields.\nCreation dispatches stages with service-owned default hyperparameters until\nper-stage overrides are added to this schema.",
        "properties": {
          "base_model": {
            "title": "Base Model",
            "type": "string"
          },
          "datasets": {
            "items": {
              "$ref": "#/components/schemas/DatasetReference"
            },
            "minItems": 1,
            "title": "Datasets",
            "type": "array"
          },
          "merge_parent_before": {
            "default": false,
            "title": "Merge Parent Before",
            "type": "boolean"
          },
          "parent_stage_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Stage Index"
          },
          "rl_config": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RLConfig"
              },
              {
                "type": "null"
              }
            ]
          },
          "training_algorithm": {
            "default": "sft",
            "enum": [
              "sft",
              "dpo",
              "grpo"
            ],
            "title": "Training Algorithm",
            "type": "string"
          },
          "training_type": {
            "default": "lora",
            "enum": [
              "full",
              "lora",
              "qlora"
            ],
            "title": "Training Type",
            "type": "string"
          }
        },
        "required": [
          "base_model",
          "datasets"
        ],
        "title": "TrainingPipelineStageCreate",
        "type": "object"
      },
      "TrainingPipelineStageCreateResponse": {
        "description": "Created pipeline stage summary.",
        "properties": {
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "job_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Reference"
          },
          "provider_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider Name"
          },
          "stage_index": {
            "title": "Stage Index",
            "type": "integer"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "job_id",
          "stage_index",
          "status"
        ],
        "title": "TrainingPipelineStageCreateResponse",
        "type": "object"
      },
      "TrainingPipelineStageEstimate": {
        "description": "Estimated cost and duration for one pipeline stage.",
        "properties": {
          "assumptions": {
            "items": {
              "type": "string"
            },
            "title": "Assumptions",
            "type": "array"
          },
          "base_model": {
            "title": "Base Model",
            "type": "string"
          },
          "dataset_count": {
            "title": "Dataset Count",
            "type": "integer"
          },
          "dataset_row_count": {
            "title": "Dataset Row Count",
            "type": "integer"
          },
          "estimated_minutes": {
            "title": "Estimated Minutes",
            "type": "integer"
          },
          "estimated_usd": {
            "title": "Estimated Usd",
            "type": "number"
          },
          "stage_index": {
            "title": "Stage Index",
            "type": "integer"
          },
          "training_algorithm": {
            "title": "Training Algorithm",
            "type": "string"
          },
          "training_type": {
            "title": "Training Type",
            "type": "string"
          }
        },
        "required": [
          "stage_index",
          "base_model",
          "training_type",
          "training_algorithm",
          "dataset_count",
          "dataset_row_count",
          "estimated_minutes",
          "estimated_usd"
        ],
        "title": "TrainingPipelineStageEstimate",
        "type": "object"
      },
      "TrainingPipelineStageRead": {
        "description": "Read model for one persisted pipeline stage.",
        "properties": {
          "base_model": {
            "title": "Base Model",
            "type": "string"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "current_epoch": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Epoch"
          },
          "current_substep": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Substep"
          },
          "dataset_ids": {
            "items": {
              "type": "string"
            },
            "title": "Dataset Ids",
            "type": "array"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "job_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Reference"
          },
          "merge_parent_before": {
            "default": false,
            "title": "Merge Parent Before",
            "type": "boolean"
          },
          "normalized_adapter_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Normalized Adapter Path"
          },
          "parent_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Job Id"
          },
          "progress_percent": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Progress Percent"
          },
          "provider_deployments": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider Deployments"
          },
          "provider_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider Name"
          },
          "stage_index": {
            "title": "Stage Index",
            "type": "integer"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "status_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Message"
          },
          "train_dataset_paths": {
            "items": {
              "type": "string"
            },
            "title": "Train Dataset Paths",
            "type": "array"
          },
          "training_algorithm": {
            "title": "Training Algorithm",
            "type": "string"
          },
          "training_type": {
            "title": "Training Type",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "job_id",
          "stage_index",
          "status",
          "base_model",
          "training_type",
          "training_algorithm",
          "created_at",
          "updated_at"
        ],
        "title": "TrainingPipelineStageRead",
        "type": "object"
      },
      "TriggerAgentRunRequest": {
        "description": "Request body for manual agent run trigger.",
        "properties": {
          "project_id": {
            "description": "Project to run the agent for.",
            "title": "Project Id",
            "type": "string"
          }
        },
        "required": [
          "project_id"
        ],
        "title": "TriggerAgentRunRequest",
        "type": "object"
      },
      "TriggerAgentRunResponse": {
        "description": "Response for manual agent run trigger.",
        "properties": {
          "agent_run_id": {
            "description": "Created agent run ID.",
            "title": "Agent Run Id",
            "type": "string"
          },
          "message": {
            "description": "Human-readable status message.",
            "title": "Message",
            "type": "string"
          },
          "status": {
            "description": "Initial run status (queued).",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "agent_run_id",
          "status",
          "message"
        ],
        "title": "TriggerAgentRunResponse",
        "type": "object"
      },
      "UpdateModelNameRequest": {
        "description": "Request to update a training job's model name",
        "properties": {
          "model_name": {
            "description": "New model name (alphanumeric, hyphens, underscores)",
            "maxLength": 64,
            "minLength": 1,
            "title": "Model Name",
            "type": "string"
          }
        },
        "required": [
          "model_name"
        ],
        "title": "UpdateModelNameRequest",
        "type": "object"
      },
      "UpdateModelNameResponse": {
        "description": "Response model for updating model name",
        "properties": {
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "model_name": {
            "title": "Model Name",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message",
          "job_id",
          "model_name"
        ],
        "title": "UpdateModelNameResponse",
        "type": "object"
      },
      "UpdateOverageSettingsRequest": {
        "description": "Request to update overage billing settings.",
        "properties": {
          "charge_threshold": {
            "anyOf": [
              {
                "maximum": 50000.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Remaining credits trigger",
            "title": "Charge Threshold"
          },
          "max_monthly_spend": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Monthly cap (null to remove)",
            "title": "Max Monthly Spend"
          },
          "overage_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Overage Enabled"
          },
          "topup_amount": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 100000.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Credits per top-up (100 = $1)",
            "title": "Topup Amount"
          },
          "topup_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Top-up mode: 'by' or 'to'",
            "title": "Topup Mode"
          },
          "usage_reset_hour": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Local hour for daily reset. Must be between 0 and 23.",
            "title": "Usage Reset Hour"
          },
          "usage_reset_timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "IANA timezone used to interpret usage_reset_hour.",
            "title": "Usage Reset Timezone"
          }
        },
        "title": "UpdateOverageSettingsRequest",
        "type": "object"
      },
      "UpdateResourceProjectRequest": {
        "description": "Request to assign a resource to a project (or unassign with empty string).",
        "properties": {
          "project_id": {
            "description": "Project ID to assign, or empty string to unassign",
            "title": "Project Id",
            "type": "string"
          }
        },
        "required": [
          "project_id"
        ],
        "title": "UpdateResourceProjectRequest",
        "type": "object"
      },
      "UpdateResourceProjectResponse": {
        "description": "Response for project assignment update.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "UpdateResourceProjectResponse",
        "type": "object"
      },
      "UpdateUserProfileRequest": {
        "description": "Request for updating user profile fields.\n\nAttributes:\n    onboarded: Mark onboarding as complete.\n    intent: User's chosen workflow intent from onboarding.\n    agent_mode: Preferred agent mode ('mle' or 'auto').\n    preferred_language: Preferred code language for inference snippets.\n    preferred_framework: Preferred API framework for inference snippets.\n    team_size: Self-reported team size bucket from onboarding.\n    org_name: Organisation name from onboarding (persisted + Attio).\n    use_case: Free-text use case from onboarding (persisted + Attio).",
        "properties": {
          "adaptive_learning_cadence": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Adaptive Learning Cadence"
          },
          "agent_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Mode"
          },
          "intent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent"
          },
          "onboarded": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Onboarded"
          },
          "org_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Org Name"
          },
          "preferred_framework": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preferred Framework"
          },
          "preferred_language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preferred Language"
          },
          "team_size": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Team Size"
          },
          "training_opt_out": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Training Opt Out"
          },
          "use_case": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Use Case"
          }
        },
        "title": "UpdateUserProfileRequest",
        "type": "object"
      },
      "UpdateUserProfileResponse": {
        "description": "Response for user profile update.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "UpdateUserProfileResponse",
        "type": "object"
      },
      "UpgradeAccountRequest": {
        "description": "Request model for upgrading account plan.",
        "properties": {
          "cancel_url": {
            "description": "URL to redirect to if user cancels",
            "title": "Cancel Url",
            "type": "string"
          },
          "force_checkout": {
            "default": false,
            "description": "When true, skip using existing payment method and always create a Stripe Checkout session.",
            "title": "Force Checkout",
            "type": "boolean"
          },
          "plan": {
            "description": "Target plan to upgrade to",
            "enum": [
              "hobby",
              "pro",
              "enterprise"
            ],
            "title": "Plan",
            "type": "string"
          },
          "success_url": {
            "description": "URL to redirect to after successful payment",
            "title": "Success Url",
            "type": "string"
          }
        },
        "required": [
          "plan",
          "success_url",
          "cancel_url"
        ],
        "title": "UpgradeAccountRequest",
        "type": "object"
      },
      "UpgradeAccountResponse": {
        "description": "Response model for upgrade account.",
        "properties": {
          "already_subscribed": {
            "default": false,
            "title": "Already Subscribed",
            "type": "boolean"
          },
          "checkout_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Checkout Url"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "UpgradeAccountResponse",
        "type": "object"
      },
      "UpgradeTeamPlanRequest": {
        "description": "Request for direct team plan upgrade (no Checkout redirect).",
        "properties": {
          "plan": {
            "description": "Target plan to upgrade to",
            "enum": [
              "pro",
              "enterprise"
            ],
            "title": "Plan",
            "type": "string"
          },
          "promotion_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional Stripe promotion code to apply",
            "title": "Promotion Code"
          }
        },
        "required": [
          "plan"
        ],
        "title": "UpgradeTeamPlanRequest",
        "type": "object"
      },
      "UpgradeTeamPlanResponse": {
        "description": "Response for direct team plan upgrade.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "plan": {
            "title": "Plan",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "plan",
          "message"
        ],
        "title": "UpgradeTeamPlanResponse",
        "type": "object"
      },
      "UploadEvaluationRequest": {
        "description": "Upload manually computed evaluation results to the platform.",
        "properties": {
          "accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy"
          },
          "bleu_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bleu Score"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional evaluation metadata stored in model_evaluations.config, for example threshold sweeps, schemas, judge criteria, or system prompts.",
            "title": "Config"
          },
          "dataset_name": {
            "description": "Pioneer dataset name the evaluation was run against",
            "title": "Dataset Name",
            "type": "string"
          },
          "dataset_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dataset version (latest if omitted)",
            "title": "Dataset Version"
          },
          "error_count": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Count"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "error_sample": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Sample"
          },
          "evaluation_time_ms": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Evaluation Time Ms"
          },
          "f1_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "F1 Score"
          },
          "failed_examples": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "maxItems": 10000,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failed Examples"
          },
          "hamming_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hamming Loss"
          },
          "max_examples": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Examples"
          },
          "max_tokens": {
            "anyOf": [
              {
                "maximum": 131072.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tokens"
          },
          "model_id": {
            "description": "Model identifier used for the evaluation",
            "title": "Model Id",
            "type": "string"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional human-readable model name for the UI",
            "title": "Model Name"
          },
          "precision_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Precision Score"
          },
          "predictions": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "maxItems": 10000,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Predictions"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional project ID to associate the evaluation with",
            "title": "Project Id"
          },
          "recall_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recall Score"
          },
          "result_rows": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/UploadEvaluationResultRow"
                },
                "maxItems": 10000,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result Rows"
          },
          "rouge_l_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rouge L Score"
          },
          "sample_count": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Count"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed"
          },
          "status": {
            "default": "complete",
            "description": "Final evaluation status. 'errored' is normalized to 'failed'.",
            "enum": [
              "complete",
              "failed",
              "errored"
            ],
            "title": "Status",
            "type": "string"
          },
          "subset_accuracy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subset Accuracy"
          },
          "total_cost_usd": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Cost Usd"
          },
          "total_latency_ms": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Latency Ms"
          },
          "total_tokens": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Tokens"
          },
          "validation_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation Loss"
          }
        },
        "required": [
          "model_id",
          "dataset_name"
        ],
        "title": "UploadEvaluationRequest",
        "type": "object"
      },
      "UploadEvaluationResultRow": {
        "description": "Per-example evaluation row uploaded to ``evaluation_results``.",
        "properties": {
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "correct": {
            "title": "Correct",
            "type": "boolean"
          },
          "example_index": {
            "minimum": 0.0,
            "title": "Example Index",
            "type": "integer"
          },
          "input_text": {
            "title": "Input Text",
            "type": "string"
          },
          "latency_ms": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latency Ms"
          },
          "predicted_entities": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Predicted Entities"
          },
          "predicted_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Predicted Label"
          },
          "true_entities": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "True Entities"
          },
          "true_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "True Label"
          }
        },
        "required": [
          "example_index",
          "input_text",
          "correct"
        ],
        "title": "UploadEvaluationResultRow",
        "type": "object"
      },
      "UsageHistoryRequest": {
        "description": "Request model for usage history.",
        "properties": {
          "end_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "End date in ISO format (YYYY-MM-DD)",
            "title": "End Date"
          },
          "start_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Start date in ISO format (YYYY-MM-DD)",
            "title": "Start Date"
          }
        },
        "title": "UsageHistoryRequest",
        "type": "object"
      },
      "UsageHistoryResponse": {
        "description": "Response model for usage history.",
        "properties": {
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "requests": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Requests",
            "type": "array"
          },
          "requests_limit": {
            "default": 100,
            "description": "Maximum detailed request rows included in this response.",
            "title": "Requests Limit",
            "type": "integer"
          },
          "requests_truncated": {
            "default": false,
            "description": "Whether more matching request rows exist than are returned.",
            "title": "Requests Truncated",
            "type": "boolean"
          },
          "resource_breakdown_30d": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Resource Breakdown 30D",
            "type": "array"
          },
          "total_cost": {
            "title": "Total Cost",
            "type": "number"
          },
          "total_credits": {
            "title": "Total Credits",
            "type": "number"
          },
          "total_tokens": {
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "total_tokens",
          "total_credits",
          "total_cost",
          "request_count",
          "requests"
        ],
        "title": "UsageHistoryResponse",
        "type": "object"
      },
      "UsageRequestItem": {
        "description": "A single row from ``public.requests`` for the usage table UI.",
        "properties": {
          "cache_read_tokens": {
            "default": 0,
            "title": "Cache Read Tokens",
            "type": "integer"
          },
          "cache_write_tokens": {
            "default": 0,
            "title": "Cache Write Tokens",
            "type": "integer"
          },
          "cost": {
            "default": 0.0,
            "title": "Cost",
            "type": "number"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "credit_usage": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Credit Usage"
          },
          "endpoint": {
            "default": "",
            "title": "Endpoint",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "input_tokens": {
            "default": 0,
            "title": "Input Tokens",
            "type": "integer"
          },
          "model": {
            "default": "",
            "title": "Model",
            "type": "string"
          },
          "output_tokens": {
            "default": 0,
            "title": "Output Tokens",
            "type": "integer"
          },
          "token_usage": {
            "default": 0,
            "title": "Token Usage",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "created_at"
        ],
        "title": "UsageRequestItem",
        "type": "object"
      },
      "UsageRequestModelSummaryItem": {
        "description": "Aggregated usage table row grouped by model.",
        "properties": {
          "last_request_at": {
            "title": "Last Request At",
            "type": "string"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "total_cache_read_tokens": {
            "default": 0,
            "title": "Total Cache Read Tokens",
            "type": "integer"
          },
          "total_cache_write_tokens": {
            "default": 0,
            "title": "Total Cache Write Tokens",
            "type": "integer"
          },
          "total_cost": {
            "default": 0.0,
            "title": "Total Cost",
            "type": "number"
          },
          "total_credits": {
            "default": 0.0,
            "title": "Total Credits",
            "type": "number"
          },
          "total_input_tokens": {
            "default": 0,
            "title": "Total Input Tokens",
            "type": "integer"
          },
          "total_output_tokens": {
            "default": 0,
            "title": "Total Output Tokens",
            "type": "integer"
          },
          "total_tokens": {
            "default": 0,
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "model",
          "request_count",
          "last_request_at"
        ],
        "title": "UsageRequestModelSummaryItem",
        "type": "object"
      },
      "UsageRequestModelSummaryResponse": {
        "description": "Full-range model summary for the usage table UI.",
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/UsageRequestModelSummaryItem"
            },
            "title": "Items",
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "title": "UsageRequestModelSummaryResponse",
        "type": "object"
      },
      "UsageRequestsPageResponse": {
        "description": "Paginated request log for the usage table UI.",
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/UsageRequestItem"
            },
            "title": "Items",
            "type": "array"
          },
          "page": {
            "title": "Page",
            "type": "integer"
          },
          "page_size": {
            "title": "Page Size",
            "type": "integer"
          },
          "total_count": {
            "title": "Total Count",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total_count",
          "page",
          "page_size"
        ],
        "title": "UsageRequestsPageResponse",
        "type": "object"
      },
      "UsageTimeseriesPoint": {
        "description": "One bucket of aggregated usage.\n\nFor daily granularity the value is an ISO date (``YYYY-MM-DD``).\nFor sub-daily intervals it is an ISO datetime (``YYYY-MM-DDTHH:MM:SS``).",
        "properties": {
          "bucket_date": {
            "description": "ISO date or datetime string",
            "title": "Bucket Date",
            "type": "string"
          },
          "request_count": {
            "title": "Request Count",
            "type": "integer"
          },
          "total_credits": {
            "title": "Total Credits",
            "type": "number"
          }
        },
        "required": [
          "bucket_date",
          "total_credits",
          "request_count"
        ],
        "title": "UsageTimeseriesPoint",
        "type": "object"
      },
      "UsageTimeseriesResponse": {
        "description": "Daily usage series for charts.",
        "properties": {
          "points": {
            "items": {
              "$ref": "#/components/schemas/UsageTimeseriesPoint"
            },
            "title": "Points",
            "type": "array"
          }
        },
        "required": [
          "points"
        ],
        "title": "UsageTimeseriesResponse",
        "type": "object"
      },
      "UsedModel": {
        "description": "A single model the user has run inference against.\n\nOne row per distinct ``inferences.model_id`` for the authenticated\nuser, carrying the most-recent usage timestamp and a lifetime call\ncount. Display-only attributes (``model_name``, ``base_model``,\n``project_id``, ``training_job_id``) let the client resolve a nice\nlabel and logo and route a click to the right detail page.",
        "properties": {
          "base_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "HuggingFace base model id for fine-tuned models; null for direct base-model calls.",
            "title": "Base Model"
          },
          "inference_count": {
            "default": 0,
            "description": "Lifetime count of the user's inferences against this model (excluding LLM-as-Judge calls).",
            "title": "Inference Count",
            "type": "integer"
          },
          "last_used_at": {
            "description": "Most recent ``created_at`` for this model across the user's inferences (excluding LLM-as-Judge calls).",
            "format": "date-time",
            "title": "Last Used At",
            "type": "string"
          },
          "model_id": {
            "description": "Identifier the caller used for inference (base catalog id or fine-tuned model id). Stable grouping key for this row.",
            "title": "Model Id",
            "type": "string"
          },
          "model_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Human-readable model name recorded on the inference, when set.",
            "title": "Model Name"
          },
          "project_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project the model belongs to (fine-tunes only); null for base-model calls. Lets the client route a click to the project page.",
            "title": "Project Id"
          },
          "training_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Training job that produced the model (fine-tunes only); null for base-model calls.",
            "title": "Training Job Id"
          }
        },
        "required": [
          "model_id",
          "last_used_at"
        ],
        "title": "UsedModel",
        "type": "object"
      },
      "UsedModelsResponse": {
        "description": "Distinct models a user has used, most-recently-used first.\n\nExcludes LLM-as-Judge (``source = 'llmaj'``) calls so the list only\nreflects models the user actually invoked. Scoped to the requesting\nuser — the ``service_role`` engine bypasses RLS, so the service\nfilters ``inferences.user_id`` explicitly.",
        "properties": {
          "models": {
            "description": "Used models ordered by ``last_used_at`` descending.",
            "items": {
              "$ref": "#/components/schemas/UsedModel"
            },
            "title": "Models",
            "type": "array"
          }
        },
        "title": "UsedModelsResponse",
        "type": "object"
      },
      "UserProfileResponse": {
        "description": "Response for GET /users/me — returns the user's public profile fields.",
        "properties": {
          "active_team_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active Team Id"
          },
          "adaptive_learning_cadence": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Adaptive Learning Cadence"
          },
          "agent_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Mode"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "intent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent"
          },
          "onboarded": {
            "title": "Onboarded",
            "type": "boolean"
          },
          "org_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Org Name"
          },
          "preferred_framework": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preferred Framework"
          },
          "preferred_language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preferred Language"
          },
          "team_size": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Team Size"
          },
          "training_opt_out": {
            "default": false,
            "title": "Training Opt Out",
            "type": "boolean"
          },
          "use_case": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Use Case"
          }
        },
        "required": [
          "onboarded"
        ],
        "title": "UserProfileResponse",
        "type": "object"
      },
      "UserRegistrationRequest": {
        "description": "Request for user registration with Google OAuth.\n\nThe user's email and full name are intentionally NOT accepted from the\nclient — the brain always sources them from the immutable Supabase\nauth identity (JWT email + ``auth.users.user_metadata``). Accepting them\nfrom the request body was a phishing primitive (ENG-1214) that allowed\nany authenticated user to overwrite ``public.users.email`` for their\nown row with an arbitrary string, e.g. another user's address.",
        "properties": {
          "captcha_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Captcha Token"
          },
          "linkedin_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkedin Url"
          },
          "refresh_token": {
            "title": "Refresh Token",
            "type": "string"
          },
          "twitter_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Twitter Url"
          }
        },
        "required": [
          "refresh_token"
        ],
        "title": "UserRegistrationRequest",
        "type": "object"
      },
      "UserRegistrationResponse": {
        "description": "Response for user registration.",
        "properties": {
          "connection_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Connection Id"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "title": "UserRegistrationResponse",
        "type": "object"
      },
      "UserReportAttachmentUploadResponse": {
        "description": "Response after uploading one or more report attachments.",
        "properties": {
          "attachments": {
            "description": "Attachment URLs stored on the report.",
            "items": {
              "type": "string"
            },
            "title": "Attachments",
            "type": "array"
          }
        },
        "required": [
          "attachments"
        ],
        "title": "UserReportAttachmentUploadResponse",
        "type": "object"
      },
      "UserReportCreateRequest": {
        "description": "Request body for creating a user report.\n\nAttributes:\n    report_type: Report category selected in the frontend.\n    title: Short summary generated from the description.\n    description: Full report body provided by the user.\n    selected_element: Optional DOM snapshot for highlighted elements.\n    attachments: Optional uploaded attachment URLs.\n    page_url: Browser URL where the report was filed.\n    user_agent: Browser user agent string.\n    screen_size: Browser viewport dimensions.\n    created_at: Client timestamp preserved for backward compatibility.",
        "properties": {
          "attachments": {
            "anyOf": [
              {
                "items": {
                  "format": "uri",
                  "maxLength": 2083,
                  "minLength": 1,
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Uploaded attachment URLs.",
            "title": "Attachments"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional client timestamp retained for compatibility.",
            "title": "Created At"
          },
          "description": {
            "description": "Full user report text.",
            "maxLength": 10000,
            "title": "Description",
            "type": "string"
          },
          "page_url": {
            "anyOf": [
              {
                "format": "uri",
                "maxLength": 2083,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "string"
              }
            ],
            "description": "Browser URL where the report was created.",
            "title": "Page Url"
          },
          "report_type": {
            "description": "Selected report category.",
            "enum": [
              "bug",
              "improvement",
              "question",
              "praise",
              "feature",
              "performance",
              "accessibility",
              "security",
              "documentation",
              "other"
            ],
            "title": "Report Type",
            "type": "string"
          },
          "screen_size": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Viewport dimensions captured in the browser.",
            "title": "Screen Size"
          },
          "selected_element": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional highlighted DOM element snapshot.",
            "title": "Selected Element"
          },
          "title": {
            "description": "Short generated title.",
            "maxLength": 200,
            "title": "Title",
            "type": "string"
          },
          "user_agent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Browser user agent string.",
            "title": "User Agent"
          }
        },
        "required": [
          "report_type",
          "title",
          "description",
          "page_url"
        ],
        "title": "UserReportCreateRequest",
        "type": "object"
      },
      "UserReportCreateResponse": {
        "description": "Response after persisting a user report.",
        "properties": {
          "report_id": {
            "description": "Persisted report UUID.",
            "title": "Report Id",
            "type": "string"
          },
          "success": {
            "description": "Whether the report was created.",
            "title": "Success",
            "type": "boolean"
          }
        },
        "required": [
          "success",
          "report_id"
        ],
        "title": "UserReportCreateResponse",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "WorkspaceMetrics": {
        "description": "Workspace-wide metrics for the monitoring page KPI grid.\n\nAggregates inference rows over a rolling window selected by the caller\n(``window``), scoped by ``scope``: ``personal`` filters by the requesting\nuser, ``team`` filters by the user's active team (every member sees the\nsame totals). The previous-window fields are computed against the\nimmediately preceding window of equal length so the UI can render trend\ndeltas; for ``window=\"all\"`` both windows are unbounded so each\n``*_previous`` field equals its current counterpart and the UI hides the\nresulting zero deltas. ``inference_count_all_time`` is independent of the\nwindow.\n\nScoping is applied as an explicit ``user_id`` / ``team_id`` predicate, not\nvia RLS — the ``service_role`` async engine bypasses Postgres RLS.",
        "properties": {
          "avg_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Average latency over the selected window, or null when no latency was recorded.",
            "title": "Avg Latency Ms"
          },
          "error_count": {
            "default": 0,
            "description": "Inferences in the selected window with status = 'failed'.",
            "title": "Error Count",
            "type": "integer"
          },
          "inference_count": {
            "default": 0,
            "description": "Number of inference rows in the selected window for the team.",
            "title": "Inference Count",
            "type": "integer"
          },
          "inference_count_all_time": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "All-time inference count for the team with no time window.",
            "title": "Inference Count All Time"
          },
          "inference_count_previous": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Inference count for the window immediately preceding the current one (equal length). For ``window='all'`` both windows are unbounded, so this equals ``inference_count``. Drives the trend arrow.",
            "title": "Inference Count Previous"
          },
          "last_inference_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Most recent inference ``created_at`` observed in the selected window, or null.",
            "title": "Last Inference At"
          },
          "median_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Median (p50) latency in milliseconds over the selected window.",
            "title": "Median Latency Ms"
          },
          "open_issue_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Count of inferences in the selected window where ``llmaj_verdict = 'incorrect'`` OR ``human_verdict = 'incorrect'``.",
            "title": "Open Issue Count"
          },
          "p99_latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "p99 latency in milliseconds over the selected window, computed via ``percentile_cont(0.99) WITHIN GROUP (ORDER BY latency_ms)``.",
            "title": "P99 Latency Ms"
          },
          "p99_latency_ms_previous": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "p99 latency for the preceding window of equal length. For ``window='all'`` both windows are unbounded, so this equals ``p99_latency_ms``. Drives the latency trend arrow on the KPI grid.",
            "title": "P99 Latency Ms Previous"
          },
          "scope": {
            "default": "personal",
            "description": "Echo of the scope used to compute the rollup. ``personal`` aggregates the requesting user's inferences; ``team`` aggregates the user's active team.",
            "enum": [
              "personal",
              "team"
            ],
            "title": "Scope",
            "type": "string"
          },
          "spend_per_1k_calls_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Average cost per 1,000 inferences over the selected window.",
            "title": "Spend Per 1K Calls Usd"
          },
          "spend_previous_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Workspace spend for the preceding window of equal length. For ``window='all'`` both windows are unbounded, so this equals ``spend_usd``.",
            "title": "Spend Previous Usd"
          },
          "spend_usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Workspace spend in USD over the selected window, summed across all models the team called. Null when pricing is unavailable for every called model.",
            "title": "Spend Usd"
          },
          "window": {
            "default": "24h",
            "description": "Echo of the rolling window used to compute the rollup. One of ``24h``, ``7d``, ``30d``, ``90d``, ``all``.",
            "enum": [
              "24h",
              "7d",
              "30d",
              "90d",
              "all"
            ],
            "title": "Window",
            "type": "string"
          }
        },
        "title": "WorkspaceMetrics",
        "type": "object"
      },
      "_SandboxFailRequest": {
        "description": "Final failure report from the sandbox.",
        "properties": {
          "error_message": {
            "maxLength": 4096,
            "title": "Error Message",
            "type": "string"
          }
        },
        "required": [
          "error_message"
        ],
        "title": "_SandboxFailRequest",
        "type": "object"
      },
      "_SandboxLogRequest": {
        "description": "Single log line submitted by the sandbox.",
        "properties": {
          "line": {
            "description": "Log line body (timestamp added server-side).",
            "maxLength": 8192,
            "title": "Line",
            "type": "string"
          }
        },
        "required": [
          "line"
        ],
        "title": "_SandboxLogRequest",
        "type": "object"
      },
      "_SandboxPartialResultsRequest": {
        "description": "Best-effort save of in-flight files when the container is interrupted.",
        "properties": {
          "curation_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Curation Report"
          },
          "deliverables_json": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deliverables Json"
          },
          "error_message": {
            "maxLength": 4096,
            "title": "Error Message",
            "type": "string"
          },
          "final_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Final Report"
          }
        },
        "required": [
          "error_message"
        ],
        "title": "_SandboxPartialResultsRequest",
        "type": "object"
      },
      "_SandboxPhaseRequest": {
        "description": "High-level progress phase update.",
        "properties": {
          "phase": {
            "description": "Phase identifier, e.g. ``analyzing``.",
            "maxLength": 64,
            "title": "Phase",
            "type": "string"
          }
        },
        "required": [
          "phase"
        ],
        "title": "_SandboxPhaseRequest",
        "type": "object"
      },
      "_SandboxWorkspaceFilesRequest": {
        "description": "Partial workspace files synced from the sandbox while the run is running.",
        "properties": {
          "curation_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Curation Report"
          },
          "deliverables_json": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deliverables Json"
          },
          "final_report": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Final Report"
          }
        },
        "title": "_SandboxWorkspaceFilesRequest",
        "type": "object"
      },
      "schemas__inference__ChatMessage": {
        "description": "Single message in a chat conversation.\n\nMatches the Qwen chat format used for decoder dataset validation.",
        "properties": {
          "content": {
            "description": "Message content text",
            "minLength": 1,
            "title": "Content",
            "type": "string"
          },
          "role": {
            "description": "Message role: 'system', 'user', or 'assistant'",
            "enum": [
              "system",
              "user",
              "assistant"
            ],
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "title": "ChatMessage",
        "type": "object"
      },
      "schemas__openai_compat__ChatMessage": {
        "description": "A single chat message.\n\n``content`` accepts either a plain string or a list of content blocks\n(e.g. ``[{\"type\": \"text\", ...}, {\"type\": \"image_url\", ...}]``) so that\nmultimodal/vision payloads can pass through to upstream providers.",
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "reasoning_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning Content"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "tool_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Call Id"
          },
          "tool_calls": {
            "anyOf": [
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Calls"
          }
        },
        "required": [
          "role"
        ],
        "title": "ChatMessage",
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Pioneer AI Brain System API",
    "title": "Brain API",
    "version": "2.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/": {
      "get": {
        "description": "Root endpoint - API information - publicly accessible without authentication.",
        "operationId": "root__get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Root"
      }
    },
    "/agent/runs": {
      "get": {
        "description": "List agent runs for the authenticated user.\n\nArgs:\n    request: FastAPI request (for rate limiter).\n    project_id: Optional project filter.\n    limit: Page size.\n    offset: Pagination offset.\n    auth: Authenticated user.\n    service: Agent service.\n\nReturns:\n    Paginated list of agent runs.",
        "operationId": "list_agent_runs_agent_runs_get",
        "parameters": [
          {
            "description": "Filter by project ID",
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by project ID",
              "title": "Project Id"
            }
          },
          {
            "description": "Page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Page size",
              "maximum": 50,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Pagination offset",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Pagination offset",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRunListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Agent run dependency is temporarily unavailable."
          }
        },
        "summary": "List Agent Runs",
        "tags": [
          "agent"
        ]
      },
      "post": {
        "description": "Manually trigger an agent run for a project.\n\nArgs:\n    request: FastAPI request (for rate limiter).\n    body: Request body with project_id.\n    auth: Authenticated user.\n    service: Agent service.\n\nReturns:\n    Trigger response with agent_run_id and status.\n\nRaises:\n    HTTPException: 429 if slot taken, 503 if disabled, 404 if project not found.",
        "operationId": "trigger_agent_run_agent_runs_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerAgentRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerAgentRunResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Trigger Agent Run",
        "tags": [
          "agent"
        ]
      }
    },
    "/agent/runs/{agent_run_id}": {
      "get": {
        "description": "Get detailed agent run including deliverables.\n\nArgs:\n    request: FastAPI request (for rate limiter).\n    agent_run_id: Agent run identifier.\n    auth: Authenticated user.\n    service: Agent service.\n\nReturns:\n    Full agent run detail with report.\n\nRaises:\n    HTTPException: 404 if run not found.",
        "operationId": "get_agent_run_agent_runs__agent_run_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "agent_run_id",
            "required": true,
            "schema": {
              "title": "Agent Run Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRunDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "404": {
            "description": "Agent run not found."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Agent run dependency is temporarily unavailable."
          }
        },
        "summary": "Get Agent Run",
        "tags": [
          "agent"
        ]
      }
    },
    "/agent/runs/{agent_run_id}/complete": {
      "post": {
        "description": "Handle sandbox completion callbacks for autonomous agent runs.\n\nArgs:\n    agent_run_id: Agent run identifier from the path.\n    payload: Completion payload from the sandbox.\n    callback_token: One-time callback authentication token.\n    execution_service: Agent execution service.\n\nReturns:\n    Callback acceptance response including resulting run status.\n\nRaises:\n    HTTPException: When callback auth fails or run is missing.",
        "operationId": "complete_agent_run_agent_runs__agent_run_id__complete_post",
        "parameters": [
          {
            "in": "path",
            "name": "agent_run_id",
            "required": true,
            "schema": {
              "title": "Agent Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Agent-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Agent-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRunCallbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRunCallbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Complete Agent Run",
        "tags": [
          "agent"
        ]
      }
    },
    "/analytics/model-datasets": {
      "get": {
        "description": "Return training + evaluation datasets for a project or base model.\n\nExactly one of ``project_id`` or ``base_model`` must be provided.\n\nArgs:\n    project_id: Scope to datasets directly attached to this project,\n        or the sentinel ``\"default\"`` for unallocated datasets.\n    base_model: Scope to datasets used by training jobs and\n        evaluations against this base model id.\n    auth: Authentication result carrying the user id and team scope.\n\nReturns:\n    ``ModelDatasetsResponse`` with training and evaluation dataset\n    rows. Evaluation rows include their latest completed evaluation\n    when available.",
        "operationId": "get_model_datasets_analytics_model_datasets_get",
        "parameters": [
          {
            "description": "Project UUID. Returns datasets attached to this project. Pass the literal value 'default' to return datasets whose project_id is null (the unallocated-resources bucket).",
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Project UUID. Returns datasets attached to this project. Pass the literal value 'default' to return datasets whose project_id is null (the unallocated-resources bucket).",
              "title": "Project Id"
            }
          },
          {
            "description": "Base catalog model id (e.g. 'meta-llama/Llama-3-8B').",
            "in": "query",
            "name": "base_model",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Base catalog model id (e.g. 'meta-llama/Llama-3-8B').",
              "title": "Base Model"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDatasetsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "description": "Exactly one scope parameter must be provided."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Model datasets dependency is temporarily unavailable."
          }
        },
        "summary": "Get Model Datasets",
        "tags": [
          "analytics"
        ]
      }
    },
    "/analytics/model-metrics": {
      "post": {
        "description": "Return per-model metrics for the last 24 hours.\n\nCounts, error counts, average latency, and last-inference timestamp are\nall scoped to the last 24 hours. ``latest_evaluation`` is all-time.\n\nArgs:\n    request: Batch of model ids to look up.\n    auth: Authentication result carrying the user id and team scope.\n\nReturns:\n    ``ModelMetricsResponse`` with an entry for each requested id.",
        "operationId": "get_model_metrics_analytics_model_metrics_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModelMetricsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelMetricsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Model metrics dependency is temporarily unavailable."
          }
        },
        "summary": "Get Model Metrics",
        "tags": [
          "analytics"
        ]
      }
    },
    "/analytics/quality-timeseries": {
      "get": {
        "description": "Return bucketed LLM-as-Judge quality metrics for a model.\n\nEach bucket reports the average ``llmaj_score``, the fraction of\njudged inferences with ``llmaj_verdict = 'pass'``, and the count of\nscored inferences. ``model_id`` is resolved against ``training_jobs``\nto determine whether to filter ``inferences`` by ``project_id``,\n``training_job_id``, or ``model_id`` (raw base traffic).\n\nArgs:\n    model_id: Training-job UUID or base catalog id.\n    interval: ``date_trunc`` bucket size.\n    since: Inclusive start of the window.\n    until: Exclusive end of the window.\n    auth: Authentication result carrying the user id used to scope\n        every aggregate.\n\nReturns:\n    ``QualityTimeSeriesResponse`` with descending buckets. An empty\n    ``series`` is returned when no inference rows match.",
        "operationId": "get_quality_timeseries_analytics_quality_timeseries_get",
        "parameters": [
          {
            "description": "Training-job UUID (task model) or base catalog id (e.g. 'meta-llama/Llama-3-8B').",
            "in": "query",
            "name": "model_id",
            "required": true,
            "schema": {
              "description": "Training-job UUID (task model) or base catalog id (e.g. 'meta-llama/Llama-3-8B').",
              "title": "Model Id",
              "type": "string"
            }
          },
          {
            "description": "Bucket size used for ``date_trunc``.",
            "in": "query",
            "name": "interval",
            "required": false,
            "schema": {
              "default": "day",
              "description": "Bucket size used for ``date_trunc``.",
              "enum": [
                "day",
                "week"
              ],
              "title": "Interval",
              "type": "string"
            }
          },
          {
            "description": "Inclusive start of the window (UTC). Defaults to 90 days ago.",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Inclusive start of the window (UTC). Defaults to 90 days ago.",
              "title": "Since"
            }
          },
          {
            "description": "Exclusive end of the window (UTC). Defaults to now.",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exclusive end of the window (UTC). Defaults to now.",
              "title": "Until"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QualityTimeSeriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "description": "Invalid time window."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Quality timeseries dependency is temporarily unavailable."
          }
        },
        "summary": "Get Quality Timeseries",
        "tags": [
          "analytics"
        ]
      }
    },
    "/analytics/used-models": {
      "get": {
        "description": "Return the distinct models the user has run inference against.\n\nOne entry per distinct ``inferences.model_id`` for the authenticated\nuser, ordered by most-recently-used first and carrying the last-used\ntimestamp plus a lifetime call count. LLM-as-Judge calls\n(``source = 'llmaj'``) are excluded so the list reflects user-driven\nusage. The service filters ``inferences.user_id`` explicitly because\nthe ``service_role`` async engine bypasses Postgres RLS.\n\nArgs:\n    limit: Maximum number of models to return.\n    auth: Authentication result carrying the user id used to scope\n        the aggregate.\n\nReturns:\n    ``UsedModelsResponse`` with the recency-ordered model list. Empty\n    when the user has no qualifying inferences.",
        "operationId": "get_used_models_analytics_used_models_get",
        "parameters": [
          {
            "description": "Maximum number of distinct models to return, ordered by most-recently-used first.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "Maximum number of distinct models to return, ordered by most-recently-used first.",
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsedModelsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Used models dependency is temporarily unavailable."
          }
        },
        "summary": "Get Used Models",
        "tags": [
          "analytics"
        ]
      }
    },
    "/analytics/workspace-metrics": {
      "get": {
        "description": "Return KPI metrics for the monitoring page.\n\nAggregates inference rows over the selected ``window`` and the immediately\npreceding window of equal length (for trend deltas), plus an all-time count\nfor the caption. ``scope`` selects per-user vs active-team aggregation; the\nservice explicitly filters ``inferences``/``requests`` by ``user_id`` or\n``team_id`` — the ``service_role`` async engine bypasses Postgres RLS, so\nRLS cannot be relied on for tenant isolation.\n\nArgs:\n    window: Rolling window key driven by the monitoring page picker.\n    scope: ``personal`` (per-user) or ``team`` (active team) aggregation.\n    auth: Authentication result carrying the user id used to scope\n        every aggregate.\n\nReturns:\n    ``WorkspaceMetrics`` populated with current / previous / all-time\n    counts, p99 / median latency, spend, and the open-issue tally. For\n    ``window='all'`` the previous-window aggregates run against the same\n    unbounded all-time range, so each ``*_previous`` field equals its\n    current counterpart.",
        "operationId": "get_workspace_metrics_analytics_workspace_metrics_get",
        "parameters": [
          {
            "description": "Rolling window for the KPI rollup, used only when ``since`` is omitted. ``24h``/``7d``/``30d``/``90d`` produce a current window of that length plus a previous window of equal length for trend deltas. ``all`` runs both the current and previous aggregates against the unbounded all-time window.",
            "in": "query",
            "name": "window",
            "required": false,
            "schema": {
              "default": "24h",
              "description": "Rolling window for the KPI rollup, used only when ``since`` is omitted. ``24h``/``7d``/``30d``/``90d`` produce a current window of that length plus a previous window of equal length for trend deltas. ``all`` runs both the current and previous aggregates against the unbounded all-time window.",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d",
                "all"
              ],
              "title": "Window",
              "type": "string"
            }
          },
          {
            "description": "``personal`` aggregates the requesting user's inferences; ``team`` aggregates the user's active team (every member sees the same totals). A ``team`` request from a user with no team degrades to personal scope rather than erroring.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "personal",
              "description": "``personal`` aggregates the requesting user's inferences; ``team`` aggregates the user's active team (every member sees the same totals). A ``team`` request from a user with no team degrades to personal scope rather than erroring.",
              "enum": [
                "personal",
                "team"
              ],
              "title": "Scope",
              "type": "string"
            }
          },
          {
            "description": "Inclusive start of an explicit custom window (UTC). When provided it overrides ``window``; the previous window is the immediately preceding window of equal length.",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Inclusive start of an explicit custom window (UTC). When provided it overrides ``window``; the previous window is the immediately preceding window of equal length.",
              "title": "Since"
            }
          },
          {
            "description": "Exclusive end of the explicit window (UTC). Defaults to now.",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exclusive end of the explicit window (UTC). Defaults to now.",
              "title": "Until"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceMetrics"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Workspace metrics dependency is temporarily unavailable."
          }
        },
        "summary": "Get Workspace Metrics",
        "tags": [
          "analytics"
        ]
      }
    },
    "/auth/check-domain-limit": {
      "post": {
        "description": "Check whether a domain is allowed to sign up.\n\nChecks in order:\n1. domain_exclusions — if matched, return banned\n2. domain_inclusions — if matched, return allowed (skip count)\n3. Count existing users — enforce SIGNUP_DOMAIN_LIMIT",
        "operationId": "check_domain_limit_auth_check_domain_limit_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainLimitRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainLimitResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Check Domain Limit",
        "tags": [
          "domain-limit"
        ]
      }
    },
    "/auth/check-email-canonical": {
      "post": {
        "description": "Check whether a Gmail address is a dot-trick duplicate of an existing account.\n\nOnly meaningful for ``@gmail.com`` / ``@googlemail.com`` addresses.\nAlways returns ``duplicate: false`` for all other domains.\nThis intentionally trades limited account-enumeration exposure for a clear\nsignup error; the unauthenticated route is IP-rate-limited.",
        "operationId": "check_email_canonical_auth_check_email_canonical_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailCanonicalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailCanonicalResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Check Email Canonical",
        "tags": [
          "domain-limit"
        ]
      }
    },
    "/auth/report-blocked-domain": {
      "post": {
        "description": "Send a Discord notification when a user reports their domain was blocked incorrectly.",
        "operationId": "report_blocked_domain_auth_report_blocked_domain_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainReportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Report Blocked Domain",
        "tags": [
          "domain-limit"
        ]
      }
    },
    "/auto-agent/clarify": {
      "post": {
        "description": "Stream the clarification agent response as Server-Sent Events.\n\nEach event is a JSON object preceded by ``data: `` and terminated by two\nnewlines.  Two event types are emitted:\n\n- ``{\"type\": \"delta\", \"content\": \"...\"}`` — streamed token(s).\n- ``{\"type\": \"complete\", ...}`` — final summary with answer, interrupt\n  data, and run_id / results_url if the agent triggered a run.\n\nWhen a run is triggered, a background task is scheduled via\n``spawn_background_task`` (FastAPI BackgroundTasks is incompatible with\nStreamingResponse).\n\nArgs:\n    request: FastAPI request (required by rate limiter).\n    body: Chat request with message, optional resume_value, and history.\n    auth: Authenticated user.\n\nReturns:\n    StreamingResponse with ``text/event-stream`` content type.\n\nRaises:\n    HTTPException: 400 if neither message nor resume_value is provided.",
        "operationId": "clarify_auto_agent_clarify_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoAgentClarifyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Clarify",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run": {
      "post": {
        "description": "Directly launch an Auto Agent run from a complete task description.\n\nThis endpoint intentionally bypasses the clarification agent. It is meant\nfor programmatic experiments and test harnesses that already know exactly\nwhat the Auto Agent should do.\n\nArgs:\n    request: FastAPI request (required by rate limiter).\n    body: Complete Auto Agent task description and optional history.\n    auth: Authenticated user.\n\nReturns:\n    Newly created run ID, project ID, and results URL.",
        "operationId": "start_run_direct_auto_agent_run_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoAgentRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoAgentRunResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Run Direct",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}": {
      "get": {
        "description": "Get the status and results of an Auto Agent run.\n\nPoll this endpoint to check if the run is still running or has completed.\nWhen the run is active and new logs exist, schedules a background task to\ngenerate an AI progress summary.\n\nArgs:\n    run_id: UUID of the run to check.\n    auth: Authenticated user (ownership is enforced).\n\nReturns:\n    Current run status and results if complete.\n\nRaises:\n    HTTPException: 404 if run not found or not owned by user.",
        "operationId": "get_run_status_auto_agent_run__run_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoAgentRunStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Run Status",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/billing/agent-turn": {
      "post": {
        "description": "Accept a legacy per-turn LLM self-report from inside the sandbox.\n\nBrokered sandboxes now bill the upstream LLM call server-side on\n``/v1/messages`` from Brain-observed usage. This endpoint remains\nfor older sandbox images and verifies the callback token, but it\ndoes not create a second billing row from sandbox-supplied tokens.\n\nAuth: the same one-time ``X-Callback-Token`` issued at run creation\nthat gates the other ``/auto-agent/run/{run_id}/...`` callbacks.\nNo bearer token / API key is involved — the sandbox runs untrusted\ncode and intentionally has no credentials beyond this token.\n\nDedup: ``(run_id, body.turn_id)`` is cached in ``dedup_cache`` so\nany legacy end-of-run replay treats the self-report as handled.\n\nArgs:\n    run_id: Run UUID from the path.\n    body: Per-turn token usage payload.\n    callback_token: Sandbox callback token from\n        ``X-Callback-Token`` header.\n\nRaises:\n    HTTPException 401: Callback token invalid or run finalized.\n    HTTPException 404: Run not found.",
        "operationId": "report_agent_turn_billing_auto_agent_run__run_id__billing_agent_turn_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentTurnBillingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentTurnBillingResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Report Agent Turn Billing",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/complete": {
      "post": {
        "description": "Sandbox completion callback — called by the Modal agent when it finishes.\n\nValidates the one-time callback token, writes results to the DB, and clears\nthe token. No user auth required — the token IS the auth.\n\nArgs:\n    run_id: Run UUID from the path.\n    body: JSON payload with deliverables_json, final_report, curation_report,\n          tool_calls_made, message_history, error_message.\n    callback_token: One-time token issued at run creation (X-Callback-Token header).\n\nRaises:\n    HTTPException 401: Token invalid or already used.\n    HTTPException 404: Run not found.\n    HTTPException 400: Validation error.",
        "operationId": "complete_run_auto_agent_run__run_id__complete_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "title": "Body",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Complete Run",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/fail": {
      "post": {
        "description": "Mark a run as failed when the agent itself catches an unrecoverable error.\n\nArgs:\n    run_id: Run UUID from the path.\n    body: ``{\"error_message\": \"...\"}``.\n    callback_token: One-time token issued at run creation.\n\nRaises:\n    HTTPException 401: Token invalid or run already finalized.\n    HTTPException 404: Run not found.",
        "operationId": "fail_sandbox_run_auto_agent_run__run_id__fail_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/_SandboxFailRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Fail Sandbox Run",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/log": {
      "post": {
        "description": "Append a log line streamed from inside the sandbox.\n\nArgs:\n    run_id: Run UUID from the path.\n    body: ``{\"line\": \"...\"}``.\n    callback_token: One-time token issued at run creation.\n\nRaises:\n    HTTPException 401: Token invalid or run already finalized.\n    HTTPException 404: Run not found.",
        "operationId": "append_sandbox_log_auto_agent_run__run_id__log_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/_SandboxLogRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Append Sandbox Log",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/partial-results": {
      "post": {
        "description": "Save partial deliverables when the sandbox is interrupted (timeout/SIGTERM).\n\nIf all three result files (``deliverables_json``, ``final_report``,\n``curation_report``) are present, the run is marked ``complete``.\nOtherwise the run flips to ``failed`` (only when still ``running`` —\na concurrent ``stop_run`` keeps its ``stopped`` status) with whatever\npartial data was provided.\n\nArgs:\n    run_id: Run UUID from the path.\n    body: Partial results payload + ``error_message``.\n    callback_token: One-time token issued at run creation.\n\nRaises:\n    HTTPException 401: Token invalid or run already finalized.\n    HTTPException 404: Run not found.",
        "operationId": "save_sandbox_partial_results_auto_agent_run__run_id__partial_results_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/_SandboxPartialResultsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Save Sandbox Partial Results",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/phase": {
      "post": {
        "description": "Update the high-level progress phase visible to the user.\n\nArgs:\n    run_id: Run UUID from the path.\n    body: ``{\"phase\": \"analyzing\"}``.\n    callback_token: One-time token issued at run creation.\n\nRaises:\n    HTTPException 401: Token invalid or run already finalized.\n    HTTPException 404: Run not found.",
        "operationId": "update_sandbox_phase_auto_agent_run__run_id__phase_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/_SandboxPhaseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Sandbox Phase",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/stop": {
      "post": {
        "description": "Stop a running Auto Agent by terminating its Modal sandbox.\n\nArgs:\n    request: FastAPI request (required by rate limiter).\n    run_id: UUID of the run to stop.\n    auth: Authenticated user (ownership is enforced).\n\nRaises:\n    HTTPException: 404 if run not found, 400 if not running.",
        "operationId": "stop_run_endpoint_auto_agent_run__run_id__stop_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stop Run Endpoint",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/run/{run_id}/workspace-files": {
      "post": {
        "description": "Sync partial workspace files so the UI can show progress mid-run.\n\nArgs:\n    run_id: Run UUID from the path.\n    body: Optional fields ``deliverables_json``, ``final_report``,\n        ``curation_report`` — missing fields preserve the existing value.\n    callback_token: One-time token issued at run creation.\n\nRaises:\n    HTTPException 401: Token invalid or run already finalized.\n    HTTPException 404: Run not found.",
        "operationId": "sync_sandbox_workspace_files_auto_agent_run__run_id__workspace_files_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Callback-Token",
            "required": true,
            "schema": {
              "title": "X-Callback-Token",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/_SandboxWorkspaceFilesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Sync Sandbox Workspace Files",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/auto-agent/runs": {
      "get": {
        "description": "List all Auto Agent runs for the authenticated user.\n\nArgs:\n    limit: Max runs to return (default 50).\n    offset: Pagination offset.\n    auth: Authenticated user.\n\nReturns:\n    List of run summaries, most recent first.",
        "operationId": "list_runs_endpoint_auto_agent_runs_get",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoAgentRunListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Runs Endpoint",
        "tags": [
          "auto-agent"
        ]
      }
    },
    "/base-models": {
      "get": {
        "description": "Public model catalog — single source of truth for available models.\n\nReturns the union of all provider catalogs. Each model carries\n``supports_training`` and ``supports_inference`` flags derived from\n``catalog_registry``. Use query parameters to filter by capability.\n\nThe ``supports_inference`` flag and filter use\n:func:`supports_inference_runtime`, which unions\n``supports_base_inference`` across every provider entry **whose\nruntime configuration is present in the current process**. A\nfinetune-only Fireworks decoder still reports ``True`` when it is\nbridged through OpenRouter or AWS Bedrock; an Azure-only catalog\nslug (``claude-sonnet-4-5``) reports ``True`` only when the brain\nhas the Azure env vars set so the request actually has somewhere\nto go.\n\nAuthentication is **optional**. Anonymous callers receive the public\ncatalog with all feature-flag-gated entries hidden (their flags\nresolve to ``default_value=False``). Authenticated callers populate\nthe request-scoped identity ContextVars via ``FlexibleAuth`` so\nper-user / per-team / per-email Datadog Remote Config rules can match,\nexposing gated entries (e.g. Gliner-PII, Gliner Guardrails) to users\non a rollout. Bad credentials are silently downgraded to anonymous so\nthis endpoint never returns 401.\n\nCallers in sanctioned jurisdictions (resolved from CloudFront's\n``CloudFront-Viewer-Country`` header) have the restricted foreign frontier\nfamilies (OpenAI/Anthropic/Gemini/Llama) hidden from the catalog, mirroring\nthe inference-time block so the UI never offers an unusable model.\n\nExamples:\n    GET /base-models                          — full catalog\n    GET /base-models?supports_inference=true   — serverless-capable models\n    GET /base-models?supports_training=true    — trainable models\n    GET /base-models?task_type=encoder          — encoder/NER models only\n    GET /base-models?task_type=decoder          — decoder/LLM models only",
        "operationId": "list_base_models_base_models_get",
        "parameters": [
          {
            "description": "Filter to models that support fine-tuning",
            "in": "query",
            "name": "supports_training",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to models that support fine-tuning",
              "title": "Supports Training"
            }
          },
          {
            "description": "Filter to models with serverless inference",
            "in": "query",
            "name": "supports_inference",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to models with serverless inference",
              "title": "Supports Inference"
            }
          },
          {
            "description": "Filter by model architecture: 'encoder' (NER/GLiNER) or 'decoder' (LLM)",
            "in": "query",
            "name": "task_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by model architecture: 'encoder' (NER/GLiNER) or 'decoder' (LLM)",
              "title": "Task Type"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseModelsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Base Models",
        "tags": [
          "model-selection"
        ]
      }
    },
    "/base-models/{model_id}/benchmarks": {
      "get": {
        "description": "Third-party benchmark figures and axis means for one base model.\n\nArgs:\n    model_id: Canonical catalog model ID.\n    auth: Optional caller identity; benchmarks are public reference data.\n\nReturns:\n    Roster benchmarks grouped by axis, plus the per-axis means.\n\nRaises:\n    HTTPException: 404 when the model is not in the catalog.",
        "operationId": "get_base_model_benchmarks_base_models__model_id__benchmarks_get",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelBenchmarksResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Base Model Benchmarks",
        "tags": [
          "model-selection"
        ]
      }
    },
    "/billing/billing-status": {
      "get": {
        "description": "Get billing status for the authenticated user.\n\nReturns:\n    - Total token usage\n    - Free tier remaining tokens\n    - Whether user has exceeded free tier\n    - Whether user has a payment method on file\n    - Stripe customer ID\n    - List of payment methods",
        "operationId": "get_billing_status_billing_billing_status_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Get Billing Status",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/checkout-session-status": {
      "get": {
        "description": "Verify a Stripe checkout session so the success page can gate its UI.\n\nUnauthenticated — any visitor with a session_id can call this, but\nonly valid Stripe session IDs will yield ``paid=True``.\n\nArgs:\n    request: FastAPI request (required by SlowAPI rate limiter).\n    session_id: Stripe checkout session ID (cs_...) from the success redirect.\n\nReturns:\n    Minimal verified status (no PII exposed).",
        "operationId": "get_checkout_session_status_billing_checkout_session_status_get",
        "parameters": [
          {
            "description": "Stripe checkout session ID from the success URL",
            "in": "query",
            "name": "session_id",
            "required": true,
            "schema": {
              "description": "Stripe checkout session ID from the success URL",
              "maxLength": 200,
              "minLength": 1,
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Checkout Session Status",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/downgrade-to-free": {
      "post": {
        "description": "Downgrade the user from a paid plan to the free (hobby) tier.\n\nCancels all active Stripe subscriptions, removes payment methods,\nupdates the user's plan to hobby, sends a confirmation email, and\ntracks the cancellation feedback in Amplitude.\n\nArgs:\n    feedback: Optional cancellation feedback (reason + free text).\n    auth: Authenticated user context.\n\nReturns:\n    Success status with message.",
        "operationId": "downgrade_to_free_billing_downgrade_to_free_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/CancellationFeedbackRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Feedback"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Downgrade To Free",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/plan-info": {
      "get": {
        "description": "Get detailed plan information for the authenticated user.\n\nReturns:\n    Plan details including limits and current usage",
        "operationId": "get_plan_info_billing_plan_info_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanInfoResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Get Plan Info",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/plans": {
      "get": {
        "description": "Public endpoint returning plan credit limits from the database.\n\nNo authentication required — used by the frontend to display\npricing information dynamically without hardcoding dollar amounts.\n\nReturns:\n    Per-plan credit limit, USD limit, and reset interval.",
        "operationId": "get_plans_billing_plans_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "additionalProperties": true,
                    "type": "object"
                  },
                  "title": "Response Get Plans Billing Plans Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Get Plans",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/public-checkout": {
      "post": {
        "description": "Create a Stripe Checkout session without requiring authentication.\n\nDesigned for shareable checkout links (/checkout/pro, /checkout/enterprise)\nwhere the user pays before creating a Pioneer account.\n\nRate-limited to 10 requests per IP per minute since the endpoint is\nunauthenticated and each call creates a Stripe Checkout Session.\nCaptcha verification required in non-local environments.\n\nArgs:\n    request: FastAPI request (required by SlowAPI rate limiter).\n    body: Plan, redirect URLs, and optional email.\n\nReturns:\n    Stripe-hosted checkout URL.",
        "operationId": "public_checkout_billing_public_checkout_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicCheckoutRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCheckoutResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Public Checkout",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/remove-payment-method": {
      "delete": {
        "description": "Cancel the user's active subscription and remove the stored payment method.\n\nThis endpoint is retained for frontend compatibility, but its behavior is\nsubscription-centric:\n1. Cancels the user's active Stripe subscription immediately\n2. Downgrades the user to the Hobby plan in Supabase\n3. Removes the stored card from the Stripe customer\n\nArgs:\n    request: Active subscription payment method ID shown in the UI\n    auth: Authenticated user context\n\nReturns:\n    Success status with cancellation message",
        "operationId": "remove_payment_method_billing_remove_payment_method_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemovePaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Payment Method",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/setup-payment-method": {
      "post": {
        "description": "Attach a payment method to the user's Stripe customer.\n\nThis endpoint:\n1. Creates a Stripe customer if one doesn't exist\n2. Attaches the payment method to the customer\n3. Sets it as the default payment method\n4. Checks card fingerprint for abuse (same card on too many teams)\n5. Stores the fingerprint and marks team as card-verified\n\nRate-limited to 5 attempts per user per hour. Each attempt captures a\n$1 PaymentIntent (real settled charge) for Stripe Radar fraud scoring,\nso unbounded retries let a single bot account incinerate Pioneer's\nStripe fee budget and Radar reputation. The cap leaves plenty of\nheadroom for legitimate users to retry on declined cards or SCA hiccups\nwhile denying bot farms unlimited attempts on the same compromised account.\n\nArgs:\n    request: FastAPI request (required by SlowAPI rate limiter).\n    body: Payment method ID from Stripe.js.\n    auth: Authenticated user context.\n\nReturns:\n    Success status and customer ID.",
        "operationId": "setup_payment_method_billing_setup_payment_method_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetupPaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetupPaymentMethodResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Setup Payment Method",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/stripe-webhook": {
      "post": {
        "description": "Handle Stripe webhook events.\n\nVerifies the Stripe signature, deduplicates by event id, and routes the\nevent to its billing-lifecycle handler. Unprotected (no auth) but\nsignature-verified.\n\nEvents handled: checkout.session.completed, invoice.paid,\ninvoice.payment_failed, customer.subscription.deleted / .updated,\npayment_method.attached / .detached, charge.refunded, customer.deleted,\nradar.early_fraud_warning.created.\n\nArgs:\n    request: Inbound FastAPI request carrying the raw Stripe payload.\n    stripe_signature: Value of the ``stripe-signature`` header.\n\nReturns:\n    ``{\"status\": \"success\"}`` once the event is processed.\n\nRaises:\n    HTTPException: 500 when the webhook secret is unconfigured or\n        processing fails; 400 for an invalid signature.",
        "operationId": "stripe_webhook_billing_stripe_webhook_post",
        "parameters": [
          {
            "in": "header",
            "name": "stripe-signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Stripe-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Stripe Webhook Billing Stripe Webhook Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stripe Webhook",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team-billing-status/{team_id}": {
      "get": {
        "description": "Get billing status for a team (limited info for team members).\n\nThis endpoint allows team members to see that the team owner has billing\nconfigured, without exposing sensitive billing details.\n\nArgs:\n    team_id: Team UUID\n    auth: Authenticated user context\n\nReturns:\n    - Team name\n    - Owner name\n    - Payment plan (hobby/pro/enterprise)\n    - Whether owner has a payment method configured",
        "operationId": "get_team_billing_status_billing_team_billing_status__team_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamBillingStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Team Billing Status",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/billing-portal": {
      "post": {
        "description": "Create a Stripe Billing Portal session for a team.\n\nAllows users with billing permissions to manage their subscription,\npayment methods, and invoices through Stripe's hosted portal.\n\nArgs:\n    team_id: Team UUID.\n    return_url: URL to redirect the user back to after the portal.\n    auth: Authenticated user context.\n\nReturns:\n    BillingPortalResponse with the portal URL.\n\nRaises:\n    HTTPException: 403 if not a member or lacks permission,\n        400 if return_url is untrusted or no Stripe customer exists.",
        "operationId": "create_billing_portal_session_billing_team__team_id__billing_portal_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "description": "URL to redirect to after the portal session",
            "in": "query",
            "name": "return_url",
            "required": true,
            "schema": {
              "description": "URL to redirect to after the portal session",
              "title": "Return Url",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPortalResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Billing Portal Session",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/cancel-subscription": {
      "post": {
        "description": "Cancel the team's subscription with a usage-netted pro-rated refund.\n\nThe single in-app cancellation entry point. Eligible teams (the\ngrandfathered ``legacy`` cohort, once per card fingerprint) receive a\npro-rated refund of unused subscription time minus the value of inference\nconsumed this period. The subscription is cancelled immediately and the\nteam is downgraded to ``free``.\n\nRequires: MANAGE_BILLING permission (owner, admin, or billing role).",
        "operationId": "cancel_subscription_billing_team__team_id__cancel_subscription_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelSubscriptionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cancel Subscription",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/charge-history": {
      "get": {
        "description": "Return recent Stripe charges and invoices for the team.",
        "operationId": "get_charge_history_billing_team__team_id__charge_history_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 25,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List charge history for a team",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/check-topup": {
      "post": {
        "description": "Manually trigger the overage threshold check for a team.\n\nIf the team's remaining balance is below their charge threshold,\nthis will fire the same top-up charge that normally triggers on inference.",
        "operationId": "check_topup_billing_team__team_id__check_topup_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Force a threshold top-up check",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/full-status": {
      "get": {
        "description": "Get full billing status for a team (for billing/admin/owner roles).\n\nThis endpoint returns comprehensive billing information including\npayment methods, usage, and credit limits.\n\nRequires: MANAGE_BILLING permission (owner, admin, or billing role)\n\nArgs:\n    team_id: Team UUID\n    auth: Authenticated user context\n\nReturns:\n    Full team billing status including payment methods and usage",
        "operationId": "get_team_full_billing_status_billing_team__team_id__full_status_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamBillingFullStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Team Full Billing Status",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/initialize-timezone": {
      "post": {
        "description": "Idempotently set usage_reset_timezone when it has never been configured.",
        "operationId": "initialize_team_timezone_billing_team__team_id__initialize_timezone_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InitializeTimezoneRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set default timezone for a team that has never configured one",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/invoices/{invoice_id}/link": {
      "post": {
        "description": "Return a fresh Stripe Hosted Invoice Page URL after billing authorization.\n\nRaises:\n    HTTPException: When the invoice link is unavailable or access is denied.",
        "operationId": "create_team_invoice_link_billing_team__team_id__invoices__invoice_id__link_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "title": "Invoice Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceLinkResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create an authorized Stripe invoice link for a team invoice",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/overage-settings": {
      "get": {
        "description": "Return current overage billing configuration for the team.",
        "operationId": "get_overage_settings_billing_team__team_id__overage_settings_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OverageSettingsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get team overage settings",
        "tags": [
          "billing"
        ]
      },
      "patch": {
        "description": "Update overage billing configuration. Requires MANAGE_BILLING.",
        "operationId": "update_overage_settings_billing_team__team_id__overage_settings_patch",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOverageSettingsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OverageSettingsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update team overage settings",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/purchase-credits": {
      "post": {
        "description": "Create a Stripe Checkout session for a one-time credit purchase.\n\nCredits are not granted here — the user is redirected to Stripe's hosted\ncheckout, and the ``checkout.session.completed`` webhook applies the\ncredits to the team's paid balance once payment is confirmed.\n\nRequires MANAGE_BILLING (owner, admin, or billing role).",
        "operationId": "purchase_credits_billing_team__team_id__purchase_credits_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseCreditsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseCreditsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start a credit purchase via Stripe Checkout",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/reactivate-subscription": {
      "post": {
        "description": "Undo a pending subscription cancellation.\n\nIf the team's subscription is scheduled to cancel at period end,\nthis removes the cancellation so the subscription renews normally.\nPrevents double-charging when a user cancels then changes their mind.",
        "operationId": "reactivate_subscription_billing_team__team_id__reactivate_subscription_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Reactivate Subscription",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/recheck-billing": {
      "post": {
        "description": "Re-derive a team's billing-cache columns from live Stripe state.\n\nManual replacement for the deleted reconcile/backfill jobs: refreshes\n``card_verified`` and ``card_fingerprint`` so the read-time inference gate\nsees current Stripe data, and repairs a bricked verified-without-fingerprint\nrow. Off the inference request path; requires MANAGE_BILLING.\n\nRaises:\n    HTTPException: 403 when the caller lacks MANAGE_BILLING; 500 on\n        unexpected failure.",
        "operationId": "recheck_team_billing_billing_team__team_id__recheck_billing_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecheckBillingResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Recheck Team Billing",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/remove-payment-method": {
      "delete": {
        "description": "Remove the team's payment method and downgrade to Hobby plan.\n\nRequires: MANAGE_BILLING permission (owner, admin, or billing role)\n\nThis endpoint:\n1. Cancels any active Stripe subscriptions for the team\n2. Downgrades the team to the Hobby plan\n3. Removes the stored card from the Stripe customer\n\nArgs:\n    team_id: Team UUID\n    request: Payment method ID to remove\n    auth: Authenticated user context\n\nReturns:\n    Success status with message",
        "operationId": "remove_team_payment_method_billing_team__team_id__remove_payment_method_delete",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveTeamPaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Team Payment Method",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/seat-preview": {
      "get": {
        "description": "Preview cost impact of adding or removing seats without applying changes.\n\nRequires MANAGE_BILLING permission.\n\nArgs:\n    team_id: Team UUID.\n    action: Either 'add' or 'remove'.\n    count: Number of seats to change.\n    auth: Authenticated user context.\n\nReturns:\n    SeatChangePreview with current/new seat counts and pricing.",
        "operationId": "get_seat_change_preview_billing_team__team_id__seat_preview_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "description": "'add' or 'remove'",
            "in": "query",
            "name": "action",
            "required": true,
            "schema": {
              "description": "'add' or 'remove'",
              "title": "Action",
              "type": "string"
            }
          },
          {
            "description": "Number of seats to add/remove",
            "in": "query",
            "name": "count",
            "required": false,
            "schema": {
              "default": 1,
              "description": "Number of seats to add/remove",
              "minimum": 1,
              "title": "Count",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeatChangePreview"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Seat Change Preview",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/setup-payment-method": {
      "post": {
        "description": "Attach a payment method to a team's Stripe customer.\n\nRequires: MANAGE_BILLING permission (owner, admin, or billing role)\n\nThis endpoint:\n1. Creates a Stripe customer for the team if one doesn't exist\n2. Attaches the payment method to the team's customer\n3. Sets it as the default payment method\n\nRate-limited to 5 attempts per user per hour. Each attempt captures a\n$1 PaymentIntent (real settled charge) for Stripe Radar fraud scoring,\nso unbounded retries from a single owner/admin let a bot incinerate the\nStripe fee budget and burn Radar reputation. The cap leaves room for\nlegitimate retries on declined cards or SCA hiccups while denying bots\nunlimited attempts on the same compromised owner account.\n\nArgs:\n    request: FastAPI request (required by SlowAPI rate limiter).\n    team_id: Team UUID.\n    body: Payment method ID from Stripe.js.\n    auth: Authenticated user context.\n\nReturns:\n    Success status and customer ID.",
        "operationId": "setup_team_payment_method_billing_team__team_id__setup_payment_method_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetupTeamPaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetupPaymentMethodResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Setup Team Payment Method",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/upgrade-plan": {
      "post": {
        "description": "Upgrade a team's plan directly without Stripe Checkout.\n\nRequires the team to already have a payment method on file. Creates a\nStripe subscription for the target plan price. Optionally applies a\npromotion code.",
        "operationId": "upgrade_team_plan_billing_team__team_id__upgrade_plan_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpgradeTeamPlanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpgradeTeamPlanResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upgrade Team Plan",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/team/{team_id}/usage": {
      "get": {
        "description": "Get per-member usage breakdown for the current billing period.\n\nRequires ``MANAGE_BILLING`` — owner, admin, and billing roles all qualify.\nUsage is scoped to requests billed to this team within the team's current\nbilling period.\n\nReturns per-member usage including:\n- User email and name\n- Total credits used (current billing period)\n- Request count (current billing period)\n\nArgs:\n    team_id: Team UUID\n    auth: Authenticated user context\n\nReturns:\n    Team usage breakdown by member",
        "operationId": "get_team_member_usage_billing_team__team_id__usage_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamUsageResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Team Member Usage",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/upgrade-account": {
      "post": {
        "description": "Upgrade user's account to Pro or Enterprise plan.\n\nThis endpoint creates a Stripe Checkout session for the user to complete payment.\nAfter successful payment, the webhook will update the user's plan and reset their token usage.\n\nArgs:\n    request: Plan selection and redirect URLs\n    auth: Authenticated user context\n\nReturns:\n    Checkout URL to redirect user to",
        "operationId": "upgrade_account_billing_upgrade_account_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpgradeAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpgradeAccountResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upgrade Account",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage-history": {
      "post": {
        "description": "Get usage history for the authenticated user.\n\nArgs:\n    request: Optional start_date and end_date filters\n    auth: Authenticated user context\n\nReturns:\n    Usage summary with detailed request history",
        "operationId": "get_usage_history_billing_usage_history_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UsageHistoryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageHistoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Usage History",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/requests": {
      "get": {
        "description": "Paginated request rows for the settings usage table.",
        "operationId": "get_billing_usage_requests_billing_usage_requests_get",
        "parameters": [
          {
            "description": "1-based page",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "description": "1-based page",
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "description": "Page size (max 100)",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 25,
              "description": "Page size (max 100)",
              "maximum": 100,
              "minimum": 1,
              "title": "Page Size",
              "type": "integer"
            }
          },
          {
            "description": "Filter: created_at >= (ISO); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter: created_at >= (ISO); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Filter: created_at <= (ISO); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter: created_at <= (ISO); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, from first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, from first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageRequestsPageResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Requests",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/requests-by-model": {
      "get": {
        "description": "Return full-range request usage grouped by model.\n\nArgs:\n    start_date: Optional inclusive lower bound on request creation time.\n    end_date: Optional inclusive upper bound on request creation time.\n    full_history: Whether to ignore ``start_date`` and begin at first usage.\n    auth: Authenticated caller context.\n\nReturns:\n    Aggregated usage rows grouped by model.\n\nRaises:\n    HTTPException: If date parameters are invalid or usage cannot be loaded.",
        "operationId": "get_billing_usage_requests_by_model_billing_usage_requests_by_model_get",
        "parameters": [
          {
            "description": "Filter: created_at >= (ISO); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter: created_at >= (ISO); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Filter: created_at <= (ISO); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter: created_at <= (ISO); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, from first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, from first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageRequestModelSummaryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Requests By Model",
        "tags": [
          "billing",
          "billing"
        ]
      }
    },
    "/billing/usage/routed-savings": {
      "get": {
        "description": "Routed-savings rollup per router project plus an overall total.",
        "operationId": "get_billing_routed_savings_billing_usage_routed_savings_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, span from the team's first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, span from the team's first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutedSavingsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Routed Savings",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/timeseries": {
      "get": {
        "description": "Aggregated credits from ``requests`` for the settings usage chart.",
        "operationId": "get_billing_usage_timeseries_billing_usage_timeseries_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, span from the team's first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, span from the team's first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          },
          {
            "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
            "in": "query",
            "name": "interval_minutes",
            "required": false,
            "schema": {
              "default": 1440,
              "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
              "maximum": 43200,
              "minimum": 1,
              "title": "Interval Minutes",
              "type": "integer"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's usage; ``personal`` narrows to the requesting user's own usage (home page toggle).",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's usage; ``personal`` narrows to the requesting user's own usage (home page toggle).",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageTimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Timeseries",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/timeseries-by-model": {
      "get": {
        "description": "Per-model request counts for stacked bar charts.",
        "operationId": "get_billing_usage_timeseries_by_model_billing_usage_timeseries_by_model_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, span from the team's first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, span from the team's first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          },
          {
            "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
            "in": "query",
            "name": "interval_minutes",
            "required": false,
            "schema": {
              "default": 1440,
              "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
              "maximum": 43200,
              "minimum": 1,
              "title": "Interval Minutes",
              "type": "integer"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's usage; ``personal`` narrows to the requesting user's own usage (home page toggle).",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's usage; ``personal`` narrows to the requesting user's own usage (home page toggle).",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelUsageTimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Timeseries By Model",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/timeseries-latency": {
      "get": {
        "description": "Average response latency bucketed by time interval.",
        "operationId": "get_billing_usage_timeseries_latency_billing_usage_timeseries_latency_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, span from the team's first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, span from the team's first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          },
          {
            "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
            "in": "query",
            "name": "interval_minutes",
            "required": false,
            "schema": {
              "default": 1440,
              "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
              "maximum": 43200,
              "minimum": 1,
              "title": "Interval Minutes",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LatencyTimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Timeseries Latency",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/timeseries-latency-by-model": {
      "get": {
        "description": "Per-model average latency bucketed by time interval.",
        "operationId": "get_billing_usage_timeseries_latency_by_model_billing_usage_timeseries_latency_by_model_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, span from the team's first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, span from the team's first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          },
          {
            "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
            "in": "query",
            "name": "interval_minutes",
            "required": false,
            "schema": {
              "default": 1440,
              "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
              "maximum": 43200,
              "minimum": 1,
              "title": "Interval Minutes",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelLatencyTimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Timeseries Latency By Model",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/timeseries-routed-savings": {
      "get": {
        "description": "Router savings bucketed by time interval for the home page chart.\n\nWhen routing is live for the team the points are realized savings stamped on\nrouted inferences. When it is not, the points are an *estimate* of what the\nrouter could have saved, derived from the team's real billed spend; the\n``router_on`` flag on the response tells the client which regime applies so\nit can label/colour the line accordingly. ``scope='personal'`` narrows both\npaths to the requesting user.",
        "operationId": "get_billing_usage_timeseries_routed_savings_billing_usage_timeseries_routed_savings_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, span from the team's first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, span from the team's first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          },
          {
            "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
            "in": "query",
            "name": "interval_minutes",
            "required": false,
            "schema": {
              "default": 1440,
              "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
              "maximum": 43200,
              "minimum": 1,
              "title": "Interval Minutes",
              "type": "integer"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's usage; ``personal`` narrows to the requesting user's own usage (home page toggle).",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's usage; ``personal`` narrows to the requesting user's own usage (home page toggle).",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutedSavingsTimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Timeseries Routed Savings",
        "tags": [
          "billing"
        ]
      }
    },
    "/billing/usage/timeseries-tokens": {
      "get": {
        "description": "Token volume (input + output) bucketed by time interval.",
        "operationId": "get_billing_usage_timeseries_tokens_billing_usage_timeseries_tokens_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC); ignored when full_history=true",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC); with full_history, caps the window",
              "title": "End Date"
            }
          },
          {
            "description": "If true, span from the team's first request through end (or now); ignores start_date",
            "in": "query",
            "name": "full_history",
            "required": false,
            "schema": {
              "default": false,
              "description": "If true, span from the team's first request through end (or now); ignores start_date",
              "title": "Full History",
              "type": "boolean"
            }
          },
          {
            "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
            "in": "query",
            "name": "interval_minutes",
            "required": false,
            "schema": {
              "default": 1440,
              "description": "Bucket width in minutes (default 1440 = daily). Values >= 10080 bucket by week and >= 43200 by month so long ranges stay bounded in point count.",
              "maximum": 43200,
              "minimum": 1,
              "title": "Interval Minutes",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenVolumeTimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing Usage Timeseries Tokens",
        "tags": [
          "billing"
        ]
      }
    },
    "/cli/telemetry": {
      "post": {
        "description": "Receive CLI telemetry and forward to Datadog.\n\nOptionally enriched with user info if X-API-Key header is provided.\nGeographic info derived from request IP by Datadog.",
        "operationId": "cli_telemetry_cli_telemetry_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliTelemetryEvent"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cli Telemetry",
        "tags": [
          "cli"
        ]
      }
    },
    "/clustering/run": {
      "post": {
        "deprecated": true,
        "description": "Reject the retired manual clustering agent endpoint.\n\nThe supported production path is event-driven: LLMAJ stores a not-pass\nverdict, enqueues ``inference_cluster_refresh``, and the worker updates\n``InferenceCluster`` rows for the project/model variant scope.\n\nArgs:\n    request: FastAPI request (required by rate limiter).\n    auth: Authenticated user.\n\nRaises:\n    HTTPException: Always raised with 410 Gone.",
        "operationId": "run_clustering_clustering_run_post",
        "responses": {
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "detail": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "detail"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Legacy manual clustering agent is retired."
          }
        },
        "summary": "Run Clustering",
        "tags": [
          "clustering"
        ]
      }
    },
    "/create-api-key": {
      "post": {
        "description": "Create a new API key for the authenticated user.\n\nOnly JWT-authenticated (browser session) requests are permitted — API key\ncreation via an existing API key is blocked to prevent credential chaining.\n\nArgs:\n    request: The incoming FastAPI request (used by SlowAPI rate limiter).\n    body: The API key creation request payload.\n    auth: The authenticated user context.\n\nReturns:\n    CreateAPIKeyResponse with the secret key (shown only once).\n\nRaises:\n    HTTPException: 403 if called via API key or the active team's plan does\n        not include API keys, 409 if the team API-key cap is reached, 500\n        for unexpected failures.",
        "operationId": "create_api_key_create_api_key_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAPIKeyResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Api Key",
        "tags": [
          "api-keys"
        ]
      }
    },
    "/custom-enums": {
      "get": {
        "description": "List all custom enums for the authenticated user.\n\nReturns enums sorted by name.",
        "operationId": "list_custom_enums_custom_enums_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomEnumListResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Custom Enums",
        "tags": [
          "custom-enums"
        ]
      },
      "post": {
        "description": "Create a new custom enum for the authenticated user.\n\nEnum names must be unique per user.",
        "operationId": "create_custom_enum_custom_enums_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomEnumCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomEnumResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Custom Enum",
        "tags": [
          "custom-enums"
        ]
      }
    },
    "/custom-enums/{enum_id}": {
      "delete": {
        "description": "Delete a custom enum.",
        "operationId": "delete_custom_enum_custom_enums__enum_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "enum_id",
            "required": true,
            "schema": {
              "title": "Enum Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomEnumDeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Custom Enum",
        "tags": [
          "custom-enums"
        ]
      },
      "get": {
        "description": "Get a specific custom enum by ID.\n\nOnly returns enums owned by the authenticated user.",
        "operationId": "get_custom_enum_custom_enums__enum_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "enum_id",
            "required": true,
            "schema": {
              "title": "Enum Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomEnumResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Custom Enum",
        "tags": [
          "custom-enums"
        ]
      },
      "patch": {
        "description": "Update a custom enum's metadata.\n\nOnly provided fields will be updated. Enum names must remain unique per user.",
        "operationId": "update_custom_enum_custom_enums__enum_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "enum_id",
            "required": true,
            "schema": {
              "title": "Enum Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomEnumUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomEnumResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Custom Enum",
        "tags": [
          "custom-enums"
        ]
      }
    },
    "/db_health": {
      "get": {
        "description": "Health check endpoint with database status - publicly accessible without authentication.",
        "operationId": "db_health_db_health_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Db Health"
      }
    },
    "/delete-api-key": {
      "delete": {
        "description": "Delete an API key belonging to the caller's active team.\n\nKeys are team-bound and shared, but managing them is gated by the team\nrole matrix: only members holding ``CREATE_API_KEYS`` (owner, admin,\neditor) may delete a team key. Viewer and billing members are rejected\nwith 403.",
        "operationId": "delete_api_key_delete_api_key_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAPIKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Api Key",
        "tags": [
          "api-keys"
        ]
      }
    },
    "/delete_user_account": {
      "post": {
        "description": "Delete user account and all associated data (HTTP wrapper).\n\nAccepts optional cancellation feedback and ownership transfers.\nWhen ``ownership_transfers`` is provided the backend applies them\nserver-side using the admin client before proceeding with deletion,\navoiding RLS permission issues.\n\nArgs:\n    request: Optional feedback + ownership transfers.\n    auth: Authenticated user context.\n\nReturns:\n    DeleteUserResponse with status and message.",
        "operationId": "delete_user_account_delete_user_account_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAccountRequest",
                "default": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteUserResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete User Account",
        "tags": [
          "users"
        ]
      }
    },
    "/feature-flags": {
      "get": {
        "description": "Return resolved feature flags for the requesting user.\n\nUses ``FlexibleAuth`` (not ``get_current_user_with_client``) because the\nJWT path inside ``_authenticate_with_jwt`` resolves the billing team and\ncalls ``set_session_team_scope`` — required for per-team Datadog targeting\nrules to take effect on this evaluation.\n\nReturns:\n    ``FeatureFlagsResponse`` with each flag's resolved boolean value.",
        "operationId": "get_feature_flags_feature_flags_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeatureFlagsResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Get Feature Flags",
        "tags": [
          "feature-flags"
        ]
      }
    },
    "/felix/activity": {
      "get": {
        "description": "List activity events for the authenticated user.\n\nUses the activity_events table to provide a unified timeline of user actions.\nSupports pagination via limit/offset.\n\nArgs:\n    limit: Maximum number of activity events to return per page.\n    offset: Number of events to skip for pagination.\n    auth: Authentication result containing user context.\n\nReturns:\n    ActivityLogResponse containing activity events in reverse-chronological order.\n\nRaises:\n    HTTPException: If the activity log retrieval fails.",
        "operationId": "list_activity_felix_activity_get",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityLogResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Activity",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/baseline-models": {
      "get": {
        "description": "List available baseline LLM models for evaluation comparison.\n\nBackend selection is owned by ``InferenceService`` — these entries are\npurely a catalog of model IDs the eval pipeline knows how to drive.",
        "operationId": "list_baseline_models_felix_baseline_models_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Baseline Models",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/benchmarks": {
      "get": {
        "description": "List available benchmarks for model evaluation.\n\nReturns benchmarks organized by task type (ner, text_classification, summarization).",
        "operationId": "list_benchmarks_felix_benchmarks_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListBenchmarksResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Benchmarks",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/benchmarks/evaluate": {
      "post": {
        "description": "Start an asynchronous benchmark evaluation.\n\nLaunches evaluation in the background and returns immediately with\nan evaluation_id that can be used to check status.",
        "operationId": "start_benchmark_evaluation_felix_benchmarks_evaluate_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BenchmarkEvaluationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BenchmarkEvaluationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Benchmark Evaluation",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/benchmarks/evaluate/{evaluation_id}": {
      "get": {
        "description": "Get the status and results of a benchmark evaluation.",
        "operationId": "get_benchmark_evaluation_felix_benchmarks_evaluate__evaluation_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "evaluation_id",
            "required": true,
            "schema": {
              "title": "Evaluation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BenchmarkEvaluationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Benchmark Evaluation",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/benchmarks/evaluate/{evaluation_id}/cancel": {
      "post": {
        "description": "Cancel a running benchmark evaluation.",
        "operationId": "cancel_benchmark_evaluation_felix_benchmarks_evaluate__evaluation_id__cancel_post",
        "parameters": [
          {
            "in": "path",
            "name": "evaluation_id",
            "required": true,
            "schema": {
              "title": "Evaluation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelBenchmarkResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cancel Benchmark Evaluation",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/constraints/classification": {
      "post": {
        "description": "Generate constraints for classification tasks",
        "operationId": "generate_classification_constraints_endpoint_felix_constraints_classification_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateClassificationConstraintsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateConstraintsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Generate Classification Constraints Endpoint",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/constraints/expand": {
      "post": {
        "description": "Expand choices for a constraint",
        "operationId": "expand_constraint_choices_endpoint_felix_constraints_expand_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpandConstraintChoicesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpandConstraintChoicesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Expand Constraint Choices Endpoint",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/constraints/ner": {
      "post": {
        "description": "Generate constraints for NER tasks",
        "operationId": "generate_ner_constraints_endpoint_felix_constraints_ner_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateNERConstraintsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateConstraintsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Generate Ner Constraints Endpoint",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/constraints/records": {
      "post": {
        "description": "Generate constraints for records/custom tasks",
        "operationId": "generate_records_constraints_endpoint_felix_constraints_records_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateRecordsConstraintsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateConstraintsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Generate Records Constraints Endpoint",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/data-editing/check-labels": {
      "post": {
        "description": "Use AI to verify label quality by checking if labels match the text content.\n\nArgs:\n    request: Label check request with dataset name, columns, and sample size.\n    auth: Authenticated user.\n\nReturns:\n    Label check results with per-row assessments.\n\nRaises:\n    HTTPException: 404 if dataset not found, 400 for invalid columns,\n        504 if upstream LLM provider times out.",
        "operationId": "check_labels_felix_data_editing_check_labels_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataEditingCheckLabelsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataEditingCheckLabelsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Check Labels",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/data-editing/remove-pii": {
      "post": {
        "description": "Remove or redact PII from the dataset based on scan findings.\n\nCreates a new dataset version with the redacted data.",
        "operationId": "remove_pii_felix_data_editing_remove_pii_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataEditingRemoveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataEditingRemoveResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Pii",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/data-editing/scan-phd": {
      "post": {
        "description": "Scan dataset columns for Prompt Hack/Injection attempts (PHD).\n\nUses specialized model to detect prompt injection attempts.\n\nArgs:\n    request.dataset_name: Dataset name.\n    request.version: Optional version number. Returns latest if omitted.",
        "operationId": "scan_for_phd_felix_data_editing_scan_phd_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataEditingScanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataEditingScanResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Scan For Phd",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/data-editing/scan-pii": {
      "post": {
        "description": "Scan dataset columns for Personally Identifiable Information (PII).\n\nUses GLiNER for entity extraction to detect names, emails, phone numbers, etc.\n\nArgs:\n    request.dataset_name: Dataset name.\n    request.version: Optional version number. Returns latest if omitted.",
        "operationId": "scan_for_pii_felix_data_editing_scan_pii_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataEditingScanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataEditingScanResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Scan For Pii",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/data-editing/subsample": {
      "post": {
        "description": "Create a subsample of the dataset using random or balanced sampling.\n\nCreates a new dataset version with the subsampled data.",
        "operationId": "subsample_dataset_felix_data_editing_subsample_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataEditingSubsampleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataEditingSubsampleResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Subsample Dataset",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/dataset/analyze": {
      "post": {
        "description": "Analyze a dataset for quality, distribution, and potential issues.\n\nSupports NER, Classification, and Generative task types. Available\nanalyses: distribution, duplicates, outliers, correlation, splits,\nerrors, and diversity (Vendi score + embedding visualisation).\n\nProvide data inline via ``dataset`` or reference a stored dataset\nwith ``dataset_name``.  See ``DatasetAnalysisRequest`` schema for\nthe full set of options including diversity visualisation config.",
        "operationId": "analyze_dataset_felix_dataset_analyze_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetAnalysisRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetAnalysisResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Analyze Dataset",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/dataset/analyze_llm": {
      "post": {
        "description": "Run LLM-based dataset quality analysis.\n\nThis endpoint performs the slow (~8s) LLM-based diversity and quality\nanalysis separately from the fast statistical analysis endpoint.\n\nUse ``/felix/dataset/analyze`` for fast statistical metrics (distribution,\nduplicates, outliers, vendi score, visualization). Use this endpoint when\nyou need the LLM's reasoning about dataset quality and reducibility.\n\nProvide data inline via ``dataset`` or reference a stored dataset\nwith ``dataset_name``.",
        "operationId": "analyze_dataset_llm_felix_dataset_analyze_llm_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetLLMAnalysisRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiversityLLMAnalysis"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Analyze Dataset Llm",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/dataset/augment": {
      "post": {
        "description": "Augment a dataset by removing duplicates/outliers and generating synthetic samples.\n\nThis endpoint creates a NEW dataset with the augmentations applied.\nOperations include:\n- **remove_duplicates**: Remove exact duplicate samples.\n- **remove_outliers**: Remove samples with anomalous lengths.\n- **balance**: Generate synthetic samples for underrepresented classes/entities.\n\nThe original dataset is preserved.",
        "operationId": "augment_dataset_felix_dataset_augment_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetAugmentationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetAugmentationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Augment Dataset",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/dataset/grow": {
      "post": {
        "description": "Grow an existing dataset by generating new synthetic examples.\n\nTakes an existing classification or NER dataset and generates additional\nexamples to reach the target size. Supports class balancing to ensure\nequal representation of each class.\n\nArgs:\n    request: Growth request with dataset ID, target size, and options.\n    auth: Authentication result with user ID and client.\n\nReturns:\n    GrowDatasetResponse with new dataset info and generation statistics.\n\nRaises:\n    HTTPException: If dataset not found, invalid type, or generation fails.",
        "operationId": "grow_dataset_felix_dataset_grow_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GrowDatasetRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrowDatasetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grow Dataset",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/dataset/outliers/dismiss": {
      "post": {
        "description": "Dismiss an outlier so it no longer appears in analysis results.\n\nAppends the content fingerprint to the ``dismissed_outliers`` JSONB\narray on the dataset row. On subsequent analysis runs the fingerprint\nis matched and the outlier is filtered out of the response.",
        "operationId": "dismiss_outlier_felix_dataset_outliers_dismiss_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DismissOutlierRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DismissOutlierResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Dismiss Outlier",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/dataset/query": {
      "post": {
        "description": "Execute Polars code on a dataset server-side.\n\nThe code runs in a sandboxed environment with access to:\n- `df`: Polars DataFrame containing the dataset\n- `pl`: Polars module for expressions\n\nAssign the result to a `result` variable to return it.\n**Multiline code is fully supported** — use intermediate variables, comments, etc.\n\n**Security**: Only allowlisted Polars DataFrame/Expression methods are\npermitted. Control-flow (for/while/if-stmt), comprehensions, f-strings,\nstr.format, imports, eval/exec, and dunder access are all blocked.\n\n**Examples**::\n\n    result = df.head(10)\n\n    filtered = df.filter(pl.col('score') > 0.5)\n    grouped = filtered.group_by('label').agg([\n        pl.col('score').mean().alias('avg_score'),\n        pl.col('score').count().alias('count')\n    ])\n    result = grouped.sort('avg_score', descending=True)",
        "operationId": "query_dataset_felix_dataset_query_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetQueryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Query Dataset",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/datasets": {
      "get": {
        "description": "List all datasets for the authenticated user.\n\nBy default, returns only the latest version of each dataset.\nSet include_all_versions=True to return all versions.\nIf project_id is provided, returns datasets for that project plus orphan datasets.\n\nFailed datasets (status='failed') are hidden from the default\nresponse. They are preserved in the database — the raw upload,\n``processing_error``, and ``column_mapping`` columns stay populated\nso support tooling can replay or inspect them.\n\nPass ``include_failed=true`` to surface the caller's own failed\nrows (e.g. for an \"uploads\" / \"history\" view that wants to show\nerror details). The flag is purely a result-set toggle — it does\nnot relax the user-scoping that runs underneath, so it's safe for\nany authenticated caller. There is intentionally no admin-only\ngate; if cross-user visibility is ever needed it should be a\nseparate, explicitly-authenticated endpoint.",
        "operationId": "list_datasets_felix_datasets_get",
        "parameters": [
          {
            "in": "query",
            "name": "include_all_versions",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include All Versions",
              "type": "boolean"
            }
          },
          {
            "description": "Filter by project ID (includes datasets with no project)",
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by project ID (includes datasets with no project)",
              "title": "Project Id"
            }
          },
          {
            "description": "When true, include the caller's own failed datasets (status='failed'). Defaults to false so the UI never renders broken-but-clickable records that 404 on preview/analyze. The result set is always scoped to the authenticated user — this flag does NOT grant cross-user visibility, so passing true is safe for any authenticated caller. Failed rows remain in the database for support / debugging; their original upload is preserved at raw_s3_key.",
            "in": "query",
            "name": "include_failed",
            "required": false,
            "schema": {
              "default": false,
              "description": "When true, include the caller's own failed datasets (status='failed'). Defaults to false so the UI never renders broken-but-clickable records that 404 on preview/analyze. The result set is always scoped to the authenticated user — this flag does NOT grant cross-user visibility, so passing true is safe for any authenticated caller. Failed rows remain in the database for support / debugging; their original upload is preserved at raw_s3_key.",
              "title": "Include Failed",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Datasets",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/import-from-github": {
      "post": {
        "description": "Download a file from GitHub and create a Pioneer dataset.\n\nArgs:\n    request: Contains ``repo``, ``file_path``, optional ``branch``,\n        ``dataset_name``, ``github_token``.\n    auth: Authenticated user context.\n\nReturns:\n    DatasetResponse of the created dataset.\n\nRaises:\n    HTTPException: 400 on parse errors, 502 on download failures.",
        "operationId": "import_from_github_felix_datasets_import_from_github_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "title": "Request",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Import From Github",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/import-from-github/list-files": {
      "post": {
        "description": "List importable data files in a GitHub repository.\n\nArgs:\n    request: Contains ``repo`` (owner/repo or URL), optional ``branch``,\n        optional ``github_token``.\n    auth: Authenticated user context.\n\nReturns:\n    List of data files and the resolved default branch.\n\nRaises:\n    HTTPException: 400 on invalid repo, 502 on GitHub API errors.",
        "operationId": "list_github_files_felix_datasets_import_from_github_list_files_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "title": "Request",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Github Files",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/merge": {
      "post": {
        "description": "Merge multiple datasets of the same type into a single new dataset.\n\nConcatenates all rows from the source datasets into a new dataset.\nAll source datasets must share the same dataset_type (NER, classification, etc.).\n\nArgs:\n    request: Merge request with source datasets and output name.\n\nReturns:\n    DatasetMergeResponse with the new dataset details.",
        "operationId": "merge_datasets_felix_datasets_merge_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetMergeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetMergeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Merge Datasets",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/preview-from-hub": {
      "post": {
        "description": "Preview a dataset from HuggingFace Hub without saving it.\n\nFetches the dataset and returns a preview (first 50 rows, schema, metadata)\nfor user review before confirming the import.\n\nRequires a HuggingFace API token with read access.",
        "operationId": "preview_dataset_from_hub_felix_datasets_preview_from_hub_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HuggingFacePullRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HuggingFacePullPreviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Preview Dataset From Hub",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/pull-from-hub": {
      "post": {
        "description": "Pull a dataset from HuggingFace Hub and save it locally.\n\nRequires a HuggingFace API token with read access.\nOptionally accepts session_id for SSE log streaming.",
        "operationId": "pull_dataset_from_hub_felix_datasets_pull_from_hub_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HuggingFacePullRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Pull Dataset From Hub",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/upload/process": {
      "post": {
        "description": "Process dataset uploaded to S3 via presigned URL.\n\n**Prerequisites:**\n1. Must have called /upload/url to get dataset_id\n2. Must have uploaded file to S3 using presigned URL\n\n**Response:**\n- Returns 202 Accepted with dataset in \"uploading\" status\n- Poll GET /{name}/{version} to check processing status\n- Status will change to \"ready\" when complete or \"failed\" on error\n\n**Processing:**\n- Validates file exists in S3\n- Converts to Parquet if needed (CSV/JSONL/JSON → Parquet)\n- Extracts metadata (row count, schema, etc.)\n- Validates data against expected schema if provided\n- Updates database status throughout",
        "operationId": "process_uploaded_dataset_felix_datasets_upload_process_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetUploadProcessRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Process Uploaded Dataset",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/upload/url": {
      "post": {
        "description": "Get presigned S3 URL for direct dataset upload (bypasses API Gateway limits).\n\n**Two-step upload flow:**\n1. Call this endpoint to get presigned URL and dataset_id\n2. Upload file directly to S3 using the presigned URL (HTTP PUT)\n3. Call /upload/process with dataset_id to trigger validation/processing\n\n**Auto-versioning behavior:**\n- If dataset_name is new: creates version 1\n- If dataset_name exists: creates next version (e.g., 2, 3, etc.)\n\n**Response:**\n- presigned_url: S3 PUT URL for direct upload\n- dataset_id: Use this in /upload/process\n- version_number: Dataset version\n- expires_in: URL valid for this many seconds (default: 3600 = 1 hour)\n\nSupports JSONL, CSV, TSV, JSON, and Parquet formats.",
        "operationId": "get_upload_url_felix_datasets_upload_url_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetUploadUrlRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetUploadUrlResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Upload Url",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{dataset_id}": {
      "patch": {
        "description": "Patch a dataset by ID. Currently exposes only ``project_id``.\n\nDelegates to :func:`services.projects.movement.assign_resource_to_project`\nwhich owns the visibility check, target-project gating, and the\nservice-role ``UPDATE``. Send ``project_id: null`` to unassign the\ndataset from its project.",
        "operationId": "update_dataset_felix_datasets__dataset_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "dataset_id",
            "required": true,
            "schema": {
              "title": "Dataset Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateResourceProjectResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Dataset",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{dataset_id}/type": {
      "patch": {
        "description": "Change a dataset's use type between training and evaluation.\n\nArgs:\n    dataset_id: UUID of the dataset to update.\n    request: New use type ('training' or 'evaluation').\n\nReturns:\n    DatasetTypeUpdateResponse with the updated id and type.\n\nRaises:\n    HTTPException: 404 if the dataset is not found or not owned by the user.\n    HTTPException: 500 on unexpected database error.",
        "operationId": "update_dataset_use_type_felix_datasets__dataset_id__type_patch",
        "parameters": [
          {
            "in": "path",
            "name": "dataset_id",
            "required": true,
            "schema": {
              "title": "Dataset Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetUseTypeUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetTypeUpdateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Dataset Use Type",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{name}": {
      "delete": {
        "description": "Soft-delete a dataset and all its versions.\n\nArgs:\n    name: Dataset name. Legacy UUID lookups are still accepted and routed\n        through the by-ID path for backwards compatibility.",
        "operationId": "delete_dataset_felix_datasets__name__delete",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Dataset",
        "tags": [
          "felix",
          "datasets"
        ]
      },
      "get": {
        "description": "List all versions of a dataset.\n\nArgs:\n    name: Dataset name.",
        "operationId": "list_dataset_versions_felix_datasets__name__get",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetVersionsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Dataset Versions",
        "tags": [
          "felix",
          "datasets"
        ]
      },
      "post": {
        "description": "Create a new version of an existing dataset.\n\nArgs:\n    name: Dataset name.\n\nCreates a new version linked to the existing dataset.\nUse POST /upload with the same dataset_name for auto-versioning behavior.",
        "operationId": "create_dataset_version_felix_datasets__name__post",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_create_dataset_version_felix_datasets__name__post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Dataset Version",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{name}/{version}": {
      "delete": {
        "description": "Delete a specific version of a dataset.\n\nArgs:\n    name: Dataset name.\n    version: Version number to delete.",
        "operationId": "delete_dataset_version_felix_datasets__name___version__delete",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Dataset Version",
        "tags": [
          "felix",
          "datasets"
        ]
      },
      "get": {
        "description": "Get metadata for a specific dataset version.\n\nArgs:\n    name: Dataset name.\n    version: Version number (use \"latest\" for most recent).",
        "operationId": "get_dataset_felix_datasets__name___version__get",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Dataset",
        "tags": [
          "felix",
          "datasets"
        ]
      },
      "put": {
        "description": "Update dataset metadata without creating a new version.\n\nName changes propagate to all versions.\n\nArgs:\n    name: Dataset name.\n    version: Version number to update (use \"latest\" for most recent).",
        "operationId": "update_dataset_metadata_felix_datasets__name___version__put",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetMetadataUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Dataset Metadata",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{name}/{version}/download": {
      "get": {
        "description": "Download a specific dataset version in the specified format.\n\nArgs:\n    name: Dataset name.\n    version: Version number (use \"latest\" for most recent).\n    format: Output format (jsonl, csv, parquet). Default: jsonl.\n\nResponse headers include:\n    - X-Dataset-Version: The version number downloaded\n    - X-Dataset-Total-Versions: Total number of versions available",
        "operationId": "download_dataset_felix_datasets__name___version__download_get",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "jsonl",
              "enum": [
                "jsonl",
                "csv",
                "parquet"
              ],
              "title": "Format",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "standard_columns",
            "required": false,
            "schema": {
              "default": false,
              "title": "Standard Columns",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Download Dataset",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{name}/{version}/evaluations": {
      "get": {
        "description": "Get all evaluations for a dataset.\n\nArgs:\n    name: Dataset name.\n    version: Dataset version (use \"latest\" for most recent).\n\nReturns all of the user's deployed models with their evaluation results\nfor the specified dataset. Models without evaluations will have null evaluation data.",
        "operationId": "get_dataset_evaluations_felix_datasets__name___version__evaluations_get",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetEvaluationsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Dataset Evaluations",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/datasets/{name}/{version}/preview": {
      "get": {
        "description": "Preview rows from a dataset without downloading the full file.\n\nArgs:\n    name: Dataset name.\n    version: Version number (use \"latest\" for most recent).\n    limit: Number of rows to return (1-100, default 10).\n    offset: Number of rows to skip (default 0).\n\nReturns:\n    JSON with dataset metadata and preview rows.",
        "operationId": "preview_dataset_felix_datasets__name___version__preview_get",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          },
          {
            "description": "Number of rows to preview (max 100)",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "description": "Number of rows to preview (max 100)",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Number of rows to skip",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Number of rows to skip",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Preview Dataset",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{name}/{version}/push-to-hub": {
      "post": {
        "description": "Push a specific dataset version to HuggingFace Hub.\n\nArgs:\n    name: Dataset name.\n    version: Version number to push (use \"latest\" for most recent).\n\nRequires a HuggingFace API token with write access.\nThe dataset will be uploaded in Parquet format with metadata.",
        "operationId": "push_dataset_to_hub_felix_datasets__name___version__push_to_hub_post",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HuggingFacePushRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushDatasetToHubResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Push Dataset To Hub",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/datasets/{name}/{version}/rows": {
      "delete": {
        "description": "Delete specific rows from a dataset, creating a new version.\n\nSupports two modes: index-based (``row_indices``) for backwards\ncompatibility and fingerprint-based (``fingerprints``) for safe\ndeletion that is immune to dataset mutations between analysis and\ndelete.\n\nArgs:\n    name: Dataset name.\n    version: Version number (use \"latest\" for most recent).\n    request: Exactly one of ``row_indices`` or ``fingerprints``.\n\nReturns:\n    DatasetRowsDeleteResponse with deletion status and new version.\n\nRaises:\n    HTTPException: 400 if identifiers are invalid, 404 if not found.",
        "operationId": "delete_dataset_rows_felix_datasets__name___version__rows_delete",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetRowsDeleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetRowsDeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Dataset Rows",
        "tags": [
          "felix",
          "datasets"
        ]
      },
      "patch": {
        "description": "Update specific rows in a dataset without re-uploading the entire dataset.\n\nThis is more efficient than creating a new version for small edits.\nOnly the specified rows are modified; all other rows remain unchanged.\n\nArgs:\n    name: Dataset name.\n    version: Version number to update (use \"latest\" for most recent).\n    request: List of row updates with row_index and changes.\n\nReturns:\n    DatasetRowsUpdateResponse with update status.",
        "operationId": "update_dataset_rows_felix_datasets__name___version__rows_patch",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "title": "Name",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "title": "Version",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DatasetRowsUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetRowsUpdateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Dataset Rows",
        "tags": [
          "felix",
          "datasets"
        ]
      }
    },
    "/felix/deployments": {
      "get": {
        "description": "Deprecated. Forwards to GET /projects/{project_id}/deployments.\n\nArgs:\n    project_id: Project to query (query parameter).\n    limit: Maximum records to return.\n    auth: Authenticated user.\n\nReturns:\n    DeploymentHistoryResponse with deprecation headers.",
        "operationId": "list_deployments_felix_deployments_get",
        "parameters": [
          {
            "description": "Project ID",
            "in": "query",
            "name": "project_id",
            "required": true,
            "schema": {
              "description": "Project ID",
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentHistoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "[Deprecated] List deployments -- use /projects/{project_id}/deployments",
        "tags": [
          "felix-deprecated"
        ]
      },
      "post": {
        "description": "Removed. Provider-based deployment creation (Fastino/HuggingFace/Fireworks) no longer exists.\n\nThe new deployment model is a simple model-swap on a project.\nUse ``POST /projects/{project_id}/deployments`` with ``{training_job_id, reason}`` instead.",
        "operationId": "create_deployment_felix_deployments_post",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "[Removed] Create a provider deployment -- use POST /projects/{project_id}/deployments",
        "tags": [
          "felix-deprecated"
        ]
      }
    },
    "/felix/deployments/options": {
      "get": {
        "description": "Removed. Provider-based deployment options no longer exist.",
        "operationId": "get_deployment_options_felix_deployments_options_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "[Removed] Deployment provider options",
        "tags": [
          "felix-deprecated"
        ]
      }
    },
    "/felix/deployments/{deployment_id}": {
      "delete": {
        "description": "Removed. Deployment history records are immutable and cannot be deleted.",
        "operationId": "delete_deployment_felix_deployments__deployment_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "deployment_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Deployment Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "[Removed] Delete a deployment",
        "tags": [
          "felix-deprecated"
        ]
      },
      "get": {
        "description": "Deprecated. Looks up deployment by ID and forwards to new response shape.\n\nArgs:\n    deployment_id: Deployment record ID.\n    auth: Authenticated user.\n\nReturns:\n    DeploymentResponse with deprecation headers.",
        "operationId": "get_deployment_felix_deployments__deployment_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "deployment_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Deployment Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "[Deprecated] Get a deployment -- use /projects/{project_id}/deployments/{id}",
        "tags": [
          "felix-deprecated"
        ]
      }
    },
    "/felix/embeddings": {
      "post": {
        "deprecated": true,
        "description": "Embed a single text. Deprecated — use ``POST /v1/embeddings`` instead.",
        "operationId": "create_embeddings_felix_embeddings_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Embeddings",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/evaluations": {
      "get": {
        "description": "List all evaluations for the authenticated user.\n\nReturns model and benchmark evaluations with their metrics.\nUsed by the frontend to build the evaluations matrix view.\n\nIf ``project_id`` is the sentinel ``\"default\"``, returns only\nevaluations whose ``project_id`` is null (the unallocated bucket).\nIf ``project_id`` is any other value, it must be a valid UUID and\nthe response includes evaluations for that project plus orphan\nevaluations (legacy behavior). If ``model_id`` is provided, only\nevaluations for that model are returned.",
        "operationId": "list_evaluations_felix_evaluations_get",
        "parameters": [
          {
            "description": "Filter by project ID. Pass the literal value 'default' to return only orphan evaluations (project_id IS NULL). For real project UUIDs the response also includes orphans for backward compatibility.",
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by project ID. Pass the literal value 'default' to return only orphan evaluations (project_id IS NULL). For real project UUIDs the response also includes orphans for backward compatibility.",
              "title": "Project Id"
            }
          },
          {
            "description": "Filter evaluations by the evaluated model's ID",
            "in": "query",
            "name": "model_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter evaluations by the evaluated model's ID",
              "title": "Model Id"
            }
          },
          {
            "description": "Maximum evaluations to return in this page.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum evaluations to return in this page.",
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Opaque cursor returned by the previous page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Opaque cursor returned by the previous page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvaluationListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Evaluation listing dependency is temporarily unavailable."
          }
        },
        "summary": "List Evaluations",
        "tags": [
          "felix"
        ]
      },
      "post": {
        "description": "Create model evaluation job(s) for multiple models and datasets.\n\nArgs:\n    request.base_model: Primary model to evaluate (required).\n    request.comparison_models: Optional list of models to compare against.\n    request.dataset_name: Single dataset name (for backward compatibility).\n    request.dataset_names: List of dataset names (creates one evaluation per dataset).\n    request.dataset_version: Optional version (latest if omitted).\n    request.max_tokens: Optional decoder generation cap per example.\n\nThis creates evaluation records for each model x dataset combination and triggers\nasync evaluation jobs. Each job runs inference on its dataset and computes metrics.\n\nReturns:\n    EvaluationCreateResponse with list of created evaluations.",
        "operationId": "create_evaluation_felix_evaluations_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvaluationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvaluationCreateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Evaluation",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/evaluations/upload": {
      "post": {
        "description": "Upload manually computed evaluation results so they appear in the UI.",
        "operationId": "upload_evaluation_results_felix_evaluations_upload_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadEvaluationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvaluationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload Evaluation Results",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/evaluations/{evaluation_id}": {
      "delete": {
        "description": "Delete an evaluation by ID.\n\nVerifies ownership via user_id before deleting.\n\nArgs:\n    evaluation_id: The evaluation ID to delete.\n    auth: Authenticated user context.\n\nReturns:\n    DeleteEvaluationResponse indicating success.\n\nRaises:\n    HTTPException: 404 if evaluation not found or not owned by user.\n    HTTPException: 500 if an unexpected error occurs.",
        "operationId": "delete_evaluation_felix_evaluations__evaluation_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "evaluation_id",
            "required": true,
            "schema": {
              "title": "Evaluation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteEvaluationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Evaluation",
        "tags": [
          "felix"
        ]
      },
      "get": {
        "description": "Get the status and results of a specific evaluation.",
        "operationId": "get_evaluation_felix_evaluations__evaluation_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "evaluation_id",
            "required": true,
            "schema": {
              "title": "Evaluation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvaluationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Evaluation",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/evaluations/{evaluation_id}/project": {
      "patch": {
        "description": "Assign or unassign an evaluation to/from a project.\n\nArgs:\n    evaluation_id: The evaluation ID.\n    request: Contains the project_id to assign (or empty string to unassign).\n    auth: Authenticated user context.\n\nReturns:\n    UpdateResourceProjectResponse indicating success.\n\nRaises:\n    HTTPException: If the evaluation is not found or the update fails.",
        "operationId": "update_evaluation_project_felix_evaluations__evaluation_id__project_patch",
        "parameters": [
          {
            "in": "path",
            "name": "evaluation_id",
            "required": true,
            "schema": {
              "title": "Evaluation Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateResourceProjectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateResourceProjectResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Evaluation Project",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/logs/{session_id}": {
      "get": {
        "description": "Stream logs for a generation session via Server-Sent Events",
        "operationId": "stream_logs_felix_logs__session_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stream Logs",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/presets": {
      "get": {
        "description": "List all available presets for authenticated callers.",
        "operationId": "list_presets_felix_presets_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/PresetMetadata"
                  },
                  "title": "Response List Presets Felix Presets Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Presets",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/presets/{preset_id}": {
      "get": {
        "description": "Get a preset configuration for authenticated callers.",
        "operationId": "get_preset_felix_presets__preset_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "preset_id",
            "required": true,
            "schema": {
              "title": "Preset Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PresetDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Preset",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/synthesis-log": {
      "post": {
        "description": "Create a single synthesis log entry.\n\nArgs:\n    request: Log entry data.\n    auth: Authentication result.\n\nReturns:\n    The created SynthesisLogEntry.\n\nRaises:\n    HTTPException: If the entry could not be created.",
        "operationId": "create_log_entry_felix_synthesis_log_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SynthesisLogCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SynthesisLogEntry"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Log Entry",
        "tags": [
          "felix",
          "synthesis-log"
        ]
      }
    },
    "/felix/synthesis-log/dataset/{dataset_id}": {
      "get": {
        "description": "Get all synthesis log entries linked to a dataset.\n\nArgs:\n    dataset_id: UUID of the dataset.\n    auth: Authentication result.\n\nReturns:\n    All synthesis log entries for the dataset in chronological order.\n\nRaises:\n    HTTPException: If the query fails.",
        "operationId": "get_dataset_history_felix_synthesis_log_dataset__dataset_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "dataset_id",
            "required": true,
            "schema": {
              "title": "Dataset Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SynthesisLogDatasetResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Dataset History",
        "tags": [
          "felix",
          "synthesis-log"
        ]
      }
    },
    "/felix/synthesis-log/session/{session_id}": {
      "get": {
        "description": "Get all log entries for a synthesis session.\n\nArgs:\n    session_id: UUID of the synthesis session.\n    auth: Authentication result.\n\nReturns:\n    All entries for the session in chronological order.\n\nRaises:\n    HTTPException: If the query fails.",
        "operationId": "get_session_felix_synthesis_log_session__session_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SynthesisLogSessionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Session",
        "tags": [
          "felix",
          "synthesis-log"
        ]
      }
    },
    "/felix/synthesis-log/session/{session_id}/link": {
      "post": {
        "description": "Link all entries in a synthesis session to a dataset.\n\nCalled after a synthesized dataset is created so the history is\naccessible from the dataset detail page.\n\nArgs:\n    session_id: UUID of the synthesis session.\n    request: Contains the dataset_id to link.\n    auth: Authentication result.\n\nReturns:\n    Success indicator.\n\nRaises:\n    HTTPException: If the link operation fails.",
        "operationId": "link_session_to_dataset_felix_synthesis_log_session__session_id__link_post",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SynthesisLogLinkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "boolean"
                  },
                  "title": "Response Link Session To Dataset Felix Synthesis Log Session  Session Id  Link Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Link Session To Dataset",
        "tags": [
          "felix",
          "synthesis-log"
        ]
      }
    },
    "/felix/trained-models": {
      "get": {
        "description": "List all completed/trained models for the authenticated user.\n\nArgs:\n    project_id: Optional project filter. When supplied, only models\n        assigned to that project are returned (still subject to the\n        caller's visibility scope). Used by the agent to keep model\n        discovery scoped to the user-selected project.",
        "operationId": "list_trained_models_felix_trained_models_get",
        "parameters": [
          {
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingJobListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Trained Models",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs": {
      "get": {
        "description": "List training jobs for the authenticated user.\n\nSupports pagination via ``limit`` and ``offset`` query parameters.\nOptionally filter by status (requested, running, complete, deployed, errored).",
        "operationId": "list_training_jobs_felix_training_jobs_get",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project Id"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 200,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingJobListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Training Jobs",
        "tags": [
          "felix"
        ]
      },
      "post": {
        "description": "Create a new training job.\n\nThe provider is resolved from the registry based on\n``(base_model, training_type)``.\n\nArgs:\n    request: Incoming FastAPI request (required by SlowAPI key function).\n    training_request: Training configuration with dataset references and base_model.\n    auth: Authenticated user context.",
        "operationId": "create_training_job_felix_training_jobs_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrainingJobCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingJobResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Training Job",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}": {
      "delete": {
        "description": "Delete a training job and associated checkpoints.",
        "operationId": "delete_training_job_felix_training_jobs__job_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteTrainingJobResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Training Job",
        "tags": [
          "felix"
        ]
      },
      "get": {
        "description": "Get a specific training job by ID.",
        "operationId": "get_training_job_felix_training_jobs__job_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingJobResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Training Job",
        "tags": [
          "felix"
        ]
      },
      "patch": {
        "description": "Patch a training job. Currently exposes only ``project_id``.\n\nDelegates to :func:`services.projects.movement.assign_resource_to_project`\nwhich owns the visibility check, target-project gating, and the\nservice-role ``UPDATE``. Send ``project_id: null`` to unassign the job\nfrom its project.\n\nMovement is **label-only**: only ``training_jobs.project_id`` changes.\nDependent rows that carry their own ``project_id`` (``deployments``,\n``inferences``, ``model_evaluations``) are intentionally not cascaded.\nCallers needing aggregate-model movement must update dependents\nexplicitly.",
        "operationId": "update_training_job_felix_training_jobs__job_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrainingJobUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateResourceProjectResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Training Job",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/checkpoints": {
      "get": {
        "description": "List all checkpoints for a training job.",
        "operationId": "list_training_job_checkpoints_felix_training_jobs__job_id__checkpoints_get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckpointListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Training Job Checkpoints",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/checkpoints/{checkpoint_id}/deploy": {
      "post": {
        "description": "Deploy a specific checkpoint to the Multi-Model Endpoint.",
        "operationId": "deploy_checkpoint_to_mme_felix_training_jobs__job_id__checkpoints__checkpoint_id__deploy_post",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "checkpoint_id",
            "required": true,
            "schema": {
              "title": "Checkpoint Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeployCheckpointResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Deploy Checkpoint To Mme",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/deployments": {
      "get": {
        "description": "Deprecated. Returns deployments that reference the given training job.\n\nArgs:\n    job_id: Training job ID.\n    auth: Authenticated user.\n\nReturns:\n    DeploymentHistoryResponse with deprecation headers.",
        "operationId": "get_training_job_deployments_felix_training_jobs__job_id__deployments_get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentHistoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "[Deprecated] Get deployments for a training job -- use /projects/{project_id}/deployments",
        "tags": [
          "felix-deprecated"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/download": {
      "get": {
        "description": "Generate a presigned S3 URL to download a trained model.",
        "operationId": "download_trained_model_felix_training_jobs__job_id__download_get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDownloadResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get download URL for trained model",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/logs": {
      "get": {
        "description": "Get training output logs (stdout/stderr) for a specific job.",
        "operationId": "get_training_job_logs_felix_training_jobs__job_id__logs_get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingLogsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Training Job Logs",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/model-name": {
      "patch": {
        "description": "Update the model_name for a training job.\n\nThin wrapper: visibility scoping, validation, the UPDATE, and the\nactivity-event side effect all live in\n:meth:`TrainingJobService.update_model_name`. The router only owns\nHTTP concerns (status codes, request/response shaping) per\n``brain/CLAUDE.md``.",
        "operationId": "update_training_job_model_name_felix_training_jobs__job_id__model_name_patch",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateModelNameRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateModelNameResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Training Job Model Name",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/push-to-hub": {
      "post": {
        "description": "Push a completed training job's model to HuggingFace Hub.",
        "operationId": "push_training_job_to_huggingface_felix_training_jobs__job_id__push_to_hub_post",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HuggingFacePushModelRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushModelToHubResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Push Training Job To Huggingface",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/stop": {
      "post": {
        "description": "Stop a running training job.",
        "operationId": "stop_training_job_felix_training_jobs__job_id__stop_post",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StopJobResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stop Training Job",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/sync": {
      "post": {
        "description": "Sync training job status from the provider to the database.",
        "operationId": "sync_training_job_status_felix_training_jobs__job_id__sync_post",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingJobResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Sync Training Job Status",
        "tags": [
          "felix"
        ]
      }
    },
    "/felix/training-jobs/{job_id}/terminate": {
      "post": {
        "description": "Terminate a training job and delete all artifacts.\n\nStops the provider job if running, deletes all checkpoints, and marks\nthe job as terminated. This operation is irreversible.",
        "operationId": "terminate_training_job_felix_training_jobs__job_id__terminate_post",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TerminateJobResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Terminate Training Job",
        "tags": [
          "felix"
        ]
      }
    },
    "/generate": {
      "post": {
        "description": "Create an async dataset generation job.\n\nReturns immediately with a ``job_id``. Poll ``GET /generate/jobs/{job_id}``\nfor status and results.\n\nThe ``task_type`` field in the request body determines what kind of dataset\nis generated:\n- ``ner``: Named-entity recognition dataset. Requires ``labels``.\n- ``classification``: Text classification dataset. Requires ``labels``.\n- ``custom``: Free-form prompt-based dataset. Requires ``prompt``.\n- ``decoder``: Instruction-tuning (chat format) dataset.\n  Requires ``domain_description``.\n\nDispatches via SQS with idempotency deduplication; falls back to an\nin-process background task if SQS is unavailable.\n\nArgs:\n    request: Incoming HTTP request (used by SlowAPI rate limiter).\n    generation_request: Unified generation parameters including task_type.\n    auth: Authenticated user context.\n    is_seed: Whether this is a small seed dataset for UI preview.\n    synthesis_session_id: Optional synthesis log session UUID for resume.\n\nReturns:\n    GenerateAsyncResponse with ``job_id`` for polling and initial status.\n\nRaises:\n    HTTPException: 422 if required task-specific fields are missing.",
        "operationId": "create_generation_job_generate_post",
        "parameters": [
          {
            "description": "Whether this is a seed generation",
            "in": "query",
            "name": "is_seed",
            "required": false,
            "schema": {
              "default": false,
              "description": "Whether this is a seed generation",
              "title": "Is Seed",
              "type": "boolean"
            }
          },
          {
            "description": "Synthesis log session ID for resume support",
            "in": "query",
            "name": "synthesis_session_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Synthesis log session ID for resume support",
              "title": "Synthesis Session Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateAsyncResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Generation Job",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/classification/infer-labels": {
      "post": {
        "description": "Infer classification labels from a domain description.",
        "operationId": "infer_classification_labels_generate_classification_infer_labels_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InferClassificationLabelsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferLabelsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Infer Classification Labels",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/classification/label-existing": {
      "post": {
        "description": "Label existing texts for classification tasks.\n\nArgs:\n    request: Classification labeling request with texts and labels.\n    auth: Authenticated user context.\n\nReturns:\n    GenerateResponse with classified samples and optional dataset info.\n\nRaises:\n    HTTPException: 400 if no valid inputs or dataset validation fails.\n    HTTPException: 500 on labeling failure.",
        "operationId": "label_existing_classification_generate_classification_label_existing_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelExistingClassificationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Label Existing Classification",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/fields/infer-fields": {
      "post": {
        "description": "Infer input and output fields from a domain description.",
        "operationId": "infer_fields_generate_fields_infer_fields_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InferFieldsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferFieldsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Infer Fields",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/fields/label-existing": {
      "post": {
        "description": "Label existing data dictionaries with custom input/output field definitions.\n\nArgs:\n    request: Fields labeling request with input dicts and field schemas.\n    auth: Authenticated user context.\n\nReturns:\n    GenerateResponse with labeled samples and optional dataset info.\n\nRaises:\n    HTTPException: 400 on invalid field configuration, missing inputs, or dataset validation failure.\n    HTTPException: 500 on labeling failure.",
        "operationId": "label_existing_fields_generate_fields_label_existing_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelExistingFieldsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Label Existing Fields",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/improve-prompt": {
      "post": {
        "description": "Improve a dataset generation prompt with AI-generated expansions.",
        "operationId": "improve_prompt_generate_improve_prompt_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImprovePromptRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImprovePromptResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Improve Prompt",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/infer-advanced": {
      "post": {
        "description": "Infer constraints and multiplicator from a generation prompt.",
        "operationId": "infer_advanced_options_generate_infer_advanced_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InferAdvancedRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferAdvancedResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Infer Advanced Options",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/jobs/{job_id}": {
      "get": {
        "description": "Get the current status of an async generation job.\n\nReturns the current status and, when complete, the generated data.\n\nArgs:\n    job_id: The job/dataset UUID to query.\n    auth: Authenticated user context.\n\nReturns:\n    GenerateJobStatus with status and data when the job is 'ready'.\n\nRaises:\n    HTTPException: 400 if job_id is not a valid UUID.\n    HTTPException: 404 if the job is not found or not owned by this user.",
        "operationId": "get_generation_job_status_generate_jobs__job_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateJobStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Generation Job Status",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/ner/infer-labels": {
      "post": {
        "description": "Infer NER entity types from a domain description.",
        "operationId": "infer_ner_labels_generate_ner_infer_labels_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InferNERLabelsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferLabelsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Infer Ner Labels",
        "tags": [
          "generate"
        ]
      }
    },
    "/generate/ner/label-existing": {
      "post": {
        "description": "Label existing texts for NER entity extraction.\n\nApplies the provided label set to a corpus of raw texts using Felix.\n\nArgs:\n    request: NER labeling request with texts and label definitions.\n    auth: Authenticated user context.\n\nReturns:\n    GenerateResponse with labeled samples and optional dataset info.\n\nRaises:\n    HTTPException: 400 if no valid inputs or dataset validation fails.\n    HTTPException: 500 on labeling failure.",
        "operationId": "label_existing_ner_generate_ner_label_existing_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelExistingNERRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Label Existing Ner",
        "tags": [
          "generate"
        ]
      }
    },
    "/gliner-2": {
      "post": {
        "description": "Process text using GLiNER-2 base model via InferenceService.\n\n``task`` is optional — when omitted the unified schema path is used.\nLegacy task names are still accepted but deprecated.",
        "operationId": "gliner2_process_gliner_2_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GlinerRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GlinerResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Gliner2 Process",
        "tags": [
          "gliner"
        ]
      }
    },
    "/gliner-2/async": {
      "post": {
        "description": "Submit large GLiNER-2 request for async processing.\n\nUse this endpoint when processing >1M tokens that would exceed\nthe 30-second timeout. Returns immediately with a job_id.\nPoll GET /gliner-2/jobs/{job_id} to retrieve results.\n\nArgs:\n    request: AsyncGlinerRequest with task, text, schema\n    http_request: FastAPI request object\n    auth: Authentication result\n\nReturns:\n    202 Accepted with job_id for polling",
        "operationId": "gliner2_async_gliner_2_async_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AsyncGlinerRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncGlinerResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Gliner2 Async",
        "tags": [
          "gliner"
        ]
      }
    },
    "/gliner-2/jobs/{job_id}": {
      "get": {
        "description": "Get status and result of an async GLiNER-2 job.\n\nReturns:\n- 200 with status=\"complete\" and result when done\n- 200 with status=\"processing\" while in progress\n- 200 with status=\"error\" and error message if failed\n- 404 if job not found or belongs to different user\n\nArgs:\n    job_id: UUID of the job to check\n    auth: Authentication result\n\nReturns:\n    GlinerJobStatus with current status and result if complete",
        "operationId": "gliner2_job_status_gliner_2_jobs__job_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GlinerJobStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Gliner2 Job Status",
        "tags": [
          "gliner"
        ]
      }
    },
    "/health": {
      "get": {
        "description": "Health check endpoint - publicly accessible without authentication.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Health"
      }
    },
    "/huggingface/disconnect": {
      "post": {
        "description": "Disconnect the current user's HuggingFace connection.\n\nArgs:\n    auth: Authenticated user context.\n    service: HuggingFace service.\n\nReturns:\n    Whether the connection was disconnected.",
        "operationId": "disconnect_huggingface_huggingface_disconnect_post",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HuggingFaceDisconnectResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Disconnect Huggingface",
        "tags": [
          "huggingface"
        ]
      }
    },
    "/huggingface/oauth-state": {
      "post": {
        "description": "Create a HuggingFace OAuth state token via the backend.\n\nArgs:\n    request: Redirect URL payload.\n    auth: Authenticated user context.\n    service: HuggingFace service.\n\nReturns:\n    Generated state token for the frontend OAuth redirect.",
        "operationId": "create_huggingface_oauth_state_huggingface_oauth_state_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HuggingFaceOAuthStateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HuggingFaceOAuthStateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Huggingface Oauth State",
        "tags": [
          "huggingface"
        ]
      }
    },
    "/inference": {
      "post": {
        "description": "Run inference on a fine-tuned or base Pioneer model.\n\nSupports both encoder tasks (NER, classification, JSON extraction) and\ndecoder tasks (text generation). The ``task`` field discriminates the\nrequest type automatically, and the response ``type`` field indicates\nthe result shape.\n\nAll wire-format translation, routing, dispatch, persistence, and error\nmapping live in :func:`services.inference.adapters.native.run_native_inference`. The\nrouter keeps only the HTTP-shaped concerns: route declaration,\nauthentication, rate limiting, global admission control, and the\ndeprecation-header injection that flags legacy encoder task shapes\nbefore the body is rendered.\n\nArgs:\n    request: FastAPI request object (required by SlowAPI key extraction).\n    inference_request: Discriminated union -- either encoder or decoder\n        payload.\n    response: FastAPI response object -- used to set deprecation headers\n        on legacy encoder task shapes before the body is rendered.\n    auth: Authenticated request context.\n\nReturns:\n    :class:`schemas.inference.EncoderInferenceResponse` for encoder\n    requests, :class:`schemas.inference.GenerateInferenceResponse` for\n    decoder requests.\n\nRaises:\n    HTTPException: If the model is not found, the inference fails, or\n        the request payload is invalid. See the adapter for the\n        full error-mapping ladder.",
        "operationId": "run_inference_inference_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/EncoderInferenceRequest"
                  },
                  {
                    "$ref": "#/components/schemas/GenerateInferenceRequest"
                  }
                ],
                "title": "Inference Request"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "discriminator": {
                    "mapping": {
                      "decoder": "#/components/schemas/GenerateInferenceResponse",
                      "encoder": "#/components/schemas/EncoderInferenceResponse"
                    },
                    "propertyName": "type"
                  },
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/EncoderInferenceResponse"
                    },
                    {
                      "$ref": "#/components/schemas/GenerateInferenceResponse"
                    }
                  ],
                  "title": "Response Run Inference Inference Post"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Run Inference",
        "tags": [
          "inference"
        ]
      }
    },
    "/inference-clusters/{cluster_id}": {
      "get": {
        "description": "Get one inference cluster.\n\nArgs:\n    cluster_id: Cluster ID.\n    window: Metrics window for primary metrics.\n    auth: Authentication result.\n\nReturns:\n    Cluster detail.\n\nRaises:\n    HTTPException: 404 for inaccessible clusters.",
        "operationId": "get_inference_cluster_inference_clusters__cluster_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "cluster_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Cluster Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "window",
            "required": false,
            "schema": {
              "default": "7d",
              "enum": [
                "24h",
                "7d",
                "30d",
                "all"
              ],
              "title": "Window",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceClusterDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Inference Cluster",
        "tags": [
          "inference-clusters"
        ]
      },
      "patch": {
        "description": "Update a cluster status.\n\nArgs:\n    cluster_id: Cluster ID.\n    request: Status update payload.\n    auth: Authentication result.\n\nReturns:\n    Updated cluster detail.",
        "operationId": "update_inference_cluster_inference_clusters__cluster_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "cluster_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Cluster Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InferenceClusterUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceClusterDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Inference Cluster",
        "tags": [
          "inference-clusters"
        ]
      }
    },
    "/inference-clusters/{cluster_id}/examples": {
      "get": {
        "description": "List representative examples for a cluster.\n\nArgs:\n    cluster_id: Cluster ID.\n    window: Example window.\n    limit: Maximum examples.\n    offset: Number of examples to skip.\n    include: Compact or full inference shape.\n    auth: Authentication result.\n\nReturns:\n    Paginated cluster examples.",
        "operationId": "list_inference_cluster_examples_inference_clusters__cluster_id__examples_get",
        "parameters": [
          {
            "in": "path",
            "name": "cluster_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Cluster Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "window",
            "required": false,
            "schema": {
              "default": "all",
              "enum": [
                "24h",
                "7d",
                "30d",
                "all"
              ],
              "title": "Window",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "include",
            "required": false,
            "schema": {
              "default": "compact",
              "enum": [
                "compact",
                "full"
              ],
              "title": "Include",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceClusterInferencesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Inference Cluster Examples",
        "tags": [
          "inference-clusters"
        ]
      }
    },
    "/inference-clusters/{cluster_id}/inferences": {
      "get": {
        "description": "List all member inferences or passing context for a cluster.\n\nArgs:\n    cluster_id: Cluster ID.\n    role: Member failures or pass context.\n    window: Optional inference window.\n    limit: Maximum records.\n    offset: Number of records to skip.\n    sort: Sort order.\n    include: Compact or full inference shape.\n    auth: Authentication result.\n\nReturns:\n    Paginated cluster-related inferences.",
        "operationId": "list_inference_cluster_inferences_inference_clusters__cluster_id__inferences_get",
        "parameters": [
          {
            "in": "path",
            "name": "cluster_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Cluster Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "role",
            "required": false,
            "schema": {
              "default": "members",
              "enum": [
                "members",
                "pass_context"
              ],
              "title": "Role",
              "type": "string"
            }
          },
          {
            "description": "Optional inference window. Defaults to all for members and 30d for pass_context.",
            "in": "query",
            "name": "window",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "24h",
                    "7d",
                    "30d",
                    "all"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional inference window. Defaults to all for members and 30d for pass_context.",
              "title": "Window"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 500,
              "maximum": 1000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "default": "recent",
              "enum": [
                "recent",
                "score_asc",
                "score_desc"
              ],
              "title": "Sort",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include",
            "required": false,
            "schema": {
              "default": "compact",
              "enum": [
                "compact",
                "full"
              ],
              "title": "Include",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceClusterInferencesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Inference Cluster Inferences",
        "tags": [
          "inference-clusters"
        ]
      }
    },
    "/inferences": {
      "get": {
        "description": "List inference history for the authenticated user.\n\nReturns all inference records across all model types (NER, classification,\nJSON extraction, decoder) sorted by most recent first.\n\nArgs:\n    auth: Authentication result with user_id\n    limit: Maximum number of records to return (default 100, max 500)\n    offset: Number of records to skip for pagination\n    model_id: Optional filter by model ID\n    task: Optional filter by task type\n    project_id: Optional filter by project ID\n    training_job_id: Optional filter by training job ID\n    latency_min/latency_max: Inclusive latency window in ms.\n    llmaj_score_min/llmaj_score_max: Inclusive LLMAJ-score window\n        in [0.0, 1.0].\n    since: Optional inclusive lower bound on ``created_at`` (ISO 8601).\n    until: Optional exclusive upper bound on ``created_at`` (ISO 8601).\n\nReturns:\n    InferenceListResponse with paginated inference records.\n\nRaises:\n    HTTPException: 422 when ``min`` is greater than its paired\n        ``max`` — returning an empty page would silently mask the\n        caller's misordered query.",
        "operationId": "list_inference_history_inferences_get",
        "parameters": [
          {
            "description": "Maximum records to return",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum records to return",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Number of records to skip",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Number of records to skip",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Filter by model ID",
            "in": "query",
            "name": "model_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by model ID",
              "title": "Model Id"
            }
          },
          {
            "description": "Filter by task type",
            "in": "query",
            "name": "task",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by task type",
              "title": "Task"
            }
          },
          {
            "description": "Filter by project ID",
            "in": "query",
            "name": "project_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by project ID",
              "title": "Project Id"
            }
          },
          {
            "description": "Filter by training job ID",
            "in": "query",
            "name": "training_job_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by training job ID",
              "title": "Training Job Id"
            }
          },
          {
            "description": "Minimum latency in ms (must be >= 0).",
            "in": "query",
            "name": "latency_min",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Minimum latency in ms (must be >= 0).",
              "title": "Latency Min"
            }
          },
          {
            "description": "Maximum latency in ms (must be >= 0).",
            "in": "query",
            "name": "latency_max",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum latency in ms (must be >= 0).",
              "title": "Latency Max"
            }
          },
          {
            "description": "Minimum LLM-as-Judge score in [0.0, 1.0].",
            "in": "query",
            "name": "llmaj_score_min",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Minimum LLM-as-Judge score in [0.0, 1.0].",
              "title": "Llmaj Score Min"
            }
          },
          {
            "description": "Maximum LLM-as-Judge score in [0.0, 1.0].",
            "in": "query",
            "name": "llmaj_score_max",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum LLM-as-Judge score in [0.0, 1.0].",
              "title": "Llmaj Score Max"
            }
          },
          {
            "description": "Inclusive lower bound on created_at (ISO 8601, UTC).",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Inclusive lower bound on created_at (ISO 8601, UTC).",
              "title": "Since"
            }
          },
          {
            "description": "Exclusive upper bound on created_at (ISO 8601, UTC).",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exclusive upper bound on created_at (ISO 8601, UTC).",
              "title": "Until"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Inference history dependency is temporarily unavailable."
          }
        },
        "summary": "List Inference History",
        "tags": [
          "inference-history"
        ]
      }
    },
    "/inferences/{inference_id}": {
      "get": {
        "description": "Get a single inference record by ID.\n\nArgs:\n    inference_id: The inference record UUID\n    auth: Authentication result with user_id\n\nReturns:\n    InferenceRecord with full details\n\nRaises:\n    HTTPException: 404 if inference not found or outside the caller's team",
        "operationId": "get_inference_detail_inferences__inference_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "inference_id",
            "required": true,
            "schema": {
              "title": "Inference Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceRecord"
                }
              }
            },
            "description": "Successful Response"
          },
          "404": {
            "description": "Inference not found."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Inference history dependency is temporarily unavailable."
          }
        },
        "summary": "Get Inference Detail",
        "tags": [
          "inference-history"
        ]
      }
    },
    "/inferences/{inference_id}/feedback": {
      "get": {
        "description": "Get human feedback for a specific inference.\n\nArgs:\n    inference_id: The inference record UUID to look up.\n    auth: Authentication result with user_id.\n\nReturns:\n    InferenceFeedbackResponse with the stored feedback.\n\nRaises:\n    HTTPException: 404 if inference not found or no feedback submitted.",
        "operationId": "get_inference_feedback_inferences__inference_id__feedback_get",
        "parameters": [
          {
            "in": "path",
            "name": "inference_id",
            "required": true,
            "schema": {
              "title": "Inference Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceFeedbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "404": {
            "description": "Feedback not found."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Inference history dependency is temporarily unavailable."
          }
        },
        "summary": "Get Inference Feedback",
        "tags": [
          "inference-history"
        ]
      },
      "post": {
        "description": "Submit human feedback on a specific inference.\n\nMarks an inference as correct or incorrect. When marking as incorrect,\nthe expected output must be provided for downstream training data curation.\n\nArgs:\n    inference_id: The inference record UUID to annotate.\n    request: Feedback payload with verdict, optional corrected output, and notes.\n    auth: Authentication result with user_id.\n\nReturns:\n    InferenceFeedbackResponse confirming the stored feedback.\n\nRaises:\n    HTTPException: 404 if inference not found or outside the caller's team.",
        "operationId": "submit_inference_feedback_inferences__inference_id__feedback_post",
        "parameters": [
          {
            "in": "path",
            "name": "inference_id",
            "required": true,
            "schema": {
              "title": "Inference Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InferenceFeedbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InferenceFeedbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "404": {
            "description": "Inference not found."
          },
          "422": {
            "description": "Invalid feedback payload."
          },
          "503": {
            "description": "Inference history dependency is temporarily unavailable."
          }
        },
        "summary": "Submit Inference Feedback",
        "tags": [
          "inference-history"
        ]
      }
    },
    "/invitations/pending": {
      "get": {
        "description": "Get all pending invitations for the authenticated user.\n\nReturns invitations that match the user's email address and are not expired.\nUsed on login to show pending team invites.",
        "operationId": "get_pending_invitations_invitations_pending_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PendingInvitationsResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Get Pending Invitations",
        "tags": [
          "team-invitations"
        ]
      }
    },
    "/invitations/{invitation_id}/accept": {
      "post": {
        "description": "Accept a team invitation.\n\nValidates the invitation belongs to the user's email.\n\nPayment is intentionally NOT enforced (``enforce_payment=False``):\naccepting an invite consumes no credits and is the canonical path for a\nuser on the unpaid ``free`` plan to join a paid team. Gating it behind the\nbilling check blocked free-plan invitees from ever joining (min_plan must\nbe ``free`` for this route — see ``docs/endpoint-access-matrix.md``).",
        "operationId": "accept_invitation_invitations__invitation_id__accept_post",
        "parameters": [
          {
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "title": "Invitation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationActionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Accept Invitation",
        "tags": [
          "team-invitations"
        ]
      }
    },
    "/invitations/{invitation_id}/decline": {
      "post": {
        "description": "Decline a team invitation.\n\nLike ``accept``, declining consumes no credits and must remain available\nto ``free``-plan users, so payment is not enforced.",
        "operationId": "decline_invitation_invitations__invitation_id__decline_post",
        "parameters": [
          {
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "title": "Invitation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationActionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Decline Invitation",
        "tags": [
          "team-invitations"
        ]
      }
    },
    "/leaderboard/competitions": {
      "get": {
        "description": "List all active competition datasets with their top scores.\n\nArgs:\n    include_samples: If True, fetch sample rows from S3 for preview.\n        Defaults to False for fast loading.\n\nReturns datasets where is_competition=true, along with the current winner\nand optionally a few sample rows for preview.",
        "operationId": "list_competitions_leaderboard_competitions_get",
        "parameters": [
          {
            "in": "query",
            "name": "include_samples",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include Samples",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompetitionsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Competitions",
        "tags": [
          "leaderboard"
        ]
      }
    },
    "/leaderboard/competitions/{dataset_id}/samples": {
      "get": {
        "description": "Fetch sample rows for a single competition dataset.\n\nThis is the lazy-load endpoint called when a user clicks\n\"View Sample Data\" on a competition card.\n\nArgs:\n    dataset_id: The competition dataset to fetch samples for.\n\nReturns:\n    Dict with dataset_id and sample_rows list.",
        "operationId": "get_competition_samples_leaderboard_competitions__dataset_id__samples_get",
        "parameters": [
          {
            "in": "path",
            "name": "dataset_id",
            "required": true,
            "schema": {
              "title": "Dataset Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Competition Samples",
        "tags": [
          "leaderboard"
        ]
      }
    },
    "/leaderboard/datasets/{dataset_id}/entries": {
      "get": {
        "description": "Get top leaderboard entries for a competition dataset.\n\nReturns entries sorted by F1 score in descending order.",
        "operationId": "get_leaderboard_entries_leaderboard_datasets__dataset_id__entries_get",
        "parameters": [
          {
            "in": "path",
            "name": "dataset_id",
            "required": true,
            "schema": {
              "title": "Dataset Id",
              "type": "string"
            }
          },
          {
            "description": "Number of entries to return",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "description": "Number of entries to return",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaderboardEntriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Leaderboard Entries",
        "tags": [
          "leaderboard"
        ]
      }
    },
    "/leaderboard/datasets/{dataset_id}/submit": {
      "post": {
        "description": "Submit or update a leaderboard entry after evaluation.\n\nIf the user already has an entry for this dataset, it will be updated\nonly if the new score is better (higher F1).",
        "operationId": "submit_to_leaderboard_leaderboard_datasets__dataset_id__submit_post",
        "parameters": [
          {
            "in": "path",
            "name": "dataset_id",
            "required": true,
            "schema": {
              "title": "Dataset Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaderboardSubmission"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaderboardSubmitResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit To Leaderboard",
        "tags": [
          "leaderboard"
        ]
      }
    },
    "/list-api-keys": {
      "get": {
        "description": "List all API keys for the caller's active team with usage statistics.\n\nKeys are team-bound and shared, so every member sees the same set. Does\nnot return the actual key values.",
        "operationId": "list_api_keys_list_api_keys_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAPIKeysResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Api Keys",
        "tags": [
          "api-keys"
        ]
      }
    },
    "/mle-agent/sessions": {
      "get": {
        "description": "List all chat sessions for the authenticated user.\n\nReturns sessions sorted by updated_at (most recent first). Each session\nincludes ``first_user_attached_resources`` populated from the preamble\nof its first user message so the threads-sidebar preview can render\nthe same chips that appear inside the chat history.",
        "operationId": "list_sessions_mle_agent_sessions_get",
        "parameters": [
          {
            "description": "Number of sessions to return",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "description": "Number of sessions to return",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Offset for pagination",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Offset for pagination",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Include archived sessions",
            "in": "query",
            "name": "include_archived",
            "required": false,
            "schema": {
              "default": false,
              "description": "Include archived sessions",
              "title": "Include Archived",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Sessions",
        "tags": [
          "agent-chat-sessions"
        ]
      },
      "post": {
        "description": "Create a new chat session.\n\nIf title is not provided, it will be auto-generated from the first_message.",
        "operationId": "create_session_mle_agent_sessions_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatSessionCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Session",
        "tags": [
          "agent-chat-sessions"
        ]
      }
    },
    "/mle-agent/sessions/{session_id}": {
      "delete": {
        "description": "Delete a chat session and all its messages.\n\nMessages are automatically cascade-deleted by the database.",
        "operationId": "delete_session_mle_agent_sessions__session_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionDeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Session",
        "tags": [
          "agent-chat-sessions"
        ]
      },
      "get": {
        "description": "Get a specific chat session with all messages.\n\nOnly returns sessions owned by the authenticated user.",
        "operationId": "get_session_mle_agent_sessions__session_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionWithMessages"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Session",
        "tags": [
          "agent-chat-sessions"
        ]
      },
      "patch": {
        "description": "Update a chat session's title or archive status.",
        "operationId": "update_session_mle_agent_sessions__session_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatSessionUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Session",
        "tags": [
          "agent-chat-sessions"
        ]
      }
    },
    "/mle-agent/sessions/{session_id}/billing/agent-turn": {
      "post": {
        "description": "Accept a legacy per-turn LLM self-report for MLE chat sessions.\n\nOlder MLE sandbox images may still POST usage here after each LLM\ncall. Brain now bills brokered sandbox LLM calls from\nserver-observed ``/v1/messages`` usage, so this endpoint verifies\nsession ownership and dedups the report but does not create a\n``requests`` row from the sandbox payload.\n\nAuthenticated with the user's ``pio_sk_`` API key via\n:class:`FlexibleAuth`. The session ownership check in\n:func:`bill_mle_agent_turn` is the second layer of defence — a\nstolen API key cannot mark *other* users' chats handled.\n\nRate-limited at 120 req/min, the same admission ceiling as the\nauto-agent per-turn endpoint. A single user's sandbox emitting\none turn per second still has 2× headroom on bursts.\n\nArgs:\n    request: FastAPI request used by the rate-limiter.\n    session_id: ``agent_chat_sessions.id`` for the active chat.\n    body: ``AgentTurnBillingRequest`` with provider, model,\n        input / output tokens, and a per-turn dedup key. The token\n        fields are retained for compatibility metrics and are not\n        trusted for billing.\n    auth: Authenticated caller; ``user_id`` must own ``session_id``.\n\nReturns:\n    :class:`AgentTurnBillingResponse` with ``billed=False``.\n    ``request_id`` is normally ``None`` for newly accepted\n    compatibility reports, but may contain a cached legacy id for\n    old dedup entries.\n\nRaises:\n    HTTPException 404: session does not exist.\n    HTTPException 403: session belongs to a different user.\n    HTTPException 500: unexpected internal failure (callers may\n        retry the same ``(session_id, turn_id)`` safely — the\n        dedup cache makes the second call a no-op).",
        "operationId": "report_mle_agent_turn_billing_mle_agent_sessions__session_id__billing_agent_turn_post",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentTurnBillingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentTurnBillingResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Report Mle Agent Turn Billing",
        "tags": [
          "agent-chat-sessions"
        ]
      }
    },
    "/mle-agent/sessions/{session_id}/messages": {
      "post": {
        "description": "Append messages to an existing session.\n\nMessages are added with sequential message_index values.",
        "operationId": "append_messages_mle_agent_sessions__session_id__messages_post",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatSessionMessagesAppend"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionMessagesAppendResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Append Messages",
        "tags": [
          "agent-chat-sessions"
        ]
      }
    },
    "/mle-agent/tools": {
      "get": {
        "description": "List available tools for a client type.\n\nArgs:\n    request: Incoming HTTP request (required by SlowAPI rate limiter).\n    params: Query parameters including client_type ('web' or 'cli')\n\nReturns:\n    List of available tools",
        "operationId": "list_tools_mle_agent_tools_get",
        "parameters": [
          {
            "in": "query",
            "name": "client_type",
            "required": false,
            "schema": {
              "default": "web",
              "title": "Client Type",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Tools",
        "tags": [
          "MLE Agent"
        ]
      }
    },
    "/monitoring/improvement-candidates": {
      "get": {
        "description": "List workspace-scoped monitoring improvement candidates.\n\nArgs:\n    limit: Requested maximum number of candidates.\n    auth: Authentication result.\n    service: Improvement-candidates service.\n\nReturns:\n    ImprovementCandidatesResponse with zero or more candidates.",
        "operationId": "list_improvement_candidates_monitoring_improvement_candidates_get",
        "parameters": [
          {
            "description": "Maximum candidates to return, capped at 50.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "description": "Maximum candidates to return, capped at 50.",
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImprovementCandidatesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List deployable improvement candidates for monitoring",
        "tags": [
          "monitoring"
        ]
      }
    },
    "/monitoring/improvement-candidates/{training_job_id}/dismiss": {
      "post": {
        "description": "Dismiss a visible improvement candidate training job.\n\nArgs:\n    training_job_id: Training job ID backing the candidate.\n    auth: Authentication result.\n    service: Improvement-candidates service.\n\nReturns:\n    DismissImprovementCandidateResponse with dismissal metadata.\n\nRaises:\n    HTTPException: 404 when the candidate is not visible to the caller.",
        "operationId": "dismiss_improvement_candidate_monitoring_improvement_candidates__training_job_id__dismiss_post",
        "parameters": [
          {
            "in": "path",
            "name": "training_job_id",
            "required": true,
            "schema": {
              "title": "Training Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DismissImprovementCandidateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Dismiss a monitoring improvement candidate",
        "tags": [
          "monitoring"
        ]
      }
    },
    "/observability/categories": {
      "get": {
        "description": "Spend / tokens / task count per work category.\n\nFixed to the 7-day classification window; the response restates the window\nso the UI labels it. ``non_coding`` is a first-class slice, never hidden.",
        "operationId": "get_observability_categories_observability_categories_get",
        "parameters": [
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Categories",
        "tags": [
          "observability"
        ]
      }
    },
    "/observability/harnesses": {
      "get": {
        "description": "Per-harness rollup — the headline table.\n\nSpend, tasks, sessions, session cost percentiles, tokens, models, surface\nbreakdown, and category-coverage gating.",
        "operationId": "get_observability_harnesses_observability_harnesses_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
              "title": "End Date"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HarnessesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Harnesses",
        "tags": [
          "observability"
        ]
      }
    },
    "/observability/keys": {
      "get": {
        "description": "Per-API-key rollup, ordered alphabetically by key name (never by spend).",
        "operationId": "get_observability_keys_observability_keys_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
              "title": "End Date"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeysResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Keys",
        "tags": [
          "observability"
        ]
      }
    },
    "/observability/keys/{api_key_id}": {
      "get": {
        "description": "Drill-down for one key: daily spend/token series, model mix, harness mix, recent tasks.",
        "operationId": "get_observability_key_detail_observability_keys__api_key_id__get",
        "parameters": [
          {
            "description": "API key UUID to drill into.",
            "in": "path",
            "name": "api_key_id",
            "required": true,
            "schema": {
              "description": "API key UUID to drill into.",
              "title": "Api Key Id",
              "type": "string"
            }
          },
          {
            "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
              "title": "End Date"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyDetailResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Key Detail",
        "tags": [
          "observability"
        ]
      }
    },
    "/observability/models": {
      "get": {
        "description": "Spend and tokens by model across coding-harness traffic.",
        "operationId": "get_observability_models_observability_models_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
              "title": "End Date"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Models",
        "tags": [
          "observability"
        ]
      }
    },
    "/observability/router": {
      "get": {
        "description": "Model-router vs raw-model usage split, plus which routers the team uses.",
        "operationId": "get_observability_router_observability_router_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
              "title": "End Date"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouterUsageResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Router",
        "tags": [
          "observability"
        ]
      }
    },
    "/observability/summary": {
      "get": {
        "description": "Headline totals, previous-period trend, and daily spend series.\n\nSeparates total coding-harness spend from actual software-engineering spend\n(``engineering_spend`` = total minus ``non_coding``).",
        "operationId": "get_observability_summary_observability_summary_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
              "title": "End Date"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObservabilitySummary"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Summary",
        "tags": [
          "observability"
        ]
      }
    },
    "/observability/timeseries": {
      "get": {
        "description": "Harness-mix and model-mix over time, plus an hour-of-day usage profile.",
        "operationId": "get_observability_timeseries_observability_timeseries_get",
        "parameters": [
          {
            "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range start (ISO date or datetime, UTC). Defaults to 30 days ago.",
              "title": "Start Date"
            }
          },
          {
            "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Range end (ISO date or datetime, UTC). Defaults to now.",
              "title": "End Date"
            }
          },
          {
            "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "team",
              "description": "``team`` (default) aggregates the active team's coding-agent tasks; ``personal`` narrows to tasks on keys the requesting user created.",
              "enum": [
                "team",
                "personal"
              ],
              "title": "Scope",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Observability Timeseries",
        "tags": [
          "observability"
        ]
      }
    },
    "/projects": {
      "get": {
        "description": "List all projects visible to the authenticated user.\n\nReturns team projects (visibility=team) and the user's own private projects,\nscoped to the user's team, sorted by creation date (most recent first).\nLazily provisions the pioneer/auto router if routing is live but the project\nis absent (handles silent creation failures at registration time).",
        "operationId": "list_projects_projects_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectListResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Projects",
        "tags": [
          "projects"
        ]
      },
      "post": {
        "description": "Create a new project for the authenticated user.\n\nDelegates to ``ProjectService`` for business logic, example generation,\nactivity recording, and failure analytics.\n\nArgs:\n    request: Validated project creation payload.\n    auth: Authentication result.\n\nReturns:\n    ProjectResponse for the newly created project.\n\nRaises:\n    HTTPException: 409 on duplicate name, 500 on unexpected errors.",
        "operationId": "create_project_projects_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Project",
        "tags": [
          "projects"
        ]
      }
    },
    "/projects/{project_id}": {
      "delete": {
        "description": "Soft-delete a project by setting is_deleted=True.\n\nThe project row is preserved in the database but hidden from all\nread queries. Associated resources (datasets, training\njobs) remain linked and are unaffected.\n\nThe project owner can always soft-delete their own project. Other\nteam members must hold ``TeamPermission.DELETE_RESOURCES`` in the\nproject's team — granted to ``owner``, ``admin``, and ``editor``.\n\nArgs:\n    project_id: Project UUID to soft-delete.\n    auth: Authentication result.\n\nReturns:\n    ProjectDeleteResponse confirming the deletion.\n\nRaises:\n    HTTPException: 404 when no visible, non-deleted project matches\n        ``project_id`` for the caller; 403 when the caller is not the\n        project owner and lacks ``DELETE_RESOURCES``; 500 on\n        transient infrastructure errors.",
        "operationId": "delete_project_projects__project_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Project",
        "tags": [
          "projects"
        ]
      },
      "get": {
        "description": "Get a specific project by ID.\n\nReturns the project if the user can see it (team member + visibility check).\nPrivate projects are only visible to the creator.",
        "operationId": "get_project_projects__project_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Project",
        "tags": [
          "projects"
        ]
      },
      "patch": {
        "description": "Update a project's metadata.\n\nOnly provided fields will be updated. Project names must remain unique\nper team (the ``unique_active_project_name_per_team`` index): no two\nprojects in the same team may share a name. User must be a member of\nthe project's team.",
        "operationId": "update_project_projects__project_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Project",
        "tags": [
          "projects"
        ]
      }
    },
    "/projects/{project_id}/dataset-count": {
      "get": {
        "description": "Get the number of datasets attached to a project.\n\nUseful for checking if a project can be safely deleted.\nWorks for all team projects the user can see.",
        "operationId": "get_project_dataset_count_projects__project_id__dataset_count_get",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDatasetCountResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Project Dataset Count",
        "tags": [
          "projects"
        ]
      }
    },
    "/projects/{project_id}/deployments": {
      "get": {
        "description": "Return deployment history for a project, newest first.\n\nArgs:\n    project_id: ID of the project to query.\n    limit: Maximum number of records to return (1-100, default 50).\n    auth: Authenticated user.\n\nReturns:\n    DeploymentHistoryResponse with ordered deployment records.\n\nRaises:\n    403: If the user does not have access to the project.",
        "operationId": "list_deployments_projects__project_id__deployments_get",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentHistoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List deployment history for a project",
        "tags": [
          "deployments"
        ]
      },
      "post": {
        "description": "Activate a model as the project's active model and record the swap.\n\nExactly one of ``training_job_id`` (a fine-tuned checkpoint) or\n``base_model`` (a stock HuggingFace base model) must be supplied in the\nrequest body; this is enforced by the ``DeploymentCreate`` schema.\n\nArgs:\n    project_id: ID of the project to update.\n    request: Deployment target (training job or base model) and optional\n        reason.\n    auth: Authenticated user.\n\nReturns:\n    DeploymentResponse with the new history record.\n\nRaises:\n    400: If the supplied base model is not in the catalog.\n    403: If the user does not have access to the project.\n    404: If the project or training job is not found.",
        "operationId": "deploy_model_projects__project_id__deployments_post",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeploymentCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Deploy a model to a project",
        "tags": [
          "deployments"
        ]
      }
    },
    "/projects/{project_id}/deployments/{deployment_id}": {
      "get": {
        "description": "Fetch a specific deployment history record.\n\nArgs:\n    project_id: Project the deployment belongs to.\n    deployment_id: Deployment record ID.\n    auth: Authenticated user.\n\nReturns:\n    DeploymentResponse for the record.\n\nRaises:\n    403: If the user does not have access to the project.\n    404: If the deployment is not found for this project.",
        "operationId": "get_deployment_projects__project_id__deployments__deployment_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "deployment_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Deployment Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get a single deployment record",
        "tags": [
          "deployments"
        ]
      }
    },
    "/projects/{project_id}/deployments/{deployment_id}/rollback": {
      "post": {
        "description": "Re-deploy the model from a previous deployment record.\n\nThe rolled-back deployment may be either a training-job deployment or a\nbase-model deployment; this endpoint handles both shapes by mirroring\nwhichever target was set on the source record.\n\nArgs:\n    project_id: Project to roll back.\n    deployment_id: Deployment record whose target will be re-activated.\n    auth: Authenticated user.\n\nReturns:\n    DeploymentResponse for the new rollback deployment record.\n\nRaises:\n    400: If the historical deployment targets a base model that is no\n        longer in the catalog.\n    403: If the user does not have access to the project.\n    404: If the deployment record is not found for this project.",
        "operationId": "rollback_deployment_projects__project_id__deployments__deployment_id__rollback_post",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "deployment_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Deployment Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rollback to a previous deployment",
        "tags": [
          "deployments"
        ]
      }
    },
    "/projects/{project_id}/improvement-timeseries": {
      "get": {
        "description": "Return training jobs grouped with their evaluations for the quality chart.\n\nIncludes the latest completed base-model evaluation so the frontend\ncan pin it as the leftmost point on the improvement curve.\n\nArgs:\n    project_id: Project UUID.\n    auth: Authentication result.\n\nReturns:\n    ImprovementTimeseriesResponse with adapters ordered newest first.\n\nRaises:\n    HTTPException 403: User lacks access to the project.\n    HTTPException 404: Project not found or deleted.",
        "operationId": "get_improvement_timeseries_projects__project_id__improvement_timeseries_get",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImprovementTimeseriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Grouped training-job + evals + base-model-eval for a project",
        "tags": [
          "projects"
        ]
      }
    },
    "/projects/{project_id}/inference-clusters": {
      "get": {
        "description": "List inference clusters for a project.\n\nArgs:\n    project_id: Project ID.\n    window: Metrics window for ranking/counts.\n    status: Optional comma-delimited status filter.\n    base_model: Optional base model filter.\n    model_id: Optional model ID filter.\n    training_job_id: Optional training job filter.\n    severity: Optional severity filter.\n    auth: Authentication result.\n\nReturns:\n    Grouped project inference clusters.\n\nRaises:\n    HTTPException: 404 for inaccessible projects.",
        "operationId": "list_project_inference_clusters_projects__project_id__inference_clusters_get",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "window",
            "required": false,
            "schema": {
              "default": "7d",
              "enum": [
                "24h",
                "7d",
                "30d",
                "all"
              ],
              "title": "Window",
              "type": "string"
            }
          },
          {
            "description": "Comma-delimited statuses. Defaults to open,reopened.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Comma-delimited statuses. Defaults to open,reopened.",
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "base_model",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Base Model"
            }
          },
          {
            "in": "query",
            "name": "model_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Model Id"
            }
          },
          {
            "in": "query",
            "name": "training_job_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Training Job Id"
            }
          },
          {
            "in": "query",
            "name": "severity",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "high",
                    "mid",
                    "low"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectInferenceClustersResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Project Inference Clusters",
        "tags": [
          "inference-clusters"
        ]
      }
    },
    "/projects/{project_id}/quality-metrics": {
      "get": {
        "description": "Get LLMAJ pass/fail aggregates for a project.\n\nArgs:\n    request: FastAPI request (for rate limiter).\n    project_id: Project UUID to aggregate metrics for.\n    auth: Authenticated user.\n    service: Agent service.\n\nReturns:\n    Quality metrics response with verdict counts and rates.\n\nRaises:\n    HTTPException: 404 if project not found.",
        "operationId": "get_quality_metrics_projects__project_id__quality_metrics_get",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Project Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QualityMetricsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "404": {
            "description": "Project not found."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          },
          "503": {
            "description": "Quality metrics dependency is temporarily unavailable."
          }
        },
        "summary": "Get Quality Metrics",
        "tags": [
          "agent"
        ]
      }
    },
    "/register-web": {
      "post": {
        "description": "Register the authenticated user's Google OAuth refresh token.\n\nOnly browser-session (JWT) callers are accepted. A valid hCaptcha token\nis required in non-local environments to prevent automated registration.\n\nThe user identity (email, full name) is sourced from the immutable\nSupabase auth identity inside :func:`register_user_core`. The request\nbody intentionally only carries the OAuth refresh token plus optional\nprofile links — any email/full_name fields a client sends are ignored\nby the Pydantic schema (ENG-1214).\n\nArgs:\n    http_request: The incoming FastAPI request.\n    request: Registration request with the OAuth refresh token.\n    auth: Authenticated user context (JWT-validated).\n\nReturns:\n    UserRegistrationResponse with success status and connection info.",
        "operationId": "register_user_register_web_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserRegistrationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserRegistrationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Register User",
        "tags": [
          "users"
        ]
      }
    },
    "/responses": {
      "post": {
        "description": "OpenAI-compatible Responses API endpoint.\n\nThin shell over :func:`services.inference.adapters.openai_responses.run_responses`.\nThe adapter handles input-item to chat-message translation,\nLLM-passthrough vs Pioneer-task dispatch, SSE rendering,\ntool-call serialisation, persistence, and error mapping. The\nrouter keeps only HTTP-shaped concerns: route declaration, auth,\nrate limiting.\n\nArgs:\n    body: Validated :class:`ResponsesRequest`.\n    request: FastAPI request (forwarded so the adapter can read\n        API-key billing context out of ``request.state`` for\n        streaming responses).\n    auth: Authenticated request context.\n\nReturns:\n    JSON response payload or :class:`StreamingResponse` SSE stream\n    in Responses API format.",
        "operationId": "responses_responses_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Responses",
        "tags": [
          "openai-compat"
        ]
      }
    },
    "/routers/meta": {
      "get": {
        "description": "Return the effort presets and candidate models for every router type.\n\nAuthentication is optional; the payload is static configuration.",
        "operationId": "get_routers_meta_routers_meta_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouterMetaResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Get Routers Meta",
        "tags": [
          "routers"
        ]
      }
    },
    "/sandbox-agents/{agent_type}/runs/{run_ref_id}/billing/agent-turn": {
      "post": {
        "description": "Accept a legacy LLM turn self-report from a keyed sandbox-script agent.\n\nOlder sandbox images may still call this once per LangChain\n``on_chat_model_end`` event. Brain now bills brokered sandbox LLM\ncalls from server-observed ``/v1/messages`` usage, so this endpoint\nverifies auth and dedups the report but does not create a\n``requests`` row from the sandbox payload.\n\nFresh accepted compatibility reports return ``request_id=None`` and\n``billed=False``. Replays return the cached compatibility result\nwith ``billed=False``.\n\nArgs:\n    agent_type: Which keyed agent fired the call. Validated by\n        :data:`KeyedAgentType` — unknown values 422 rather than\n        accepting an untagged category.\n    run_ref_id: Client-generated UUID identifying the run /\n        conversation (typically the LangGraph ``thread_id``).\n        Used as part of the dedup namespace.\n    body: Token usage payload (turn_id, provider, model,\n        input_tokens, output_tokens). These fields are retained for\n        compatibility metrics and are not trusted for billing.\n    auth: Authenticated user (from ``X-API-Key``). Their UUID\n        identifies the sandbox owner.\n\nRaises:\n    HTTPException 500: Anything unexpected. The sandbox MUST\n        retry on 5xx (the shared\n        :class:`SandboxBillingClient` already does once).",
        "operationId": "report_keyed_agent_turn_billing_sandbox_agents__agent_type__runs__run_ref_id__billing_agent_turn_post",
        "parameters": [
          {
            "in": "path",
            "name": "agent_type",
            "required": true,
            "schema": {
              "enum": [
                "clustering_agent",
                "adaptive_finetuning",
                "data_engine"
              ],
              "title": "Agent Type",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "run_ref_id",
            "required": true,
            "schema": {
              "title": "Run Ref Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentTurnBillingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentTurnBillingResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Report Keyed Agent Turn Billing",
        "tags": [
          "sandbox-agents"
        ]
      }
    },
    "/support/contact": {
      "post": {
        "description": "Forward an in-app support request to Intercom as a conversation.\n\nArgs:\n    request: FastAPI request (required by the rate limiter).\n    body: The submitted support form fields.\n    auth: Authenticated caller; ``auth.email`` resolves (or creates) the\n        submitter's Intercom contact so the conversation is attributed\n        to them.\n\nReturns:\n    A success envelope once the Intercom conversation has been created.",
        "operationId": "submit_support_request_support_contact_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportContactRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit Support Request",
        "tags": [
          "support"
        ]
      }
    },
    "/teams": {
      "get": {
        "description": "List all teams the authenticated user is a member of.\n\nReturns teams sorted with member counts and user's role in each.",
        "operationId": "list_teams_teams_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamListResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Teams",
        "tags": [
          "teams"
        ]
      },
      "post": {
        "description": "Create a new team with the authenticated user as owner.\n\nThe creator automatically becomes the team owner.",
        "operationId": "create_team_teams_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Team",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}": {
      "delete": {
        "description": "Delete a team.\n\nOnly the team owner can delete a team.",
        "operationId": "delete_team_teams__team_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamDeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Team",
        "tags": [
          "teams"
        ]
      },
      "get": {
        "description": "Get a specific team by ID.\n\nOnly accessible to team members.",
        "operationId": "get_team_teams__team_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Team",
        "tags": [
          "teams"
        ]
      },
      "patch": {
        "description": "Update a team's details.\n\nRequires owner or admin role.",
        "operationId": "update_team_teams__team_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Team",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/invitations": {
      "get": {
        "description": "List all invitations for a team.\n\nRequires owner, admin, or billing role.",
        "operationId": "list_team_invitations_teams__team_id__invitations_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamInvitationsListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Team Invitations",
        "tags": [
          "teams"
        ]
      },
      "post": {
        "description": "Invite a user to join a team.\n\nRequires owner, admin, or billing role. Owner-role invitations are\nrejected; ownership can only be transferred to an existing team member.\nSupports pre-signup invites (invitee doesn't need an account yet).\n\n**Accepted risk (ENG-1281):** AAL2 enforcement was intentionally removed\n(PR #3928) — users without MFA enrolled were being blocked from routine\nteam operations. Inviting an attacker-controlled email as\n``admin``/``billing`` is the cleanest L-A16 escalation path: the\nattacker accepts on their own AAL2 account and instantly has\nMANAGE_BILLING on the victim team. This risk is accepted per the design\ndecision.",
        "operationId": "invite_member_teams__team_id__invitations_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamInvitationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamInvitationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Invite Member",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/invitations/{invitation_id}": {
      "delete": {
        "description": "Cancel a pending invitation.\n\nRequires owner or admin role. Cancelling pending invites is paired\nwith ``invite_member`` in the\nescalation chain (clean up the attacker's evidence, ENG-1281).",
        "operationId": "cancel_invitation_teams__team_id__invitations__invitation_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "title": "Invitation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Cancel Invitation Teams  Team Id  Invitations  Invitation Id  Delete",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cancel Invitation",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/leave": {
      "post": {
        "description": "Leave a team voluntarily.\n\nRoutes to :func:`sole_member_leave_team_atomic` when the caller is\nthe only member (no transfer plan required) and to\n:func:`leave_team_atomic` otherwise. Owners cannot leave without\ntransferring ownership first — the lifecycle helper raises 400 in\nthat case.\n\nArgs:\n    team_id: Team the caller is leaving.\n    body: Optional ``{transfer_plan: {resource_type: {row_id: target|\"delete\"}}}``.\n        Required for multi-member teams when the caller owns rows;\n        ignored for sole-member teams.\n    auth: Authenticated user context.\n\nReturns:\n    :class:`TeamLeaveResponse`. ``new_active_team_id`` is the team\n    the caller's active-team snapped to (earliest remaining\n    membership) or ``None`` when they have none left.\n\nRaises:\n    HTTPException: 400 if the caller is the team owner; 404 if not\n        a member; 409 with ``{detail: \"owned_resources_unresolved\",\n        unresolved: {...}}`` when the transfer plan is incomplete;\n        409 ``transfer_target_not_member`` when a target is not a\n        current member.",
        "operationId": "leave_team_teams__team_id__leave_post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LeaveTeamRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamLeaveResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Leave Team",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/members": {
      "get": {
        "description": "List all members of a team.\n\nAccessible to all team members.",
        "operationId": "list_team_members_teams__team_id__members_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMembersListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Team Members",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/members/mfa-status": {
      "get": {
        "description": "Get MFA enrollment status for all team members.\n\nRequires MANAGE_BILLING permission (owner/admin).\n\nArgs:\n    team_id: Team UUID.\n    auth: Authenticated user context.\n\nReturns:\n    Members with their per-user ``has_mfa`` enrollment status.",
        "operationId": "get_members_mfa_status_teams__team_id__members_mfa_status_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMembersMfaStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Members Mfa Status",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/members/{user_id}": {
      "delete": {
        "description": "Remove a member from a team.\n\nRequires owner or admin role. Member eviction can lock legitimate\noperators out of audit / response\ncapabilities and is part of the L-A16 attack surface (ENG-1281).",
        "operationId": "remove_team_member_teams__team_id__members__user_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMemberRemoveResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Team Member",
        "tags": [
          "teams"
        ]
      },
      "patch": {
        "description": "Update a team member's role.\n\nRequires owner or admin role. Passing ``role=owner`` performs an\nownership transfer to an existing member; ordinary role updates cannot\ndirectly modify the current owner.\n\n**Accepted risk (ENG-1281):** AAL2 enforcement was intentionally removed\n(PR #3928) — users without MFA enrolled were being blocked from routine\nteam operations. Promoting a low-privilege collaborator is part of the\nL-A16 escalation chain: an AAL1 attacker on a team-admin's session could\npromote a colluding member into MANAGE_BILLING and pivot into credential\nminting. This risk is accepted per the design decision.",
        "operationId": "update_member_role_teams__team_id__members__user_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamRoleUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMemberResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Member Role",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/owned-resources": {
      "get": {
        "description": "Snapshot the rows the caller owns in ``team_id`` for the leave-team UI.\n\nThe frontend's :class:`LeaveTeamModal` calls this once before\nsubmitting :func:`leave_team` to render a per-resource picker.\nResource types with zero owned rows are omitted.\n\nArgs:\n    team_id: Team the caller intends to leave.\n    auth: Authenticated user context.\n\nReturns:\n    :class:`OwnedResourcesResponse` containing\n    ``is_sole_member`` (so the UI can route directly to the\n    destructive sole-member-leave flow) and the per-resource\n    picker payload.",
        "operationId": "list_owned_resources_teams__team_id__owned_resources_get",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OwnedResourcesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Owned Resources",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/settings": {
      "patch": {
        "description": "Update team settings.\n\nRequires MANAGE_BILLING permission (owner/admin). Currently exposes the\n``router_enabled`` toggle for the team's auto model-router.\n\nArgs:\n    team_id: Team UUID.\n    settings: Validated settings payload.\n    auth: Authenticated user context.\n\nReturns:\n    Success status with message.",
        "operationId": "update_team_settings_teams__team_id__settings_patch",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "title": "Team Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamSettingsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Update Team Settings Teams  Team Id  Settings Patch",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update Team Settings",
        "tags": [
          "teams"
        ]
      }
    },
    "/teams/{team_id}/transfer-ownership/{new_owner_id}": {
      "post": {
        "description": "Transfer team ownership to another member.\n\nOnly the current owner can transfer ownership. The current owner becomes\nan admin after transfer.\n\n**Accepted risk (ENG-1281):** AAL2 enforcement was intentionally removed\n(PR #3928) — users without MFA enrolled were being blocked from routine\nteam operations. Ownership transfer is the highest-impact admin action;\nan AAL1 attacker on the owner's session could hand the team to a\ncolluding member and pivot into credential / billing surfaces. This risk\nis accepted per the design decision.\n\nPath params are typed as :class:`uuid.UUID` so FastAPI rejects malformed\ninputs with a clean 422 at the API boundary instead of letting them\nleak into the service and trip an asyncpg\n``invalid input syntax for type uuid`` 500 via the role lookup\n(ENG-2214 / Sentry PYTHON-1SY0).",
        "operationId": "transfer_ownership_teams__team_id__transfer_ownership__new_owner_id__post",
        "parameters": [
          {
            "in": "path",
            "name": "team_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Team Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "new_owner_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "New Owner Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Transfer Ownership Teams  Team Id  Transfer Ownership  New Owner Id  Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Transfer Ownership",
        "tags": [
          "teams"
        ]
      }
    },
    "/training-pipelines": {
      "get": {
        "description": "List multi-stage training pipelines for the authenticated user.",
        "operationId": "list_training_pipelines_training_pipelines_get",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineListResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Training Pipelines",
        "tags": [
          "training-pipelines"
        ]
      },
      "post": {
        "description": "Create a pipeline root and dispatch its first stage.",
        "operationId": "create_training_pipeline_training_pipelines_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrainingPipelineCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineCreateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/estimate": {
      "post": {
        "description": "Return a read-only estimate for a pipeline recipe.",
        "operationId": "estimate_training_pipeline_training_pipelines_estimate_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrainingPipelineCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineEstimateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Estimate Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}": {
      "get": {
        "description": "Return one pipeline root with stage progress and lineage.",
        "operationId": "get_training_pipeline_training_pipelines__pipeline_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineDetailResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}/branch": {
      "post": {
        "description": "Create a new pipeline branch from an artifact-ready stage.",
        "operationId": "branch_training_pipeline_training_pipelines__pipeline_id__branch_post",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrainingPipelineBranchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineCreateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Branch Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}/cancel": {
      "post": {
        "description": "Cancel a pipeline and stop the active provider stage.",
        "operationId": "cancel_training_pipeline_training_pipelines__pipeline_id__cancel_post",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineControlResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Cancel Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}/deployments": {
      "get": {
        "description": "Return deployment history derived from pipeline stage rows.",
        "operationId": "get_training_pipeline_deployments_training_pipelines__pipeline_id__deployments_get",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineDeploymentHistoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Training Pipeline Deployments",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}/pause": {
      "post": {
        "description": "Pause a pipeline after any active stage finishes.",
        "operationId": "pause_training_pipeline_training_pipelines__pipeline_id__pause_post",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineControlResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Pause Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}/resume": {
      "post": {
        "description": "Resume a paused pipeline.",
        "operationId": "resume_training_pipeline_training_pipelines__pipeline_id__resume_post",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineControlResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resume Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}/rollback": {
      "post": {
        "description": "Roll the pipeline project back to an existing deployment.",
        "operationId": "rollback_training_pipeline_training_pipelines__pipeline_id__rollback_post",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrainingPipelineRollbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineDeploymentControlResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rollback Training Pipeline",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/training-pipelines/{pipeline_id}/stages/{stage_index}/deploy": {
      "post": {
        "description": "Deploy an artifact-ready pipeline stage to its project.",
        "operationId": "deploy_training_pipeline_stage_training_pipelines__pipeline_id__stages__stage_index__deploy_post",
        "parameters": [
          {
            "in": "path",
            "name": "pipeline_id",
            "required": true,
            "schema": {
              "title": "Pipeline Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "stage_index",
            "required": true,
            "schema": {
              "title": "Stage Index",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrainingPipelineDeployStageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPipelineDeploymentControlResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Deploy Training Pipeline Stage",
        "tags": [
          "training-pipelines"
        ]
      }
    },
    "/user-reports": {
      "post": {
        "description": "Persist a browser-submitted user report via the backend.\n\nArgs:\n    request: User report payload from the frontend.\n    auth: Authenticated user context.\n    service: User report service.\n\nReturns:\n    The created report identifier.",
        "operationId": "create_user_report_user_reports_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserReportCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserReportCreateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create User Report",
        "tags": [
          "user-reports"
        ]
      }
    },
    "/user-reports/attachments": {
      "post": {
        "description": "Upload report attachments through the backend.\n\nArgs:\n    report_id: Report UUID used to group attachments.\n    files: Uploaded browser files.\n    auth: Authenticated user context.\n    service: User report service.\n\nReturns:\n    Uploaded attachment URLs.\n\nRaises:\n    HTTPException: 403 if called via API key (storage not available).\n    HTTPException: 500 if authenticated client is missing.",
        "operationId": "upload_user_report_attachments_user_reports_attachments_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_upload_user_report_attachments_user_reports_attachments_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserReportAttachmentUploadResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Upload User Report Attachments",
        "tags": [
          "user-reports"
        ]
      }
    },
    "/users/me": {
      "get": {
        "description": "Return the authenticated user's public profile fields.\n\nArgs:\n    auth: Authenticated user context.\n\nReturns:\n    UserProfileResponse with onboarded status and intent.\n\nRaises:\n    HTTPException: 404 if user row not found, 500 on DB failure.",
        "operationId": "get_user_profile_users_me_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProfileResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Get User Profile",
        "tags": [
          "users"
        ]
      },
      "patch": {
        "description": "Update the authenticated user's profile fields.\n\nUses service-role client to bypass RLS on the users table.\n\nArgs:\n    request: Fields to update (onboarded, intent).\n    auth: Authenticated user context.\n\nReturns:\n    UpdateUserProfileResponse with success status.\n\nRaises:\n    HTTPException: 400 if no fields provided, 500 on DB failure.",
        "operationId": "update_user_profile_users_me_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserProfileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateUserProfileResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Update User Profile",
        "tags": [
          "users"
        ]
      }
    },
    "/users/me/active-team": {
      "post": {
        "description": "Switch the authenticated user's active team.\n\nDelegates the locked membership write and billing-cache invalidation\nto :func:`set_active_team`, then reads the activated team back through\n:func:`get_team_response_for_user`. Both a revoked membership and a\nconcurrent teardown surface as a single 409 so the frontend has one\nretry path. Emits a ``team.activated`` audit event after the switch\ncommits.\n\nArgs:\n    request: ``{team_id: uuid}`` — target team to activate.\n    auth: Authenticated user context.\n\nReturns:\n    ``TeamResponse`` for the newly active team.\n\nRaises:\n    HTTPException: 409 if the user is not a current member of the\n        target team (or the membership is revoked between the\n        activation and the readback).",
        "operationId": "set_active_team_endpoint_users_me_active_team_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetActiveTeamRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Active Team Endpoint",
        "tags": [
          "users"
        ]
      }
    },
    "/users/me/attribution": {
      "post": {
        "description": "Persist first-touch marketing attribution (UTM + gclid) for the user.\n\nWrite-once: each field is only set when currently NULL, so a later sign-in\nnever overwrites the original campaign. An empty payload is a no-op.\n\nArgs:\n    request: First-touch attribution captured at signup.\n    auth: Authenticated user context.\n\nReturns:\n    SignupAttributionResponse indicating whether anything was newly written.\n\nRaises:\n    HTTPException: 500 if the persistence layer fails.",
        "operationId": "record_signup_attribution_users_me_attribution_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupAttributionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignupAttributionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Record Signup Attribution",
        "tags": [
          "users"
        ]
      }
    },
    "/v1/chat/completions": {
      "post": {
        "description": "OpenAI-compatible chat completions endpoint.\n\nThin shell over :func:`services.inference.adapters.openai_chat.run_chat_completion`.\nThe adapter handles LLM-passthrough vs Pioneer-task dispatch, SSE\nrendering with ``<think>...</think>`` folding for reasoning models,\ntool-call deltas, finish-reason mapping, persistence, and error\nmapping. The router keeps only HTTP-shaped concerns: route\ndeclaration, auth, rate limiting.\n\nArgs:\n    body: Validated :class:`ChatCompletionRequest`.\n    request: FastAPI request (forwarded so the adapter can read\n        API-key billing context out of ``request.state`` for\n        streaming responses).\n    auth: Authenticated request context.\n\nReturns:\n    :class:`ChatCompletionResponse` for non-streaming, or a\n    :class:`StreamingResponse` of ``chat.completion.chunk`` SSE\n    events terminated by ``data: [DONE]`` when ``body.stream``\n    is true.",
        "operationId": "chat_completions_v1_chat_completions_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "example": "data: {\"id\":\"chatcmpl-abc\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"Qwen/Qwen3-8B\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hi\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-abc\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"Qwen/Qwen3-8B\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\"}],\"usage\":{\"prompt_tokens\":1,\"completion_tokens\":1,\"total_tokens\":2}}\n\ndata: [DONE]\n\n",
                "schema": {
                  "description": "OpenAI-compatible chat completion streaming chunk.\n\n    One of these is JSON-serialized into each ``data: {...}\n\n`` SSE event\n    emitted by the chat completions handler when ``stream=true``. The stream\n    is terminated by a literal ``data: [DONE]\n\n`` sentinel that does not\n    follow this schema.\n\n    ``x_pioneer`` mirrors the field on :class:`ChatCompletionResponse` and is\n    populated only on the terminal chunk (the one carrying ``finish_reason``)\n    when persistence ran. Intermediate chunks set it to ``None`` so SDK\n    clients can wait for the terminal frame before reading the id rather\n    than racing the early text deltas.\n    ",
                  "properties": {
                    "choices": {
                      "items": {
                        "description": "One choice slot inside a streaming chunk.",
                        "properties": {
                          "delta": {
                            "description": "Incremental delta payload inside a streaming chunk's choice.\n\nThe OpenAI Chat Completions chunk schema (``ChoiceDelta`` in the\nopenai-python SDK) defines ``content``, ``function_call``,\n``refusal``, ``role``, and ``tool_calls`` — there is no spec slot\nfor reasoning. Pioneer can expose the de facto industry extension\n(vLLM, DeepSeek, Fireworks, OpenRouter, LiteLLM) on\n``reasoning_content`` for callers that opt in with existing\n``reasoning`` visibility controls (``exclude=false`` or\n``display=summarized``), mirroring Pioneer's\nown input path at\n:func:`services.inference.providers.openai_compat.OpenAICompatProvider._chat_delta_to_events`\n(which already reads ``delta.reasoning_content`` from those same\nupstream providers). Stock OpenAI-compatible consumers receive no\nreasoning field by default so model scratchpad text is not rendered\nas assistant output. The renderer contract lives on\n:class:`~services.inference.adapters.openai_chat._ChatStreamRenderer`.",
                            "properties": {
                              "content": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Content"
                              },
                              "reasoning_content": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Reasoning Content"
                              },
                              "tool_calls": {
                                "anyOf": [
                                  {
                                    "items": {
                                      "additionalProperties": true,
                                      "type": "object"
                                    },
                                    "type": "array"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Tool Calls"
                              }
                            },
                            "title": "ChatCompletionStreamDelta",
                            "type": "object"
                          },
                          "finish_reason": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "title": "Finish Reason"
                          },
                          "index": {
                            "default": 0,
                            "title": "Index",
                            "type": "integer"
                          }
                        },
                        "title": "ChatCompletionStreamChoice",
                        "type": "object"
                      },
                      "title": "Choices",
                      "type": "array"
                    },
                    "created": {
                      "title": "Created",
                      "type": "integer"
                    },
                    "id": {
                      "title": "Id",
                      "type": "string"
                    },
                    "model": {
                      "title": "Model",
                      "type": "string"
                    },
                    "object": {
                      "default": "chat.completion.chunk",
                      "title": "Object",
                      "type": "string"
                    },
                    "usage": {
                      "anyOf": [
                        {
                          "description": "Token usage statistics.\n\n``prompt_tokens`` follows the upstream wire contract — *includes* every\ninput class (non-cached, cache read, and cache write). The breakdown is\nexposed under ``prompt_tokens_details`` so consumers can attribute the\ncached-read and cache-write subsets. Cache-aware billing on the brain\nside reads the canonical ``InferenceUsage`` fields directly, not this\nwire payload.",
                          "properties": {
                            "completion_tokens": {
                              "default": 0,
                              "title": "Completion Tokens",
                              "type": "integer"
                            },
                            "prompt_tokens": {
                              "default": 0,
                              "title": "Prompt Tokens",
                              "type": "integer"
                            },
                            "prompt_tokens_details": {
                              "anyOf": [
                                {
                                  "description": "Per-input-class breakdown for OpenAI-shape usage payloads.\n\nMirrors OpenAI's ``prompt_tokens_details`` block and OpenRouter's\ncache-creation extension so clients reading\n``usage.prompt_tokens_details.cached_tokens`` /\n``cache_write_tokens`` keep working when Pioneer relays a cache-aware\nupstream response. Both counts are subsets of ``prompt_tokens`` on the\nwire — that's the upstream contract Pioneer relays faithfully.\n\nAttributes:\n    cached_tokens: Input tokens served from the upstream prompt cache\n        (cache read).\n    cache_write_tokens: Input tokens written into the upstream prompt\n        cache (cache creation). ``0`` for upstreams that bill writes\n        as plain input (OpenAI, Fireworks, vLLM).",
                                  "properties": {
                                    "cache_write_tokens": {
                                      "default": 0,
                                      "title": "Cache Write Tokens",
                                      "type": "integer"
                                    },
                                    "cached_tokens": {
                                      "default": 0,
                                      "title": "Cached Tokens",
                                      "type": "integer"
                                    }
                                  },
                                  "title": "PromptTokensDetails",
                                  "type": "object"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "total_tokens": {
                              "default": 0,
                              "title": "Total Tokens",
                              "type": "integer"
                            }
                          },
                          "title": "ChatCompletionUsage",
                          "type": "object"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "x_pioneer": {
                      "anyOf": [
                        {
                          "description": "Pioneer-specific extension fields appended to OpenAI-compatible responses.\n\nOpenAI's API contract reserves the unprefixed top-level keys (``id``,\n``choices``, ``usage``, …); custom data must live under a clearly\nnamespaced key. ``x_pioneer`` is that key.\n\nAttributes:\n    inference_id: The Pioneer-side identifier of the persisted\n        ``inferences`` row associated with this completion. Present\n        when persistence is enabled (``extra_body.store == True``)\n        and the row was successfully recorded; ``None`` for ad-hoc\n        requests that opted out of persistence. The frontend uses\n        this to poll ``GET /inferences/{id}`` for asynchronous\n        judge results without coupling the inference response\n        latency to the judge.\n    routed_model: Backend catalog model selected by a router project\n        (for example ``pioneer/auto``). ``None`` when the request\n        was not routed or the routed model matches the requested id.\n    savings: Routed-vs-frontier per-1M-token savings rate diff (same\n        wire shape as the Anthropic ``pioneer_savings`` extension). The\n        Codex routing-savings hook multiplies these rates by per-turn\n        token usage to surface cumulative money saved. ``None`` when the\n        request was not routed below the frontier reference model.",
                          "properties": {
                            "inference_id": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "title": "Inference Id"
                            },
                            "routed_model": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "title": "Routed Model"
                            },
                            "savings": {
                              "anyOf": [
                                {
                                  "additionalProperties": true,
                                  "type": "object"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "title": "Savings"
                            }
                          },
                          "title": "PioneerExtension",
                          "type": "object"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "model",
                    "choices"
                  ],
                  "title": "ChatCompletionStreamChunk",
                  "type": "object"
                }
              }
            },
            "description": "Chat completion. Returns ``application/json`` (``ChatCompletionResponse``) by default, or ``text/event-stream`` of ``ChatCompletionStreamChunk`` events terminated by ``data: [DONE]`` when ``stream=true``."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Chat Completions",
        "tags": [
          "openai-compat"
        ]
      }
    },
    "/v1/codex/session-savings/{session_id}": {
      "get": {
        "description": "Return cumulative routing savings for one Codex session.\n\nArgs:\n    session_id: Codex session id (the request ``prompt_cache_key``).\n    auth: Authenticated request context; the billing team it resolves is\n        applied as the read scope so sessions are not cross-team readable.\n\nReturns:\n    Cumulative savings for the session, or a ``found=False`` payload when\n    nothing has accumulated.",
        "operationId": "codex_session_savings_v1_codex_session_savings__session_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodexSessionSavingsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Codex Session Savings",
        "tags": [
          "openai-compat"
        ]
      }
    },
    "/v1/completions": {
      "post": {
        "description": "OpenAI-compatible text completions endpoint.\n\nThin shell over :func:`services.inference.adapters.openai_text.run_text_completion`.\nThe adapter handles project routing, dispatch (LLM passthrough vs\nPioneer-task), SSE rendering, persistence, and error mapping. The\nrouter keeps only HTTP-shaped concerns: route declaration, auth,\nrate limiting.\n\nArgs:\n    body: Validated :class:`TextCompletionRequest`.\n    request: FastAPI request (forwarded so the adapter can read\n        API-key billing context out of ``request.state`` for\n        streaming responses).\n    auth: Authenticated request context.\n\nReturns:\n    :class:`TextCompletionResponse` for non-streaming, or a\n    :class:`StreamingResponse` of ``text_completion`` SSE events\n    terminated by ``data: [DONE]`` when ``body.stream`` is true.",
        "operationId": "text_completions_v1_completions_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextCompletionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextCompletionResponse"
                }
              },
              "text/event-stream": {
                "example": "data: {\"id\":\"cmpl-abc\",\"object\":\"text_completion\",\"created\":0,\"model\":\"Qwen/Qwen3-8B-Base\",\"choices\":[{\"index\":0,\"text\":\"Hello.\",\"logprobs\":null,\"finish_reason\":\"stop\"}],\"usage\":{\"prompt_tokens\":1,\"completion_tokens\":1,\"total_tokens\":2}}\n\ndata: [DONE]\n\n",
                "schema": {
                  "description": "OpenAI-compatible text completion streaming chunk.\n\n``x_pioneer`` mirrors the field on :class:`TextCompletionResponse` and is\npopulated only on the terminal chunk when persistence ran (matching the\nchat-completions streaming contract).",
                  "properties": {
                    "choices": {
                      "items": {
                        "description": "A single text completion choice.\n\nThe OpenAI ``/v1/completions`` chunk / response schema has no\nreasoning slot. Pioneer adopts the de facto vLLM extension and\nexposes upstream reasoning on ``reasoning_content`` so this surface\nstays symmetric with ``/v1/chat/completions``\n(:class:`ChatCompletionStreamDelta` and ``message.reasoning_content``).\nStock OpenAI SDK consumers reading only ``text`` ignore the unknown\nfield; reasoning-aware consumers drain both. The streaming-chunk\nrenderer at\n:class:`~services.inference.adapters.openai_text._TextStreamRenderer`\nemits ``choices[0].reasoning_content`` on the wire for thinking\ndeltas.",
                        "properties": {
                          "finish_reason": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "title": "Finish Reason"
                          },
                          "index": {
                            "default": 0,
                            "title": "Index",
                            "type": "integer"
                          },
                          "logprobs": {
                            "anyOf": [
                              {
                                "additionalProperties": true,
                                "type": "object"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "title": "Logprobs"
                          },
                          "reasoning_content": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "title": "Reasoning Content"
                          },
                          "text": {
                            "default": "",
                            "title": "Text",
                            "type": "string"
                          }
                        },
                        "title": "TextCompletionChoice",
                        "type": "object"
                      },
                      "title": "Choices",
                      "type": "array"
                    },
                    "created": {
                      "title": "Created",
                      "type": "integer"
                    },
                    "id": {
                      "title": "Id",
                      "type": "string"
                    },
                    "model": {
                      "title": "Model",
                      "type": "string"
                    },
                    "object": {
                      "default": "text_completion",
                      "title": "Object",
                      "type": "string"
                    },
                    "usage": {
                      "anyOf": [
                        {
                          "description": "Token usage statistics.\n\n``prompt_tokens`` follows the upstream wire contract — *includes* every\ninput class (non-cached, cache read, and cache write). The breakdown is\nexposed under ``prompt_tokens_details`` so consumers can attribute the\ncached-read and cache-write subsets. Cache-aware billing on the brain\nside reads the canonical ``InferenceUsage`` fields directly, not this\nwire payload.",
                          "properties": {
                            "completion_tokens": {
                              "default": 0,
                              "title": "Completion Tokens",
                              "type": "integer"
                            },
                            "prompt_tokens": {
                              "default": 0,
                              "title": "Prompt Tokens",
                              "type": "integer"
                            },
                            "prompt_tokens_details": {
                              "anyOf": [
                                {
                                  "description": "Per-input-class breakdown for OpenAI-shape usage payloads.\n\nMirrors OpenAI's ``prompt_tokens_details`` block and OpenRouter's\ncache-creation extension so clients reading\n``usage.prompt_tokens_details.cached_tokens`` /\n``cache_write_tokens`` keep working when Pioneer relays a cache-aware\nupstream response. Both counts are subsets of ``prompt_tokens`` on the\nwire — that's the upstream contract Pioneer relays faithfully.\n\nAttributes:\n    cached_tokens: Input tokens served from the upstream prompt cache\n        (cache read).\n    cache_write_tokens: Input tokens written into the upstream prompt\n        cache (cache creation). ``0`` for upstreams that bill writes\n        as plain input (OpenAI, Fireworks, vLLM).",
                                  "properties": {
                                    "cache_write_tokens": {
                                      "default": 0,
                                      "title": "Cache Write Tokens",
                                      "type": "integer"
                                    },
                                    "cached_tokens": {
                                      "default": 0,
                                      "title": "Cached Tokens",
                                      "type": "integer"
                                    }
                                  },
                                  "title": "PromptTokensDetails",
                                  "type": "object"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "total_tokens": {
                              "default": 0,
                              "title": "Total Tokens",
                              "type": "integer"
                            }
                          },
                          "title": "ChatCompletionUsage",
                          "type": "object"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "x_pioneer": {
                      "anyOf": [
                        {
                          "description": "Pioneer-specific extension fields appended to OpenAI-compatible responses.\n\nOpenAI's API contract reserves the unprefixed top-level keys (``id``,\n``choices``, ``usage``, …); custom data must live under a clearly\nnamespaced key. ``x_pioneer`` is that key.\n\nAttributes:\n    inference_id: The Pioneer-side identifier of the persisted\n        ``inferences`` row associated with this completion. Present\n        when persistence is enabled (``extra_body.store == True``)\n        and the row was successfully recorded; ``None`` for ad-hoc\n        requests that opted out of persistence. The frontend uses\n        this to poll ``GET /inferences/{id}`` for asynchronous\n        judge results without coupling the inference response\n        latency to the judge.\n    routed_model: Backend catalog model selected by a router project\n        (for example ``pioneer/auto``). ``None`` when the request\n        was not routed or the routed model matches the requested id.\n    savings: Routed-vs-frontier per-1M-token savings rate diff (same\n        wire shape as the Anthropic ``pioneer_savings`` extension). The\n        Codex routing-savings hook multiplies these rates by per-turn\n        token usage to surface cumulative money saved. ``None`` when the\n        request was not routed below the frontier reference model.",
                          "properties": {
                            "inference_id": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "title": "Inference Id"
                            },
                            "routed_model": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "title": "Routed Model"
                            },
                            "savings": {
                              "anyOf": [
                                {
                                  "additionalProperties": true,
                                  "type": "object"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "title": "Savings"
                            }
                          },
                          "title": "PioneerExtension",
                          "type": "object"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "model",
                    "choices"
                  ],
                  "title": "TextCompletionStreamChunk",
                  "type": "object"
                }
              }
            },
            "description": "Text completion. Returns ``application/json`` (``TextCompletionResponse``) by default, or ``text/event-stream`` of ``TextCompletionStreamChunk`` events terminated by ``data: [DONE]`` when ``stream=true``."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Text Completions",
        "tags": [
          "openai-compat"
        ]
      }
    },
    "/v1/embeddings": {
      "post": {
        "description": "Generate embeddings for one or more inputs in the OpenAI response shape.",
        "operationId": "create_embeddings_v1_embeddings_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Embeddings",
        "tags": [
          "openai-compat"
        ]
      }
    },
    "/v1/messages": {
      "post": {
        "description": "Anthropic-compatible messages endpoint.\n\nThin shell over :func:`services.inference.adapters.anthropic_messages.run_messages`.\nThe adapter handles content-block translation, LLM-passthrough vs\nPioneer-task dispatch, SSE rendering, persistence, and error\nmapping. The router keeps only HTTP-shaped concerns: route\ndeclaration, auth, rate limiting.\n\nArgs:\n    body: Validated :class:`AnthropicMessagesRequest`.\n    request: FastAPI request (forwarded so the adapter can read\n        API-key billing context out of ``request.state`` for\n        streaming responses).\n    auth: Authenticated request context.\n\nReturns:\n    :class:`AnthropicMessagesResponse` for non-streaming, or a\n    :class:`StreamingResponse` of Anthropic SSE events when\n    ``body.stream`` is true.",
        "operationId": "messages_v1_messages_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessagesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicMessagesResponse"
                }
              }
            },
            "description": "Non-streaming Anthropic Messages response. When the request sets ``stream=true`` the server emits an Anthropic-shaped SSE event stream over ``text/event-stream`` instead; that stream shape is documented in the Anthropic Messages API reference."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Messages",
        "tags": [
          "anthropic-compat"
        ]
      }
    },
    "/v1/models": {
      "get": {
        "description": "List available Anthropic-compatible models.\n\nAuthentication is optional. Anonymous callers receive the public runtime\ncatalog; authenticated callers also receive their user-scoped decoder\nfine-tunes.\n\nArgs:\n    limit: Maximum number of models to return. Omit to return the full\n        assembled catalog.\n    before_id: Cursor for paginating backward.\n    after_id: Cursor for paginating forward.\n    client_version: Optional Codex/OpenAI client version hint.\n    auth: Optional authentication result.\n\nReturns:\n    Combined Anthropic-compatible and Codex/OpenAI-compatible model catalog.\n\nRaises:\n    HTTPException: If both cursor parameters are provided.",
        "operationId": "list_models_v1_models_get",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maximum": 1000,
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "before_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Before Id"
            }
          },
          {
            "in": "query",
            "name": "after_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "After Id"
            }
          },
          {
            "in": "query",
            "name": "client_version",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Client Version"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Models",
        "tags": [
          "anthropic-compat"
        ]
      }
    },
    "/v1/models/{model_id}": {
      "get": {
        "description": "Retrieve metadata for a single Anthropic-compatible model.\n\nThe ``:path`` converter is required because our runtime catalog ships model\nIDs containing slashes (e.g. ``qwen/qwen3-8b``). Without it, FastAPI's default\nsingle-segment path param matcher 404s every such request — breaking\n``openai.OpenAI(...).models.retrieve(\"qwen/qwen3-8b\")`` and\n``anthropic.Anthropic(...).models.retrieve(\"qwen/qwen3-8b\")`` for real SDK\nusers.\n\nArgs:\n    model_id: Requested model identifier (may contain ``/``).\n    auth: Authentication result.\n\nReturns:\n    Combined Anthropic-compatible and Codex/OpenAI-compatible model metadata.\n\nRaises:\n    HTTPException: If the model ID is not in the runtime catalog.",
        "operationId": "retrieve_model_v1_models__model_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "model_id",
            "required": true,
            "schema": {
              "title": "Model Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Retrieve Model",
        "tags": [
          "anthropic-compat"
        ]
      }
    },
    "/v1/responses": {
      "post": {
        "description": "OpenAI-compatible Responses API endpoint.\n\nThin shell over :func:`services.inference.adapters.openai_responses.run_responses`.\nThe adapter handles input-item to chat-message translation,\nLLM-passthrough vs Pioneer-task dispatch, SSE rendering,\ntool-call serialisation, persistence, and error mapping. The\nrouter keeps only HTTP-shaped concerns: route declaration, auth,\nrate limiting.\n\nArgs:\n    body: Validated :class:`ResponsesRequest`.\n    request: FastAPI request (forwarded so the adapter can read\n        API-key billing context out of ``request.state`` for\n        streaming responses).\n    auth: Authenticated request context.\n\nReturns:\n    JSON response payload or :class:`StreamingResponse` SSE stream\n    in Responses API format.",
        "operationId": "responses_v1_responses_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Responses",
        "tags": [
          "openai-compat"
        ]
      }
    },
    "/v1/route": {
      "post": {
        "description": "Score one request against the chosen router (POC, feature-flagged).\n\nArgs:\n    request: The routing request (``router_type`` + messages/prompt + knobs).\n    auth: The authenticated caller; its team scopes the release flag.\n\nReturns:\n    The router's decision, or a conservative fallback route on upstream\n    failure (the endpoint never 5xxs on a routing error).\n\nRaises:\n    HTTPException: 404 when ``router_type`` is unknown or not released to the\n        caller's team (keeps the surface invisible to non-POC teams and\n        reveals nothing about which routers exist).",
        "operationId": "route_v1_route_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RouteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Route",
        "tags": [
          "router"
        ]
      }
    },
    "/version": {
      "get": {
        "description": "Return backend version/build metadata for authenticated callers.",
        "operationId": "version_version_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Version"
      }
    }
  }
}
