Last updated: 2026-04-12

Proxy Endpoints

API reference for SpendLil's proxy gateway.

The proxy is SpendLil's core service. Each AI provider has its own gateway subdomain.

Gateway Subdomains

ProviderGateway URLUpstream
OpenAIhttps://openai.gateway.spendlil.aiapi.openai.com
Anthropichttps://anthropic.gateway.spendlil.aiapi.anthropic.com
Googlehttps://google.gateway.spendlil.aigenerativelanguage.googleapis.com
Mistralhttps://mistral.gateway.spendlil.aiapi.mistral.ai

The path after the domain is forwarded as-is to the upstream provider. For example, openai.gateway.spendlil.ai/v1/chat/completions forwards to api.openai.com/v1/chat/completions.

Proxy Request

ANY /{path+}

Forward any request to the AI provider determined by the gateway subdomain.

Required Headers

HeaderRequiredDescription
X-SpendLil-KeyYesYour SpendLil account key (e.g., sl_abc123).
X-Provider-KeyYesYour provider API key (e.g., Bearer sk-...). Reconstructed as Authorization before forwarding.
Content-TypeYesapplication/json (standard for AI APIs).
Why X-Provider-Key instead of Authorization?

AWS API Gateway intercepts the standard Authorization header. SpendLil uses X-Provider-Key to pass your provider key through, then reconstructs it as Authorization before forwarding to the upstream provider.

Response Headers

HeaderValueDescription
X-SpendLil-RoutegovernedRequest was successfully tracked.
X-SpendLil-RoutebypassedRequest was forwarded but tracking failed (temporary).
X-SpendLil-Request-IduuidUnique identifier for this proxied request.

Health Check

GET /health

Returns proxy health status. Available on each gateway subdomain.

bash Check all gateways
curl https://openai.gateway.spendlil.ai/health
curl https://anthropic.gateway.spendlil.ai/health
curl https://google.gateway.spendlil.ai/health
curl https://mistral.gateway.spendlil.ai/health

Error Responses

StatusCodeDescription
400MISSING_SPENDLIL_KEYX-SpendLil-Key header not provided
400MISSING_AUTHX-Provider-Key header not provided
400INVALID_AUTHX-Provider-Key header is empty or malformed
401INVALID_SPENDLIL_KEYSpendLil account not found for this key
403ACCOUNT_INACTIVESpendLil account is suspended or cancelled
502PROVIDER_ERRORCould not connect to the AI provider