Connect a provider
After installing SRouter, open the dashboard at http://localhost:3000 and open Providers. Complete the authentication flow for one supported provider before sending a model request.
The provider connection owns the upstream credential. Your clients should use a SRouter virtual key instead of the provider’s original credential.
Create a virtual key
Open API Keys in the dashboard and create a key for the client or tool that will use the gateway. Configure limits when needed:
- request rate limit;
- token quota;
- credit limit;
- expiration;
- model scope.
Use the generated key as the Authorization: Bearer ... value. Do not copy provider credentials into client configuration.
Configure the gateway
The default gateway URL is:
http://localhost:3000/v1
For local source development, the API runs on 3000, the React dashboard runs on 5173, and the OAuth callback listener uses 1455. Docker serves the built dashboard and API from the main 3000 port.
Set environment variables only when the defaults do not fit your setup:
| Variable | Default | Purpose |
|---|---|---|
PORT |
3000 |
Main API and dashboard port |
OAUTH_PORT |
1455 |
OAuth callback listener |
DATABASE_PATH |
~/.srouter/srouter.db locally |
SQLite database path |
DATABASE_URL |
Not set | PostgreSQL connection string |
SROUTER_PUBLIC_URL |
Not set | Public OAuth callback URL |
Send a request
curl -N http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sr-live-your_virtual_key" \
-d '{
"model": "antigravity/gemini-3.7-flash-high",
"messages": [{"role": "user", "content": "Ping!"}],
"stream": true
}'
The gateway also exposes the Anthropic-compatible POST /v1/messages endpoint. See the OpenAI integration and Anthropic integration guides for SDK examples.
If the request fails
- Check that the API responds:
curl http://localhost:3000/health. - Confirm the provider connection is active in the dashboard.
- Confirm the virtual key is present and has not expired.
- Confirm the model prefix matches a connected provider.
- Inspect request logs for validation or upstream errors.
Continue with API routes or Errors and limits when you need the exact HTTP surface.