{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/oneinfer-ai/json-schema/oneinfer-ai-optimizer-run-create-request-schema.json",
  "title": "OptimizerRunCreateRequest",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/oneinfer-ai-openapi.json#/components/schemas/OptimizerRunCreateRequest",
  "properties": {
    "name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 120
        },
        {
          "type": "null"
        }
      ],
      "title": "Name"
    },
    "agent_model": {
      "type": "string",
      "maxLength": 80,
      "minLength": 1,
      "title": "Agent Model"
    },
    "agent_effort": {
      "type": "string",
      "enum": [
        "medium",
        "high",
        "xhigh",
        "max"
      ],
      "title": "Agent Effort",
      "default": "high"
    },
    "model_id": {
      "type": "string",
      "maxLength": 200,
      "minLength": 3,
      "title": "Model Id"
    },
    "revision": {
      "type": "string",
      "maxLength": 100,
      "title": "Revision",
      "default": "main"
    },
    "modality": {
      "type": "string",
      "enum": [
        "text",
        "vision",
        "image",
        "video",
        "world",
        "asr",
        "tts"
      ],
      "title": "Modality",
      "default": "text"
    },
    "variant": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[a-z0-9_]{1,16}$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Variant"
    },
    "gpu_count": {
      "type": "integer",
      "maximum": 8.0,
      "minimum": 1.0,
      "title": "Gpu Count",
      "default": 1
    },
    "max_model_len": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 256.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Model Len"
    },
    "instance_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128
        },
        {
          "type": "null"
        }
      ],
      "title": "Instance Id"
    },
    "sandbox_offer_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 200
        },
        {
          "type": "null"
        }
      ],
      "title": "Sandbox Offer Id"
    },
    "simulated_gpu": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 40
        },
        {
          "type": "null"
        }
      ],
      "title": "Simulated Gpu"
    },
    "workload_agent_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128
        },
        {
          "type": "null"
        }
      ],
      "title": "Workload Agent Id"
    },
    "objective": {
      "type": "string",
      "enum": [
        "throughput",
        "latency",
        "goodput"
      ],
      "title": "Objective",
      "default": "throughput"
    },
    "slo": {
      "additionalProperties": true,
      "type": "object",
      "title": "Slo"
    },
    "scenarios": {
      "items": {
        "$ref": "#/$defs/OptimizerScenario"
      },
      "type": "array",
      "maxItems": 8,
      "minItems": 1,
      "title": "Scenarios"
    },
    "precision": {
      "additionalProperties": true,
      "type": "object",
      "title": "Precision"
    },
    "levers": {
      "additionalProperties": true,
      "type": "object",
      "title": "Levers"
    },
    "budget": {
      "additionalProperties": true,
      "type": "object",
      "title": "Budget"
    },
    "baselines": {
      "anyOf": [
        {
          "items": {
            "type": "string",
            "enum": [
              "vllm",
              "sglang",
              "diffusers",
              "transformers"
            ]
          },
          "type": "array",
          "maxItems": 4,
          "minItems": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Baselines"
    },
    "auto_stacks": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Auto Stacks"
    },
    "sol_target_pct": {
      "type": "number",
      "maximum": 100.0,
      "minimum": 50.0,
      "title": "Sol Target Pct",
      "default": 95.0
    },
    "min_gain_pct": {
      "type": "number",
      "maximum": 50.0,
      "minimum": 0.0,
      "title": "Min Gain Pct",
      "default": 1.0
    },
    "regression_tolerance_pct": {
      "type": "number",
      "maximum": 50.0,
      "minimum": 0.0,
      "title": "Regression Tolerance Pct",
      "default": 3.0
    },
    "latency_tolerance_pct": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 500.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Latency Tolerance Pct",
      "default": 25.0
    },
    "tracks": {
      "items": {
        "$ref": "#/$defs/OptimizerTrack"
      },
      "type": "array",
      "maxItems": 4,
      "title": "Tracks"
    },
    "hf_token": {
      "anyOf": [
        {
          "type": "string",
          "format": "password",
          "writeOnly": true
        },
        {
          "type": "null"
        }
      ],
      "title": "Hf Token"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "agent_model",
    "model_id",
    "scenarios"
  ],
  "$defs": {
    "OptimizerScenario": {
      "properties": {
        "key": {
          "type": "string",
          "maxLength": 48,
          "minLength": 1,
          "title": "Key"
        },
        "label": {
          "type": "string",
          "maxLength": 80,
          "minLength": 1,
          "title": "Label"
        },
        "concurrency": {
          "type": "integer",
          "maximum": 1024.0,
          "minimum": 1.0,
          "title": "Concurrency"
        },
        "prompt_tokens": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 262144.0,
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Prompt Tokens"
        },
        "output_tokens": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 32768.0,
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Output Tokens"
        },
        "media": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Media"
        },
        "num_requests": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 20000.0,
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Num Requests"
        },
        "shared_prefix_tokens": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Shared Prefix Tokens",
          "default": 0
        },
        "primary": {
          "type": "boolean",
          "title": "Primary",
          "default": true
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "key",
        "label",
        "concurrency"
      ],
      "title": "OptimizerScenario"
    },
    "OptimizerTrack": {
      "properties": {
        "key": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,31}$",
          "title": "Key"
        },
        "label": {
          "type": "string",
          "maxLength": 60,
          "minLength": 1,
          "title": "Label"
        },
        "scenarios": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 8,
          "minItems": 1,
          "title": "Scenarios"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "key",
        "label",
        "scenarios"
      ],
      "title": "OptimizerTrack",
      "description": "Scenarios one deployment serves, optimized on their own (the optimizer checks they exist)."
    }
  }
}