{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/promptster-dev/json-schema/promptster-dev-test-prompt-response-schema.json",
  "title": "TestPromptResponse",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/promptster-dev-openapi.yaml#/components/schemas/TestPromptResponse",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique test ID"
    },
    "provider": {
      "$ref": "#/$defs/Provider"
    },
    "model": {
      "type": "string"
    },
    "prompt": {
      "type": "string"
    },
    "response": {
      "type": "string",
      "description": "The AI's response text. Often empty when the model selected a tool."
    },
    "tool_calls": {
      "$ref": "#/$defs/ToolCalls"
    },
    "finish_reason": {
      "$ref": "#/$defs/FinishReason"
    },
    "metadata": {
      "$ref": "#/$defs/ResponseMetadata"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "FinishReason": {
      "type": "string",
      "description": "Why generation stopped, one vocabulary across providers: `stop`, `tool_calls`, `length` (hit `max_tokens`), `content_filter`; any other provider-specific value is passed through lower-cased (for example Gemini's `unexpected_tool_call` under `tool_choice: none`). Present whenever the provider reports one, with or without tools."
    },
    "Provider": {
      "type": "string",
      "enum": [
        "openai",
        "anthropic",
        "google",
        "deepseek",
        "xai",
        "groq",
        "mistral",
        "perplexity",
        "together",
        "cerebras",
        "fireworks"
      ],
      "description": "AI provider identifier"
    },
    "ResponseMetadata": {
      "type": "object",
      "properties": {
        "input_tokens": {
          "type": "integer",
          "description": "Tokens in the prompt"
        },
        "output_tokens": {
          "type": "integer",
          "description": "Tokens in the response"
        },
        "total_tokens": {
          "type": "integer",
          "description": "The provider's total for the call. Includes `reasoning_tokens` when present, so it can exceed `input_tokens + output_tokens`."
        },
        "response_time_ms": {
          "type": "integer",
          "description": "Response time in milliseconds"
        },
        "tokens_per_second": {
          "type": "number",
          "description": "Output tokens per second"
        },
        "estimated_cost": {
          "type": "number",
          "description": "Estimated cost in USD"
        },
        "reasoning_tokens": {
          "type": "integer",
          "description": "Hidden reasoning (thinking) tokens the provider bills at the output rate but leaves out of `output_tokens`: Google `thoughtsTokenCount`, xAI `completion_tokens_details.reasoning_tokens`. Present only when the provider reports a non-zero count; already included in `estimated_cost`. OpenAI and Anthropic count reasoning inside `output_tokens`, so the field is absent for them."
        },
        "cached_input_tokens": {
          "type": "integer",
          "description": "Portion of `input_tokens` served from the provider's prompt cache and billed at the cached rate (xAI, Google, Perplexity). Present only when the provider reports a non-zero count. xAI prepends a ~1,150-token system prompt to every request and reports it here."
        }
      }
    },
    "ToolCall": {
      "type": "object",
      "required": [
        "id",
        "name",
        "arguments"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The provider's call id (Gemini sends none; `call_<index>` is synthesised)."
        },
        "name": {
          "type": "string"
        },
        "arguments": {
          "type": "object",
          "description": "Parsed argument object. `{}` when the provider's argument string was not a JSON object."
        },
        "arguments_raw": {
          "type": "string",
          "description": "Present only when the provider's argument string did not parse to a JSON object."
        },
        "arguments_parse_error": {
          "type": "boolean",
          "enum": [
            true
          ],
          "description": "Present (true) only alongside `arguments_raw`."
        }
      }
    },
    "ToolCalls": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ToolCall"
      },
      "description": "Tools the model selected, in the provider's order. Omitted when the model selected none (including every request without `tools`). An array so parallel calls arrive as-is, but nothing guarantees more than one entry."
    }
  }
}