token billing#211
Closed
jsyqrt wants to merge 4 commits into
Closed
Conversation
… skeleton - Create packages/cloudflare-worker/ with wrangler.toml + tsconfig + package.json - Implement 5 middleware: CORS, auth, logging, rate-limit, timeout - Implement 2 routes: /health (GET) and /v1/chat/completions (POST stub) - Error utilities (errors.ts) and HTTP response helpers (response.ts) - Composable middleware chain with Env + Context request passing
c6731c0 to
cb7ad41
Compare
… — real auth and LLM forwarding - Hub: POST /api/auth/token JWT endpoint with plan-based claims - Hub: JWT verify + refresh support - Worker: JWT verify (jose) middleware replacing auth stub - Worker: auth context extraction (userId/planType/quota) - Worker: Chat proxy route with upstream URL building + CU quota checks - Test: 19 tests across 3 files (jwt-verify, auth-context, chat route)
…quota, AbortController for streaming - Issue 1: Changed 403→429 for QUOTA_EXCEEDED and INSUFFICIENT_QUOTA - Issue 2: Added AbortController + DEFAULT_TIMEOUT_MS to streaming fetch path (catch AbortError as UPSTREAM_TIMEOUT 504, other errors as UPSTREAM_UNREACHABLE 502) - Non-blocking suggestions kept for future rounds
…525317e [TASK-tsk_5319d992235c56638525317e][Backend Developer] feat: JWT auth + Chat proxy route — real auth and LLM forwarding
Contributor
Author
|
已合并到 feature/token-billing,PR 关闭。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 基本信息
🎯 背景与动机 (Why)
Create the Cloudflare Worker proxy skeleton as the first step of the token-billing infrastructure. This provides routing, middleware chain, error handling, and a health check endpoint.
🔧 变更内容 (What)
✅ 验证方式 (How to Verify)
👤 评审人