Commit Graph
664 Commits
Author SHA1 Message Date
shroominicandGitHub af6ecbdd3e Merge pull request #186 from Routstr/v0.1.4
V0.1.4
2025-10-20 10:11:09 +08:00
Shroominic 4641f40278 custom version suffix v0.1.4 2025-10-18 13:33:41 +08:00
shroominicandGitHub 0c1fa27257 Merge pull request #189 from kwsantiago/kwsantiago/188-fee-not-applying-to-usd
fix: upstream provider fee not being applied to USD pricing
2025-10-18 13:30:17 +08:00
Shroominic 24aceb2b07 ruff fmt 2025-10-18 13:29:49 +08:00
Shroominic 229702a983 ruff fmt 2025-10-18 13:29:37 +08:00
Shroominic eda1f8dadf set defaul model refresh interval 2025-10-18 13:29:17 +08:00
Shroominic 71ed601269 fix: max_tokens as string should not work 2025-10-18 13:18:59 +08:00
Shroominic a8b7554334 fix: mints env var not initialized properly 2025-10-18 13:18:59 +08:00
Shroominic e0341b06a5 pin python version to 3.11 2025-10-18 13:18:59 +08:00
Shroominic be7e1ff4a3 maybe fix 2025-10-18 13:18:59 +08:00
Shroominic 8960501f6b enable sqlite WAL mode 2025-10-18 13:18:59 +08:00
Shroominic 8d9c9d93eb fix tests 2025-10-18 13:18:59 +08:00
Shroominic 6c66a37dfa ruff fmt 2025-10-18 13:18:59 +08:00
Shroominic a33193e4a3 dontations endpoint 2025-10-18 13:18:59 +08:00
redshiftandShroominic da6e0a4c59 Fixed the bug where refund amount is below 1 sat for a sat mint 2025-10-18 13:18:59 +08:00
Shroominic 764bc3d7e8 fix periodic payouts 2025-10-18 13:18:59 +08:00
Shroominic 1557a7c58d remove need for ADMIN_PASSWORD, added in initial setup 2025-10-18 13:18:59 +08:00
Shroominic d69a8f76e1 improved upstream error message handling 2025-10-18 13:18:59 +08:00
Shroominic 78821929a6 v1/providers redirect to v1/providers/ 2025-10-18 13:18:59 +08:00
Shroominic 401728582f filter out openrouter spam models 2025-10-18 13:18:59 +08:00
Shroominic 98aa886477 add models.json batch paste 2025-10-18 13:18:59 +08:00
Shroominic 81ac14bbc5 models admin dashboard 2025-10-18 13:18:59 +08:00
Shroominic 036e04467e v0.1.4-dev 2025-10-18 13:18:59 +08:00
Shroominic 6d6651acbe fix: max_tokens as string should not work 2025-10-18 13:10:09 +08:00
Shroominic 19972bc8fc fix: mints env var not initialized properly 2025-10-18 13:09:50 +08:00
Shroominic 4d09867a9a pin python version to 3.11 2025-10-16 16:03:39 +08:00
shroominicandGitHub 78d99a7462 Merge pull request #194 from Routstr/fix-x-cashu-msat-refund-bug
Fix x cashu msat refund bug
2025-10-16 16:03:12 +08:00
Shroominic 523816db30 maybe fix 2025-10-16 15:37:38 +08:00
Shroominic 7e6e0f806b enable sqlite WAL mode 2025-10-16 11:00:52 +08:00
Kyle Santiago 9096a6c30d Create test_fee_consistency.py 2025-10-13 21:42:33 -04:00
Kyle Santiago 6538427782 fix: upstream provider fee not being applied to USD pricing 2025-10-09 19:31:02 -04:00
Shroominic c56a06f3df fix tests 2025-10-04 20:49:53 +08:00
Shroominic 325abad736 ruff fmt 2025-10-04 20:49:45 +08:00
Shroominic f8090f5c35 dontations endpoint 2025-10-02 14:55:02 +08:00
shroominicandGitHub b2e5da4b46 Merge pull request #180 from Routstr/sh1ftred-patch-1
Fixed the bug where refund amount is below 1 sat for a sat mint
2025-09-23 12:40:43 +01:00
redshiftandGitHub 729f00caa2 Fixed the bug where refund amount is below 1 sat for a sat mint 2025-09-22 16:55:16 +00:00
Shroominic 54d7a5a247 fix periodic payouts 2025-09-22 17:54:28 +01:00
redshiftandGitHub ecbe3158c0 Merge pull request #179 from Routstr/503-mint-service-bug
Fixed the 503 mint service unavailable bug
2025-09-22 16:27:36 +00:00
redshiftandGitHub bac50f2150 Fixed the 503 mint service unavailable bug
This flag fetch all keysets from the db into the wallet, which is wrong given that we're initiating it for a mint. And load_mint sets the first keyset from all the keysets from the db, irrespective of the unit and the mint. 

