modelspec-dev Credits API
The Credits API from modelspec-dev — 1 operation(s) for credits.
The Credits API from modelspec-dev — 1 operation(s) for credits.
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-credits-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 Credits 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: Credits
paths:
/v1/credits:
get:
operationId: credits
summary: The credit balance for the presented API key
x-modelspec-probe: skip
responses:
'200':
description: The holder's available and reserved units.
content:
application/json:
schema:
$ref: '#/components/schemas/CreditsBalance'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'401':
description: 'missing_holder: an active live API key is required; sandbox keys have no live balance.'
content:
application/json:
schema:
$ref: '#/components/schemas/CreditsRefused'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'403':
description: 'missing_holder: the presented key is inactive.'
content:
application/json:
schema:
$ref: '#/components/schemas/CreditsRefused'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'503':
description: 'credits_store_not_configured: credit account authentication or the credit ledger is unavailable.'
content:
application/json:
schema:
$ref: '#/components/schemas/CreditsRefused'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
'404':
description: No endpoint at that path. `error.accepted` names the versioned paths.
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/credits takes GET.
content:
application/json:
schema:
$ref: '#/components/schemas/TransportError'
headers:
Link:
$ref: '#/components/headers/AgentGuide'
x-modelspec-guide-version:
$ref: '#/components/headers/AgentGuideVersion'
tags:
- Credits
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:
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
CreditsBalance:
type: object
required:
- available
- endpoint
- grants
- holder
- monthly
- packs
- reserved
- result
- schema_version
- service_commit
- total
- unit
- x402_enabled
properties:
available:
type: integer
endpoint:
type: string
grants:
type: array
items: {}
holder:
type: string
monthly:
type: integer
packs:
type: integer
reserved:
type: integer
result:
type: array
items: {}
schema_version:
type: string
service_commit:
type: string
total:
type: integer
unit:
type: string
x402_enabled:
type: boolean
CreditsRefused:
type: object
required:
- schema_version
- error
- result
properties:
schema_version:
type: string
service_commit:
type: string
error:
type: object
properties:
code:
type: string
enum:
- credits_store_not_configured
- missing_holder
docs:
type: string
how_to_get_a_key:
type: string
limit:
type: integer
message:
type: string
remaining:
type: integer
resets_at:
type: string
retry_after_seconds:
type: integer
sandbox:
type: string
scope:
type: string
tier:
type: string
upgrade:
type: string
used:
type: integer
window:
type: string
window_seconds:
type: integer
windows:
type: array
items:
$ref: '#/components/schemas/Sharedddf01cbae5c7'
required:
- code
- message
result:
type: array
items: {}
maxItems: 0
Sharedddf01cbae5c7:
properties:
limit:
type: integer
remaining:
type: integer
resets_at:
type: string
retry_after_seconds:
type: integer
scope:
type: string
used:
type: integer
window:
type: string
window_seconds:
type: integer
required:
- limit
- remaining
- resets_at
- retry_after_seconds
- scope
- used
- window
- window_seconds
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:
- POST /v1/rank
timezone: UTC
tiers:
dpf:
daily_limit: null
burst_limit_per_minute: null
live_data: true
description: 'Unlimited, and deliberately on the same handler as a paid key: null limits, not a bypass.'
free:
daily_limit: 10
burst_limit_per_minute: 5
live_data: true
description: Live rankings. Enough for a genuine decision, not for a build loop. No determinations.
friends:
daily_limit: null
burst_limit_per_minute: 60
live_data: true
description: 'Friends and family: live paid access without credit charges. No daily limit; the paid tier''s burst cap applies. Usage is recorded.'
paid:
daily_limit: null
burst_limit_per_minute: 60
live_data: true
description: 'Funded key: paid answer including determinations. No daily limit; burst is configuration. Entitlement follows remaining credits, not this flag alone.'
sandbox:
daily_limit: null
burst_limit_per_minute: null
live_data: false
description: Fixed, obviously synthetic results. Unlimited, no signup, no live data.
refusals:
access_not_configured: 500
access_store_not_configured: 503
invalid_api_key: 401
key_revoked: 403
missing_api_key: 401
rate_limited: 429
sandbox_not_available: 400
tier_not_configured: 500
documented_in: docs/api-access.md
x-modelspec-billing:
status: wired; enabled
ticket: MODEL-93
enabled: true
switch: BILLING_ENABLED in api/worker/wrangler.jsonc
unit: credit
what_is_sold: 'credits on this API key: a monthly allowance that resets each paid invoice (no rollover), and/or pack credits that expire 12 months after purchase. A funded key receives the paid answer, including cited commercial-use and data-residency determinations. Only successful results draw credits.'
documented_in: docs/billing.md
x-modelspec-x402:
wired: true
enabled: true
mainnet: true
network: eip155:8453
per_credit_atomic: 20000
keyless_price_rule: 20000 atomic USDC per endpoint credit
packs:
- name: 250-credit pack
credits: 250
usd: 5
atomic: 5000000
- name: 1,300-credit pack
credits: 1300
usd: 25
atomic: 25000000
- name: 2,750-credit pack
credits: 2750
usd: 50
atomic: 50000000
- name: 6,000-credit pack
credits: 6000
usd: 100
atomic: 100000000
facilitator: https://api.cdp.coinbase.com/platform
docs: docs/x402.md