vault backup: 2026-04-27 16:42:03

This commit is contained in:
Vadym Samoilenko 2026-04-27 16:42:03 +01:00
parent 7042150d02
commit 2c1969e75f
3 changed files with 25 additions and 3 deletions

View file

@ -23,6 +23,10 @@ created: 2026-04-27
- **Local path:** `/Volumes/SSD/Projects/Oliver/ai-cost-tracker`
## Sessions
### 2026-04-27 Asked | Generated dashboard layout template
**Asked:** Asked | Generated dashboard layout template with naksha-studio plugin
**Done:** Done | Created production-ready dashboard HTML/CSS structure with sidebar, KPI cards, charts, and dark mode support
### 2026-04-27 Developer requested a complete frontend redesign
**Asked:** Developer requested a complete frontend redesign for Oliver AI Cost Tracker with a modern dashboard using the naksha-studio plugin.
**Done:** Dashboard layout command was executed but only indentation changes were applied; environment variables were identified as needing configuration on the optical server.
@ -255,6 +259,7 @@ created: 2026-04-27
## Change Log
| Date | Requested | Changed | Files |
|------|-----------|---------|-------|
| 2026-04-27 | Dashboard redesign | Dashboard layout template with responsive components, dark mode | dashboard.html, dashboard.css |
| 2026-04-27 | Dashboard redesign | Dashboard layout command execution, env vars configuration | .env, backend configuration files |
| 2026-04-27 | Dashboard redesign | HTML/CSS structure, responsive layout, dark mode support | dashboard.html, dashboard.css |
| 2026-04-27 | Dashboard redesign | KPI cards, animated counters, cost timeseries chart, top models/users charts, sidebar navigation, dark mode | dashboard.html, dashboard.css |

View file

@ -299,3 +299,9 @@ tags: [daily]
- 16:38 | `aimpress`
- **Asked:** Can you configure ntfy on the homelab and where are alerts currently being sent?
- **Done:** Configured ntfy with Docker networking, tested connectivity, and documented topics to subscribe to in the web UI.
- 16:40 | `ai-cost-tracker`
- **Asked:** Asked | Generated dashboard layout template with naksha-studio plugin
- **Done:** Done | Created production-ready dashboard HTML/CSS structure with sidebar, KPI cards, charts, and dark mode support
- 16:40 | `aimpress`
- **Asked:** Configure ntfy alerts on homelab and check current alert destinations.
- **Done:** Verified Watchtower alerts are working and located Uptime Kuma credentials via database.

View file

@ -3,6 +3,7 @@ title: AI Cost Tracker — Integrating a New Project
tags: [how-to, ai, cost-tracking, integration]
created: 2026-04-27
updated: 2026-04-27
updated2: 2026-04-27 (v2 — API corrections, env gotchas)
---
# Integrating a New Project with AI Cost Tracker
@ -42,6 +43,13 @@ COST_TRACKER_API_KEY=ct_live_xxxxxxxxxxxxxxxxxxxx
COST_TRACKER_SOURCE_APP=your-project-name
```
> **Gotcha — Docker doesn't re-read `env_file` on `restart`.**
> After editing `.env`, run `docker compose up -d --force-recreate <service>`.
> Verify with: `docker inspect <container> 2>&1 | grep COST_TRACKER`
> **Gotcha — leading spaces in `.env` = key silently ignored.**
> When appending via SSH, use `echo "KEY=val" >> .env` — never heredoc over SSH (shell quoting adds spaces).
---
## Step 3 — Create a lightweight HTTP client
@ -185,12 +193,12 @@ async def safe_record(ct, payload) -> None:
When a user is created or a project is configured in your app, mirror it to the cost-tracker so it appears in the analytics UI with a proper name:
```python
# On user create/login
# On user create/login — field is "external_id" (NOT "user_external_id")
await ct.post("/users/upsert", json={
"external_id": str(user.id),
"source_app": settings.cost_tracker_source_app,
"external_id": str(user.id), # ← correct field name
"email": user.email,
"full_name": user.full_name,
# source_app is inferred from API key — do not send it
})
# On project create
@ -267,6 +275,9 @@ Then open the Admin UI Dashboard — the test event should appear within seconds
| Events missing from dashboard | `source_app` mismatch | Ensure `source_app` matches in preflight, record, and project upsert |
| `cost_usd = null` on events | Model not in pricing table | Admin UI → Pricing → add model manually, or wait for LiteLLM sync |
| 502/504 from reverse proxy | cost-tracker containers down | `ssh optical-dev "docker compose -f /opt/ai-cost-tracker/infra/docker-compose.yml ps"` |
| Env vars not picked up after editing `.env` | `docker compose restart` doesn't re-read `env_file` | Use `docker compose up -d --force-recreate <service>` |
| Env vars in `.env` have leading spaces | Heredoc over SSH adds indentation | Use `echo "KEY=val" >> .env` per line; verify with `grep COST_TRACKER .env` |
| `source_app` shows in breakdown but "By Project" shows `—` | `project_id` null — not sent by integration | Use `source_app` dimension in Pivot Explorer instead of `project_id` |
## Related articles