TaskClassificationItem - TypeScript SDK

TaskClassificationItem type definition

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Example Usage

1import { TaskClassificationItem } from "@openrouter/sdk/models";
2
3let 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

FieldTypeRequiredDescriptionExample
categoryTokenSharenumber✔️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
categoryUsageSharenumber✔️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
displayNamestring✔️Human-readable label for the classification.Code Generation
macroCategorystring✔️Coarse grouping derived from the tag prefix: code, data, agent, or general.code
modelsmodels.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.
tagstring✔️Classification tag identifier (e.g. code:general_impl, agent:web_search).code:general_impl
tokenSharenumber✔️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
usageSharenumber✔️Fraction of classified sampled requests attributed to this classification (0–1). The unclassified other bucket is excluded from the denominator.0.23