Public
OpenAI-compatible gateway on Val Town native AI, no keys needed
aiarabicgatewayopenai
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
A production-ready OpenAI-compatible API gateway whose upstream engine is
Val Town's native AI (std/openai → the ValTownOpenAI proxy, authenticated
by the ambient valtown token). No external API key required — Cline, Roo
Code, Cursor, the Python OpenAI SDK, or cURL can all connect to this gateway
and chat through real SSE streaming.
- Base URL:
{origin}/api/provider/v1 - Model:
gpt-5.4-nano(Val Town native) - API Key: shown in the UI (stored server-side in
PROVIDER_API_KEY)
baseUrl = {origin}/api/provider/v1
apiKey = <the key shown in the UI>
modelId = gpt-5.4-nano
curl {origin}/api/provider/v1/chat/completions \ -H "Authorization: Bearer <KEY>" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-5.4-nano","stream":true, "messages":[{"role":"user","content":"مرحباً"}]}'
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /health | no | {status:"ok", service:"internal-bridge"} |
| GET | /api/provider/v1 | no | Service info & limits |
| GET | /api/provider/v1/models | no | Active model, OpenAI format |
| POST | /api/provider/v1/chat/completions | yes | Chat (SSE or non-streaming) |
| GET | /api/provider/config | no | {model, apiKey, keyRequired} for the UI |
main.ts(http) — router: mounts the gateway under/api/provider/v1, serves the RTL frontend and assets.lib/bridge.ts(script) — the internal provider bridge:sanitizeMessages(never throws),max_tokensclamping, auto-healing singleton that re-reads platform credentials, and real SSE streaming via the OpenAI SDK.public/— Arabic RTL UI (playground, connection info, integration snippets, activity/usage).
PROVIDER_API_KEY— the gateway bearer key (required on chat completions).PROVIDER_MODEL— optional, overrides the defaultgpt-5.4-nano.
- Native engine rate limit: ~10 requests/minute (Val Town proxy).
- Pro users get 10 expensive-model requests per rolling 24h, then bump to nano.
max_tokensis auto-clamped to the engine ceiling to avoid upstream errors.