Skip to content

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

daoxe-render-proxy

A tiny OpenAI-compatible proxy with a live health page — one click to Render. Zero dependencies (~1 file of vanilla Node), so you can read every line before you ship it. Default upstream: https://daoxe.com/v1, but it works with any OpenAI-compatible endpoint.

Deploy to Render


Why

  • Share access without sharing your key. In gateway mode, callers use a PROXY_TOKEN you hand out; the proxy swaps it for the real upstream key, which never leaves the server. Rotate or revoke the token anytime.
  • Fix browser CORS. Point a browser app at /v1 and get permissive CORS headers, so BYO-key front-ends stop throwing CORS errors.
  • See that it's alive. / renders a health dashboard; /healthz returns JSON (mode, upstream reachability, config) for uptime monitors.

Two modes (chosen automatically)

Mode Trigger Who holds the key Callers send
passthrough (default) no DAOXE_API_KEY each caller (their own) their own upstream key
gateway DAOXE_API_KEY and PROXY_TOKEN the server the PROXY_TOKEN

Fail-closed safety: if DAOXE_API_KEY is set but PROXY_TOKEN is not, the server stays in passthrough mode and refuses to inject the key — a misconfig can't silently become an open wallet. To intentionally inject the key for everyone (behind your own network controls), set ALLOW_OPEN_RELAY=true.

Deploy in one click

  1. Click Deploy to Render above. Render reads render.yaml.
  2. Render prompts for the sync: false variables:
    • For a CORS relay only, leave DAOXE_API_KEY / PROXY_TOKEN blank.
    • For a gateway, set DAOXE_API_KEY (your key) and PROXY_TOKEN (invent a strong random string).
  3. Deploy. Open the service URL to see the health page.

Use it

Point any OpenAI SDK/client at https://<your-service>.onrender.com/v1:

# gateway mode: the "api key" you give clients is the PROXY_TOKEN
curl https://<your-service>.onrender.com/v1/chat/completions \
  -H "Authorization: Bearer $PROXY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_MODEL_ID","messages":[{"role":"user","content":"hi"}]}'
from openai import OpenAI
client = OpenAI(base_url="https://<your-service>.onrender.com/v1",
                api_key="<PROXY_TOKEN or your own upstream key>")

Environment variables

Name Required Default Notes
DAOXE_BASE_URL — https://daoxe.com/v1 Any OpenAI-compatible root.
DAOXE_API_KEY for gateway — Real upstream key. Server-side only.
PROXY_TOKEN for gateway — Token callers use in place of the key.
DAOXE_ALLOWED_MODELS — any Comma-separated allow-list on /v1/chat/completions.
CORS_ORIGIN — * Lock to your domain in production.
ALLOW_OPEN_RELAY — false true = inject key without a token (dangerous).
PORT — provided by Render —

Run locally

cp .env.example .env         # fill values; never commit it
node --env-file=.env server.js   # Node 20.6+
# or: DAOXE_API_KEY=... PROXY_TOKEN=... node server.js

Visit http://localhost:10000/ for the health page.

Endpoints

  • GET / — HTML health dashboard.
  • GET /healthz — JSON status (mode, upstream reachability, config).
  • ANY /v1/* — proxied to ${DAOXE_BASE_URL}/* (e.g. /v1/chat/completions, /v1/models), streaming passed through unchanged.

Security notes

  • * CORS + gateway mode = a public relay for your credits. If you enable the gateway, treat PROXY_TOKEN like a password and set a real CORS_ORIGIN.
  • The proxy never logs or returns your key; upstream error bodies are trimmed.
  • Render's free web service spins down when idle; the first request after a nap is slow. That's a plan trait, not a bug.

More one-click deploy templates

Sibling starters, same idea (provider-neutral, key via env, one click):

Disclosure

This template is maintained by people who work on daoxe, an OpenAI-compatible, multi-model LLM gateway (one key, many models). It is not available in mainland China. The default DAOXE_BASE_URL and the health page link point to daoxe, but both are one-line changes — the proxy is fully provider-neutral. daoxe.com

License

MIT — see LICENSE.

Releases

Packages

Contributors

Languages