{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/llm-broker-net/json-schema/llm-broker-net-chat-completion-response-schema.json",
  "title": "ChatCompletionResponse",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/llm-broker-net-openapi.json#/components/schemas/ChatCompletionResponse",
  "properties": {
    "broker": {
      "description": "Broker metadata of market-routed answers (never a provider name)",
      "properties": {
        "cost": {
          "properties": {
            "amount": {
              "type": "string"
            },
            "amount_chf": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            }
          },
          "type": "object"
        },
        "receipt": {
          "properties": {
            "attempts": {
              "type": "integer"
            },
            "measured_at": {
              "type": "string"
            },
            "model": {
              "type": "string"
            },
            "request_id": {
              "type": "string"
            },
            "score": {
              "type": "object"
            },
            "substituted": {
              "type": "boolean"
            }
          },
          "type": "object"
        },
        "region": {
          "type": "string"
        },
        "routing": {
          "description": "Applied routing (`category`, `level`)",
          "type": "object"
        }
      },
      "type": "object"
    },
    "choices": {
      "items": {
        "properties": {
          "finish_reason": {
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter"
            ],
            "type": "string"
          },
          "index": {
            "type": "integer"
          },
          "message": {
            "properties": {
              "content": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reasoning_content": {
                "description": "Reasoning trace, if the model produced one",
                "type": "string"
              },
              "role": {
                "enum": [
                  "assistant"
                ],
                "type": "string"
              },
              "tool_calls": {
                "items": {
                  "type": "object"
                },
                "type": "array"
              }
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "created": {
      "type": "integer"
    },
    "id": {
      "type": "string"
    },
    "model": {
      "description": "The model you requested",
      "type": "string"
    },
    "object": {
      "enum": [
        "chat.completion"
      ],
      "type": "string"
    },
    "system_fingerprint": {
      "type": "string"
    },
    "usage": {
      "properties": {
        "completion_tokens": {
          "type": "integer"
        },
        "completion_tokens_details": {
          "properties": {
            "reasoning_tokens": {
              "type": "integer"
            }
          },
          "type": "object"
        },
        "prompt_tokens": {
          "type": "integer"
        },
        "prompt_tokens_details": {
          "properties": {
            "cached_tokens": {
              "type": "integer"
            }
          },
          "type": "object"
        },
        "total_tokens": {
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "id",
    "object",
    "choices"
  ],
  "type": "object"
}