Last updated: 2026-04-20

Proxy Endpoints

API reference for SpendLil's proxy gateway.

The proxy is SpendLil's core service. Each AI provider has its own gateway subdomain. Your standard provider auth header passes through unchanged — just swap the base URL and add X-SpendLil-Key.

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
Groqhttps://groq.gateway.spendlil.aiapi.groq.com
DeepSeekhttps://deepseek.gateway.spendlil.aiapi.deepseek.com
xAI (Grok)https://xai.gateway.spendlil.aiapi.x.ai
Togetherhttps://together.gateway.spendlil.aiapi.together.xyz
Fireworkshttps://fireworks.gateway.spendlil.aiapi.fireworks.ai
Perplexityhttps://perplexity.gateway.spendlil.aiapi.perplexity.ai
OpenRouterhttps://openrouter.gateway.spendlil.aiopenrouter.ai/api
Coherehttps://cohere.gateway.spendlil.aiapi.cohere.com

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).
AuthorizationProvider-dependentBearer <key> — OpenAI, Mistral, Cohere, Groq, DeepSeek, xAI, Together, Fireworks, Perplexity, OpenRouter. Also accepted by Anthropic.
x-api-keyProvider-dependentAnthropic native auth.
x-goog-api-keyProvider-dependentGoogle Gemini.
X-SpendLil-TagNoOptional label for filtering spend by workload (max 64 chars).
Content-TypeYesapplication/json (standard for AI APIs).
Provider SDKs work unchanged

Point your existing SDK's baseURL at the SpendLil gateway and add X-SpendLil-Key to defaultHeaders. No code rewrite needed.

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
for p in openai anthropic google mistral groq deepseek xai together fireworks perplexity cohere openrouter; do
  echo -n "$p: "
  curl -s https://$p.gateway.spendlil.ai/health | jq -r .status
done

Error Responses

StatusCodeDescription
400MISSING_SPENDLIL_KEYX-SpendLil-Key header not provided
400MISSING_AUTHNo provider auth header (Authorization / x-api-key / x-goog-api-key)
400UNKNOWN_PROVIDERGateway subdomain does not match a supported provider
401INVALID_SPENDLIL_KEYSpendLil account not found for this key
403ACCOUNT_INACTIVESpendLil account is suspended or cancelled
502PROVIDER_ERRORCould not connect to the AI provider