proxy

OpenAI-compatible chat completions, governed and recorded

Set the OpenAI SDK baseURL/base_url to https://www.spendline.ai/v1. WITH /v1. The SDK appends /chat/completions itself.

Providers reachable on this shape: openai, google, xai, mistral, deepseek, qwen, together, fireworks, groq. The model name selects the provider (gpt-* → OpenAI, gemini-* → Google, grok-* → xAI, mistral-* → Mistral, …).

Streaming is supported. Request/response bodies are the provider's own. Spendline does not reshape them.

post/v1/chat/completions

Request

  • Base URL: https://www.spendline.ai
  • URL: https://www.spendline.ai/v1/chat/completions
  • Auth: API key in header x-spendline-key

Headers

Authorizationstring required

The application's OWN provider key, as Bearer <key>. Forwarded upstream.

x-agent-idstring

Stable name of the bot/agent/feature making the call, e.g. support-bot. One per agent. Not per request. Required when attribution enforcement is enabled.

x-customer-idstring

The end customer this request is billable to. PER REQUEST. A hardcoded value makes per-customer cost attribution useless, thread it from request context. Required when attribution enforcement is enabled.

x-spendline-tagsstring

JSON object that must include a cost-centre key: one of cost_center, costCenter, department, or team. Example: {"team":"support","env":"prod"} Per call site or per request. Required when attribution enforcement is enabled.

x-workflow-idstring

Groups a multi-step run.

x-step-namestring

Labels a step within a workflow.

x-source-routestring

The application route that triggered the call.

Request body

modelstring required

Selects the provider. See /agents/providers.md.

messagesobject[] required
streamboolean
max_tokensinteger

Also used to project pre-call cost for budget enforcement. A realistic value makes enforcement more accurate.

Response

Provider response, passed through unchanged. The call is recorded in the ledger.

Changes

No recorded changes to this operation across all 1 revision of this API.