curl --request GET \
--url https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/conversations/{contextId}/usage \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/conversations/{contextId}/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/conversations/{contextId}/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"context_id": "<string>",
"agent_id": "<string>",
"title": "<string>",
"totals": {
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"tokens_total": 123,
"cost": 123,
"carbon": 123
},
"by_model": [
{
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"tokens_total": 123,
"cost": 123,
"carbon": 123,
"model": "<string>"
}
],
"meta": {
"source": "tasks",
"messages_count": 123,
"generated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Usage totals for one conversation
Tokens, cost, carbon and message count for one conversation,
aggregated from each turn’s task.metadata.usage (the same source
as the per-message usage shown in chat, so per-message lines always
sum to these totals). Broken down per model in by_model, an array
because model names contain dots.
Self-scoped: a user only reads their own conversation. Privileged and trusted-monitoring callers may read any user’s conversation of this agent. At most 500 turns are aggregated.
curl --request GET \
--url https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/conversations/{contextId}/usage \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/conversations/{contextId}/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/{agentId}/conversations/{contextId}/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"context_id": "<string>",
"agent_id": "<string>",
"title": "<string>",
"totals": {
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"tokens_total": 123,
"cost": 123,
"carbon": 123
},
"by_model": [
{
"messages": 123,
"tokens_input": 123,
"tokens_output": 123,
"tokens_total": 123,
"cost": 123,
"carbon": 123,
"model": "<string>"
}
],
"meta": {
"source": "tasks",
"messages_count": 123,
"generated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Authorizations
User-bound credential carrying an identity: either a session JWT
or a user access token (at:*) generated from the user settings UI.
Send as Authorization: Bearer <token>.
Org API keys (iak_*) are not accepted here - they carry
no user identity. Use the x-prismeai-api-key header instead
(see OrgApiKeyAuth).
Path Parameters
6464Response
Conversation usage totals.
Hide child attributes
Hide child attributes
Turns that carried usage (one per assistant turn with an LLM call).
Global warming potential of the turns (from usage.carbon.gwp.value).
Was this page helpful?