---
title: "Render Python Stats"
method: GET
path: "/api/v1/slides/render-python/stats"
tags: ["slides"]
---

# Render Python Stats

`GET /api/v1/slides/render-python/stats`

## Request

- Base URL: `https://api.slidemaster.tw` (the document declares no server; this is the origin it was published from)
- URL: `https://api.slidemaster.tw/api/v1/slides/render-python/stats`
- Auth: none declared

Aggregate python-mode render stats over the last `days` days.

Returns a snapshot good enough for ops to decide rollout cadence:
  - attempt distribution (1/2/3) → MiniMax stability proxy
  - failed_rate → how often we exit without a usable pptx
  - avg_attempts → cost proxy (higher = more retries = more MiniMax calls)
  - hardest_slides → top N slides with attempts ≥ 3 OR errored, including
    title + project + error so you can drill into specific failures

Caveats:
  - "deterministic_rate" can't be derived precisely from current Firestore
    fields. attempts==3 + status ok could be either "MiniMax 3rd attempt
    succeeded" or "deterministic fallback kicked in". To distinguish we'd
    need to start writing a `python_render_strategy` field; not yet done.
    For now, attempts==3 is reported as a "needs-investigation" bucket.

Auth: ADMIN_USER_IDS allowlist (env). Non-admin → 403.

Query is a single Firestore range scan on slides where
`render_mode_used == "python"` and `first_render_charged_at >= cutoff`.
Per slide, we pull only the fields used in aggregation — kept O(N) where
N is rendered-slide count over `days`. At current traffic this is well
under 1k docs / 7 days, so loading them all in memory is fine.

## Query parameters

- `days` integer

## Headers

- `Authorization` string, nullable

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/slidemaster/apis/slidemaster-ai-api.md) · [All operations](https://skmtc.dev/slidemaster/apis/slidemaster-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/slidemaster/apis/slidemaster-ai-api/revisions/a964c005977e?raw)
