Commit Graph
79 Commits
Author SHA1 Message Date
MythEclipseandClaude Fable 5 5974d31164 fix: avoid double markFailed in AI proxy retry loop
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>
2026-06-11 00:02:40 +07:00
MythEclipseandClaude Fable 5 2dfb87eac6 fix: retry AI proxy with next proxy on HTTP errors too
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>
2026-06-10 23:57:24 +07:00
MythEclipseandClaude Fable 5 38d7a83fe9 feat: add AI proxy routes to Workers and Vercel entry points
- 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>
2026-06-10 23:45:38 +07:00
MythEclipseandClaude Fable 5 4168a087a0 feat: add Anthropic-compatible AI proxy endpoint
- 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>
2026-06-10 23:08:32 +07:00
MythEclipseandClaude Fable 5 567ed52db5 feat: add OpenAI-compatible AI proxy endpoint
- 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>
2026-06-10 22:52:45 +07:00
MythEclipseandClaude Fable 5 c61f8d9db6 fix: try direct connection first, fall back to proxy
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>
2026-06-10 22:15:47 +07:00
MythEclipseandClaude Fable 5 03427cae8c feat: auto-rotate proxy pool with retry on network failure
- 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>
2026-06-10 22:12:59 +07:00
MythEclipseandClaude Fable 5 3f96d8a6e7 fix: relay requests to / with x-relay-target instead of showing index
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>
2026-06-10 21:59:25 +07:00
Asep Haryana SaputraandGitHub a67f9283e3 Update README.md 2026-06-10 21:56:26 +07:00
Asep Haryana SaputraandGitHub 2b58b6cb0f Update README.md 2026-06-10 21:55:49 +07:00
Asep Haryana SaputraandGitHub 1aac993d34 Update README.md 2026-06-10 21:49:17 +07:00
MythEclipseandClaude Fable 5 2ac23f199d chore: configure Cloudflare Workers deployment
- 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>
2026-06-10 21:46:13 +07:00
MythEclipseandClaude Fable 5 7a4df35371 feat: add Cloudflare Workers deployment support
- 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>
2026-06-10 21:38:22 +07:00
Asep Haryana SaputraandGitHub 5552ee2118 Update README.md 2026-06-10 21:30:05 +07:00
MythEclipseandClaude Fable 5 58553f936e fix: disable Vercel Next.js framework detection
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>
2026-06-10 21:22:37 +07:00
MythEclipseandClaude Fable 5 9dc32e8b10 fix: correct Vercel Bun runtime config and handler export format
Per Vercel docs (vercel.com/docs/functions/runtimes/bun):
- Use top-level "bunVersion": "1.x" in vercel.json (NOT functions block)
- Export default { async fetch(request) { ... } } — object with fetch method
  (not a bare default function)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 21:20:16 +07:00
