A lightweight serverless proxy that allows OpenAI-compatible applications to securely access private Modal-hosted AI models.
Many modern AI applications support custom OpenAI-compatible endpoints but only allow a single API key for authentication.
Modal's protected endpoints require custom authentication headers:
Modal-KeyModal-Secret
which are not supported by many clients.
This project bridges that gap by exposing a standard OpenAI-compatible API while securely handling Modal authentication on the server side.
The result is a reusable gateway that allows private Modal-hosted models to be used from any OpenAI-compatible application without exposing Modal credentials.
This project was built to support a variety of personal AI workflows, including:
- AI meeting assistants
- Meeting transcription analysis
- Action item extraction
- Document summarization
- Personal chatbots
- Knowledge assistants
- Retrieval-Augmented Generation (RAG)
- Custom AI applications built on private Modal deployments
OpenAI-Compatible Client
│
│ Bearer API Key
▼
Modal OpenAI Proxy
│
├── Validates API Key
├── Injects Modal Authentication
└── Forwards Requests
▼
Modal Endpoint
▼
Gemma / Qwen / Llama / Custom Models
- OpenAI-compatible Chat Completions API
- Works with any OpenAI-compatible client
- Supports private Modal endpoints
- Server-side credential management
- Bearer token authentication
- Streaming support
- Serverless deployment
- Scale-to-zero friendly
- Simple and lightweight
| Variable | Description |
|---|---|
PROXY_API_KEY |
API key used by client applications |
MODAL_ENDPOINT_URL |
Full Modal endpoint URL |
MODAL_KEY |
Modal authentication key |
MODAL_SECRET |
Modal authentication secret |
Example:
PROXY_API_KEY=sk-my-private-key
MODAL_ENDPOINT_URL=https://your-endpoint.modal.direct/v1/chat/completions
MODAL_KEY=wk_xxxxxxxxx
MODAL_SECRET=ws_xxxxxxxxxDeploy directly to Vercel:
- Clone the repository
- Import into Vercel
- Configure environment variables
- Deploy
No additional infrastructure is required.
Base URL:
https://your-deployment.vercel.app/v1
API Key:
sk-my-private-key
Model:
google/gemma-4-E4B-it
curl -X POST \
https://your-deployment.vercel.app/v1/chat/completions \
-H "Authorization: Bearer sk-my-private-key" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemma-4-E4B-it",
"messages": [
{
"role": "user",
"content": "Summarize this document."
}
]
}'- Multi-model routing
- Model fallback support
- Request analytics
- Rate limiting
- RAG integrations
- Long-term memory support
- Tool calling support
- Multi-user authentication
MIT