@openrouter/sdk 0.13.26 → 0.13.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,13 @@ import { Result } from "../types/fp.js";
22
22
  * reserved permaslug `other` and is always returned last within its date, so callers
23
23
  * can compute `top-50 traffic / total daily traffic` without a second request.
24
24
  *
25
+ * Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time
26
+ * grain. `modality` and `context_bucket` narrow the exact dataset by output/input
27
+ * modality (or tool-calling activity) and request context length. `category` and
28
+ * `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are
29
+ * weekly-grain estimates — they cannot be combined with each other or with the exact
30
+ * filters, and reject `period=day` with a 400.
31
+ *
25
32
  * Authenticate with any valid OpenRouter API key (same key used for inference).
26
33
  * Rate-limited to 30 requests/minute per key and 500 requests/day per account.
27
34
  *
@@ -26,6 +26,13 @@ import { APIPromise } from "../types/async.js";
26
26
  * reserved permaslug `other` and is always returned last within its date, so callers
27
27
  * can compute `top-50 traffic / total daily traffic` without a second request.
28
28
  *
29
+ * Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time
30
+ * grain. `modality` and `context_bucket` narrow the exact dataset by output/input
31
+ * modality (or tool-calling activity) and request context length. `category` and
32
+ * `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are
33
+ * weekly-grain estimates — they cannot be combined with each other or with the exact
34
+ * filters, and reject `period=day` with a 400.
35
+ *
29
36
  * Authenticate with any valid OpenRouter API key (same key used for inference).
30
37
  * Rate-limited to 30 requests/minute per key and 500 requests/day per account.
31
38
  *
