Responses Proxy configuration
Use this page when you operate or deploy Responses Proxy. If you only need to send requests through the hosted service, start with Getting started.
The hosted service is:
https://agent-responses-proxy.svc.cloud.morph.so/
Client SDKs and Codex should use the Responses API base URL:
https://agent-responses-proxy.svc.cloud.morph.so/v1
Self-hosted deployments read PROXY_ environment variables for service settings and unprefixed OPENAI_* variables for runtime OpenAI resources.
Core variables
| Variable | Default | Purpose |
|---|---|---|
PROXY_REDIS_URL | redis://127.0.0.1:6379/0 | Redis state and telemetry stream. |
PROXY_DATABASE_URL | unset | Preferred durable SQL URL. Use Postgres or Neon in production. |
SERVICE_DATABASE_URL | unset | Fallback SQL URL. |
DATABASE_URL | unset | Fallback SQL URL. |
PROXY_SQLITE_URL | sqlite:///./data/proxy.sqlite3 | Local fallback when no Postgres URL is set. |
PROXY_UPSTREAM_BASE_URL | https://api.openai.com/v1 | Upstream OpenAI-compatible base URL. |
PROXY_REQUEST_TIMEOUT_SECONDS | 600.0 | Upstream request timeout. |
PROXY_MAX_CAPTURE_BYTES | 2000000 | Maximum captured request or response body bytes. |
PROXY_IN_PROCESS_WORKER | false | Run worker inside the API process when true. |
PROXY_ADMIN_TOKEN | unset | Optional bearer token for registry endpoints. |
PROXY_SECRET_ENCRYPTION_KEY | unset | Required for inline provider API key registration. |
Runtime resources
Runtime resources are the upstream OpenAI keys used by the live router. Configure one or more keys:
OPENAI_API_KEY_1=sk-...
OPENAI_API_KEY_2=sk-...
OPENAI_API_KEY_3=sk-...
OPENAI_API_KEY_4=sk-...
OPENAI_RESOURCE_WEIGHTS=1,1,1,1
OPENAI_RESOURCE_POOL_ID=openai-default
For multiple pools:
OPENAI_RESOURCE_POOL_IDS=interactive,batch,batch,evals
OPENAI_RESOURCE_WEIGHTS=2,1,1,1
Weights and pool ids are matched by position against the parsed keys.
Current limit: providers registered through /admin/providers do not feed the live router yet. Use OPENAI_API_KEY_* variables for traffic routing.
Health checks
| Variable | Default | Purpose |
|---|---|---|
PROXY_HEALTH_CHECK_ENABLED | true | Start periodic resource health checks. |
PROXY_HEALTH_CHECK_INTERVAL_SECONDS | 30.0 | Periodic check interval. |
PROXY_HEALTH_CHECK_TIMEOUT_SECONDS | 10.0 | Per-resource timeout. |
PROXY_HEALTH_CHECK_PATH | models | Relative path under the upstream base URL. |
PROXY_RESOURCE_COOLDOWN_SECONDS | 30 | Degraded resource cooldown after failures. |
Telemetry worker
| Variable | Default | Purpose |
|---|---|---|
PROXY_TELEMETRY_STREAM | telemetry:events | Redis stream name. |
PROXY_TELEMETRY_GROUP | responses-proxy-workers | Redis consumer group. |
PROXY_TELEMETRY_CONSUMER | worker-1 | Worker consumer prefix. |
Run the worker separately in development:
uv run responses-proxy-worker
Local development
Run local development when you are changing the proxy service itself:
docker compose up -d redis
uv run uvicorn responses_proxy.app:create_app --factory --reload --host 127.0.0.1 --port 8000
uv run responses-proxy-worker
Local SQLite is created under data/ when no SQL database URL is configured.
Docker service
Build and run the service container:
docker build -t agent-responses-proxy .
docker run --rm --env-file .env.service.local -p 8000:8000 agent-responses-proxy
The service container starts Redis, the worker, and the FastAPI app.
Morph service deployment
Production deploys should supply:
MORPH_API_KEY_PRODMORPH_API_KEY_STAGEfor stageMORPH_BUILDER_SNAPSHOT_IDorMORPH_BASE_IMAGE_IDPROXY_DATABASE_URLOPENAI_API_KEY_1throughOPENAI_API_KEY_4
Registry-related secrets:
PROXY_ADMIN_TOKENPROXY_SECRET_ENCRYPTION_KEY
Validate deploy configuration without contacting Morph:
MORPH_API_KEY=... \
MORPH_BUILDER_SNAPSHOT_ID=... \
OPENAI_API_KEY_1=... \
PROXY_DATABASE_URL=... \
uv run --extra deploy python scripts/deploy_service.py --dry-run
Persistence
Use Postgres or Neon for production:
PROXY_DATABASE_URL=postgresql://user:password@host/database?sslmode=require
Persists in SQL:
- telemetry events
- sessions
- requests
- load-balancer decisions
- registered providers
- registered model or agent aliases
Resets with Redis or container lifecycle:
- live counters
- affinity mappings
- health state
- telemetry stream queue
The Docker service intentionally runs Redis without persistence because durable telemetry belongs in SQL.