Skip to content

feat: api key token control + qol - #1107

Open
AntiTamper wants to merge 25 commits into
decolua:masterfrom
AntiTamper:feature/api-key-token-control-qol
Open

feat: api key token control + qol#1107
AntiTamper wants to merge 25 commits into
decolua:masterfrom
AntiTamper:feature/api-key-token-control-qol

Conversation

@AntiTamper

@AntiTamper AntiTamper commented May 13, 2026

Copy link
Copy Markdown

Synced this with the latest master and kept the API key/quota work in place.

What's in here:

  • API key token limits for unlimited, daily, weekly, daily+weekly, and hard caps
  • key expiry/removal, usage counters, bars, and reset actions
  • quota auto toggle plus provider average quota and highest-session-quota routing
  • Kimi split: Kimi Code uses kimi/kimi-k2.6 through kimi-for-coding, Kimi API stays Moonshot/OpenAI-compatible
  • Claude Code/Kimi Code compatibility fixes
  • SSRF hardening around provider/model URL fetches
  • dashboard QoL fixes, including stale tunnel health pings no longer spamming the browser console

Checked with lint, unit tests, build, API smoke, dashboard smoke, and a real Claude CLI smoke through Kimi Code.

@AntiTamper
AntiTamper force-pushed the feature/api-key-token-control-qol branch from cb07dab to 1afcc1b Compare May 15, 2026 11:42
AntiTamper added 16 commits May 15, 2026 18:58
- Adapt PR decolua#1247: gate /api/v1 and /api/v1beta as public LLM APIs; require API key for remote access
- Replace spoofable Host/Origin local-only check with CLI token requirement
- Add dynamic CORS helper (src/lib/cors.js) for LLM API routes
- Expand sanitizeHeaders and add sanitizeBody in requestDetailsRepo to redact secrets
- Hash apiKey before persistence in usageRepo (SHA-256)
- Replace unbounded global state in usageRepo with module-local bounded caps
- Fix requestDetailsRepo flushTimer leak and deduplicate shutdown handlers
- Bound codex.js assistantSessionMap to 5k entries; unref cleanup interval
- Add streamHandler abortTimeout cleanup
- Cap notificationStore at 50 items; track and clear dismiss timers
- Mobile UI: viewport meta, safe-area CSS, responsive toast width, table padding reduction
- Add dashboard-guard unit tests
… pipeline

- Unconditional reasoning_content stripping broke thinking models for OpenAI clients.
  Now only strips for Firecrawl AI SDK or x-strip-reasoning header.
- hasValuableContent now recognizes delta.reasoning and delta.thinking.
- stream.js passthrough + translate paths accumulate from all reasoning fields.
- openai-responses.js and responsesTransformer.js normalize reasoning/thinking.
- sseToJsonHandler.js extracts reasoning from all fields + conditional stripping.
- streamingHandler.js shows thinking instead of [Empty streaming response].
- Added FORMATS.KIMI and kimi-to-openai translator registration.
- Fixed test import path. All 455 tests pass.
…e.content fallbacks

- streamToJsonConverter.js: process output_text.delta and reasoning_summary_text.delta
events to accumulate text/reasoning when output_item.done is incomplete.
- sseToJsonHandler.js: extract reasoning from Codex response output items.
Add delta.message?.content fallback for non-standard providers.
- stream.js: passthrough + translate paths use delta.message?.content fallback.
- streamHelpers.js: hasValuableContent recognizes delta.message?.content.
- openai-responses.js + responsesTransformer.js: delta.message?.content fallback.

All 455 tests pass.
@AntiTamper
AntiTamper force-pushed the feature/api-key-token-control-qol branch from 8bc5c7a to a033cc3 Compare June 25, 2026 03:25
…ipeline

- streamToJsonConverter: handle delta as string OR {text:...} (extractDeltaText helper)
- streamToJsonConverter: fall back to parsed.item?.id when item_id missing on output_item.done
- responsesTransformer: emit delta: {text} for reasoning/output_text deltas (spec compliant)
- openai-responses.js: emit delta: {text} for reasoning/output_text; read back robustly

Fixes: thinking/reasoning content lost in non-streaming Codex path; output_item.done
merge never firing when item_id missing from transformer-emitted events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant