Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

Docs: model usage in the API reference, usage and the security report form on the docs home (#161)

GET /diffinery/model-usage (#158) gets its summary, fields, days and
token scope in the generated API reference, and Get an agent task names
usage. The docs home links usage and cost, and the private report form
from /security/report (#159).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016q5wwBFck8JHq14gHUM2CL
Canberk Demirci authored · GitHub committed signed1 parent 7a65ff4commit 74272c2aad785e8951438c248e5afb520279f6bfBrowse files
2 files changed+10−2
modifiedapps/diffinery/docs/index.md+2−1View file
@@ -15,6 +15,7 @@
1515 | Run CI | [Actions overview](/docs/actions/overview) and [Workflow syntax](/docs/actions/workflow-syntax) |
1616 | Connect an AI agent | [Agents](/docs/agents/overview) and [MCP](/docs/agents/mcp) |
1717 | Give an agent a goal and get a pull request back, with your own model key | [Agent tasks](/docs/agents/tasks) |
18+| See the tokens and cost your agent tasks and reviews used | [Usage and cost](/docs/agents/tasks#usage-and-cost) |
1819 | Work in a browser shell with Claude Code or Codex on your own Claude or ChatGPT subscription, and give it tasks | [Terminals](/docs/agents/terminal) |
1920 | Track agent work on a board, with shared memory and project instructions | [Projects](/docs/agents/projects) |
2021 | See what needs you and what your agents did since yesterday | [Today](/docs/agents/today) |
@@ -22,7 +23,7 @@
2223 | Script against Diffinery | [REST API guide](/docs/reference/rest-api), [REST API reference](/docs/api) and [CLI reference](/docs/reference/cli) |
2324 | Export your data or delete your account | [Exporting and deleting your account](/docs/accounts/account-data) |
2425 | Run your own instance | [Deploy Diffinery](/docs/self-hosting/deploy) |
25-| Report a security problem | [Reporting a vulnerability](/docs/security/disclosure) |
26+| Report a security problem privately (the [report form](/security/report)) | [Reporting a vulnerability](/docs/security/disclosure) |
2627
2728 ## What you get
2829
modifiedapps/diffinery/src/docs/api-meta.ts+8−1View file
@@ -77,6 +77,7 @@
7777 "PUT /diffinery/model-keys/{provider}": { scope: "admin", sessionOnly: true },
7878 "DELETE /diffinery/model-keys/{provider}": { scope: "admin", sessionOnly: true },
7979 "GET /diffinery/model-keys": { scope: "read", anyToken: true },
80+ "GET /diffinery/model-usage": { scope: "read", anyToken: true },
8081 "GET /diffinery/tasks": { scope: "read", anyToken: true },
8182 "POST /repos/{owner}/{repo}/diffinery/tasks": { scope: "write", sessionOnly: true },
8283 "POST /repos/{owner}/{repo}/diffinery/tasks/{number}/messages": { scope: "write", sessionOnly: true },
@@ -1640,6 +1641,12 @@
16401641 description: "Your saved model API keys for agent tasks: `provider` (`anthropic`, `openai` or `openrouter`), `hint` (the key's last four characters), `opted_in_at`, `created_at` and `updated_at`. The keys themselves are never returned. See /docs/agents/tasks#model-access.",
16411642 access: "account",
16421643 },
1644+ "GET /diffinery/model-usage": {
1645+ summary: "Get your model usage",
1646+ description: "The model usage you paid for over the last `days`, as on Settings → Model access: `days`, `since`, and `repositories`, one line per repository (named as it was when its runs ended) and `kind` (`task`, `review` or `coordinator`) with `runs`, `reported_by_cli_runs`, `requests`, `input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_write_tokens` and `cost_usd` (`null` when no run reported a cost). A token limited to some repositories sees only their lines. See /docs/agents/tasks#usage-and-cost.",
1647+ access: "account",
1648+ query: { days: ["integer", "1 to 90 (default 30)."] },
1649+ },
16431650 "PUT /diffinery/model-keys/{provider}": {
16441651 summary: "Save a model key",
16451652 description: "From a browser session only: no token, agent, job or sandbox can set a model key. `provider` is `anthropic`, `openai` or `openrouter`. `accept_terms: true` records that you use that provider through Diffinery under your own account and its terms (422 without it). The key is encrypted, never shown again and never sent to a sandbox. Sends you a security email. Audited as `model_key.set`.",
@@ -1744,7 +1751,7 @@
17441751 },
17451752 "GET /repos/{owner}/{repo}/diffinery/tasks/{number}": {
17461753 summary: "Get an agent task",
1747- description: "The task, its runs and its pull request. Needs write access. A plan-first task also has `plan_state` (`planning`, `waiting`, `approved` or `split`) and `plan`; a task split from a plan has `parent_task`. A task with more than one attempt has `pick_state` (`running`, `waiting` or `picked`) and `picked_attempt`, and each run its `attempt`. Every task has `fix_checks`, `check_fixes` (fix runs started so far) and `land`.",
1754+ description: "The task, its runs and its pull request. Needs write access. A plan-first task also has `plan_state` (`planning`, `waiting`, `approved` or `split`) and `plan`; a task split from a plan has `parent_task`. A task with more than one attempt has `pick_state` (`running`, `waiting` or `picked`) and `picked_attempt`, and each run its `attempt`. Every task has `fix_checks`, `check_fixes` (fix runs started so far) and `land`, and `usage` (the model usage of all its runs; each run has its own `usage`, with `source`: `proxy`, or `runtime` for a run in a terminal). See /docs/agents/tasks#usage-and-cost.",
17481755 access: "write",
17491756 },
17501757 "PATCH /repos/{owner}/{repo}/diffinery/tasks/{number}": {