Example Usage
import { TaskClassificationItem } from "@openrouter/sdk/models";
let value: TaskClassificationItem = {
categoryTokenShare: 0.48,
categoryUsageShare: 0.51,
displayName: "Code Generation",
macroCategory: "code",
models: [
{
id: "openai/gpt-4.1-mini",
tagTokenShare: 0.75,
tagUsageShare: 0.55,
},
{
id: "anthropic/claude-sonnet-4",
tagTokenShare: 0.12,
tagUsageShare: 0.2,
},
],
tag: "code:general_impl",
tokenShare: 0.31,
usageShare: 0.23,
};
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
categoryTokenShare | number | :heavy_check_mark: | Fraction of this classification’s token volume within its macro-category (0–1). Sums to 1 across all classifications sharing the same macro_category. | 0.48 |
categoryUsageShare | number | :heavy_check_mark: | Fraction of this classification’s usage within its macro-category (0–1). Sums to 1 across all classifications sharing the same macro_category. | 0.51 |
displayName | string | :heavy_check_mark: | Human-readable label for the classification. | Code Generation |
macroCategory | string | :heavy_check_mark: | Coarse grouping derived from the tag prefix: code, data, agent, or general. | code |
models | models.TaskClassificationModel[] | :heavy_check_mark: | Top models for this classification by request volume, sorted descending. Each entry reports the model’s share of this classification’s requests and tokens. | |
tag | string | :heavy_check_mark: | Classification tag identifier (e.g. code:general_impl, agent:web_search). | code:general_impl |
tokenShare | number | :heavy_check_mark: | Fraction of classified sampled token volume (prompt + completion) attributed to this classification (0–1). The unclassified other bucket is excluded from the denominator. | 0.31 |
usageShare | number | :heavy_check_mark: | Fraction of classified sampled requests attributed to this classification (0–1). The unclassified other bucket is excluded from the denominator. | 0.23 |