askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
ai_usage.json · 1.5 KB · 57 lines
| 1 | { |
| 2 | "name": "ai_usage", |
| 3 | "title": "AI Usage", |
| 4 | "version": 1, |
| 5 | "description": "Append-only per-turn AI cost record: tokens and cost for one /api/ai/chat call. Written server-side by the chat handler itself (never by the client) so cost recording is authoritative -- a caller cannot omit or falsify it the way it could a client-written shell_commands row. cost_cents is null when no ai_prices row matched; tokens are always recorded regardless.", |
| 6 | "fields": [ |
| 7 | { |
| 8 | "name": "id" |
| 9 | }, |
| 10 | { |
| 11 | "name": "owner_id", |
| 12 | "type": "text", |
| 13 | "label": "Owner", |
| 14 | "help": "The user who made the chat call" |
| 15 | }, |
| 16 | { |
| 17 | "name": "provider", |
| 18 | "type": "text", |
| 19 | "required": true, |
| 20 | "label": "Provider" |
| 21 | }, |
| 22 | { |
| 23 | "name": "model", |
| 24 | "type": "text", |
| 25 | "required": true, |
| 26 | "label": "Model" |
| 27 | }, |
| 28 | { |
| 29 | "name": "tokens_in", |
| 30 | "type": "int", |
| 31 | "required": true, |
| 32 | "label": "Input Tokens" |
| 33 | }, |
| 34 | { |
| 35 | "name": "tokens_out", |
| 36 | "type": "int", |
| 37 | "required": true, |
| 38 | "label": "Output Tokens" |
| 39 | }, |
| 40 | { |
| 41 | "name": "cost_cents", |
| 42 | "type": "int", |
| 43 | "label": "Cost (cents)", |
| 44 | "help": "Null when no ai_prices row matched (provider, model) -- tokens are still recorded" |
| 45 | }, |
| 46 | { |
| 47 | "name": "created_at", |
| 48 | "type": "datetime", |
| 49 | "label": "Created", |
| 50 | "read_only": true |
| 51 | } |
| 52 | ], |
| 53 | "views": { |
| 54 | "list_mode": "feed", |
| 55 | "list_fields": ["provider", "model", "tokens_in", "tokens_out", "cost_cents", "created_at"] |
| 56 | } |
| 57 | } |