{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codai-ro/json-schema/codai-ro-core-model-list-schema.json",
  "title": "Model list",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codai-ro-models-api-openapi.yml#/components/schemas/CoreModelList",
  "type": "object",
  "required": [
    "object",
    "data"
  ],
  "properties": {
    "object": {
      "type": "string",
      "enum": [
        "list"
      ]
    },
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CoreModel"
      }
    }
  },
  "$defs": {
    "CoreModel": {
      "type": "object",
      "title": "Model",
      "required": [
        "id",
        "object",
        "created",
        "owned_by",
        "codai"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string",
          "enum": [
            "model"
          ]
        },
        "created": {
          "type": "integer",
          "description": "Always `0` — codai does not track model creation time.",
          "enum": [
            0
          ]
        },
        "owned_by": {
          "type": "string",
          "enum": [
            "codai",
            "codai-upstream"
          ],
          "description": "`codai` for aliases, `codai-upstream` for concrete upstream models."
        },
        "codai": {
          "type": "object",
          "description": "Non-OpenAI extension with routing and capability flags.",
          "required": [
            "kind",
            "type",
            "capabilities"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "alias",
                "concrete"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "chat",
                "embedding"
              ],
              "description": "Surface the model serves; `embedding` entries are usable only on `/v1/embeddings`."
            },
            "routesTo": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "For aliases, the concrete upstream models in its routing chain. Absent on concrete entries."
            },
            "capabilities": {
              "$ref": "#/$defs/CoreModelCapabilities"
            },
            "pricing": {
              "$ref": "#/$defs/CoreModelPricing"
            }
          }
        }
      }
    },
    "CoreModelCapabilities": {
      "type": "object",
      "title": "Model capabilities",
      "required": [
        "tools",
        "vision",
        "streaming",
        "maxInputTokens",
        "maxOutputTokens"
      ],
      "properties": {
        "tools": {
          "type": "boolean",
          "description": "Supports function-calling style tools."
        },
        "vision": {
          "type": "boolean",
          "description": "Accepts `image_url` content parts."
        },
        "streaming": {
          "type": "boolean",
          "description": "Server-sent events streaming supported end to end."
        },
        "maxInputTokens": {
          "type": "integer",
          "description": "Conservative maximum input context window in tokens."
        },
        "maxOutputTokens": {
          "type": "integer",
          "description": "Maximum output tokens per response (`0` for embedding models)."
        }
      }
    },
    "CoreModelPricing": {
      "type": "object",
      "title": "Model pricing",
      "description": "List price in USD per million tokens, so a client can show a per-turn cost and a pre-turn estimate from the token counts it already has. For an alias the top-level numbers are the FIRST route's price (what the cascade tries first); `by_route` prices every route so the response header `x-codai-routed-to` can be priced exactly. Absent on embedding entries.",
      "required": [
        "input_usd_per_mtok",
        "output_usd_per_mtok",
        "cached_input_usd_per_mtok",
        "cache_write_usd_per_mtok",
        "exact"
      ],
      "properties": {
        "input_usd_per_mtok": {
          "type": "number"
        },
        "output_usd_per_mtok": {
          "type": "number"
        },
        "cached_input_usd_per_mtok": {
          "type": "number",
          "description": "Prompt-cache read rate (Anthropic `cache_read_input_tokens`, OpenAI `cached_tokens`)."
        },
        "cache_write_usd_per_mtok": {
          "type": "number",
          "description": "Prompt-cache write rate (5-minute ephemeral)."
        },
        "exact": {
          "type": "boolean",
          "description": "`false` when the model has no dedicated row and bills at the conservative fallback rate."
        },
        "by_route": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/CoreModelPricing"
          },
          "description": "Alias entries only — price per concrete route id."
        }
      }
    }
  }
}