MythEclipseandClaude Fable 5 591c1fa199 fix: add Vercel-compatible relay handler and fix vercel.json runtime
- 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>
2026-06-10 21:17:21 +07:00
MythEclipseandClaude Fable 5 f58a92e2aa feat: migrate from Next.js to pure Bun relay proxy
- Replace Next.js app router with standalone Bun.serve() entry point
- Add middleware stack: rate limiter, body limiter, structured logger, SSRF protection
- Add WebSocket bidirectional relay via x-relay-target header
- Implement error classification (DNS→502, timeouts→504, SSRF→403, rate→429)
- Remove all Next.js dependencies and config files
- Update deploy workflow, tsconfig, wrangler config for Bun deployment

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 19:54:55 +07:00
MythEclipse 124dab98a2 docs: improve README with comprehensive examples and protocol support info 2026-05-08 19:12:18 +07:00
MythEclipse 694f14a316 fix: add node 22 + set secrets to correct repo 2026-05-08 19:03:24 +07:00
MythEclipse eba4fbe00a fix: remove wrong working-directory from workflow 2026-05-08 19:01:49 +07:00
MythEclipse 443ff77be9 ci: add CF Workers deploy workflow + fix relay header forwarding 2026-05-08 18:58:50 +07:00
MythEclipse dfb0f5942f docs: add alternative deployment endpoint to README 2026-05-08 17:32:56 +07:00
MythEclipseandClaude Opus 4.7 75731af9b6 Remove edge runtime directive from route handler
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>
2026-05-08 17:32:35 +07:00
MythEclipseandClaude Opus 4.7 765bcdca44 Add Cloudflare Workers deploy config via OpenNext
- 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>
2026-05-08 17:27:06 +07:00
MythEclipse d211c40fa1 docs: update example usage in README for clarity and formatting 2026-05-07 23:45:00 +07:00
MythEclipse ef436182fc docs: update live deployment section by removing trailing slashes from URLs 2026-05-07 23:26:17 +07:00
MythEclipse 240866c0d0 docs: add alternative deployment endpoint to README 2026-05-07 23:25:58 +07:00
MythEclipse 6a82a834eb refactor: remove unnecessary targetUrl parameter and prevent compressed responses in relay 2026-05-07 23:09:49 +07:00
MythEclipse c1772d6b6b docs: update live deployment section in README for clarity 2026-05-07 22:56:38 +07:00
MythEclipse 6f91d93672 feat: restructure API and documentation with new relay handler and UI components 2026-05-07 22:55:23 +07:00
MythEclipse fff35f02fe docs: add secondary deployment endpoint to README 2026-05-07 22:52:22 +07:00
MythEclipse 1df328ad96 docs: update README with live deployment info and correct example commands 2026-05-07 22:47:49 +07:00
MythEclipse 6588c2bc39 test: add unit tests for relay-utils functions 2026-05-07 22:41:08 +07:00
MythEclipse d848b903e8 fix: update example proxy commands in README for clarity 2026-05-07 22:37:48 +07:00
MythEclipse 932bc192fa feat: integrate Geist font and enhance layout with utility classes
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
2026-05-07 22:30:50 +07:00
MythEclipse f691476046 fix: prevent encoding issues by removing problematic headers in relay responses 2026-05-07 22:25:39 +07:00
MythEclipse 1a0a947674 Refactor code structure for improved readability and maintainability 2026-05-07 22:22:35 +07:00
MythEclipse 83e66805c4 refactor: remove Tailwind CSS configuration and update dependencies 2026-05-07 21:34:39 +07:00
MythEclipse 001bba1d24 fix: add CORS headers to relay responses and OPTIONS method handling 2026-05-07 21:31:00 +07:00
MythEclipse 7416bfb2bd feat: migrate proxy logic to new structure and implement new relay route 2026-05-07 21:26:27 +07:00
MythEclipse 083d77e252 fix: migrate proxy handler logic from pages/api/proxy.ts to app/api/proxy/route.ts and remove old file 2026-05-07 21:22:30 +07:00
MythEclipse 52845da832 fix: update proxy configuration to use 'config' export and move allowed methods inside handler 2026-05-07 21:20:31 +07:00
MythEclipse 751eb083c4 fix: migrate proxy route logic from route.ts to pages/api/proxy.ts 2026-05-07 21:19:20 +07:00
MythEclipse f3ec82cbbf fix: replace stripRelayHeaders with filterHeaders and add BLOCKED_HEADERS set 2026-05-07 21:16:31 +07:00
MythEclipse f2ebba51bb fix: remove commented console log for request headers in Home component 2026-05-07 21:11:44 +07:00
MythEclipse 3fdbaf3ced fix: update .gitignore and tsconfig for Next.js compatibility 2026-05-07 21:09:09 +07:00
MythEclipse 9d1ef77cda fix: update duplex type assertion in buildRelayRequest function 2026-05-07 21:07:39 +07:00
MythEclipse b11763a7ab fix: update devDependencies to include TypeScript and type definitions for React 2026-05-07 21:05:58 +07:00
MythEclipse e553ed3e02 fix: update PostCSS configuration to correctly reference '@tailwindcss/postcss' 2026-05-07 21:04:45 +07:00