- Replace env-based API_KEY with sk-dummy-key hardcoded
- All entry points use same key: Authorization: Bearer sk-dummy-key
- Simplifies usage for library/client consumption
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Remove the ANTHROPIC_MODEL_MAP layer — /v1/messages now uses the
same model names as /v1/chat/completions (deepseek-v4-flash-free,
gpt-5.4-mini-no-login, deepseek/deepseek-v4-flash). This way users
send the original model name and it routes to the correct backend.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Use anthReq.model instead of backendModel so the backend receives
the user-sent model name (e.g. claude-sonnet-4) rather than the
internal mapped name.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Response handler already calls markFailed() on non-2xx and network
errors (which rotates the proxy). The preamble at attempt >= 2 was
calling markFailed() again, double-rotating and skipping a proxy.
Changed preamble to use rotate() instead of markFailed().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Previously only retried on network errors (fetch exceptions). Now also
rotates to next proxy when upstream returns non-2xx (429 rate limit,
5xx, etc). Applies to both OpenAI and Anthropic endpoints.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add /v1/chat/completions, /v1/messages, /v1/models routes to
src/worker.ts (Cloudflare Workers) and api/relay.ts (Vercel)
- Import handleChatCompletion, handleAnthropicMessages handlers
- Using the same backend routing as the standalone server
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Create src/lib/anthropic-proxy.ts: accepts Anthropic Messages API
format (POST /v1/messages) and routes to the same backend providers
- Anthropic model names (claude-sonnet-4, claude-3-haiku, claude-opus-4)
map to backend models with full request/response translation
- Streaming (SSE) via Anthropic protocol: message_start,
content_block_delta, message_stop events
- Add /v1/messages route to server with CORS and proxy pool fallback
- Reuses MODEL_ROUTES from ai-proxy.ts for consistent backend routing
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Create src/lib/ai-proxy.ts: routes OpenAI chat completions requests
to backend providers (opencode.ai, surfsense.com, deep-seek.ai)
based on model name with request/response translation
- Add POST /v1/chat/completions route to server with streaming (SSE)
support, CORS, and proxy pool fallback on failure
- Add GET /v1/models route returning available model list
- Direct-first strategy: try backend directly, fall back to proxy pool
on network failure (consistent with relay behavior)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Change proxy strategy: first attempt goes direct (no proxy).
Only if direct fails, fall back to proxy pool with rotation.
This way healthy upstreams don't pay the proxy latency.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add src/lib/proxy-pool.ts: round-robin proxy pool that reads
proxy.txt (host:port:user:pass), tracks consecutive failures,
and rotates on threshold
- Integrate into src/index.ts: on fetch network error, mark proxy
as failed, rotate to next, and retry the request once
- proxy.txt loaded from PROXY_FILE/PROXY_LIST env var or ./proxy.txt
- Graceful no-op when proxy.txt doesn't exist (Vercel/Workers)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When a GET request hits / with an x-relay-target header, it should relay
the request — not display the index page. Fixed in all three entry points
(src/index.ts, api/relay.ts, src/worker.ts).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Enable workers_dev deploy to edge-proxy-relay.workers.dev
- Set account_id in wrangler.toml
- Configure CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as
GitHub Actions secrets via gh CLI (from .env)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Create src/worker.ts: Workers-compatible relay handler using env
bindings instead of process.env, exports { fetch } for Workers runtime
- Update wrangler.toml: point to new src/worker.ts entry point
- Update deploy.yml: add wrangler-action deploy step after tests pass
- The worker reuses the same relay logic from src/lib/ and src/middleware/
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add "framework": null to vercel.json so Vercel doesn't try to
run Next.js build flow (looking for .next/routes-manifest.json).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Create api/relay.ts: Vercel serverless function handler that reuses
relay logic from src/lib/relay-utils.ts and src/middleware/
- Export default fetch handler (no Bun.serve()) for Vercel Functions
- Fix vercel.json: use @vercel/node@5 runtime with proper routing via
rewrites to catch all traffic to the relay handler
- Remove stale buildCommand/outputDirectory (Vercel handles function builds)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cloudflare Workers via OpenNext tidak support Next.js edge runtime.
Hapus export const runtime = "edge" agar handler jalan di Workers runtime.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Fix build:worker script to use opennextjs-cloudflare build
- Add open-next.config.ts required by OpenNext Cloudflare
- Update wrangler.toml main entry to .open-next/worker.js
- Ignore .open-next/ and .wrangler/ build artifacts
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
feat: update Home component with new UI elements and improved request handling
chore: add components.json for component configuration
feat: implement Badge component for status indication
feat: create Button component for consistent styling
feat: develop Card component structure for content display
feat: add Input component for user input fields
feat: implement Label component for form accessibility
feat: create Select component for dropdown functionality
feat: add Separator component for visual separation
feat: implement Toaster component for notifications
feat: create Tabs component for tabbed navigation
feat: add Textarea component for multi-line input
feat: add utility functions for class name management