# Alibaba Cloud PAI LLM tracing & evaluation API

> Alibaba Cloud PAI LLM tracing & evaluation API on Apizie: 15 endpoints (Creates a trace evaluation task. The system will sample some data from the user's trace data based on the…, Creates a service-linked role required for the PaiLLMTrace service, Delete an online evaluation task, Evaluates a specified piece of trace data, …) returned as clean JSON through one API key. Send your own provider key in the x-upstream-key header. Call it over REST at https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/{endpoint} or from Claude, ChatGPT and Cursor through the Apizie MCP server. Free plan: 1,000 requests a month.

- Project key: `cloud:aliyun-paillmtrace`
- Category: Cloud
- Status: byok
- Source: https://api.alibabacloud.com/product/paillmtrace
- Page: https://zieapi.vercel.app/api/cloud/aliyun-paillmtrace
- OpenAPI: https://zieapi.vercel.app/api/cloud/aliyun-paillmtrace/openapi.json

Alibaba Cloud OpenAPI for PAI LLM tracing & evaluation (paillmtrace, version 2024-03-11). Calls are signed with ACS3-HMAC-SHA256 using your AccessKey ID and secret.

## Endpoints

### Creates a trace evaluation task. The system will sample some data from the user's trace data based on the…
`POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/create-online-eval-task` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| body | string | no | The request data (JSON-encoded) |

### Creates a service-linked role required for the PaiLLMTrace service
`POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/create-service-identity-role` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |

### Delete an online evaluation task
`POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/delete-online-eval-task` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| TaskId | string | yes | The ID of the link evaluation task |

### Evaluates a specified piece of trace data
`POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/evaluate-trace` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| TraceId | string | yes | The trace ID |
| AppName | string | no | The name of the application to which the trace belongs |
| EvaluationConfig | object | yes | If the value retrieved at the JSON path is itself a JSON string, further JSON path definitions within this JSON are necessary to get the… |
| EvaluationId | string | no | The ID of the evaluation task. If not specified, the system randomly generates and returns an ID. You can use this ID to quickly search… |
| MaxTime | string | no | The end time of the search time range, in UTC format |
| MinTime | string | no | The start time of the search time range, in UTC format |
| ModelConfig | object | no | The configuration structure to access the model used internally by the evaluation trace |

### Get the content of prompt templates used for evaluation
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/get-evaluation-templates` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |

### Get the details of an online evaluation task
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/get-online-eval-task` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| TaskId | string | yes | Task ID |

### Obtains the information related to the service-linked role
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/get-service-identity-role` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |

### Obtains the token used in the Xtrace service and the endpoint required for uploading trace data
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/get-xtrace-token` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |

### Retrieve the list of trace assessment results. This API is used together with the EvaluateTrace API. The…
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/list-eval-results` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| RecordIds | string | no | The IDs of the traces (JSON-encoded) |
| PageNumber | integer | no | The number of the page to return. Pages start from page 1. Default value: 1 |
| PageSize | integer | no | Page size, default is 10 |
| EvaluationId | string | no | The ID of the evaluation task. Will return the latest evaluation result if this ID not provied |
| Keyword | string | no | The search key word |

### List the results of online evaluation tasks that meet the criteria
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/list-online-eval-task-results` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| TraceIds | string | no | Specify a set of trace IDs, and only return the evaluation results for these traces. At least one of the trace ID or task ID must be set… |
| PageNumber | integer | no | The current page number. Value range: integers greater than 0. Default value: 1 |
| PageSize | integer | no | Page size, default is 10 |
| EvaluationId | string | no | The ID of the evaluation task. At least one of the trace ID or task ID must be set |
| MostRecentResultsOnly | string | no | The same trace data may have been evaluated by different tasks. If no task ID is specified and there are multiple evaluation results for… |

### View online evaluation tasks that meet the criteria
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/list-online-eval-tasks` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| MinTime | string | no | The UTC start time of the search time range |
| MaxTime | string | no | The UTC end time of the search time range |
| PageNumber | integer | no | The current page number. Value range: integers greater than 0. Default value: 1 |
| PageSize | integer | no | Page size, default is 10 |
| AppName | string | no | Name of the user application recorded in the trace data. Exact match |
| Status | string | no | Job status. Exact match |
| Keyword | string | no | Search keyword. It will match on fields such as task name, application name (appName), task description, and evaluation metric name |
| SamplingMethod | string | no | Sampling method for job data. Valid values are window or probability. Exact match |
| SortBy | string | no | Field used to sort the return result. Supported fields: TaskId, CreateTime, TaskName, and Status. If not specified, results are sorted by… |
| SortOrder | string | no | Sort order of the return result. Valid values: ASC (ascending) or DESC (descending). If not specified, results are sorted in descending… |

### List trace data that meets the specified conditions from trace logs
`GET https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/list-traces-datas` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| TraceIds | string | no | The list of trace IDs (JSON-encoded) |
| SpanIds | string | no | The list of span IDs. Each trace record contains one or more spans (JSON-encoded) |
| SessionId | string | no | The value of the `attributes.gen_ai.session.id` field in trace records. Default is empty |
| MinTime | string | yes | The lower limit of the search time range, in UTC format (YYYY-mm-dd or YYYY-MM-DD HH:mm:ss). By default, the value is (current time - 2… |
| MaxTime | string | no | The upper limit of the search time range, in UTC format (YYYY-mm-dd or YYYY-MM-DD HH:mm:ss). By default, the value is (current time +10… |
| PageNumber | integer | no | The page number. Page starts from page 1. Default value: 1 |
| PageSize | integer | no | The number of entries per page. Default value: 20. Maximum value: 100 |
| SpanName | string | no | A filter condition used when searching for traces. Returns traces that contain the specified span name. |
| LlmAppName | string | no | The value of the resources.service.app.name field in the trace record. It can contain upper and lower case letters, digits, dot (.),… |
| MinDuration | number | no | A filter condition used when searching for traces: the minimum trace duration, in seconds (s) |
| MaxDuration | number | no | A filter condition used when searching for traces: the maximum trace duration, in seconds (s) |
| OpentelemetryCompatible | string | no | Whether the returned JSON data can be directly converted to OpenTelemetry TracesData protobuf object. Default value: False. JSON data that… |
| HasStatusMessage | string | no | Whether to return only trace records containing spans with a non-empty statusMessage. Example: Suppose a trace has 3 spans. If this… |
| HasEvents | string | no | Whether to return only trace records containing spans with a non-empty events. Example: Suppose a trace has 3 spans. If this parameter is… |
| OwnerSubId | string | no | The value of the resources.service.owner.sub_id field in the trace record. It can contain upper and lower case letters, digits, dot (.),… |
| EndUserId | string | no | The value of the attributes.service.app.user_id field in the trace record. It can contain upper and lower case letters, digits, dot (.),… |
| Filters | string | no | Other filter parameters (JSON-encoded) |
| TraceReduceMethod | string | no | The content simplification method for returned trace data to reduce the data volume. REMOVE_EMBEDDING: Removes all embedding array… |
| SortBy | string | no | The field used to sort the returned results. Valid values: StartTime and Duration |
| SortOrder | string | no | The sorting order. Valid values: ASC DESC (default) |

### Stop the execution of an online evaluation task
`POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/stop-online-eval-task` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| TaskId | string | yes | The ID of the trace evaluation task |

### Changes the configuration of a trace evaluation task
`POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/update-online-eval-task` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |
| TaskId | string | yes | The ID of the trace evaluation task |
| AppName | string | no | The user-defined name of the LLM application |
| Description | string | no | The description of the task |
| EndTime | string | no | The end time of the trace data, in UTC format |
| EvaluationConfig | object | no | This configuration structure defines the JSON paths needed to extract specific values from trace data in JSON format. EvaluationConfig… |
| Filters | array | no | The evaluation task must search for a certain amount of trace data generated by the user application as input data for the evaluation.… |
| ModelConfig | object | no | The access configuration structure of the model used in the evaluation |
| SamplingFrequencyMinutes | integer | no | The evaluation task must search for a certain amount of trace data generated by the user application as input data for the evaluation.… |
| SamplingRatio | integer | no | The percentage of data found in a time window that truly serves as evaluation input data. For example, 100 indicates that all data… |
| StartTime | string | no | The start time of the trace data, in UTC format |
| TaskName | string | no | The task name |

### version
`POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/version` (byok)

| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint | string | no | Regional endpoint, for example https://paillmtrace.cn-hangzhou.aliyuncs.com |

## Example
```
curl "https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/create-online-eval-task" \
  -H "x-api-key: $APIZIE_KEY" \
  -H "x-upstream-key: $PROVIDER_KEY"
```

## FAQ

### How do I call the Alibaba Cloud PAI LLM tracing & evaluation API?
Create a free Apizie key, then send POST https://zieapi.vercel.app/v1/cloud:aliyun-paillmtrace/create-online-eval-task with the header x-api-key. Every endpoint returns { project, data, timestamp }.

### Is the Alibaba Cloud PAI LLM tracing & evaluation API free on Apizie?
Yes. The Free plan includes 1,000 requests a month at 100 requests a minute, no credit card. Alibaba Cloud PAI LLM tracing & evaluation itself also needs your own key from aliyuncs.com.

### Can AI agents use the Alibaba Cloud PAI LLM tracing & evaluation API?
Yes. Add the Apizie MCP server (https://zieapi.vercel.app/mcp) to Claude, ChatGPT, Cursor or VS Code, then ask in plain language. The agent calls run_scraper with project key cloud:aliyun-paillmtrace.

### What is the status of the Alibaba Cloud PAI LLM tracing & evaluation API?
Needs your own provider key (bring your own key)