@@ -49,7 +56,12 @@ async function $do(client, request, options) {
49
56
  const body = null;
50
57
  const path = pathToFunc("/datasets/rankings-daily")();
51
58
  const query = encodeFormQuery({
59
+ "category": payload?.category,
60
+ "context_bucket": payload?.context_bucket,
52
61
  "end_date": payload?.end_date,
62
+ "language_type": payload?.language_type,
63
+ "modality": payload?.modality,
64
+ "period": payload?.period,
53
65
  "start_date": payload?.start_date,
54
66
  });
55
67
  const headers = new Headers(compactMap({
@@ -59,6 +59,9 @@ async function $do(client, request, options) {
59
59
  if (payload.RequestBody.temperature !== undefined) {
60
60
  appendForm(body, "temperature", payload.RequestBody.temperature);
61
61
  }
62
+ if (payload.RequestBody["timestamp_granularities[]"] !== undefined) {
63
+ appendForm(body, "timestamp_granularities[]", payload.RequestBody["timestamp_granularities[]"]);
64
+ }
62
65
  const path = pathToFunc("/audio/transcriptions")();
63
66
  const headers = new Headers(compactMap({
64
67
  Accept: "application/json",
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
49
49
  export declare const SDK_METADATA: {
50
50
  readonly language: "typescript";
51
51
  readonly openapiDocVersion: "1.0.0";
52
- readonly sdkVersion: "0.13.26";
52
+ readonly sdkVersion: "0.13.28";
53
53
  readonly genVersion: "2.884.4";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.13.26 2.884.4 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.13.28 2.884.4 1.0.0 @openrouter/sdk";
55
55
  };
56
56
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
26
26
  export const SDK_METADATA = {
27
27
  language: "typescript",
28
28
  openapiDocVersion: "1.0.0",
29
- sdkVersion: "0.13.26",
29
+ sdkVersion: "0.13.28",
30
30
  genVersion: "2.884.4",
31
- userAgent: "speakeasy-sdk/typescript 0.13.26 2.884.4 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.13.28 2.884.4 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -55,7 +55,7 @@ export type FusionServerToolConfig = {
55
55
  */
56
56
  cacheControl?: AnthropicCacheControlDirective | undefined;
57
57
  /**
58
- * Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies.
58
+ * Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000.
59
59
  */
60
60
  maxCompletionTokens?: number | undefined;
61
61
  /**
@@ -467,7 +467,10 @@ export * from "./streamlogprobtoplogprob.js";
467
467
  export * from "./sttinputaudio.js";
468
468
  export * from "./sttrequest.js";
469
469
  export * from "./sttresponse.js";
470
+ export * from "./sttsegment.js";
471
+ export * from "./stttimestampgranularity.js";
470
472
  export * from "./sttusage.js";
473
+ export * from "./sttword.js";
471
474
  export * from "./subagentnestedtool.js";
472
475
  export * from "./subagentreasoning.js";
473
476
  export * from "./subagentservertoolconfig.js";
@@ -471,7 +471,10 @@ export * from "./streamlogprobtoplogprob.js";
471
471
  export * from "./sttinputaudio.js";
472
472
  export * from "./sttrequest.js";
473
473
  export * from "./sttresponse.js";
474
+ export * from "./sttsegment.js";
475
+ export * from "./stttimestampgranularity.js";
474
476
  export * from "./sttusage.js";
477
+ export * from "./sttword.js";
475
478
  export * from "./subagentnestedtool.js";
476
479
  export * from "./subagentreasoning.js";
477
480
  export * from "./subagentservertoolconfig.js";
@@ -1,5 +1,5 @@
1
1
  import * as z from "zod/v4";
2
- import { ClosedEnum } from "../../types/enums.js";
2
+ import { OpenEnum } from "../../types/enums.js";
3
3
  export type CreateAudioTranscriptionsMultipartGlobals = {
4
4
  /**
5
5
  * The app identifier should be your app's URL and is used as the primary identifier for rankings.
@@ -26,15 +26,21 @@ export type CreateAudioTranscriptionsMultipartFile = {
26
26
  content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
27
27
  };
28
28
  /**
29
- * The response format. Only "json" is supported.
29
+ * The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).
30
30
  */
31
31
  export declare const ResponseFormat: {
32
32
  readonly Json: "json";
33
+ readonly VerboseJson: "verbose_json";
33
34
  };
34
35
  /**
35
- * The response format. Only "json" is supported.
36
+ * The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).
36
37
  */
37
- export type ResponseFormat = ClosedEnum<typeof ResponseFormat>;
38
+ export type ResponseFormat = OpenEnum<typeof ResponseFormat>;
39
+ export declare const TimestampGranularities: {
40
+ readonly Word: "word";
41
+ readonly Segment: "segment";
42
+ };
43
+ export type TimestampGranularities = OpenEnum<typeof TimestampGranularities>;
38
44
  export type CreateAudioTranscriptionsMultipartRequestBody = {
39
45
  /**
40
46
  * The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio.
@@ -49,13 +55,17 @@ export type CreateAudioTranscriptionsMultipartRequestBody = {
49
55
  */
50
56
  model: string;
51
57
  /**
52
- * The response format. Only "json" is supported.
58
+ * The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).
53
59
  */
54
60
  responseFormat?: ResponseFormat | undefined;
55
61
  /**
56
62
  * The sampling temperature.
57
63
  */
58
64
  temperature?: number | undefined;
65
+ /**
66
+ * Timestamp detail levels to include when response_format is "verbose_json". "word" additionally returns word-level timestamps in the words array.
67
+ */
68
+ timestampGranularities?: Array<TimestampGranularities> | undefined;
59
69
  };
60
70
  export type CreateAudioTranscriptionsMultipartRequest = {
61
71
  /**
@@ -88,7 +98,9 @@ export type CreateAudioTranscriptionsMultipartFile$Outbound = {
88
98
  export declare const CreateAudioTranscriptionsMultipartFile$outboundSchema: z.ZodType<CreateAudioTranscriptionsMultipartFile$Outbound, CreateAudioTranscriptionsMultipartFile>;
89
99
  export declare function createAudioTranscriptionsMultipartFileToJSON(createAudioTranscriptionsMultipartFile: CreateAudioTranscriptionsMultipartFile): string;
90
100
  /** @internal */
91
- export declare const ResponseFormat$outboundSchema: z.ZodEnum<typeof ResponseFormat>;
101
+ export declare const ResponseFormat$outboundSchema: z.ZodType<string, ResponseFormat>;
102
+ /** @internal */
103
+ export declare const TimestampGranularities$outboundSchema: z.ZodType<string, TimestampGranularities>;
92
104
  /** @internal */
93
105
  export type CreateAudioTranscriptionsMultipartRequestBody$Outbound = {
94
106
  file: CreateAudioTranscriptionsMultipartFile$Outbound | Blob;
@@ -96,6 +108,7 @@ export type CreateAudioTranscriptionsMultipartRequestBody$Outbound = {
96
108
  model: string;
97
109
  response_format?: string | undefined;
98
110
  temperature?: number | undefined;
111
+ "timestamp_granularities[]"?: Array<string> | undefined;
99
112
  };
100
113
  /** @internal */
101
114
  export declare const CreateAudioTranscriptionsMultipartRequestBody$outboundSchema: z.ZodType<CreateAudioTranscriptionsMultipartRequestBody$Outbound, CreateAudioTranscriptionsMultipartRequestBody>;
@@ -5,11 +5,17 @@
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { blobLikeSchema } from "../../types/blobs.js";
8
+ import * as openEnums from "../../types/enums.js";
8
9
  /**
9
- * The response format. Only "json" is supported.
10
+ * The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).
10
11
  */
11
12
  export const ResponseFormat = {
12
13
  Json: "json",
14
+ VerboseJson: "verbose_json",
15
+ };
16
+ export const TimestampGranularities = {
17
+ Word: "word",
18
+ Segment: "segment",
13
19
  };
14
20
  /** @internal */
15
21
  export const CreateAudioTranscriptionsMultipartFile$outboundSchema = z.object({
@@ -25,8 +31,9 @@ export function createAudioTranscriptionsMultipartFileToJSON(createAudioTranscri
25
31
  return JSON.stringify(CreateAudioTranscriptionsMultipartFile$outboundSchema.parse(createAudioTranscriptionsMultipartFile));
26
32
  }
27
33
  /** @internal */
28
- export const ResponseFormat$outboundSchema = z
29
- .enum(ResponseFormat);
34
+ export const ResponseFormat$outboundSchema = openEnums.outboundSchema(ResponseFormat);
35
+ /** @internal */
36
+ export const TimestampGranularities$outboundSchema = openEnums.outboundSchema(TimestampGranularities);
30
37
  /** @internal */
31
38
  export const CreateAudioTranscriptionsMultipartRequestBody$outboundSchema = z.object({
32
39
  file: z.lazy(() => CreateAudioTranscriptionsMultipartFile$outboundSchema)
@@ -35,9 +42,12 @@ export const CreateAudioTranscriptionsMultipartRequestBody$outboundSchema = z.ob
35
42
  model: z.string(),
36
43
  responseFormat: ResponseFormat$outboundSchema.optional(),
37
44
  temperature: z.number().optional(),
45
+ timestampGranularities: z.array(TimestampGranularities$outboundSchema)
46
+ .optional(),
38
47
  }).transform((v) => {
39
48
  return remap$(v, {
40
49
  responseFormat: "response_format",
50
+ timestampGranularities: "timestamp_granularities[]",
41
51
  });
42
52
  });
43
53
  export function createAudioTranscriptionsMultipartRequestBodyToJSON(createAudioTranscriptionsMultipartRequestBody) {
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod/v4";
2
+ import { OpenEnum } from "../../types/enums.js";
2
3
  export type GetRankingsDailyGlobals = {
3
4
  /**
4
5
  * The app identifier should be your app's URL and is used as the primary identifier for rankings.
@@ -20,6 +21,78 @@ export type GetRankingsDailyGlobals = {
20
21
  */
21
22
  appCategories?: string | undefined;
22
23
  };
24
+ /**
25
+ * Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.
26
+ */
27
+ export declare const Period: {
28
+ readonly Day: "day";
29
+ readonly Week: "week";
30
+ readonly Month: "month";
31
+ };
32
+ /**
33
+ * Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.
34
+ */
35
+ export type Period = OpenEnum<typeof Period>;
36
+ /**
37
+ * Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.
38
+ */
39
+ export declare const Modality: {
40
+ readonly Text: "text";
41
+ readonly Image: "image";
42
+ readonly ImageOutput: "image_output";
43
+ readonly Audio: "audio";
44
+ readonly ToolCalling: "tool_calling";
45
+ };
46
+ /**
47
+ * Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.
48
+ */
49
+ export type Modality = OpenEnum<typeof Modality>;
50
+ /**
51
+ * Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.
52
+ */
53
+ export declare const ContextBucket: {
54
+ readonly OneK: "1K";
55
+ readonly TenK: "10K";
56
+ readonly OneHundredK: "100K";
57
+ readonly OneM: "1M";
58
+ readonly TenM: "10M";
59
+ };
60
+ /**
61
+ * Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.
62
+ */
63
+ export type ContextBucket = OpenEnum<typeof ContextBucket>;
64
+ /**
65
+ * Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.
66
+ */
67
+ export declare const GetRankingsDailyCategory: {
68
+ readonly Programming: "programming";
69
+ readonly Roleplay: "roleplay";
70
+ readonly Marketing: "marketing";
71
+ readonly MarketingSeo: "marketing/seo";
72
+ readonly Technology: "technology";
73
+ readonly Science: "science";
74
+ readonly Translation: "translation";
75
+ readonly Legal: "legal";
76
+ readonly Finance: "finance";
77
+ readonly Health: "health";
78
+ readonly Trivia: "trivia";
79
+ readonly Academia: "academia";
80
+ };
81
+ /**
82
+ * Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.
83
+ */
84
+ export type GetRankingsDailyCategory = OpenEnum<typeof GetRankingsDailyCategory>;
85
+ /**
86
+ * Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.
87
+ */
88
+ export declare const LanguageType: {
89
+ readonly Natural: "natural";
90
+ readonly Programming: "programming";
91
+ };
92
+ /**
93
+ * Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.
94
+ */
95
+ export type LanguageType = OpenEnum<typeof LanguageType>;
23
96
  export type GetRankingsDailyRequest = {
24
97
  /**
25
98
  * The app identifier should be your app's URL and is used as the primary identifier for rankings.
@@ -48,14 +121,49 @@ export type GetRankingsDailyRequest = {
48
121
  * End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400.
49
122
  */
50
123
  endDate?: string | undefined;
124
+ /**
125
+ * Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.
126
+ */
127
+ period?: Period | undefined;
128
+ /**
129
+ * Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.
130
+ */
131
+ modality?: Modality | undefined;
132
+ /**
133
+ * Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.
134
+ */
135
+ contextBucket?: ContextBucket | undefined;
136
+ /**
137
+ * Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.
138
+ */
139
+ category?: GetRankingsDailyCategory | undefined;
140
+ /**
141
+ * Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.
142
+ */
143
+ languageType?: LanguageType | undefined;
51
144
  };
52
145
  /** @internal */
146
+ export declare const Period$outboundSchema: z.ZodType<string, Period>;
147
+ /** @internal */
148
+ export declare const Modality$outboundSchema: z.ZodType<string, Modality>;
149
+ /** @internal */
150
+ export declare const ContextBucket$outboundSchema: z.ZodType<string, ContextBucket>;
151
+ /** @internal */
152
+ export declare const GetRankingsDailyCategory$outboundSchema: z.ZodType<string, GetRankingsDailyCategory>;
153
+ /** @internal */
154
+ export declare const LanguageType$outboundSchema: z.ZodType<string, LanguageType>;
155
+ /** @internal */
53
156
  export type GetRankingsDailyRequest$Outbound = {
54
157
  "HTTP-Referer"?: string | undefined;
55
158
  appTitle?: string | undefined;
56
159
  appCategories?: string | undefined;
57
160
  start_date?: string | undefined;
58
161
  end_date?: string | undefined;
162
+ period?: string | undefined;
163
+ modality?: string | undefined;
164
+ context_bucket?: string | undefined;
165
+ category?: string | undefined;
166
+ language_type?: string | undefined;
59
167
  };
60
168
  /** @internal */
61
169
  export declare const GetRankingsDailyRequest$outboundSchema: z.ZodType<GetRankingsDailyRequest$Outbound, GetRankingsDailyRequest>;
@@ -4,6 +4,71 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
+ import * as openEnums from "../../types/enums.js";
8
+ /**
9
+ * Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.
10
+ */
11
+ export const Period = {
12
+ Day: "day",
13
+ Week: "week",
14
+ Month: "month",
15
+ };
16
+ /**
17
+ * Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.
18
+ */
19
+ export const Modality = {
20
+ Text: "text",
21
+ Image: "image",
22
+ ImageOutput: "image_output",
23
+ Audio: "audio",
24
+ ToolCalling: "tool_calling",
25
+ };
26
+ /**
27
+ * Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.
28
+ */
29
+ export const ContextBucket = {
30
+ OneK: "1K",
31
+ TenK: "10K",
32
+ OneHundredK: "100K",
33
+ OneM: "1M",
34
+ TenM: "10M",
35
+ };
36
+ /**
37
+ * Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.
38
+ */
39
+ export const GetRankingsDailyCategory = {
40
+ Programming: "programming",
41
+ Roleplay: "roleplay",
42
+ Marketing: "marketing",
43
+ MarketingSeo: "marketing/seo",
44
+ Technology: "technology",
45
+ Science: "science",
46
+ Translation: "translation",
47
+ Legal: "legal",
48
+ Finance: "finance",
49
+ Health: "health",
50
+ Trivia: "trivia",
51
+ Academia: "academia",
52
+ };
53
+ /**
54
+ * Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.
55
+ */
56
+ export const LanguageType = {
57
+ Natural: "natural",
58
+ Programming: "programming",
59
+ };
60
+ /** @internal */
61
+ export const Period$outboundSchema = openEnums
62
+ .outboundSchema(Period);
63
+ /** @internal */
64
+ export const Modality$outboundSchema = openEnums
65
+ .outboundSchema(Modality);
66
+ /** @internal */
67
+ export const ContextBucket$outboundSchema = openEnums.outboundSchema(ContextBucket);
68
+ /** @internal */
69
+ export const GetRankingsDailyCategory$outboundSchema = openEnums.outboundSchema(GetRankingsDailyCategory);
70
+ /** @internal */
71
+ export const LanguageType$outboundSchema = openEnums.outboundSchema(LanguageType);
7
72
  /** @internal */
8
73
  export const GetRankingsDailyRequest$outboundSchema = z.object({
9
74
  httpReferer: z.string().optional(),
@@ -11,11 +76,18 @@ export const GetRankingsDailyRequest$outboundSchema = z.object({
11
76
  appCategories: z.string().optional(),
12
77
  startDate: z.string().optional(),
13
78
  endDate: z.string().optional(),
79
+ period: Period$outboundSchema.optional(),
80
+ modality: Modality$outboundSchema.optional(),
81
+ contextBucket: ContextBucket$outboundSchema.optional(),
82
+ category: GetRankingsDailyCategory$outboundSchema.optional(),
83
+ languageType: LanguageType$outboundSchema.optional(),
14
84
  }).transform((v) => {
15
85
  return remap$(v, {
16
86
  httpReferer: "HTTP-Referer",
17
87
  startDate: "start_date",
18
88
  endDate: "end_date",
89
+ contextBucket: "context_bucket",
90
+ languageType: "language_type",
19
91
  });
20
92
  });
21
93
  export function getRankingsDailyRequestToJSON(getRankingsDailyRequest) {
@@ -13,14 +13,14 @@ export type SpeechRequestProvider = {
13
13
  /**
14
14
  * Audio output format
15
15
  */
16
- export declare const ResponseFormatEnum: {
16
+ export declare const SpeechRequestResponseFormat: {
17
17
  readonly Mp3: "mp3";
18
18
  readonly Pcm: "pcm";
19
19
  };
20
20
  /**
21
21
  * Audio output format
22
22
  */
23
- export type ResponseFormatEnum = OpenEnum<typeof ResponseFormatEnum>;
23
+ export type SpeechRequestResponseFormat = OpenEnum<typeof SpeechRequestResponseFormat>;
24
24
  /**
25
25
  * Text-to-speech request input
26
26
  */
@@ -40,7 +40,7 @@ export type SpeechRequest = {
40
40
  /**
41
41
  * Audio output format
42
42
  */
43
- responseFormat?: ResponseFormatEnum | undefined;
43
+ responseFormat?: SpeechRequestResponseFormat | undefined;
44
44
  /**
45
45
  * Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.
46
46
  */
@@ -58,7 +58,7 @@ export type SpeechRequestProvider$Outbound = {
58
58
  export declare const SpeechRequestProvider$outboundSchema: z.ZodType<SpeechRequestProvider$Outbound, SpeechRequestProvider>;
59
59
  export declare function speechRequestProviderToJSON(speechRequestProvider: SpeechRequestProvider): string;
60
60
  /** @internal */
61
- export declare const ResponseFormatEnum$outboundSchema: z.ZodType<string, ResponseFormatEnum>;
61
+ export declare const SpeechRequestResponseFormat$outboundSchema: z.ZodType<string, SpeechRequestResponseFormat>;
62
62
  /** @internal */
63
63
  export type SpeechRequest$Outbound = {
64
64
  input: string;
@@ -9,7 +9,7 @@ import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
9
9
  /**
10
10
  * Audio output format
11
11
  */
12
- export const ResponseFormatEnum = {
12
+ export const SpeechRequestResponseFormat = {
13
13
  Mp3: "mp3",
14
14
  Pcm: "pcm",
15
15
  };
@@ -21,13 +21,13 @@ export function speechRequestProviderToJSON(speechRequestProvider) {
21
21
  return JSON.stringify(SpeechRequestProvider$outboundSchema.parse(speechRequestProvider));
22
22
  }
23
23
  /** @internal */
24
- export const ResponseFormatEnum$outboundSchema = openEnums.outboundSchema(ResponseFormatEnum);
24
+ export const SpeechRequestResponseFormat$outboundSchema = openEnums.outboundSchema(SpeechRequestResponseFormat);
25
25
  /** @internal */
26
26
  export const SpeechRequest$outboundSchema = z.object({
27
27
  input: z.string(),
28
28
  model: z.string(),
29
29
  provider: z.lazy(() => SpeechRequestProvider$outboundSchema).optional(),
30
- responseFormat: ResponseFormatEnum$outboundSchema.default("pcm"),
30
+ responseFormat: SpeechRequestResponseFormat$outboundSchema.default("pcm"),
31
31
  speed: z.number().optional(),
32
32
  voice: z.string(),
33
33
  }).transform((v) => {
@@ -1,6 +1,8 @@
1
1
  import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
2
3
  import { ProviderOptions, ProviderOptions$Outbound } from "./provideroptions.js";
3
4
  import { STTInputAudio, STTInputAudio$Outbound } from "./sttinputaudio.js";
5
+ import { STTTimestampGranularity } from "./stttimestampgranularity.js";
4
6
  /**
5
7
  * Provider-specific passthrough configuration
6
8
  */
@@ -10,6 +12,17 @@ export type STTRequestProvider = {
10
12
  */
11
13
  options?: ProviderOptions | undefined;
12
14
  };
15
+ /**
16
+ * Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
17
+ */
18
+ export declare const STTRequestResponseFormat: {
19
+ readonly Json: "json";
20
+ readonly VerboseJson: "verbose_json";
21
+ };
22
+ /**
23
+ * Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
24
+ */
25
+ export type STTRequestResponseFormat = OpenEnum<typeof STTRequestResponseFormat>;
13
26
  /**
14
27
  * Speech-to-text request input. Accepts a JSON body with input_audio containing base64-encoded audio.
15
28
  */
@@ -30,10 +43,18 @@ export type STTRequest = {
30
43
  * Provider-specific passthrough configuration
31
44
  */
32
45
  provider?: STTRequestProvider | undefined;
46
+ /**
47
+ * Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
48
+ */
49
+ responseFormat?: STTRequestResponseFormat | undefined;
33
50
  /**
34
51
  * Sampling temperature for transcription
35
52
  */
36
53
  temperature?: number | undefined;
54
+ /**
55
+ * Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json".
56
+ */
57
+ timestampGranularities?: Array<STTTimestampGranularity> | undefined;
37
58
  };
38
59
  /** @internal */
39
60
  export type STTRequestProvider$Outbound = {
@@ -43,12 +64,16 @@ export type STTRequestProvider$Outbound = {
43
64
  export declare const STTRequestProvider$outboundSchema: z.ZodType<STTRequestProvider$Outbound, STTRequestProvider>;
44
65
  export declare function sttRequestProviderToJSON(sttRequestProvider: STTRequestProvider): string;
45
66
  /** @internal */
67
+ export declare const STTRequestResponseFormat$outboundSchema: z.ZodType<string, STTRequestResponseFormat>;
68
+ /** @internal */
46
69
  export type STTRequest$Outbound = {
47
70
  input_audio: STTInputAudio$Outbound;
48
71
  language?: string | undefined;
49
72
  model: string;
50
73
  provider?: STTRequestProvider$Outbound | undefined;
74
+ response_format?: string | undefined;
51
75
  temperature?: number | undefined;
76
+ timestamp_granularities?: Array<string> | undefined;
52
77
  };
53
78
  /** @internal */
54
79
  export declare const STTRequest$outboundSchema: z.ZodType<STTRequest$Outbound, STTRequest>;
@@ -4,8 +4,17 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
+ import * as openEnums from "../types/enums.js";
7
8
  import { ProviderOptions$outboundSchema, } from "./provideroptions.js";
8
9
  import { STTInputAudio$outboundSchema, } from "./sttinputaudio.js";
10
+ import { STTTimestampGranularity$outboundSchema, } from "./stttimestampgranularity.js";
11
+ /**
12
+ * Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
13
+ */
14
+ export const STTRequestResponseFormat = {
15
+ Json: "json",
16
+ VerboseJson: "verbose_json",
17
+ };
9
18
  /** @internal */
10
19
  export const STTRequestProvider$outboundSchema = z.object({
11
20
  options: ProviderOptions$outboundSchema.optional(),
@@ -14,15 +23,22 @@ export function sttRequestProviderToJSON(sttRequestProvider) {
14
23
  return JSON.stringify(STTRequestProvider$outboundSchema.parse(sttRequestProvider));
15
24
  }
16
25
  /** @internal */
26
+ export const STTRequestResponseFormat$outboundSchema = openEnums.outboundSchema(STTRequestResponseFormat);
27
+ /** @internal */
17
28
  export const STTRequest$outboundSchema = z.object({
18
29
  inputAudio: STTInputAudio$outboundSchema,
19
30
  language: z.string().optional(),
20
31
  model: z.string(),
21
32
  provider: z.lazy(() => STTRequestProvider$outboundSchema).optional(),
33
+ responseFormat: STTRequestResponseFormat$outboundSchema.optional(),
22
34
  temperature: z.number().optional(),
35
+ timestampGranularities: z.array(STTTimestampGranularity$outboundSchema)
36
+ .optional(),
23
37
  }).transform((v) => {
24
38
  return remap$(v, {
25
39
  inputAudio: "input_audio",
40
+ responseFormat: "response_format",
41
+ timestampGranularities: "timestamp_granularities",
26
42
  });
27
43
  });
28
44
  export function sttRequestToJSON(sttRequest) {
@@ -1,11 +1,29 @@
1
1
  import * as z from "zod/v4";
2
2
  import { Result as SafeParseResult } from "../types/fp.js";
3
3
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ import { STTSegment } from "./sttsegment.js";
4
5
  import { STTUsage } from "./sttusage.js";
6
+ import { STTWord } from "./sttword.js";
5
7
  /**
6
8
  * STT response containing transcribed text and optional usage statistics
7
9
  */
8
10
  export type STTResponse = {
11
+ /**
12
+ * Duration of the input audio in seconds, present when response_format is verbose_json
13
+ */
14
+ duration?: number | undefined;
15
+ /**
16
+ * Detected or forced language, present when response_format is verbose_json
17
+ */
18
+ language?: string | undefined;
19
+ /**
20
+ * Timestamped transcript segments, present when response_format is verbose_json
21
+ */
22
+ segments?: Array<STTSegment> | undefined;
23
+ /**
24
+ * The task performed, present when response_format is verbose_json
25
+ */
26
+ task?: string | undefined;
9
27
  /**
10
28
  * The transcribed text
11
29
  */
@@ -14,6 +32,10 @@ export type STTResponse = {
14
32
  * Aggregated usage statistics for the request
15
33
  */
16
34
  usage?: STTUsage | undefined;
35
+ /**
36
+ * Timestamped words, present when the provider returns word-level timestamps
37
+ */
38
+ words?: Array<STTWord> | undefined;
17
39
  };
18
40
  /** @internal */
19
41
  export declare const STTResponse$inboundSchema: z.ZodType<STTResponse, unknown>;
@@ -4,12 +4,19 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
+ import { STTSegment$inboundSchema } from "./sttsegment.js";
7
8
  import { STTUsage$inboundSchema } from "./sttusage.js";
9
+ import { STTWord$inboundSchema } from "./sttword.js";
8
10
  /** @internal */
9
11
  export const STTResponse$inboundSchema = z
10
12
  .object({
13
+ duration: z.number().optional(),
14
+ language: z.string().optional(),
15
+ segments: z.array(STTSegment$inboundSchema).optional(),
16
+ task: z.string().optional(),
11
17
  text: z.string(),
12
18
  usage: STTUsage$inboundSchema.optional(),
19
+ words: z.array(STTWord$inboundSchema).optional(),
13
20
  });
14
21
  export function sttResponseFromJSON(jsonString) {
15
22
  return safeParse(jsonString, (x) => STTResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'STTResponse' from JSON`);
@@ -0,0 +1,52 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ /**
5
+ * A timestamped transcript segment, returned when response_format is verbose_json
6
+ */
7
+ export type STTSegment = {
8
+ /**
9
+ * Average log probability of the segment
10
+ */
11
+ avgLogprob?: number | undefined;
12
+ /**
13
+ * Compression ratio of the segment
14
+ */
15
+ compressionRatio?: number | undefined;
16
+ /**
17
+ * Segment end time in seconds
18
+ */
19
+ end: number;
20
+ /**
21
+ * Segment index within the transcript
22
+ */
23
+ id: number;
24
+ /**
25
+ * Probability the segment contains no speech
26
+ */
27
+ noSpeechProb?: number | undefined;
28
+ /**
29
+ * Seek offset of the segment
30
+ */
31
+ seek?: number | undefined;
32
+ /**
33
+ * Segment start time in seconds
34
+ */
35
+ start: number;
36
+ /**
37
+ * Temperature used for the segment
38
+ */
39
+ temperature?: number | undefined;
40
+ /**
41
+ * Transcribed text of the segment
42
+ */
43
+ text: string;
44
+ /**
45
+ * Token IDs of the segment
46
+ */
47
+ tokens?: Array<number> | undefined;
48
+ };
49
+ /** @internal */
50
+ export declare const STTSegment$inboundSchema: z.ZodType<STTSegment, unknown>;
51
+ export declare function sttSegmentFromJSON(jsonString: string): SafeParseResult<STTSegment, SDKValidationError>;
52
+ //# sourceMappingURL=sttsegment.d.ts.map
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 610157864a1c
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ /** @internal */
9
+ export const STTSegment$inboundSchema = z
10
+ .object({
11
+ avg_logprob: z.number().optional(),
12
+ compression_ratio: z.number().optional(),
13
+ end: z.number(),
14
+ id: z.int(),
15
+ no_speech_prob: z.number().optional(),
16
+ seek: z.int().optional(),
17
+ start: z.number(),
18
+ temperature: z.number().optional(),
19
+ text: z.string(),
20
+ tokens: z.array(z.int()).optional(),
21
+ }).transform((v) => {
22
+ return remap$(v, {
23
+ "avg_logprob": "avgLogprob",
24
+ "compression_ratio": "compressionRatio",
25
+ "no_speech_prob": "noSpeechProb",
26
+ });
27
+ });
28
+ export function sttSegmentFromJSON(jsonString) {
29
+ return safeParse(jsonString, (x) => STTSegment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'STTSegment' from JSON`);
30
+ }
31
+ //# sourceMappingURL=sttsegment.js.map
@@ -0,0 +1,16 @@
1
+ import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ /**
4
+ * A timestamp detail level for verbose_json transcription responses.
5
+ */
6
+ export declare const STTTimestampGranularity: {
7
+ readonly Word: "word";
8
+ readonly Segment: "segment";
9
+ };
10
+ /**
11
+ * A timestamp detail level for verbose_json transcription responses.
12
+ */
13
+ export type STTTimestampGranularity = OpenEnum<typeof STTTimestampGranularity>;
14
+ /** @internal */
15
+ export declare const STTTimestampGranularity$outboundSchema: z.ZodType<string, STTTimestampGranularity>;
16
+ //# sourceMappingURL=stttimestampgranularity.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 506bf5060d97
4
+ */
5
+ import * as openEnums from "../types/enums.js";
6
+ /**
7
+ * A timestamp detail level for verbose_json transcription responses.
8
+ */
9
+ export const STTTimestampGranularity = {
10
+ Word: "word",
11
+ Segment: "segment",
12
+ };
13
+ /** @internal */
14
+ export const STTTimestampGranularity$outboundSchema = openEnums.outboundSchema(STTTimestampGranularity);
15
+ //# sourceMappingURL=stttimestampgranularity.js.map
@@ -0,0 +1,24 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ /**
5
+ * A timestamped word, returned when the provider includes word-level timestamps
6
+ */
7
+ export type STTWord = {
8
+ /**
9
+ * Word end time in seconds
10
+ */
11
+ end: number;
12
+ /**
13
+ * Word start time in seconds
14
+ */
15
+ start: number;
16
+ /**
17
+ * The transcribed word
18
+ */
19
+ word: string;
20
+ };
21
+ /** @internal */
22
+ export declare const STTWord$inboundSchema: z.ZodType<STTWord, unknown>;
23
+ export declare function sttWordFromJSON(jsonString: string): SafeParseResult<STTWord, SDKValidationError>;
24
+ //# sourceMappingURL=sttword.d.ts.map
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 748744003b2c
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ /** @internal */
8
+ export const STTWord$inboundSchema = z.object({
9
+ end: z.number(),
10
+ start: z.number(),
11
+ word: z.string(),
12
+ });
13
+ export function sttWordFromJSON(jsonString) {
14
+ return safeParse(jsonString, (x) => STTWord$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'STTWord' from JSON`);
15
+ }
16
+ //# sourceMappingURL=sttword.js.map
@@ -47,6 +47,13 @@ export declare class Datasets extends ClientSDK {
47
47
  * reserved permaslug `other` and is always returned last within its date, so callers
48
48
  * can compute `top-50 traffic / total daily traffic` without a second request.
49
49
  *
50
+ * Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time
51
+ * grain. `modality` and `context_bucket` narrow the exact dataset by output/input
52
+ * modality (or tool-calling activity) and request context length. `category` and
53
+ * `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are
54
+ * weekly-grain estimates — they cannot be combined with each other or with the exact
55
+ * filters, and reject `period=day` with a 400.
56
+ *
50
57
  * Authenticate with any valid OpenRouter API key (same key used for inference).
51
58
  * Rate-limited to 30 requests/minute per key and 500 requests/day per account.
52
59
  *
@@ -52,6 +52,13 @@ export class Datasets extends ClientSDK {
52
52
  * reserved permaslug `other` and is always returned last within its date, so callers
53
53
  * can compute `top-50 traffic / total daily traffic` without a second request.
54
54
  *
55
+ * Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time
56
+ * grain. `modality` and `context_bucket` narrow the exact dataset by output/input
57
+ * modality (or tool-calling activity) and request context length. `category` and
58
+ * `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are
59
+ * weekly-grain estimates — they cannot be combined with each other or with the exact
60
+ * filters, and reject `period=day` with a 400.
61
+ *
55
62
  * Authenticate with any valid OpenRouter API key (same key used for inference).
56
63
  * Rate-limited to 30 requests/minute per key and 500 requests/day per account.
57
64
  *
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.26",
5
+ "version": "0.13.28",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.13.26",
3
+ "version": "0.13.28",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
6
6
  "keywords": [
@@ -74,14 +74,14 @@
74
74
  "build": "tsc",
75
75
  "prepublishOnly": "npm run build",
76
76
  "prepare": "npm run build",
77
- "test:e2e": "vitest --run --project e2e",
77
+ "test:transit": "exit 0",
78
+ "typecheck": "tsc --noEmit",
78
79
  "compile": "tsc",
80
+ "postinstall": "node scripts/check-types.js || true",
79
81
  "test": "vitest --run --project unit",
80
- "test:transit": "exit 0",
82
+ "test:e2e": "vitest --run --project e2e",
81
83
  "test:watch": "vitest --watch --project unit",
82
- "typecheck": "tsc --noEmit",
83
- "typecheck:transit": "exit 0",
84
- "postinstall": "node scripts/check-types.js || true"
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {