Get Session Usage
GET
/v1/openai-agents/sessions/{session-id}/usageGET
/v1/openai-agents/sessions/{session-id}/usageYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
session-id | path | string | Yes |
Responses
200 Success
| Property | Type | Description |
|---|---|---|
status | "reported" | "unavailable" | |
input_tokens | integer | |
output_tokens | integer | |
total_tokens | integer | |
updated_at | string | |
source | string |
400 Invalid request
| Property | Type | Description |
|---|---|---|
error | object |
403 Permission denied
| Property | Type | Description |
|---|---|---|
error | object |
404 Not found
| Property | Type | Description |
|---|---|---|
error | object |
500 Internal error
| Property | Type | Description |
|---|---|---|
error | object |
503 Unavailable
| Property | Type | Description |
|---|---|---|
error | object |
Request
curl -X GET "http://localhost:8089/v1/openai-agents/sessions/{session-id}/usage" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"const response = await fetch("http://localhost:8089/v1/openai-agents/sessions/{session-id}/usage", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
});
const data = await response.json();import requests
response = requests.get(
"http://localhost:8089/v1/openai-agents/sessions/{session-id}/usage",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
)
data = response.json()Response
{
"status": "reported",
"input_tokens": 0,
"output_tokens": 0,
"total_tokens": 0,
"updated_at": "string",
"source": "string"
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}
