Own AI key prices API
Model prices for your own AI keys: see them, and type or remove a price the provider does not publish.
Endpoints
/api/v1/ownKeyPrices/listList the model prices kept for this workspace's own AI keys: those a person typed and those the provider itself publishes. Param: llmKeyId (optional: one key only). Returns { prices: [{ id, llmKeyId, provider, keyLabel, providerModelId, source ("typed" or "provider"), inputPricePerMillionTokens, outputPricePerMillionTokens, cachedInputPricePerMillionTokens, cacheWritePricePerMillionTokens (null = charged at the input price), pricedAt, updatedAt }] }, in dollars per million tokens. When a key has both for one model, the provider's price is the one used. Who may: the people allowed to manage the workspace's AI keys, from the dashboard, their AI chat, their AI client or an API key; agents, functions and flows are refused. Only reads.
Parameters
llmKeyId | string |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/ownKeyPrices/list \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"llmKeyId": "example"
}'/api/v1/ownKeyPrices/setType the prices of one model on one of this workspace's own AI keys, used when the provider publishes none (a dollar spend limit counts a run at these prices). Params: llmKeyId (the id of one of the workspace's own AI keys, as ownKeyPrices_list shows it for a key that already has prices; the AI keys themselves are listed only in the dashboard), providerModelId (the model id exactly as the key's model list names it, 1 to 200 characters), inputPricePerMillionTokens and outputPricePerMillionTokens (dollars per million tokens, above 0), cachedInputPricePerMillionTokens and cacheWritePricePerMillionTokens (optional, above 0; left out = the input price; the cached price can't be above the input price). A second set for the same key and model replaces its typed prices. At most 500 typed prices per workspace. From an AI the change is never made at once: the answer is { applied: false, pendingChange } and nothing changes until the person allows it on the card in the Serenities dashboard; tell them it waits for their OK (pendingChanges_status says what became of it). Who may: the people allowed to manage the workspace's AI keys, from the dashboard, their AI chat, their AI client or an API key; agents, functions and flows are refused.
Parameters
llmKeyId | stringrequired | |
providerModelId | stringrequired | |
inputPricePerMillionTokens | numberrequired | |
outputPricePerMillionTokens | numberrequired | |
cachedInputPricePerMillionTokens | numbernull | |
cacheWritePricePerMillionTokens | numbernull |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/ownKeyPrices/set \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"llmKeyId": "example",
"providerModelId": "example",
"inputPricePerMillionTokens": 0
}'/api/v1/ownKeyPrices/removeRemove the typed prices of one model on one of this workspace's own AI keys (prices the provider publishes are never removed here). Params: llmKeyId, providerModelId. Afterwards that model on that key has no typed price; a price the provider publishes still counts. From an AI the change is never made at once: the answer is { applied: false, pendingChange } and nothing changes until the person allows it on the card in the Serenities dashboard; tell them it waits for their OK (pendingChanges_status says what became of it). Who may: the people allowed to manage the workspace's AI keys, from the dashboard, their AI chat, their AI client or an API key; agents, functions and flows are refused. Act only on what the person named or picked.
Parameters
llmKeyId | stringrequired | |
providerModelId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/ownKeyPrices/remove \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"llmKeyId": "example",
"providerModelId": "example"
}'