{
  "openapi": "3.1.0",
  "info": {
    "title": "Agent Death Trap API",
    "version": "1.0.0",
    "description": "Public, read-only access to the Agent Death Trap leaderboard: LLM agents ranked by the HP they had left after walking a corridor of rooms. Free, CORS-open, no authentication. Results are only comparable within one benchmarkVersion + rubricVersion.",
    "contact": { "name": "Agent Death Trap", "url": "https://agentdeathtrap.com/" }
  },
  "servers": [{ "url": "https://agentdeathtrap.com" }],
  "paths": {
    "/api/v1/leaderboard": {
      "get": {
        "operationId": "getLeaderboard",
        "summary": "Get the leaderboard",
        "description": "Models ranked by final HP left (survivors by HP descending, dead models at the bottom). Returns JSON by default, or CSV with ?format=csv.",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Response format. Omit for JSON; pass `csv` for a CSV table (one row per model, rank order).",
            "schema": { "type": "string", "enum": ["csv"] }
          }
        ],
        "responses": {
          "200": {
            "description": "The leaderboard.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Leaderboard" }
              },
              "text/csv": {
                "schema": { "type": "string" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Leaderboard": {
        "type": "object",
        "description": "The board plus the version stamps a consumer must key on (results from different versions are never comparable).",
        "required": [
          "benchmarkVersion",
          "rubricVersion",
          "generatedAt",
          "startHP",
          "seedCount",
          "modelCount",
          "models"
        ],
        "properties": {
          "benchmarkVersion": { "type": "string", "description": "Benchmark version the board was produced with." },
          "rubricVersion": { "type": "string", "description": "Damage-rubric version used to grade the runs." },
          "generatedAt": { "type": "string", "format": "date-time", "description": "When the board was generated." },
          "startHP": { "type": "number", "description": "HP every model starts each run with." },
          "seedCount": { "type": "integer", "description": "Number of seeds each model was run across." },
          "modelCount": { "type": "integer", "description": "Number of models on the board." },
          "models": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/LeaderboardModel" }
          }
        }
      },
      "LeaderboardModel": {
        "type": "object",
        "description": "One model's aggregate run record.",
        "required": [
          "rank",
          "model",
          "provider",
          "finalHP",
          "finalHPStdev",
          "died",
          "diedAtStation",
          "costUsd",
          "hpPerDollar",
          "latencyMs",
          "totalSteps",
          "totalTokens"
        ],
        "properties": {
          "rank": { "type": "integer", "description": "1-based board rank (survivors by HP desc, dead at the bottom)." },
          "model": { "type": "string", "description": "Full model id, e.g. \"openai/gpt-5.6-sol\"." },
          "provider": { "type": "string", "description": "Provider, e.g. \"openai\" or \"anthropic\"." },
          "finalHP": { "type": "number", "description": "HP left at the end, averaged across seeds." },
          "finalHPStdev": { "type": "number", "description": "Standard deviation of finalHP across seeds." },
          "died": { "type": "boolean", "description": "Whether the model ran out of HP before the last room." },
          "diedAtStation": {
            "type": ["string", "null"],
            "description": "Room id where the model died, or null if it survived."
          },
          "costUsd": { "type": "number", "description": "Measured cost of one run, in USD." },
          "hpPerDollar": {
            "type": ["number", "null"],
            "description": "finalHP / costUsd; null when cost is 0."
          },
          "latencyMs": { "type": "number", "description": "Wall-clock request latency of a run, in milliseconds." },
          "totalSteps": { "type": "integer", "description": "Total agent steps taken across the corridor." },
          "totalTokens": { "type": "integer", "description": "Total tokens consumed across the corridor." }
        }
      }
    }
  }
}
