Credits
Credits your product draws down by agentKey, priced from a model bundle. Nothing is deleted — archive instead.
Base URL https://payments.clocknext.com/api/v1
Lists your credits. Pass active=true for active ones only.
apiKeyAuthorizationBearer <cnk_…>Organisation-scoped key from Settings → API Keys.
active?booleantrue returns only active credits.
Credits.
application/json- response
statusCode*integerThe HTTP status code of the response, repeated in the body.
statusDetail*The status of the request. status is SUCCESS, and message says what happened.
result*The workspace's credits.
curl -X GET 'https://payments.clocknext.com/api/v1/credits?active=true'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "Request processed successfully." }, "result": { "credits": [ { "id": "cmvgvfdp2000708l2vd8r110d", "name": "Code Review", "agentKey": "code_review", "description": "Updated 2026-10-20 — credit description", "basePrice": 0.1078125, "modelBundle": [ { "modelId": "gpt-4o", "modelName": "GPT-4o", "input": 70, "output": 25, "cache": 5, "cacheWrite": 0, "averageTokensPerLLMCall": 25000 } ], "marginPercent": 35, "pricePerCredit": 0.145546875, "isActive": true, "createdAt": "2026-10-20T16:01:47.030Z", "updatedAt": "2026-10-20T16:05:13.842Z" }, { "id": "cmvgvfdfz000608l2wsff83hq", "name": "Deep Research", "agentKey": "deep_research", "description": "One multi-source research query", "basePrice": 0.67985, "modelBundle": [ { "modelId": "claude-sonnet-4-5", "modelName": "Claude Sonnet 4.5 (latest)", "input": 60, "output": 30, "cache": 5, "cacheWrite": 5, "averageTokensPerLLMCall": 100000 }, { "modelId": "gemini-2.5-flash", "modelName": "Gemini 2.5 Flash", "input": 80, "output": 20, "cache": 0, "cacheWrite": 0, "averageTokensPerLLMCall": 40000 } ], "marginPercent": 25, "pricePerCredit": 0.8498125, "isActive": true, "createdAt": "2026-10-20T16:01:46.703Z", "updatedAt": "2026-10-20T16:01:46.703Z" }, { "id": "cmvgvfd63000508l2oexbgpzs", "name": "Chat Message", "agentKey": "chat_message", "description": "One assistant reply in the in-app chat", "basePrice": 0.000855, "modelBundle": [ { "modelId": "gpt-4o-mini", "modelName": "GPT-4o mini", "input": 70, "output": 30, "cache": 0, "cacheWrite": 0, "averageTokensPerLLMCall": 3000 } ], "marginPercent": 40, "pricePerCredit": 0.001197, "isActive": true, "createdAt": "2026-10-20T16:01:46.347Z", "updatedAt": "2026-10-20T16:01:46.347Z" } ] }}Base URL https://payments.clocknext.com/api/v1
Creates a credit. Its price is worked out from modelBundle.
apiKeyAuthorizationBearer <cnk_…>Organisation-scoped key from Settings → API Keys.
application/json- body
A new credit. Keys use letters, digits, ., _ and - (at most 80) and match exactly. The price per credit is the modelBundle base price × (1 + marginPercent / 100); you never send a price.
name*stringThe credit's name. Must be unique in the workspace, ignoring case (409 if taken).
1 <= length <= 80agentKey*stringThe key a credit signal names. Unique among your credits (409 if taken).
^[A-Za-z0-9._-]+$1 <= length <= 80description?|Optional note about the credit. An empty string is saved as null.
length <= 400marginPercent*numberMarkup on the base price, in percent. -100 makes the credit free.
-100 <= valuemodelBundle*array<>The models and token mix that the server prices the credit from, one line per model.
1 <= itemsCredit created.
application/json- response
statusCode*integerThe HTTP status code of the response, repeated in the body.
statusDetail*The status of the request. status is SUCCESS, and message says what happened.
result*The new credit.
curl -X POST 'https://payments.clocknext.com/api/v1/credits' \ -H 'Content-Type: application/json' \ -d '{ "name": "Deep Research", "agentKey": "deep_research", "description": "One multi-source research query", "marginPercent": 25, "modelBundle": [ { "modelId": "claude-sonnet-4-5", "averageTokensPerLLMCall": 100000, "input": 60, "output": 30, "cache": 5, "cacheWrite": 5 }, { "modelId": "gemini-2.5-flash", "averageTokensPerLLMCall": 40000, "input": 80, "output": 20, "cache": 0, "cacheWrite": 0 } ]}'{ "statusCode": 201, "statusDetail": { "status": "SUCCESS", "message": "Credit created." }, "result": { "created": true, "credit": { "id": "cmvgvfdfz000608l2wsff83hq", "name": "Deep Research", "agentKey": "deep_research", "description": "One multi-source research query", "basePrice": 0.67985, "modelBundle": [ { "modelId": "claude-sonnet-4-5", "modelName": "Claude Sonnet 4.5 (latest)", "input": 60, "output": 30, "cache": 5, "cacheWrite": 5, "averageTokensPerLLMCall": 100000 }, { "modelId": "gemini-2.5-flash", "modelName": "Gemini 2.5 Flash", "input": 80, "output": 20, "cache": 0, "cacheWrite": 0, "averageTokensPerLLMCall": 40000 } ], "marginPercent": 25, "pricePerCredit": 0.8498125, "isActive": true, "createdAt": "2026-10-20T16:01:46.703Z", "updatedAt": "2026-10-20T16:01:46.703Z" } }}Base URL https://payments.clocknext.com/api/v1
Updates only the fields you send. Send modelBundle to re-price.
apiKeyAuthorizationBearer <cnk_…>Organisation-scoped key from Settings → API Keys.
id*stringCredit id.
application/json- body
Only the fields you send change. Keys use letters, digits, ., _ and - (at most 80) and match exactly. Leave modelBundle out, or send [], to keep the saved bundle and price.
name?stringA new name. Must be unique in the workspace, ignoring case (409 if taken).
1 <= length <= 80agentKey?stringA new key for credit signals. Unique among your credits (409 if taken).
^[A-Za-z0-9._-]+$1 <= length <= 80description?|A new note. Send null to clear it.
length <= 400marginPercent?numberA new markup, in percent, down to -100. Without a new modelBundle, it applies to the saved base price.
-100 <= valuemodelBundle?array<>The complete new bundle. A non-empty list prices the credit again at today's model prices.
Credit updated.
application/json- response
statusCode*integerThe HTTP status code of the response, repeated in the body.
statusDetail*The status of the request. status is SUCCESS, and message says what happened.
result*The updated credit.
curl -X PATCH 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1' \ -H 'Content-Type: application/json' \ -d '{ "marginPercent": 35}'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "Credit updated." }, "result": { "updated": true, "credit": { "id": "cmvgvfdp2000708l2vd8r110d", "name": "Code Review", "agentKey": "code_review", "description": "Updated 2026-10-20 — credit description", "basePrice": 0.0984375, "modelBundle": [ { "modelId": "gpt-4o", "modelName": "GPT-4o", "input": 75, "output": 20, "cache": 5, "cacheWrite": 0, "averageTokensPerLLMCall": 25000 } ], "marginPercent": 35, "pricePerCredit": 0.132890625, "isActive": true, "createdAt": "2026-10-20T16:01:47.030Z", "updatedAt": "2026-10-20T16:05:13.499Z" } }}Base URL https://payments.clocknext.com/api/v1
Gets one credit.
apiKeyAuthorizationBearer <cnk_…>Organisation-scoped key from Settings → API Keys.
id*stringCredit id.
The credit.
application/json- response
statusCode*integerThe HTTP status code of the response, repeated in the body.
statusDetail*The status of the request. status is SUCCESS, and message says what happened.
result*The credit with this id, in credit.
curl -X GET 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "Request processed successfully." }, "result": { "credit": { "id": "cmvgvfdp2000708l2vd8r110d", "name": "Code Review", "agentKey": "code_review", "description": "Updated 2026-10-20 — credit description", "basePrice": 0.0984375, "modelBundle": [ { "modelId": "gpt-4o", "modelName": "GPT-4o", "input": 75, "output": 20, "cache": 5, "cacheWrite": 0, "averageTokensPerLLMCall": 25000 } ], "marginPercent": 30, "pricePerCredit": 0.12796875, "isActive": true, "createdAt": "2026-10-20T16:01:47.030Z", "updatedAt": "2026-10-20T16:03:01.282Z" } }}Base URL https://payments.clocknext.com/api/v1
Archives a credit. Nothing is deleted.
apiKeyAuthorizationBearer <cnk_…>Organisation-scoped key from Settings → API Keys.
id*stringCredit id.
Credit archived.
application/json- response
statusCode*integerThe HTTP status code of the response, repeated in the body.
statusDetail*The status of the request. status is SUCCESS, and message says what happened.
result*The archived credit.
curl -X POST 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1/archive'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "Credit archived." }, "result": { "archived": true, "credit": { "id": "cmvgvfdp2000708l2vd8r110d", "name": "Code Review", "agentKey": "code_review", "description": "Updated 2026-10-20 — credit description", "basePrice": 0.0984375, "modelBundle": [ { "modelId": "gpt-4o", "modelName": "GPT-4o", "input": 75, "output": 20, "cache": 5, "cacheWrite": 0, "averageTokensPerLLMCall": 25000 } ], "marginPercent": 30, "pricePerCredit": 0.12796875, "isActive": false, "createdAt": "2026-10-20T16:01:47.030Z", "updatedAt": "2026-10-20T16:04:45.355Z" } }}Base URL https://payments.clocknext.com/api/v1
Restores an archived credit.
apiKeyAuthorizationBearer <cnk_…>Organisation-scoped key from Settings → API Keys.
id*stringCredit id.
Credit unarchived.
application/json- response
statusCode*integerThe HTTP status code of the response, repeated in the body.
statusDetail*The status of the request. status is SUCCESS, and message says what happened.
result*The restored credit.
curl -X POST 'https://payments.clocknext.com/api/v1/credits/cr_8f2k1/unarchive'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "Credit restored." }, "result": { "unarchived": true, "credit": { "id": "cmvgvfdp2000708l2vd8r110d", "name": "Code Review", "agentKey": "code_review", "description": "Updated 2026-10-20 — credit description", "basePrice": 0.0984375, "modelBundle": [ { "modelId": "gpt-4o", "modelName": "GPT-4o", "input": 75, "output": 20, "cache": 5, "cacheWrite": 0, "averageTokensPerLLMCall": 25000 } ], "marginPercent": 30, "pricePerCredit": 0.12796875, "isActive": true, "createdAt": "2026-10-20T16:01:47.030Z", "updatedAt": "2026-10-20T16:04:46.067Z" } }}Types
Every object type on this page, with its fields.
Credit
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | The credit's id. |
name | string | yes | The credit's name. Unique in the workspace, ignoring case. |
agentKey | string | yes | Unique key a credit signal names. |
description | string | null | yes | Optional note about the credit. null when not set. |
basePrice | number | yes | Cost of one credit. |
modelBundle | ModelBundleLine[] | yes | The models and token mix that basePrice comes from, one line per model. |
marginPercent | number | yes | Markup on basePrice in percent: pricePerCredit = basePrice × (1 + marginPercent / 100). Down to -100. |
pricePerCredit | number | yes | Base price plus margin. |
isActive | boolean | yes | false once archived. |
createdAt | string | yes | When the credit was created. |
updatedAt | string | yes | When the credit was last changed. |
ModelBundleLine
One model in the mix of a credit or outcome step. input, output, cache and cacheWrite are whole percentages of averageTokensPerLLMCall that add up to 100.
| Field | Type | Required | Description |
|---|---|---|---|
modelId | string | null | yes | The model's id, as sent in usage.model. null when the model was removed after the bundle was saved. |
modelName | string | yes | Model name. |
averageTokensPerLLMCall | number | yes | Average tokens per LLM call. |
input | integer | yes | Input share (%). |
output | integer | yes | Output share (%). |
cache | integer | yes | Cache-read share (%). |
cacheWrite | integer | yes | Cache-write share (%). |
CreateCreditInput
A new credit. Keys use letters, digits, ., _ and - (at most 80) and match exactly. The price per credit is the modelBundle base price × (1 + marginPercent / 100); you never send a price.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | The credit's name. Must be unique in the workspace, ignoring case (409 if taken). |
agentKey | string | yes | The key a credit signal names. Unique among your credits (409 if taken). |
description | string | null | no | Optional note about the credit. An empty string is saved as null. |
marginPercent | number | yes | Markup on the base price, in percent. -100 makes the credit free. |
modelBundle | ModelBundleLineInput[] | yes | The models and token mix that the server prices the credit from, one line per model. |
ModelBundleLineInput
One model in the mix of a credit or outcome step. input, output, cache and cacheWrite are whole percentages of averageTokensPerLLMCall that add up to 100. cacheWrite is 0 when the model has no cache-write price.
| Field | Type | Required | Description |
|---|---|---|---|
modelId | string | yes | A model id enabled in your workspace — the id you send as usage.model. An archived model is refused (400). |
averageTokensPerLLMCall | number | yes | Average tokens one LLM call to this model uses. Must be above 0. The four shares split these tokens. |
input | integer | yes | Input-token share of averageTokensPerLLMCall: a whole percent, 0 to 100. |
output | integer | yes | Output-token share of averageTokensPerLLMCall: a whole percent, 0 to 100. |
cache | integer | yes | Cache-read share of averageTokensPerLLMCall: a whole percent, 0 to 100. |
cacheWrite | integer | no | Cache-write share: a whole percent, 0 to 100. 0 when the model has no cache-write price. |
UpdateCreditInput
Only the fields you send change. Keys use letters, digits, ., _ and - (at most 80) and match exactly. Leave modelBundle out, or send [], to keep the saved bundle and price.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | A new name. Must be unique in the workspace, ignoring case (409 if taken). |
agentKey | string | no | A new key for credit signals. Unique among your credits (409 if taken). |
description | string | null | no | A new note. Send null to clear it. |
marginPercent | number | no | A new markup, in percent, down to -100. Without a new modelBundle, it applies to the saved base price. |
modelBundle | ModelBundleLineInput[] | no | The complete new bundle. A non-empty list prices the credit again at today's model prices. |
Packages
Extra entitlements for one price, added to a customer's subscription. A package is always paid in advance. Added as `RECURRING` (the default), it renews with the subscription on its plan's billing cycle until it is removed; added as `ONE_TIME`, it is billed and granted once. It has no billing cycle, billing mode or rollover of its own. It holds credits, outcomes, units, composites and, once at most, wallet money for the customer's Main wallet. Each entitlement must be on the customer's plan as advance (wallet money: an advance wallet). `flatFee` is deprecated: put the fee in the package price. Nothing is deleted — archive instead. Add and remove packages with the [Subscriptions](/docs/api-reference/subscriptions/addSubscriptionPackages) routes. See [Packages](/docs/documentation/packages).
Outcomes
Multi-step deliverables billed per completed outcome. Nothing is deleted — archive instead.