Fixes #175
2025-09-22 16:25:02 +00:00
Shroominic 150f3084c1 remove need for ADMIN_PASSWORD, added in initial setup 2025-09-22 16:40:48 +01:00
Shroominic d4e1715613 improved upstream error message handling 2025-09-22 16:36:52 +01:00
Shroominic c2a26a3c00 v1/providers redirect to v1/providers/ 2025-09-22 16:36:35 +01:00
Shroominic 8e0ae6cbc8 filter out openrouter spam models 2025-09-22 13:46:07 +01:00
Shroominic 18a055ee2c add models.json batch paste 2025-09-22 12:58:53 +01:00
Shroominic c5289364e4 models admin dashboard 2025-09-22 12:47:39 +01:00
Shroominic 5fb583be55 v0.1.4-dev 2025-09-22 11:11:36 +01:00
shroominicandGitHub 4bf02226dc Merge pull request #172 from Routstr/fix-max-tokens-string-int
fix max-tokens coming in as string
2025-09-16 13:05:39 +01:00
Shroominic c8f4e7d3e5 fix max-tokens coming in as string 2025-09-16 13:00:38 +01:00
shroominicandGitHub 3d4a8e0e14 Merge pull request #169 from Routstr/dev
## Routstr v0.1.3 — 2025-09-15

### Highlights

- **DB-backed settings with live updates**: Env vars seed on first run; DB is the source of truth (except `DATABASE_URL`). Manage via Admin UI or `PATCH /admin/api/settings`.
- **Models moved to database** with background sats-pricing computation and optional periodic refresh.
- **Smarter max-cost reservation**: Discount based on prompt tokens and `max_tokens` using `TOLERANCE_PERCENTAGE`, with a `MIN_REQUEST_MSAT` floor.
- **Faster startup and provider discovery**; `.onion` endpoints use Tor proxy by default.

### Breaking changes

- **Configuration is DB-first** after bootstrap. Env changes won’t auto-apply (besides `DATABASE_URL`).
- **Models endpoint**: Use `/v1/models` for canonical model info; `/v1/info` keeps an empty `models` field for back-compat.
- **Legacy pricing envs** are auto-mapped but deprecated:
  - `MODEL_BASED_PRICING` → `!FIXED_PRICING`
  - `COST_PER_REQUEST` → `FIXED_COST_PER_REQUEST`
  - `COST_PER_1K_*` → `FIXED_PER_1K_*`

### Added

- **SettingsService** with env→computed→DB merge; runtime edits; app metadata (name/description) applied to OpenAPI.
- **Automatic migrations** on startup; new tables: `settings`, `models`.
- **Per-model sats pricing** and per-request maximums computed in the background.
- **Pricing controls**: `FIXED_PRICING`, `FIXED_COST_PER_REQUEST`, optional per-1k token overrides, `MIN_REQUEST_MSAT`.
- **Azure chat support**: Optional `CHAT_COMPLETIONS_API_VERSION` adds `api-version` to `/chat/completions`.
- **Derive `NPUB` from `NSEC`** during bootstrap if not provided.

### Changed / Improvements

- **Proxy header hardening**: Strip sensitive headers; replace Authorization with upstream key when configured.
- **Discovery**: Read `RELAYS` from settings; Tor proxy defaults for `.onion` via `TOR_PROXY_URL`; faster announcement fetching.
- **Admin**: Improved auth/log UX; fixed log search; show mint balances in dashboard.
- **Performance**: Optimized startup; lazy DB info loading.

### Fixed

- **Refunds**: Correct msat→sat conversion; configurable refund cache TTL via `REFUND_CACHE_TTL_SECONDS`; better error mapping for mint outages.
- **Balances**: Reserved balance reporting and negative-reserved edge cases.
- **Tests**: Updated to patch settings and use fixed-pricing flags.

### Upgrade notes (from v0.1.2)

1. Ensure `DATABASE_URL`, `UPSTREAM_BASE_URL`, and `ADMIN_PASSWORD` are set. Optionally set `UPSTREAM_API_KEY`, `RELAYS`, `CASHU_MINTS`, `TOR_PROXY_URL`.
2. Start the service; automatic Alembic migrations will run (`settings`, `models` tables).
3. Configure settings via Admin UI (`/admin`) or `PATCH /admin/api/settings`. Env changes after first run won’t apply automatically.
4. Prefer new pricing envs or a `models.json` at `MODELS_PATH`. Legacy envs are mapped but will be removed in a future release.
5. Optional tuning: `TOLERANCE_PERCENTAGE`, `MIN_REQUEST_MSAT`, `PRICING_REFRESH_INTERVAL_SECONDS`, `MODELS_REFRESH_INTERVAL_SECONDS`, `ENABLE_*_REFRESH`.
6. For Azure, set `CHAT_COMPLETIONS_API_VERSION`.

### References

- Configuration: `docs/getting-started/configuration.md`
- API: `docs/api/endpoints.md`
- Custom pricing: `docs/advanced/custom-pricing.md`

### Stats and credits

- 42 files changed, +1819/−832 lines.
- Merges: #170 token-discount-max-cost, #171 move-models-to-db.
- Contributors: Shroominic.
v0.1.3
2025-09-16 12:43:54 +01:00
Shroominic 8b9d53be3c fix deps issue 2025-09-15 18:04:35 +01:00