Skip to main content
POST
/
api
/
v1
/
analytics
/
turns
Create Turn Metrics
curl --request POST \
  --url https://control-plane.kubiya.ai/api/v1/analytics/turns \
  --header 'Content-Type: application/json' \
  --data '{
  "execution_id": "<string>",
  "turn_number": 123,
  "turn_id": "<string>",
  "model": "<string>",
  "model_provider": "<string>",
  "started_at": "<string>",
  "completed_at": "<string>",
  "duration_ms": 123,
  "input_tokens": 0,
  "output_tokens": 0,
  "cache_read_tokens": 0,
  "cache_creation_tokens": 0,
  "total_tokens": 0,
  "input_cost": 0,
  "output_cost": 0,
  "cache_read_cost": 0,
  "cache_creation_cost": 0,
  "total_cost": 0,
  "finish_reason": "<string>",
  "response_preview": "<string>",
  "tools_called_count": 0,
  "tools_called_names": [
    "<string>"
  ],
  "error_message": "<string>",
  "metrics": {},
  "runtime_minutes": 0,
  "model_weight": 1,
  "tool_calls_weight": 1,
  "aem_value": 0,
  "aem_cost": 0
}'
"<any>"

Body

application/json

Schema for creating a turn metrics record

execution_id
string
required
turn_number
integer
required
model
string
required
started_at
string
required
turn_id
string | null
model_provider
string | null
completed_at
string | null
duration_ms
integer | null
input_tokens
integer
default:0
output_tokens
integer
default:0
cache_read_tokens
integer
default:0
cache_creation_tokens
integer
default:0
total_tokens
integer
default:0
input_cost
number
default:0
output_cost
number
default:0
cache_read_cost
number
default:0
cache_creation_cost
number
default:0
total_cost
number
default:0
finish_reason
string | null
response_preview
string | null
tools_called_count
integer
default:0
tools_called_names
string[]
error_message
string | null
metrics
object
runtime_minutes
number
default:0
model_weight
number
default:1
tool_calls_weight
number
default:1
aem_value
number
default:0
aem_cost
number
default:0

Response

Successful Response

The response is of type any.