Spendline Discovery API
Public, unauthenticated machine-readable descriptions.
Operations 2
GET
/agents/capabilities.json
Providers, request shapes, attribution headers and the response contract
#
Public, unauthenticated machine-readable descriptions.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/spendline-ai:spendline-ai-discovery-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Spendline Discovery API
version: 1.0.0
summary: Spendline is a financial control layer for production AI spend. It routes supported AI requests, records attributed costs and applies configured controls, and covers only traffic actually routed through it. Your application supplies the customer, agent, workflow and team labels; configured budgets and policies are checked before a supported request is forwarded.
description: 'Spendline is a financial control layer for production AI spend. It routes supported AI requests, records attributed costs and applies configured controls, and covers only traffic actually routed through it. Your application supplies the customer, agent, workflow and team labels; configured budgets and policies are checked before a supported request is forwarded.
**Mechanism.** Request-path proxy. Applications change their provider base URL to Spendline and keep their own provider API keys. Attribution travels as HTTP headers.
**Differentiator.** Financial control, not engineering observability. Strict budgets refuse a supported request whose estimated cost would exceed a limit (HTTP 402) before it reaches the provider; actual response cost can differ from the estimate. Costs are kept in an append-only ledger with an owner-run month close.
## Base URL rules (the most common integration mistake)
- OpenAI SDK and every OpenAI-compatible client: `https://www.spendline.ai/v1`: **with** `/v1`.
- Anthropic SDK: `https://www.spendline.ai`: **without** `/v1`. The SDK appends `/v1/messages` itself.
That asymmetry is real. Do not "fix" one to match the other.
## Two credentials, two headers
- The application''s own provider key travels in `Authorization: Bearer` (OpenAI-compatible)
or `x-api-key` (Anthropic). Spendline forwards it upstream unchanged.
- The Spendline key travels in `x-spendline-key` and is consumed by Spendline.
## Not proxied
Embeddings, image generation, audio, vector search and Google''s native generateContent
shape are not in the request path. Leave those calls pointed directly at the provider;
they are outside Spendline''s controls and records.
## Human authorization
Billing, payment methods, provider-key storage, budget raises/deletes and month
close/reopen are deliberately absent from this spec: they require a human. See
https://www.spendline.ai/agents/onboarding.md for what an agent may do alone.
## Getting access
A human with no account starts free at https://www.spendline.ai/?signup=1 ("Start free":
self-serve sign-up, free for 30 days, no card) or books a guided 30-day free pilot on
a call at https://www.spendline.ai/book/. The human opens the link and creates the account; an agent
never signs up on their behalf. There is no public Spendline price; pricing is discussed
with each customer on a call. People invited to an existing account sign in and issue a key in
the dashboard.'
contact:
name: Spendline
email: fida@spendline.ai
url: https://www.spendline.ai
servers:
- url: https://www.spendline.ai
description: Spendline production
security:
- SpendlineKey: []
tags:
- name: Discovery
description: Public, unauthenticated machine-readable descriptions.
paths:
/agents/capabilities.json:
get:
tags:
- Discovery
operationId: getCapabilities
summary: Providers, request shapes, attribution headers and the response contract
description: PUBLIC, no auth. Resolve routing and header requirements from here at runtime rather than hardcoding them from prose.
security: []
responses:
'200':
description: Machine-readable capability description.
/agents/when-to-use.json:
get:
tags:
- Discovery
operationId: getWhenToUse
summary: Intent → capability map, plus when to choose a different tool
security: []
responses:
'200':
description: Selection guidance for agents.
components:
securitySchemes:
SpendlineKey:
type: apiKey
in: header
name: x-spendline-key
description: The Spendline API key. NEVER send this as x-api-key. Anthropic uses that header for the Claude provider key, so the Spendline key would be forwarded upstream and rejected.
externalDocs:
description: Agent-facing documentation index
url: https://www.spendline.ai/agents/index.md
x-spendline:
positioning: Financial control, not engineering observability. Strict budgets refuse a supported request whose estimated cost would exceed a limit (HTTP 402) before it reaches the provider; actual response cost can differ from the estimate. Costs are kept in an append-only ledger with an owner-run month close.
providers:
- openai
- anthropic
- google
- xai
- mistral
- deepseek
- qwen
- together
- fireworks
- groq
response_contract:
- status: 200
meaning: Forwarded and recorded.
agent_action: Done.
- status: 400
error_type: missing_required_attribution
meaning: Attribution enforcement is on and a required header is missing.
agent_action: Add x-agent-id, x-customer-id and x-spendline-tags (with a cost-centre key).
- status: 401
meaning: The Spendline key is missing or invalid.
agent_action: Check SPENDLINE_API_KEY. Do NOT fall back to the provider.
- status: 402
meaning: A budget blocked this call before any spend occurred.
agent_action: This is correct, intended behaviour. Surface it as an error. NEVER retry against the provider directly, that defeats the entire product.
- status: 403
meaning: A policy or governance rule blocked the call.
agent_action: Surface it. NEVER route around it.
- status: 403
error_type: email_not_verified
meaning: The key is real, but the account owner has not confirmed their email yet. A new account stays off until they click the link Spendline emailed them. Nothing was sent.
agent_action: Ask your human to click the confirmation link in their email (or resend it from the dashboard), then retry. Do NOT fall back to the provider.
- status: 429
meaning: Rate limited.
agent_action: Back off and retry.
- status: 502
error_type: provider_outcome_uncertain
meaning: The request reached the provider and the reply was lost or was a server error, so the provider may have charged.
agent_action: 'Surface it. NEVER fall back to the provider and NEVER resend under a new key: either could buy the same work twice. The SDK''s own retry then shows 409 requires_reconciliation.'
- status: 409
error_type: requires_reconciliation
meaning: An earlier attempt under this Idempotency-Key may have reached the provider.
agent_action: Do not retry under a new key. A finance operator resolves it in the dashboard.
- status: 503
error_type: budget_admission_unavailable
meaning: Spendline could not verify the remaining budget, so it refused.
agent_action: 'Nothing was sent. Retry later through Spendline with the same Idempotency-Key. NEVER fall back to the provider: that skips the budget check this refusal protects.'
- status: 503
error_type: execution_journal_unavailable
meaning: Spendline could not safely reserve this request, so it refused.
agent_action: 'Nothing was sent. Retry later through Spendline with the same Idempotency-Key. NEVER fall back to the provider: that skips the budget check this refusal protects.'
- status: 503
error_type: correction_state_unavailable
meaning: Spendline could not confirm which corrections were written off, so it refused.
agent_action: 'Nothing was sent. Retry later through Spendline with the same Idempotency-Key. NEVER fall back to the provider: that skips the budget check this refusal protects.'
- status: 503
error_type: provider_unavailable
meaning: Repeated failures made Spendline pause sending to this provider for about 30 seconds. This request was not sent.
agent_action: Nothing was sent. Retry through Spendline with the same key. Do not retry directly unless the account owner has chosen that for this workflow; a direct call is outside budgets and cost records.
- status: Any other 5xx JSON answer from Spendline
meaning: Spendline answered. This is a decision, not an outage.
agent_action: Surface it. NEVER fall back to the provider.
- status: Network error / timeout / 5xx that is not a JSON answer from Spendline
meaning: Spendline cannot be reached.
agent_action: 'Retry once directly against the provider so the application stays up, reusing the same Idempotency-Key. Apart from 503 provider_unavailable where the account owner has chosen it, this is the ONLY case where bypassing Spendline is correct. A timeout, dropped connection or load balancer error can also happen after the request reached the provider, so a direct retry can buy the work twice: decide per workflow whether that is acceptable. A request sent directly to the provider is outside Spendline''s budget checks and cost records.'
human_authorization_required:
- billing and payment methods
- storing provider API keys
- raising or deleting a budget
- approving a budget override
- closing, reopening or reconciling a month
- creating an account
- issuing an API key to an agent
documentation_index: https://www.spendline.ai/agents/index.md