List AI gateway span logs
GET /api/ai_gateway_logs
GET /api/ai_gateway_logsInteractive request editor loads with JavaScript.
In: header
Query Parameters
Filter logs by AI gateway group ID.
Filter logs by dataplane instance ID.
Filter logs by model name.
Filter logs with start_time >= this value (RFC3339 format).
date-timeFilter logs with start_time < this value (RFC3339 format).
date-timePage number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
int321 <= valueNumber of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
int321 <= valueResponse Body
application/json
application/json
curl -X GET "$API_BASE_URL/api/ai_gateway_logs"A paginated list of AI gateway span logs.
{
"list": [
{
"id": "string",
"instance_id": "string",
"ai_gateway_group_id": "string",
"trace_id": "string",
"span_id": "string",
"key_id": "string",
"model": "string",
"input_tokens": 0,
"output_tokens": 0,
"cache_read_tokens": 0,
"cache_write_tokens": 0,
"duration_ms": 0,
"status_code": 0,
"start_time": "2019-08-24T14:15:22Z",
"first_response_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z"
}
],
"total": 0
}Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
{
"value": {},
"error_msg": "error message"
}Complete operation details and schema variants
GET /api/ai_gateway_logs
List AI gateway span logs
IAM Action: ai_gateway:ListAIGatewayLogs, Resource: arn:api7:ai_gateway:aigatewaygroup/*
Returns a paginated list of AI/LLM span logs extracted from OTLP traces sent by AI gateway dataplanes.
Parameters
ai_gateway_group_id(query, string, optional): Filter logs by AI gateway group ID.instance_id(query, string, optional): Filter logs by dataplane instance ID.model(query, string, optional): Filter logs by model name.start_time(query, string, optional): Filter logs with start_time >= this value (RFC3339 format).end_time(query, string, optional): Filter logs with start_time < this value (RFC3339 format).page(query, integer, optional): Page number of the listed resources. Used together withpage_size. For example, when there are 13 resources in total, if the query parameters arepage=1&page_size=10, the GET response will show the routetotalas13and display 10 resources in the first page. If the query parameters arepage=2&page_size=10, the GET response will show the routetotalas13and display 3 resources in the second page.page_size(query, integer, optional): Number of resources listed per page. Used together withpage. For example, when there are 13 resources in total, if the query parameters arepage=1&page_size=10, the GET response will show the routetotalas13and display 10 resources in the first page. If the query parameters arepage=2&page_size=10, the GET response will show the routetotalas13and display 3 resources in the second page.
Responses
200: A paginated list of AI gateway span logs.list(array, optional):list[].id(string, optional): Unique log record ID (hex traceID + spanID).list[].instance_id(string, optional): Dataplane instance ID from resource attribute service.instance.id.list[].ai_gateway_group_id(string, optional): AI gateway group ID.list[].trace_id(string, optional): OTLP trace ID (hex-encoded).list[].span_id(string, optional): OTLP span ID (hex-encoded).list[].key_id(string, optional): API key ID used for this request (aisix.apikey_id attribute).list[].model(string, optional): LLM model name (gen_ai.request.model or gen_ai.response.model).list[].input_tokens(integer, optional): Number of input tokens (gen_ai.usage.input_tokens).list[].output_tokens(integer, optional): Number of output tokens (gen_ai.usage.output_tokens).list[].cache_read_tokens(integer, optional): Number of cache-read input tokens.list[].cache_write_tokens(integer, optional): Number of cache-creation input tokens.list[].duration_ms(integer, optional): Total request duration in milliseconds.list[].status_code(integer, optional): HTTP status code of the LLM response.list[].start_time(string, optional): Request start time (span StartTimeUnixNano).list[].first_response_at(string, optional): Time of first response token, derived from the first-token-arrived span event ("first token arrived" / kind=first_token_arrived).list[].created_at(string, optional): Record creation timestamp.total(integer, optional): Total number of matching log records.400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.value(object, optional): The specific resource.error_msg(string, optional): The error message.
cURL
curl -X GET '$API_BASE_URL/api/ai_gateway_logs'