TaskClassificationItem - TypeScript SDK
TaskClassificationItem - TypeScript SDK
TaskClassificationItem type definition
The TypeScript SDK and docs are currently in beta. Report issues on GitHub.
Example Usage
1 import { TaskClassificationItem } from "@openrouter/sdk/models"; 2 3 let value: TaskClassificationItem = { 4 categoryTokenShare: 0.48, 5 categoryUsageShare: 0.51, 6 displayName: "Code Generation", 7 macroCategory: "code", 8 models: [ 9 { 10 id: "openai/gpt-4.1-mini", 11 tagTokenShare: 0.75, 12 tagUsageShare: 0.55, 13 }, 14 { 15 id: "anthropic/claude-sonnet-4", 16 tagTokenShare: 0.12, 17 tagUsageShare: 0.2, 18 }, 19 ], 20 tag: "code:general_impl", 21 tokenShare: 0.31, 22 usageShare: 0.23, 23 };
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
categoryTokenShare | number | ✔️ | 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 | ✔️ | 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 | ✔️ | Human-readable label for the classification. | Code Generation |
macroCategory | string | ✔️ | Coarse grouping derived from the tag prefix: code, data, agent, or general. | code |
models | models.TaskClassificationModel[] | ✔️ | 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 | ✔️ | Classification tag identifier (e.g. code:general_impl, agent:web_search). | code:general_impl |
tokenShare | number | ✔️ | 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 | ✔️ | Fraction of classified sampled requests attributed to this classification (0–1). The unclassified other bucket is excluded from the denominator. | 0.23 |