modelspec-dev Billing API
The Billing API from modelspec-dev — 4 operation(s) for billing.
The Billing API from modelspec-dev — 4 operation(s) for billing.
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/modelspec-dev:modelspec-dev-billing-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: ModelSpec Billing API
version: '2.0'
summary: Decides which AI models fit a job from your requirements, sourced evidence and real cost, and checks them against a compliance policy.
description: 'Start with the compact agent guide https://modelspec.dev/agents.md (version 1-d71e83841e122452). Call decide early with a template-based Spec; refine from reading and recovery hints.
Use when choosing, switching, or checking a model before a task or deploy. POST /v1/decide takes your requirements and returns the models that fit, with reasons, cost per task and ties; when nothing fits, it says what to relax. POST /v1/rank is deprecated: the retired fixed-benchmark ranking, kept for existing callers and never a fallback for decide. POST /v1/policy-check returns, per model and per platform, pass, fail or undetermined against a licence, origin, residency and commercial-use policy, citing the document behind each verdict. After you act on an answer, POST /v1/feedback with a rating (reliable, unreliable, trustworthy, untrustworthy, confusing) and its decision_id; no key.
One call, and no state on your side. Each answer is computed per request from the private bundled catalogue; `build.commit` on every response names the catalogue it was computed from. A request carries a profile or a policy — never a prompt.
Machine data access needs an API key (see x-modelspec-access). GET /v1/health and POST /v1/feedback stay keyless. The free decide page uses the human browser visit gate, with a Turnstile-verified visit token for decide and vocabulary when VISIT_GATE_ENABLED is on. Any key starting `test_` is the sandbox: unlimited, synthetic rows from the real scorer, /v1/rank only.
Without a paid entitlement, policy-check uses public-export evidence. Every check it cannot settle is `undetermined` with `why: tier`, and `determinations.undetermined_for_lack_of_entitlement` counts them. It is never a pass.
Any common HTTP client `User-Agent` works, including Python''s default (`Python-urllib/*`). A `403` with the non-JSON body `error code: 1010` is a refusal at the Cloudflare edge, not from this service. Report it.
Reference: docs/api.md and docs/api-policy-check.md. Generated from the implementation by api/worker/openapi.py.'
license:
name: MIT
url: https://github.com/turbobeest/modelspec
x-error-codes:
- access_not_configured
- access_store_not_configured
- comparison_snapshot_changed
- comparison_snapshot_unavailable
- credits_store_not_configured
- determinations_unavailable
- explanation_unavailable
- export_unavailable
- human_burst_limit
- human_challenge_required
- human_day_limit
- human_gate_unavailable
- human_intent_limit
- human_origin_required
- human_sweep_limit
- insufficient_evidence
- invalid_api_key
- invalid_request
- invalid_spec
- key_revoked
- method_not_allowed
- missing_api_key
- no_match
- no_snapshot
- not_found
- origin_not_allowed
- payload_too_large
- payment_required
- rate_limited
- sandbox_not_available
- snapshot_changed
- snapshot_not_loaded
- snapshot_refused
- snapshot_unavailable
- tier_not_configured
- undetermined_present
- unknown_hardware
- unknown_hosting
- unknown_model
- unknown_platform
- unknown_runtime
- unknown_use_case
- visit_token_expired
- visit_token_invalid
x-transport-error-statuses:
export_unavailable: 502
human_burst_limit: 429
human_challenge_required: 403
human_day_limit: 429
human_gate_unavailable: 503
human_intent_limit: 429
human_origin_required: 401
human_sweep_limit: 429
method_not_allowed: 405
not_found: 404
origin_not_allowed: 404
visit_token_expired: 401
visit_token_invalid: 401
x-max-request-bytes:
/v1/rank: 16384
/v1/decide: 65536
/v1/compare: 65536
/v1/compare-models: 65536
/v1/hardware-fit: 65536
/v1/policy-check: 262144
/v1/signals: 4096
/v1/signals/discovered: 4096
/v1/feedback: 4096
servers:
- url: https://api.modelspec.dev
description: production
security:
- bearer: []
- apiKey: []
tags:
- name: Billing
paths:
/v1/billing/checkout:
post:
operationId: billingCheckout
summary: Create a Stripe-hosted Checkout Session for a plan or pack
description: 'Redirect the browser to `url`. `price_id` is required; omitted is 400 naming the valid ids, never a guessed purchase. A live key in `Authorization: Bearer` binds the payment to that key (fingerprint only, never the key): a pack ADDs credits, a plan attaches. Unknown or revoked key: 401, never anonymous. No key: claim mints one. A legacy or placeholder Price is refused with price_not_mapped, never sent to Stripe. BILLING_ENABLED off: 503 billing_not_enabled, before any call to Stripe. The flag gates this endpoint alone.
Form variant (MODEL-105): the buy buttons on https://modelspec.dev/pricing post `application/x-www-form-urlencoded` with one `price_id` field. A form post is answered 303 See Other with `Location:` the Stripe Checkout URL, so the browser goes straight to Stripe. It is always anonymous Checkout (any Authorization header is ignored; claim mints a new key); buying onto an existing key is the JSON call with the key presented. An unknown, legacy, or placeholder `price_id` is refused, never redirected, and every refusal is the JSON call''s own. A body that parses as JSON is the JSON call whatever its content type, so `curl -d ''{...}''` is unchanged.'
security:
- {}
- bearer: []
- apiKey: []
x-modelspec-probe: skip
requestBody:
required: false
content:
application/json:
schema:
type: object
additionalProperties: false
properties:
price_id:
type: string
example:
price_id: price_1UP22XBPydVRHUBjk9rrxOxN
application/x-www-form-urlencoded:
schema:
type: object
additionalProperties: false
required:
- price_id
properties:
price_id:
type: string
example:
price_id: price_1UP22XBPydVRHUBjk9rrxOxN
responses:
'200':
description: Hosted Checkout URL. Open it in a browser. The sample sells the current Solo row with its placeholder cleared; the shipped row is not for sale.
content:
application/json:
schema:
$ref: '#/components/schemas/Shared20a18378a7ba'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'303':
description: 'Form post only: See Other to the Stripe-hosted Checkout page. The body is the 200 envelope.'
content:
application/json:
schema:
$ref: '#/components/schemas/Shared20a18378a7ba'
headers:
Location:
description: The Stripe Checkout URL (the body's `url`).
schema:
type: string
format: uri
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'400':
description: Unknown field, or price_id omitted. The 400 names the valid Price ids.
content:
application/json:
schema:
type: object
required:
- endpoint
- error
- result
- schema_version
- service_commit
properties:
endpoint:
type: string
error:
type: object
required:
- code
- message
- valid_price_ids
properties:
code:
type: string
message:
type: string
valid_price_ids:
type: array
items:
type: string
result:
type: array
items: {}
schema_version:
type: string
service_commit:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'401':
description: A presented API key that is unknown or revoked. Never treated as anonymous.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'500':
description: 'price_not_mapped: the price_id is not in the tier table, or it is a legacy or placeholder Price. Refused, never redirected.'
content:
application/json:
schema:
type: object
required:
- endpoint
- error
- result
- schema_version
- service_commit
properties:
endpoint:
type: string
error:
type: object
required:
- code
- message
- price_id
properties:
code:
type: string
message:
type: string
price_id:
type: string
result:
type: array
items: {}
schema_version:
type: string
service_commit:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'503':
description: 'BILLING_ENABLED is off: no new purchase can start.'
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'404':
description: No endpoint at that path.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'405':
description: /v1/billing/checkout takes POST.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
tags:
- Billing
/v1/billing/stripe-webhook:
post:
operationId: billingStripeWebhook
summary: Stripe webhook. HMAC-SHA256 over t.payload; no SDK
security: []
x-modelspec-probe: skip
parameters:
- name: Stripe-Signature
in: header
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
responses:
'200':
description: Received. duplicate is true on a replay.
content:
application/json:
schema:
type: object
required:
- action
- duplicate
- endpoint
- event_id
- received
- schema_version
- service_commit
- type
properties:
action:
type: string
duplicate:
type: boolean
endpoint:
type: string
event_id:
type: string
received:
type: boolean
schema_version:
type: string
service_commit:
type: string
type:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'400':
description: Missing, wrong, or stale Stripe-Signature.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'503':
description: 'STRIPE_WEBHOOK_SECRET or the ACCESS store is not configured on this deployment. BILLING_ENABLED does not gate the webhook: refunds, disputes and renewals of past purchases apply with it off.'
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'404':
description: No endpoint at that path.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'405':
description: /v1/billing/stripe-webhook takes POST.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
tags:
- Billing
/v1/billing/claim:
get:
operationId: billingClaimGet
summary: Claim the purchase.
security: []
description: 'Stripe''s success redirect. HTML variant (MODEL-105): when `Accept` prefers `text/html` over JSON (a browser), the same outcome, status and facts come back as a static page (no script, nothing loaded, CSP `default-src ''none''`) that shows the key once and says to copy it now. `Accept` absent, `*/*`, `application/json`, or a tie: the JSON envelope, unchanged.'
parameters:
- name: session_id
in: query
required: true
schema:
type: string
responses:
'200':
description: The key, shown once (anonymous Checkout), or credits added to the bound key.
content:
application/json:
schema:
$ref: '#/components/schemas/Shared330abdaccb40'
text/html:
schema:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'400':
description: session_id missing.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
text/html:
schema:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'409':
description: Payment received, key not ready. Retry in a few seconds.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
text/html:
schema:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'410':
description: Already shown. Rotate if you still hold the key.
content:
application/json:
schema:
$ref: '#/components/schemas/Shared5bce56702b35'
text/html:
schema:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'503':
description: The ACCESS store is not bound on this deployment. BILLING_ENABLED does not gate this path.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
text/html:
schema:
type: string
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'404':
description: No endpoint at that path.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'405':
description: /v1/billing/claim takes GET or POST.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
tags:
- Billing
post:
operationId: billingClaimPost
summary: Claim the purchase (session_id in the JSON body). Same as GET
security: []
x-modelspec-probe: skip
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
session_id:
type: string
required:
- session_id
responses:
'200':
description: The key, shown once (anonymous Checkout), or credits added to the bound key.
content:
application/json:
schema:
$ref: '#/components/schemas/Shared330abdaccb40'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'400':
description: session_id missing.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'409':
description: Payment received, key not ready. Retry in a few seconds.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'410':
description: Already shown.
content:
application/json:
schema:
$ref: '#/components/schemas/Shared5bce56702b35'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'503':
description: The ACCESS store is not bound on this deployment. BILLING_ENABLED does not gate this path.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'404':
description: No endpoint at that path.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'405':
description: /v1/billing/claim takes GET or POST.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
tags:
- Billing
/v1/billing/rotate:
post:
operationId: billingRotate
summary: Issue a new key; revoke the one presented
x-modelspec-probe: skip
responses:
'401':
description: No current key presented.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'503':
description: The ACCESS store is not bound on this deployment. BILLING_ENABLED does not gate this path.
content:
application/json:
schema:
$ref: '#/components/schemas/Sharede25eeefc86ea'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'404':
description: No endpoint at that path.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'405':
description: /v1/billing/rotate takes POST.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
tags:
- Billing
components:
headers:
AgentGuide:
description: Compact agent guide.
schema:
type: string
const: <https://modelspec.dev/agents.md>; rel="describedby"
AgentGuideVersion:
description: Version of the byte-stable guide.
schema:
type: string
const: 1-d71e83841e122452
schemas:
Shared5bce56702b35:
properties:
endpoint:
type: string
error:
properties:
code:
type: string
key_id:
type: string
message:
type: string
tier:
type: string
required:
- code
- key_id
- message
- tier
type: object
result:
items: {}
type: array
schema_version:
type: string
service_commit:
type: string
required:
- endpoint
- error
- result
- schema_version
- service_commit
type: object
Shared20a18378a7ba:
properties:
applied_to:
type: string
credits:
type: integer
endpoint:
type: string
kind:
type: string
name:
type: string
placeholder:
type: boolean
price_id:
type: string
result:
items: {}
type: array
schema_version:
type: string
service_commit:
type: string
session_id:
type: string
terms_url:
type: string
tier:
type: string
url:
type: string
what_you_buy:
type: string
required:
- applied_to
- credits
- endpoint
- kind
- name
- placeholder
- price_id
- result
- schema_version
- service_commit
- session_id
- terms_url
- tier
- url
- what_you_buy
type: object
Sharede25eeefc86ea:
properties:
endpoint:
type: string
error:
type: object
required:
- code
- message
properties:
code:
type: string
message:
type: string
result:
items: {}
type: array
schema_version:
type: string
service_commit:
type: string
required:
- endpoint
- error
- result
- schema_version
- service_commit
type: object
TransportError:
type: object
required:
- schema_version
- error
- result
properties:
schema_version:
type: string
service_commit:
type: string
error:
type: object
required:
- code
- message
properties:
code:
type: string
enum:
- export_unavailable
- human_burst_limit
- human_challenge_required
- human_day_limit
- human_gate_unavailable
- human_intent_limit
- human_origin_required
- human_sweep_limit
- method_not_allowed
- not_found
- origin_not_allowed
- payload_too_large
- visit_token_expired
- visit_token_invalid
message:
type: string
accepted:
type: array
items:
type: string
result:
type: array
items: {}
maxItems: 0
Shared330abdaccb40:
properties:
applied_to:
type: string
credits:
type: integer
endpoint:
type: string
how:
type: string
key:
type: string
key_id:
type: string
kind:
type: string
message:
type: string
plan:
type: string
result:
items: {}
type: array
schema_version:
type: string
service_commit:
type: string
shown:
type: string
tier:
type: string
what_you_bought:
type: string
required:
- applied_to
- credits
- endpoint
- how
- key
- key_id
- kind
- message
- plan
- result
- schema_version
- service_commit
- shown
- tier
- what_you_bought
type: object
securitySchemes:
bearer:
type: http
scheme: bearer
description: 'Authorization: Bearer <key>. Takes precedence.'
apiKey:
type: apiKey
in: header
name: X-API-Key
description: 'X-API-Key: <key>. Never in the query string.'
signalHmac:
type: apiKey
in: header
name: X-ModelSpec-Signature
description: sha256=<HMAC-SHA256 of the exact request bytes>.
signalReadKey:
type: http
scheme: bearer
description: Repository-only key for pending and acknowledgement automation.
visitToken:
type: apiKey
in: header
name: X-ModelSpec-Visit-Token
description: Human browser credential from the Turnstile-verified visit gate. Bound to the visitor and allowed site origin; admits only decide and vocabulary. Machine callers use an API key.
x-modelspec-access:
status: wired; enforced
ticket: MODEL-69
enforced: true
switch: ACCESS_ENFORCED in api/worker/wrangler.jsonc
key_store_bound: true
effect_today: 'Every machine data endpoint needs an API key: a request without one is refused 401 missing_api_key, naming https://modelspec.dev/pricing. GET /v1/health and POST /v1/feedback stay keyless. The free decide page uses the human browser visit gate: with VISIT_GATE_ENABLED, a Turnstile-verified visit token admits only decide and vocabulary for its bound visitor and origin. The ACCESS key store is bound. Existing live keys are checked against it; test_ keys use the sandbox.'
policy_check_paid_entitlement:
status: granted to a presented key with remaining credits, or a credit-exempt paid tier
granted_by: entry.py::_entitlement
effect_today: 'Public-export evidence has determinations.entitlement public_export; checks they cannot settle come back undetermined with why: tier and available_in_tier: paid. A funded key reads the determinations, or gets HTTP 503 determinations_unavailable when the store cannot be read. A credit-exempt paid tier also reads the determinations without a balance. Other keys with zero credits get the public-export answer plus credits.exhausted.'
present_key_as:
- 'Authorization: Bearer <key>'
- 'X-API-Key: <key>'
never: a key in the query string
policy_version: access-v1
sandbox_prefix: test_
sandbox_endpoints:
# --- truncated at 32 KB (32 KB total) ---
# Full source: https://artifacts.apis.io/modelspec-dev/openapi/modelspec-dev-billing-api-openapi.yml