Skip to main content

Deploy to Render

Render provides a fully managed platform with auto-TLS, private networking, and managed PostgreSQL. The Ferro Labs AI Gateway ships with a render.yaml Blueprint that provisions everything in one click.

One-click deployโ€‹

Deploy to Render

The Blueprint provisions:

  • Web service โ€” Docker-based gateway with health checks
  • PostgreSQL database โ€” Managed Postgres for API key storage, config history, and request logging
  • Auto-wired DSNs โ€” All three store backends (API keys, config, request logs) connect to the database automatically
  • Generated MASTER_KEY โ€” A secure master key is generated during setup

You will be prompted for your OPENAI_API_KEY (and any other provider keys you need).

What the Blueprint configuresโ€‹

The render.yaml in the gateway repository sets up:

ResourceTypeDetails
ferrogwWeb Service (Docker)Exposes port 8080, health check at /health
ferrogw-dbPostgreSQLManaged database for all persistence

Environment variables are auto-wired:

VariableSourcePurpose
MASTER_KEYAuto-generatedAdmin authentication
OPENAI_API_KEYUser-providedOpenAI provider key
API_KEY_STORE_BACKENDpostgresAPI key storage backend
API_KEY_STORE_DSNDatabase internal URLConnection string
CONFIG_STORE_BACKENDpostgresConfig storage backend
CONFIG_STORE_DSNDatabase internal URLConnection string
REQUEST_LOG_STORE_BACKENDpostgresRequest log storage backend
REQUEST_LOG_STORE_DSNDatabase internal URLConnection string

Manual setupโ€‹

If you prefer to configure Render manually instead of using the Blueprint:

Step 1: Create a PostgreSQL databaseโ€‹

In the Render dashboard, create a new PostgreSQL database. Note the Internal Connection String โ€” you will need it for the environment variables.

Step 2: Create a web serviceโ€‹

  1. Click New โ†’ Web Service
  2. Connect your GitHub repository or use the public image: ghcr.io/ferro-labs/ai-gateway:latest
  3. Set the environment to Docker
  4. Configure environment variables:
MASTER_KEY=fgw_your-master-key
OPENAI_API_KEY=sk-your-key
PORT=8080

# Storage backends โ€” all point to the Postgres database
API_KEY_STORE_BACKEND=postgres
API_KEY_STORE_DSN=postgresql://user:pass@host:5432/dbname
CONFIG_STORE_BACKEND=postgres
CONFIG_STORE_DSN=postgresql://user:pass@host:5432/dbname
REQUEST_LOG_STORE_BACKEND=postgres
REQUEST_LOG_STORE_DSN=postgresql://user:pass@host:5432/dbname
warning

Never hardcode API keys in source files. Always use Render's environment variable management, which encrypts values at rest.

Step 3: Configure health checkโ€‹

Set the health check path to /health so Render can monitor the service and restart it if it becomes unhealthy.

Step 4: Deployโ€‹

Click Create Web Service. Render builds the Docker image and starts the gateway. You will see the service URL in the dashboard once the deploy completes.

Adding more providersโ€‹

Add provider API keys as environment variables in the Render dashboard:

ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=...
MISTRAL_API_KEY=...

No code changes or redeployment needed โ€” the gateway picks up new keys on restart. Use the Manual Deploy button or update an environment variable to trigger a fresh deploy.

Verify the deploymentโ€‹

# Health check
curl https://your-service.onrender.com/health

# Test request
curl https://your-service.onrender.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MASTER_KEY" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello from Render!"}]
}'

Cost considerationsโ€‹

ResourceRender PlanApproximate Cost
Web serviceStarter$7/month
PostgreSQLStarter$7/month
Total~$14/month

Render's free tier is available for testing but has limitations (spins down after inactivity, limited compute). For production workloads, use the Starter plan or above.