diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock
index 7793034b..27524edd 100644
--- a/.speakeasy/gen.lock
+++ b/.speakeasy/gen.lock
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: 8b6cd71c-ea04-44da-af45-e43968b5928d
management:
- docChecksum: 9660e86ea28560265285c6e3773bd061
+ docChecksum: bc2a17a8bdced4449c22e8cb27f02be5
docVersion: 1.0.0
- speakeasyVersion: 1.653.2
- generationVersion: 2.748.4
- releaseVersion: 0.1.10
- configChecksum: 0b94228b2cc806ed198c6d48069286d9
+ speakeasyVersion: 1.654.0
+ generationVersion: 2.750.0
+ releaseVersion: 0.1.11
+ configChecksum: f7e503f7b6144914db85599585462a92
repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git
installationURL: https://github.com/OpenRouterTeam/typescript-sdk
published: true
@@ -15,7 +15,7 @@ features:
acceptHeaders: 2.81.2
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.12
- core: 3.26.4
+ core: 3.26.5
customCodeRegions: 0.1.0
defaultEnabledRetries: 0.1.0
deprecations: 2.81.1
diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml
index 0bd7d020..eadf15d5 100644
--- a/.speakeasy/gen.yaml
+++ b/.speakeasy/gen.yaml
@@ -30,7 +30,7 @@ generation:
generateNewTests: true
skipResponseBodyAssertions: false
typescript:
- version: 0.1.10
+ version: 0.1.11
acceptHeaderEnum: false
additionalDependencies:
dependencies: {}
@@ -92,6 +92,7 @@ typescript:
responseFormat: flat
sseFlatResponse: true
templateVersion: v2
+ unionStrategy: left-to-right
usageSDKInitImports: []
useIndexModules: true
zodVersion: v4
diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml
index fe757f17..3923d43c 100644
--- a/.speakeasy/in.openapi.yaml
+++ b/.speakeasy/in.openapi.yaml
@@ -7157,7 +7157,9 @@ paths:
type: string
nullable: true
format: date-time
- description: Optional ISO 8601 timestamp with timezone when the API key should expire
+ description: >-
+ Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be
+ rejected
example: '2027-12-31T23:59:59Z'
required:
- name
@@ -7931,6 +7933,12 @@ paths:
type: boolean
description: Whether to include external BYOK usage in the credit limit
example: false
+ expires_at:
+ type: string
+ nullable: true
+ format: date-time
+ description: ISO 8601 UTC timestamp when the API key expires, or null if no expiration
+ example: '2027-12-31T23:59:59Z'
rate_limit:
type: object
properties:
@@ -7990,6 +7998,7 @@ paths:
limit_remaining: 74.5
limit_reset: monthly
include_byok_in_limit: false
+ expires_at: '2027-12-31T23:59:59Z'
rate_limit:
requests: 1000
interval: 1h
@@ -8013,6 +8022,7 @@ paths:
limit_remaining: 74.5
limit_reset: monthly
include_byok_in_limit: false
+ expires_at: '2027-12-31T23:59:59Z'
rate_limit:
requests: 1000
interval: 1h
diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml
index eff5ca39..fdcaa293 100644
--- a/.speakeasy/out.openapi.yaml
+++ b/.speakeasy/out.openapi.yaml
@@ -7164,7 +7164,8 @@ paths:
type: string
nullable: true
format: date-time
- description: Optional ISO 8601 timestamp with timezone when the API key should expire
+ description: >-
+ Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected
example: '2027-12-31T23:59:59Z'
required:
- name
@@ -7938,6 +7939,12 @@ paths:
type: boolean
description: Whether to include external BYOK usage in the credit limit
example: false
+ expires_at:
+ type: string
+ nullable: true
+ format: date-time
+ description: ISO 8601 UTC timestamp when the API key expires, or null if no expiration
+ example: '2027-12-31T23:59:59Z'
rate_limit:
type: object
properties:
@@ -7997,6 +8004,7 @@ paths:
limit_remaining: 74.5
limit_reset: monthly
include_byok_in_limit: false
+ expires_at: '2027-12-31T23:59:59Z'
rate_limit:
requests: 1000
interval: 1h
@@ -8020,6 +8028,7 @@ paths:
limit_remaining: 74.5
limit_reset: monthly
include_byok_in_limit: false
+ expires_at: '2027-12-31T23:59:59Z'
rate_limit:
requests: 1000
interval: 1h
diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock
index ac0404b1..12bf61b6 100644
--- a/.speakeasy/workflow.lock
+++ b/.speakeasy/workflow.lock
@@ -1,9 +1,9 @@
-speakeasyVersion: 1.653.2
+speakeasyVersion: 1.654.0
sources:
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
- sourceRevisionDigest: sha256:41a987c6a80cdcf2865e59e7a511706f801f6b5abc2713de2b75558aa812b0b1
- sourceBlobDigest: sha256:f732c29c7257afac986bc8f9076fbe3d190da15d1d8674ee191e7b83e611ecf3
+ sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
+ sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
tags:
- latest
- staging
@@ -12,10 +12,10 @@ targets:
openrouter:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
- sourceRevisionDigest: sha256:41a987c6a80cdcf2865e59e7a511706f801f6b5abc2713de2b75558aa812b0b1
- sourceBlobDigest: sha256:f732c29c7257afac986bc8f9076fbe3d190da15d1d8674ee191e7b83e611ecf3
+ sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e
+ sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23
codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples
- codeSamplesRevisionDigest: sha256:0f9c73bf63e810bfa351faeb47ca62dbc21680abe1d4d1d1342d59738cccbb53
+ codeSamplesRevisionDigest: sha256:e30bf4d24076522aaf92aa570cc8b7ba008d86e9a36336d815e99dbf154d3b47
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
diff --git a/docs/models/operations/createkeysrequest.md b/docs/models/operations/createkeysrequest.md
index a1ce00f2..8fe93541 100644
--- a/docs/models/operations/createkeysrequest.md
+++ b/docs/models/operations/createkeysrequest.md
@@ -18,4 +18,4 @@ let value: CreateKeysRequest = {
| `limit` | *number* | :heavy_minus_sign: | Optional spending limit for the API key in USD | 50 |
| `limitReset` | [operations.CreateKeysLimitReset](../../models/operations/createkeyslimitreset.md) | :heavy_minus_sign: | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly |
| `includeByokInLimit` | *boolean* | :heavy_minus_sign: | Whether to include BYOK usage in the limit | true |
-| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | Optional ISO 8601 timestamp with timezone when the API key should expire | 2027-12-31T23:59:59Z |
\ No newline at end of file
+| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected | 2027-12-31T23:59:59Z |
\ No newline at end of file
diff --git a/docs/models/operations/getcurrentkeydata.md b/docs/models/operations/getcurrentkeydata.md
index 8f618388..1cf74639 100644
--- a/docs/models/operations/getcurrentkeydata.md
+++ b/docs/models/operations/getcurrentkeydata.md
@@ -50,4 +50,5 @@ let value: GetCurrentKeyData = {
| `limitRemaining` | *number* | :heavy_check_mark: | Remaining spending limit in USD | 74.5 |
| `limitReset` | *string* | :heavy_check_mark: | Type of limit reset for the API key | monthly |
| `includeByokInLimit` | *boolean* | :heavy_check_mark: | Whether to include external BYOK usage in the credit limit | false |
+| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | ISO 8601 UTC timestamp when the API key expires, or null if no expiration | 2027-12-31T23:59:59Z |
| ~~`rateLimit`~~ | [operations.RateLimit](../../models/operations/ratelimit.md) | :heavy_check_mark: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Legacy rate limit information about a key. Will always return -1. | {
"requests": 1000,
"interval": "1h",
"note": "This field is deprecated and safe to ignore."
} |
\ No newline at end of file
diff --git a/docs/models/operations/getcurrentkeyresponse.md b/docs/models/operations/getcurrentkeyresponse.md
index 73db8b31..e6872cd1 100644
--- a/docs/models/operations/getcurrentkeyresponse.md
+++ b/docs/models/operations/getcurrentkeyresponse.md
@@ -35,6 +35,6 @@ let value: GetCurrentKeyResponse = {
## Fields
-| Field | Type | Required | Description | Example |
-| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `data` | [operations.GetCurrentKeyData](../../models/operations/getcurrentkeydata.md) | :heavy_check_mark: | Current API key information | {
"label": "sk-or-v1-au78b3456789012345678901234567890",
"limit": 100,
"usage": 25.5,
"usage_daily": 25.5,
"usage_weekly": 25.5,
"usage_monthly": 25.5,
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_weekly": 17.38,
"byok_usage_monthly": 17.38,
"is_free_tier": false,
"is_provisioning_key": false,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"include_byok_in_limit": false,
"rate_limit": {
"requests": 1000,
"interval": "1h",
"note": "This field is deprecated and safe to ignore."
}
} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `data` | [operations.GetCurrentKeyData](../../models/operations/getcurrentkeydata.md) | :heavy_check_mark: | Current API key information | {
"label": "sk-or-v1-au78b3456789012345678901234567890",
"limit": 100,
"usage": 25.5,
"usage_daily": 25.5,
"usage_weekly": 25.5,
"usage_monthly": 25.5,
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_weekly": 17.38,
"byok_usage_monthly": 17.38,
"is_free_tier": false,
"is_provisioning_key": false,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"include_byok_in_limit": false,
"expires_at": "2027-12-31T23:59:59Z",
"rate_limit": {
"requests": 1000,
"interval": "1h",
"note": "This field is deprecated and safe to ignore."
}
} |
\ No newline at end of file
diff --git a/examples/nextjs-example/package-lock.json b/examples/nextjs-example/package-lock.json
index 3d475a8e..f3728793 100644
--- a/examples/nextjs-example/package-lock.json
+++ b/examples/nextjs-example/package-lock.json
@@ -36,7 +36,7 @@
},
"../..": {
"name": "@openrouter/sdk",
- "version": "0.1.10",
+ "version": "0.1.11",
"license": "Apache-2.0",
"dependencies": {
"zod": "^3.25.0 || ^4.0.0"
diff --git a/jsr.json b/jsr.json
index 8ce39871..b75bb7a0 100644
--- a/jsr.json
+++ b/jsr.json
@@ -2,7 +2,7 @@
{
"name": "@openrouter/sdk",
- "version": "0.1.10",
+ "version": "0.1.11",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
diff --git a/package-lock.json b/package-lock.json
index 39aee2dd..074b4c02 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@openrouter/sdk",
- "version": "0.1.10",
+ "version": "0.1.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@openrouter/sdk",
- "version": "0.1.10",
+ "version": "0.1.11",
"license": "Apache-2.0",
"dependencies": {
"zod": "^3.25.0 || ^4.0.0"
diff --git a/package.json b/package.json
index 360bfe46..c4ff254d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@openrouter/sdk",
- "version": "0.1.10",
+ "version": "0.1.11",
"author": "OpenRouter",
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
"keywords": [
diff --git a/src/lib/config.ts b/src/lib/config.ts
index 67ba46fc..516c1e42 100644
--- a/src/lib/config.ts
+++ b/src/lib/config.ts
@@ -59,7 +59,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "1.0.0",
- sdkVersion: "0.1.10",
- genVersion: "2.748.4",
- userAgent: "speakeasy-sdk/typescript 0.1.10 2.748.4 1.0.0 @openrouter/sdk",
+ sdkVersion: "0.1.11",
+ genVersion: "2.750.0",
+ userAgent: "speakeasy-sdk/typescript 0.1.11 2.750.0 1.0.0 @openrouter/sdk",
} as const;
diff --git a/src/models/chatcompletionfinishreason.ts b/src/models/chatcompletionfinishreason.ts
index 1ce53c45..57f8af17 100644
--- a/src/models/chatcompletionfinishreason.ts
+++ b/src/models/chatcompletionfinishreason.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const ChatCompletionFinishReason = {
ToolCalls: "tool_calls",
@@ -20,8 +21,4 @@ export type ChatCompletionFinishReason = OpenEnum<
export const ChatCompletionFinishReason$inboundSchema: z.ZodType<
ChatCompletionFinishReason,
unknown
-> = z
- .union([
- z.enum(ChatCompletionFinishReason),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ChatCompletionFinishReason);
diff --git a/src/models/chatgenerationparams.ts b/src/models/chatgenerationparams.ts
index 47a3a91b..5ee5ae84 100644
--- a/src/models/chatgenerationparams.ts
+++ b/src/models/chatgenerationparams.ts
@@ -4,7 +4,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
-import { OpenEnum, Unrecognized } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import {
ChatStreamOptions,
ChatStreamOptions$Outbound,
@@ -101,10 +102,8 @@ export type ChatGenerationParams = {
};
/** @internal */
-export const Effort$outboundSchema: z.ZodType = z.union([
- z.enum(Effort),
- z.string().and(z.custom>()),
-]);
+export const Effort$outboundSchema: z.ZodType = openEnums
+ .outboundSchema(Effort);
/** @internal */
export type Reasoning$Outbound = {
diff --git a/src/models/chatmessagecontentitemaudio.ts b/src/models/chatmessagecontentitemaudio.ts
index e69638ca..fd289562 100644
--- a/src/models/chatmessagecontentitemaudio.ts
+++ b/src/models/chatmessagecontentitemaudio.ts
@@ -5,11 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
@@ -40,19 +37,12 @@ export type ChatMessageContentItemAudio = {
export const ChatMessageContentItemAudioFormat$inboundSchema: z.ZodType<
ChatMessageContentItemAudioFormat,
unknown
-> = z
- .union([
- z.enum(ChatMessageContentItemAudioFormat),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ChatMessageContentItemAudioFormat);
/** @internal */
export const ChatMessageContentItemAudioFormat$outboundSchema: z.ZodType<
- ChatMessageContentItemAudioFormat,
+ string,
ChatMessageContentItemAudioFormat
-> = z.union([
- z.enum(ChatMessageContentItemAudioFormat),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(ChatMessageContentItemAudioFormat);
/** @internal */
export const ChatMessageContentItemAudioInputAudio$inboundSchema: z.ZodType<
diff --git a/src/models/chatmessagecontentitemimage.ts b/src/models/chatmessagecontentitemimage.ts
index d3003ac1..5e43bf42 100644
--- a/src/models/chatmessagecontentitemimage.ts
+++ b/src/models/chatmessagecontentitemimage.ts
@@ -5,11 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
@@ -36,19 +33,12 @@ export type ChatMessageContentItemImage = {
export const ChatMessageContentItemImageDetail$inboundSchema: z.ZodType<
ChatMessageContentItemImageDetail,
unknown
-> = z
- .union([
- z.enum(ChatMessageContentItemImageDetail),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ChatMessageContentItemImageDetail);
/** @internal */
export const ChatMessageContentItemImageDetail$outboundSchema: z.ZodType<
- ChatMessageContentItemImageDetail,
+ string,
ChatMessageContentItemImageDetail
-> = z.union([
- z.enum(ChatMessageContentItemImageDetail),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(ChatMessageContentItemImageDetail);
/** @internal */
export const ImageUrl$inboundSchema: z.ZodType = z.object({
diff --git a/src/models/completionchoice.ts b/src/models/completionchoice.ts
index e9bc616e..ea525d2c 100644
--- a/src/models/completionchoice.ts
+++ b/src/models/completionchoice.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import {
CompletionLogprobs,
@@ -31,11 +32,7 @@ export type CompletionChoice = {
export const CompletionFinishReason$inboundSchema: z.ZodType<
CompletionFinishReason,
unknown
-> = z
- .union([
- z.enum(CompletionFinishReason),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(CompletionFinishReason);
/** @internal */
export const CompletionChoice$inboundSchema: z.ZodType<
diff --git a/src/models/createchargerequest.ts b/src/models/createchargerequest.ts
index 260df15d..7d5ad288 100644
--- a/src/models/createchargerequest.ts
+++ b/src/models/createchargerequest.ts
@@ -4,7 +4,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
-import { OpenEnum, Unrecognized } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const ChainId = {
One: 1,
@@ -23,10 +24,8 @@ export type CreateChargeRequest = {
};
/** @internal */
-export const ChainId$outboundSchema: z.ZodType = z.union([
- z.enum(ChainId),
- z.number().and(z.custom>()),
-]);
+export const ChainId$outboundSchema: z.ZodType = openEnums
+ .outboundSchemaInt(ChainId);
/** @internal */
export type CreateChargeRequest$Outbound = {
diff --git a/src/models/endpointstatus.ts b/src/models/endpointstatus.ts
index 10a8408e..0a64d91d 100644
--- a/src/models/endpointstatus.ts
+++ b/src/models/endpointstatus.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const EndpointStatus = {
Zero: 0,
@@ -17,8 +18,4 @@ export type EndpointStatus = OpenEnum;
/** @internal */
export const EndpointStatus$inboundSchema: z.ZodType =
- z
- .union([
- z.enum(EndpointStatus),
- z.number().transform(catchUnrecognizedEnum),
- ]);
+ openEnums.inboundSchemaInt(EndpointStatus);
diff --git a/src/models/imagegenerationstatus.ts b/src/models/imagegenerationstatus.ts
index 38760f2a..448a4bc9 100644
--- a/src/models/imagegenerationstatus.ts
+++ b/src/models/imagegenerationstatus.ts
@@ -3,11 +3,8 @@
*/
import * as z from "zod/v4";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const ImageGenerationStatus = {
InProgress: "in_progress",
@@ -21,16 +18,9 @@ export type ImageGenerationStatus = OpenEnum;
export const ImageGenerationStatus$inboundSchema: z.ZodType<
ImageGenerationStatus,
unknown
-> = z
- .union([
- z.enum(ImageGenerationStatus),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ImageGenerationStatus);
/** @internal */
export const ImageGenerationStatus$outboundSchema: z.ZodType<
- ImageGenerationStatus,
+ string,
ImageGenerationStatus
-> = z.union([
- z.enum(ImageGenerationStatus),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(ImageGenerationStatus);
diff --git a/src/models/inputmodality.ts b/src/models/inputmodality.ts
index 4bb827cf..7ce05bff 100644
--- a/src/models/inputmodality.ts
+++ b/src/models/inputmodality.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const InputModality = {
Text: "text",
@@ -15,8 +16,5 @@ export const InputModality = {
export type InputModality = OpenEnum;
/** @internal */
-export const InputModality$inboundSchema: z.ZodType = z
- .union([
- z.enum(InputModality),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const InputModality$inboundSchema: z.ZodType =
+ openEnums.inboundSchema(InputModality);
diff --git a/src/models/instructtype.ts b/src/models/instructtype.ts
index 04f1a2a3..2353fbb0 100644
--- a/src/models/instructtype.ts
+++ b/src/models/instructtype.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
/**
* Instruction format type
@@ -38,8 +39,5 @@ export const InstructType = {
export type InstructType = OpenEnum;
/** @internal */
-export const InstructType$inboundSchema: z.ZodType = z
- .union([
- z.enum(InstructType),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const InstructType$inboundSchema: z.ZodType =
+ openEnums.inboundSchema(InstructType);
diff --git a/src/models/listendpointsresponse.ts b/src/models/listendpointsresponse.ts
index 96eb7130..184395b4 100644
--- a/src/models/listendpointsresponse.ts
+++ b/src/models/listendpointsresponse.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
import { InputModality, InputModality$inboundSchema } from "./inputmodality.js";
@@ -99,11 +100,8 @@ export type ListEndpointsResponse = {
};
/** @internal */
-export const Tokenizer$inboundSchema: z.ZodType = z
- .union([
- z.enum(Tokenizer),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const Tokenizer$inboundSchema: z.ZodType = openEnums
+ .inboundSchema(Tokenizer);
/** @internal */
export const Architecture$inboundSchema: z.ZodType = z
diff --git a/src/models/modelarchitecture.ts b/src/models/modelarchitecture.ts
index 60d966ba..cc1af3ba 100644
--- a/src/models/modelarchitecture.ts
+++ b/src/models/modelarchitecture.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
import { InputModality, InputModality$inboundSchema } from "./inputmodality.js";
@@ -79,11 +80,7 @@ export type ModelArchitecture = {
export const ModelArchitectureInstructType$inboundSchema: z.ZodType<
ModelArchitectureInstructType,
unknown
-> = z
- .union([
- z.enum(ModelArchitectureInstructType),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ModelArchitectureInstructType);
/** @internal */
export const ModelArchitecture$inboundSchema: z.ZodType<
diff --git a/src/models/modelgroup.ts b/src/models/modelgroup.ts
index 05dcbda9..46567fe6 100644
--- a/src/models/modelgroup.ts
+++ b/src/models/modelgroup.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
/**
* Tokenizer type used by the model
@@ -35,8 +36,5 @@ export const ModelGroup = {
export type ModelGroup = OpenEnum;
/** @internal */
-export const ModelGroup$inboundSchema: z.ZodType = z
- .union([
- z.enum(ModelGroup),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const ModelGroup$inboundSchema: z.ZodType =
+ openEnums.inboundSchema(ModelGroup);
diff --git a/src/models/openairesponsesincludable.ts b/src/models/openairesponsesincludable.ts
index 0e7efebc..f377c38a 100644
--- a/src/models/openairesponsesincludable.ts
+++ b/src/models/openairesponsesincludable.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { OpenEnum, Unrecognized } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const OpenAIResponsesIncludable = {
FileSearchCallResults: "file_search_call.results",
@@ -18,9 +19,6 @@ export type OpenAIResponsesIncludable = OpenEnum<
/** @internal */
export const OpenAIResponsesIncludable$outboundSchema: z.ZodType<
- OpenAIResponsesIncludable,
+ string,
OpenAIResponsesIncludable
-> = z.union([
- z.enum(OpenAIResponsesIncludable),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(OpenAIResponsesIncludable);
diff --git a/src/models/openairesponsesincompletedetails.ts b/src/models/openairesponsesincompletedetails.ts
index 04946239..03fb41a8 100644
--- a/src/models/openairesponsesincompletedetails.ts
+++ b/src/models/openairesponsesincompletedetails.ts
@@ -4,7 +4,8 @@
import * as z from "zod/v4";
import { safeParse } from "../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
@@ -19,11 +20,8 @@ export type OpenAIResponsesIncompleteDetails = {
};
/** @internal */
-export const Reason$inboundSchema: z.ZodType = z
- .union([
- z.enum(Reason),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const Reason$inboundSchema: z.ZodType = openEnums
+ .inboundSchema(Reason);
/** @internal */
export const OpenAIResponsesIncompleteDetails$inboundSchema: z.ZodType<
diff --git a/src/models/openairesponsesreasoningeffort.ts b/src/models/openairesponsesreasoningeffort.ts
index 3aef746b..7d496e1d 100644
--- a/src/models/openairesponsesreasoningeffort.ts
+++ b/src/models/openairesponsesreasoningeffort.ts
@@ -3,11 +3,8 @@
*/
import * as z from "zod/v4";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const OpenAIResponsesReasoningEffort = {
High: "high",
@@ -23,16 +20,9 @@ export type OpenAIResponsesReasoningEffort = OpenEnum<
export const OpenAIResponsesReasoningEffort$inboundSchema: z.ZodType<
OpenAIResponsesReasoningEffort,
unknown
-> = z
- .union([
- z.enum(OpenAIResponsesReasoningEffort),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(OpenAIResponsesReasoningEffort);
/** @internal */
export const OpenAIResponsesReasoningEffort$outboundSchema: z.ZodType<
- OpenAIResponsesReasoningEffort,
+ string,
OpenAIResponsesReasoningEffort
-> = z.union([
- z.enum(OpenAIResponsesReasoningEffort),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(OpenAIResponsesReasoningEffort);
diff --git a/src/models/openairesponsesresponsestatus.ts b/src/models/openairesponsesresponsestatus.ts
index 4dc8f5bc..7d0c0764 100644
--- a/src/models/openairesponsesresponsestatus.ts
+++ b/src/models/openairesponsesresponsestatus.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const OpenAIResponsesResponseStatus = {
Completed: "completed",
@@ -21,8 +22,4 @@ export type OpenAIResponsesResponseStatus = OpenEnum<
export const OpenAIResponsesResponseStatus$inboundSchema: z.ZodType<
OpenAIResponsesResponseStatus,
unknown
-> = z
- .union([
- z.enum(OpenAIResponsesResponseStatus),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(OpenAIResponsesResponseStatus);
diff --git a/src/models/openairesponsesservicetier.ts b/src/models/openairesponsesservicetier.ts
index 4b966503..6189fd19 100644
--- a/src/models/openairesponsesservicetier.ts
+++ b/src/models/openairesponsesservicetier.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const OpenAIResponsesServiceTier = {
Auto: "auto",
@@ -20,8 +21,4 @@ export type OpenAIResponsesServiceTier = OpenEnum<
export const OpenAIResponsesServiceTier$inboundSchema: z.ZodType<
OpenAIResponsesServiceTier,
unknown
-> = z
- .union([
- z.enum(OpenAIResponsesServiceTier),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(OpenAIResponsesServiceTier);
diff --git a/src/models/openairesponsestruncation.ts b/src/models/openairesponsestruncation.ts
index 5d0c3e1a..f556163b 100644
--- a/src/models/openairesponsestruncation.ts
+++ b/src/models/openairesponsestruncation.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const OpenAIResponsesTruncation = {
Auto: "auto",
@@ -17,8 +18,4 @@ export type OpenAIResponsesTruncation = OpenEnum<
export const OpenAIResponsesTruncation$inboundSchema: z.ZodType<
OpenAIResponsesTruncation,
unknown
-> = z
- .union([
- z.enum(OpenAIResponsesTruncation),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(OpenAIResponsesTruncation);
diff --git a/src/models/openresponsesreasoning.ts b/src/models/openresponsesreasoning.ts
index 14c9eb64..1d038dd8 100644
--- a/src/models/openresponsesreasoning.ts
+++ b/src/models/openresponsesreasoning.ts
@@ -4,7 +4,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
-import { ClosedEnum, OpenEnum, Unrecognized } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { ClosedEnum, OpenEnum } from "../types/enums.js";
import {
ReasoningSummaryText,
ReasoningSummaryText$Outbound,
@@ -125,12 +126,9 @@ export function openResponsesReasoningStatusUnionToJSON(
/** @internal */
export const OpenResponsesReasoningFormat$outboundSchema: z.ZodType<
- OpenResponsesReasoningFormat,
+ string,
OpenResponsesReasoningFormat
-> = z.union([
- z.enum(OpenResponsesReasoningFormat),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(OpenResponsesReasoningFormat);
/** @internal */
export type OpenResponsesReasoning$Outbound = {
diff --git a/src/models/openresponsesrequest.ts b/src/models/openresponsesrequest.ts
index c9e4e9c5..9cea8d0c 100644
--- a/src/models/openresponsesrequest.ts
+++ b/src/models/openresponsesrequest.ts
@@ -4,7 +4,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
-import { ClosedEnum, OpenEnum, Unrecognized } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { ClosedEnum, OpenEnum } from "../types/enums.js";
import {
OpenAIResponsesIncludable,
OpenAIResponsesIncludable$outboundSchema,
@@ -400,27 +401,16 @@ export function openResponsesRequestToolUnionToJSON(
}
/** @internal */
-export const ServiceTier$outboundSchema: z.ZodType = z
- .union([
- z.enum(ServiceTier),
- z.string().and(z.custom>()),
- ]);
+export const ServiceTier$outboundSchema: z.ZodType =
+ openEnums.outboundSchema(ServiceTier);
/** @internal */
-export const Truncation$outboundSchema: z.ZodType = z
- .union([
- z.enum(Truncation),
- z.string().and(z.custom>()),
- ]);
+export const Truncation$outboundSchema: z.ZodType =
+ openEnums.outboundSchema(Truncation);
/** @internal */
-export const DataCollection$outboundSchema: z.ZodType<
- DataCollection,
- DataCollection
-> = z.union([
- z.enum(DataCollection),
- z.string().and(z.custom>()),
-]);
+export const DataCollection$outboundSchema: z.ZodType =
+ openEnums.outboundSchema(DataCollection);
/** @internal */
export type Order$Outbound = string | string;
@@ -460,10 +450,8 @@ export function ignoreToJSON(ignore: Ignore): string {
}
/** @internal */
-export const Sort$outboundSchema: z.ZodType = z.union([
- z.enum(Sort),
- z.string().and(z.custom>()),
-]);
+export const Sort$outboundSchema: z.ZodType = openEnums
+ .outboundSchema(Sort);
/** @internal */
export type MaxPrice$Outbound = {
@@ -542,11 +530,8 @@ export const IdFileParser$outboundSchema: z.ZodEnum = z
.enum(IdFileParser);
/** @internal */
-export const PdfEngine$outboundSchema: z.ZodType = z
- .union([
- z.enum(PdfEngine),
- z.string().and(z.custom>()),
- ]);
+export const PdfEngine$outboundSchema: z.ZodType = openEnums
+ .outboundSchema(PdfEngine);
/** @internal */
export type Pdf$Outbound = {
@@ -595,10 +580,8 @@ export function pluginFileParserToJSON(
export const IdWeb$outboundSchema: z.ZodEnum = z.enum(IdWeb);
/** @internal */
-export const Engine$outboundSchema: z.ZodType = z.union([
- z.enum(Engine),
- z.string().and(z.custom>()),
-]);
+export const Engine$outboundSchema: z.ZodType = openEnums
+ .outboundSchema(Engine);
/** @internal */
export type PluginWeb$Outbound = {
diff --git a/src/models/openresponsesresponsetext.ts b/src/models/openresponsesresponsetext.ts
index 4c00c96b..ee8a07de 100644
--- a/src/models/openresponsesresponsetext.ts
+++ b/src/models/openresponsesresponsetext.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { OpenEnum, Unrecognized } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import {
ResponseFormatTextConfig,
ResponseFormatTextConfig$Outbound,
@@ -32,12 +33,9 @@ export type OpenResponsesResponseText = {
/** @internal */
export const OpenResponsesResponseTextVerbosity$outboundSchema: z.ZodType<
- OpenResponsesResponseTextVerbosity,
+ string,
OpenResponsesResponseTextVerbosity
-> = z.union([
- z.enum(OpenResponsesResponseTextVerbosity),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(OpenResponsesResponseTextVerbosity);
/** @internal */
export type OpenResponsesResponseText$Outbound = {
diff --git a/src/models/operations/createauthkeyscode.ts b/src/models/operations/createauthkeyscode.ts
index dee1cb36..5dc902ac 100644
--- a/src/models/operations/createauthkeyscode.ts
+++ b/src/models/operations/createauthkeyscode.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
-import { OpenEnum, Unrecognized } from "../../types/enums.js";
+import * as openEnums from "../../types/enums.js";
+import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -76,12 +77,9 @@ export type CreateAuthKeysCodeResponse = {
/** @internal */
export const CreateAuthKeysCodeCodeChallengeMethod$outboundSchema: z.ZodType<
- CreateAuthKeysCodeCodeChallengeMethod,
+ string,
CreateAuthKeysCodeCodeChallengeMethod
-> = z.union([
- z.enum(CreateAuthKeysCodeCodeChallengeMethod),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(CreateAuthKeysCodeCodeChallengeMethod);
/** @internal */
export type CreateAuthKeysCodeRequest$Outbound = {
diff --git a/src/models/operations/createembeddings.ts b/src/models/operations/createembeddings.ts
index 706b0d97..f5bbe852 100644
--- a/src/models/operations/createembeddings.ts
+++ b/src/models/operations/createembeddings.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
-import { ClosedEnum, OpenEnum, Unrecognized } from "../../types/enums.js";
+import * as openEnums from "../../types/enums.js";
+import { ClosedEnum, OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import * as models from "../index.js";
@@ -213,13 +214,8 @@ export function inputToJSON(input: Input): string {
}
/** @internal */
-export const DataCollection$outboundSchema: z.ZodType<
- DataCollection,
- DataCollection
-> = z.union([
- z.enum(DataCollection),
- z.string().and(z.custom>()),
-]);
+export const DataCollection$outboundSchema: z.ZodType =
+ openEnums.outboundSchema(DataCollection);
/** @internal */
export type Order$Outbound = string | string;
@@ -259,10 +255,8 @@ export function ignoreToJSON(ignore: Ignore): string {
}
/** @internal */
-export const Sort$outboundSchema: z.ZodType = z.union([
- z.enum(Sort),
- z.string().and(z.custom>()),
-]);
+export const Sort$outboundSchema: z.ZodType = openEnums
+ .outboundSchema(Sort);
/** @internal */
export type MaxPrice$Outbound = {
diff --git a/src/models/operations/createkeys.ts b/src/models/operations/createkeys.ts
index 991e8573..5bb6789b 100644
--- a/src/models/operations/createkeys.ts
+++ b/src/models/operations/createkeys.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
-import { OpenEnum, Unrecognized } from "../../types/enums.js";
+import * as openEnums from "../../types/enums.js";
+import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -40,7 +41,7 @@ export type CreateKeysRequest = {
*/
includeByokInLimit?: boolean | undefined;
/**
- * Optional ISO 8601 timestamp with timezone when the API key should expire
+ * Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected
*/
expiresAt?: Date | null | undefined;
};
@@ -143,12 +144,9 @@ export type CreateKeysResponse = {
/** @internal */
export const CreateKeysLimitReset$outboundSchema: z.ZodType<
- CreateKeysLimitReset,
+ string,
CreateKeysLimitReset
-> = z.union([
- z.enum(CreateKeysLimitReset),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(CreateKeysLimitReset);
/** @internal */
export type CreateKeysRequest$Outbound = {
diff --git a/src/models/operations/exchangeauthcodeforapikey.ts b/src/models/operations/exchangeauthcodeforapikey.ts
index f4f95175..4b04707e 100644
--- a/src/models/operations/exchangeauthcodeforapikey.ts
+++ b/src/models/operations/exchangeauthcodeforapikey.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
-import { OpenEnum, Unrecognized } from "../../types/enums.js";
+import * as openEnums from "../../types/enums.js";
+import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -57,13 +58,8 @@ export type ExchangeAuthCodeForAPIKeyResponse = {
/** @internal */
export const ExchangeAuthCodeForAPIKeyCodeChallengeMethod$outboundSchema:
- z.ZodType<
- ExchangeAuthCodeForAPIKeyCodeChallengeMethod,
- ExchangeAuthCodeForAPIKeyCodeChallengeMethod
- > = z.union([
- z.enum(ExchangeAuthCodeForAPIKeyCodeChallengeMethod),
- z.string().and(z.custom>()),
- ]);
+ z.ZodType = openEnums
+ .outboundSchema(ExchangeAuthCodeForAPIKeyCodeChallengeMethod);
/** @internal */
export type ExchangeAuthCodeForAPIKeyRequest$Outbound = {
diff --git a/src/models/operations/getcurrentkey.ts b/src/models/operations/getcurrentkey.ts
index 583181a2..0b96d6d1 100644
--- a/src/models/operations/getcurrentkey.ts
+++ b/src/models/operations/getcurrentkey.ts
@@ -92,6 +92,10 @@ export type GetCurrentKeyData = {
* Whether to include external BYOK usage in the credit limit
*/
includeByokInLimit: boolean;
+ /**
+ * ISO 8601 UTC timestamp when the API key expires, or null if no expiration
+ */
+ expiresAt?: Date | null | undefined;
/**
* Legacy rate limit information about a key. Will always return -1.
*
@@ -147,6 +151,9 @@ export const GetCurrentKeyData$inboundSchema: z.ZodType<
limit_remaining: z.nullable(z.number()),
limit_reset: z.nullable(z.string()),
include_byok_in_limit: z.boolean(),
+ expires_at: z.nullable(
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
+ ).optional(),
rate_limit: z.lazy(() => RateLimit$inboundSchema),
}).transform((v) => {
return remap$(v, {
@@ -162,6 +169,7 @@ export const GetCurrentKeyData$inboundSchema: z.ZodType<
"limit_remaining": "limitRemaining",
"limit_reset": "limitReset",
"include_byok_in_limit": "includeByokInLimit",
+ "expires_at": "expiresAt",
"rate_limit": "rateLimit",
});
});
diff --git a/src/models/operations/getgeneration.ts b/src/models/operations/getgeneration.ts
index deb56079..30a163ee 100644
--- a/src/models/operations/getgeneration.ts
+++ b/src/models/operations/getgeneration.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../../types/enums.js";
+import * as openEnums from "../../types/enums.js";
+import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -191,11 +192,8 @@ export function getGenerationRequestToJSON(
}
/** @internal */
-export const ApiType$inboundSchema: z.ZodType = z
- .union([
- z.enum(ApiType),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const ApiType$inboundSchema: z.ZodType = openEnums
+ .inboundSchema(ApiType);
/** @internal */
export const GetGenerationData$inboundSchema: z.ZodType<
diff --git a/src/models/operations/getparameters.ts b/src/models/operations/getparameters.ts
index 681a9f7b..ffda79fe 100644
--- a/src/models/operations/getparameters.ts
+++ b/src/models/operations/getparameters.ts
@@ -5,11 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../../types/enums.js";
+import * as openEnums from "../../types/enums.js";
+import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -169,12 +166,9 @@ export function getParametersSecurityToJSON(
/** @internal */
export const GetParametersProvider$outboundSchema: z.ZodType<
- GetParametersProvider,
+ string,
GetParametersProvider
-> = z.union([
- z.enum(GetParametersProvider),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(GetParametersProvider);
/** @internal */
export type GetParametersRequest$Outbound = {
@@ -205,11 +199,7 @@ export function getParametersRequestToJSON(
export const SupportedParameter$inboundSchema: z.ZodType<
SupportedParameter,
unknown
-> = z
- .union([
- z.enum(SupportedParameter),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(SupportedParameter);
/** @internal */
export const GetParametersData$inboundSchema: z.ZodType<
diff --git a/src/models/operations/updatekeys.ts b/src/models/operations/updatekeys.ts
index 1a935c03..3cf2c3a2 100644
--- a/src/models/operations/updatekeys.ts
+++ b/src/models/operations/updatekeys.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
-import { OpenEnum, Unrecognized } from "../../types/enums.js";
+import * as openEnums from "../../types/enums.js";
+import { OpenEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -147,12 +148,9 @@ export type UpdateKeysResponse = {
/** @internal */
export const UpdateKeysLimitReset$outboundSchema: z.ZodType<
- UpdateKeysLimitReset,
+ string,
UpdateKeysLimitReset
-> = z.union([
- z.enum(UpdateKeysLimitReset),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(UpdateKeysLimitReset);
/** @internal */
export type UpdateKeysRequestBody$Outbound = {
diff --git a/src/models/outputmodality.ts b/src/models/outputmodality.ts
index 4d4621bd..29f6c937 100644
--- a/src/models/outputmodality.ts
+++ b/src/models/outputmodality.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const OutputModality = {
Text: "text",
@@ -14,8 +15,4 @@ export type OutputModality = OpenEnum;
/** @internal */
export const OutputModality$inboundSchema: z.ZodType =
- z
- .union([
- z.enum(OutputModality),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+ openEnums.inboundSchema(OutputModality);
diff --git a/src/models/parameter.ts b/src/models/parameter.ts
index 1ad8ecff..9753ec38 100644
--- a/src/models/parameter.ts
+++ b/src/models/parameter.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const Parameter = {
Temperature: "temperature",
@@ -33,8 +34,5 @@ export const Parameter = {
export type Parameter = OpenEnum;
/** @internal */
-export const Parameter$inboundSchema: z.ZodType = z
- .union([
- z.enum(Parameter),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const Parameter$inboundSchema: z.ZodType = openEnums
+ .inboundSchema(Parameter);
diff --git a/src/models/providername.ts b/src/models/providername.ts
index 17edf0ec..544177a1 100644
--- a/src/models/providername.ts
+++ b/src/models/providername.ts
@@ -3,11 +3,8 @@
*/
import * as z from "zod/v4";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const ProviderName = {
AnyScale: "AnyScale",
@@ -100,16 +97,8 @@ export const ProviderName = {
export type ProviderName = OpenEnum;
/** @internal */
-export const ProviderName$inboundSchema: z.ZodType = z
- .union([
- z.enum(ProviderName),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const ProviderName$inboundSchema: z.ZodType =
+ openEnums.inboundSchema(ProviderName);
/** @internal */
-export const ProviderName$outboundSchema: z.ZodType<
- ProviderName,
- ProviderName
-> = z.union([
- z.enum(ProviderName),
- z.string().and(z.custom>()),
-]);
+export const ProviderName$outboundSchema: z.ZodType =
+ openEnums.outboundSchema(ProviderName);
diff --git a/src/models/publicendpoint.ts b/src/models/publicendpoint.ts
index 21e2f877..d0d14ff5 100644
--- a/src/models/publicendpoint.ts
+++ b/src/models/publicendpoint.ts
@@ -5,7 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import {
EndpointStatus,
@@ -136,11 +137,7 @@ export function pricingFromJSON(
export const PublicEndpointQuantization$inboundSchema: z.ZodType<
PublicEndpointQuantization,
unknown
-> = z
- .union([
- z.enum(PublicEndpointQuantization),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(PublicEndpointQuantization);
/** @internal */
export const PublicEndpoint$inboundSchema: z.ZodType =
diff --git a/src/models/quantization.ts b/src/models/quantization.ts
index baa017bd..ba97cd53 100644
--- a/src/models/quantization.ts
+++ b/src/models/quantization.ts
@@ -3,7 +3,8 @@
*/
import * as z from "zod/v4";
-import { OpenEnum, Unrecognized } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const Quantization = {
Int4: "int4",
@@ -19,10 +20,5 @@ export const Quantization = {
export type Quantization = OpenEnum;
/** @internal */
-export const Quantization$outboundSchema: z.ZodType<
- Quantization,
- Quantization
-> = z.union([
- z.enum(Quantization),
- z.string().and(z.custom>()),
-]);
+export const Quantization$outboundSchema: z.ZodType =
+ openEnums.outboundSchema(Quantization);
diff --git a/src/models/reasoningsummaryverbosity.ts b/src/models/reasoningsummaryverbosity.ts
index 8ad72922..8b95035c 100644
--- a/src/models/reasoningsummaryverbosity.ts
+++ b/src/models/reasoningsummaryverbosity.ts
@@ -3,11 +3,8 @@
*/
import * as z from "zod/v4";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const ReasoningSummaryVerbosity = {
Auto: "auto",
@@ -22,16 +19,9 @@ export type ReasoningSummaryVerbosity = OpenEnum<
export const ReasoningSummaryVerbosity$inboundSchema: z.ZodType<
ReasoningSummaryVerbosity,
unknown
-> = z
- .union([
- z.enum(ReasoningSummaryVerbosity),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ReasoningSummaryVerbosity);
/** @internal */
export const ReasoningSummaryVerbosity$outboundSchema: z.ZodType<
- ReasoningSummaryVerbosity,
+ string,
ReasoningSummaryVerbosity
-> = z.union([
- z.enum(ReasoningSummaryVerbosity),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(ReasoningSummaryVerbosity);
diff --git a/src/models/responseinputaudio.ts b/src/models/responseinputaudio.ts
index eadffa5f..c52ffda7 100644
--- a/src/models/responseinputaudio.ts
+++ b/src/models/responseinputaudio.ts
@@ -5,12 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import {
- catchUnrecognizedEnum,
- ClosedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { ClosedEnum, OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
@@ -53,19 +49,12 @@ export const ResponseInputAudioType$outboundSchema: z.ZodEnum<
export const ResponseInputAudioFormat$inboundSchema: z.ZodType<
ResponseInputAudioFormat,
unknown
-> = z
- .union([
- z.enum(ResponseInputAudioFormat),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ResponseInputAudioFormat);
/** @internal */
export const ResponseInputAudioFormat$outboundSchema: z.ZodType<
- ResponseInputAudioFormat,
+ string,
ResponseInputAudioFormat
-> = z.union([
- z.enum(ResponseInputAudioFormat),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(ResponseInputAudioFormat);
/** @internal */
export const ResponseInputAudioInputAudio$inboundSchema: z.ZodType<
diff --git a/src/models/responseinputimage.ts b/src/models/responseinputimage.ts
index 6be3caa4..1e9aa447 100644
--- a/src/models/responseinputimage.ts
+++ b/src/models/responseinputimage.ts
@@ -5,12 +5,8 @@
import * as z from "zod/v4";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
-import {
- catchUnrecognizedEnum,
- ClosedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { ClosedEnum, OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
@@ -50,19 +46,12 @@ export const ResponseInputImageType$outboundSchema: z.ZodEnum<
export const ResponseInputImageDetail$inboundSchema: z.ZodType<
ResponseInputImageDetail,
unknown
-> = z
- .union([
- z.enum(ResponseInputImageDetail),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ResponseInputImageDetail);
/** @internal */
export const ResponseInputImageDetail$outboundSchema: z.ZodType<
- ResponseInputImageDetail,
+ string,
ResponseInputImageDetail
-> = z.union([
- z.enum(ResponseInputImageDetail),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(ResponseInputImageDetail);
/** @internal */
export const ResponseInputImage$inboundSchema: z.ZodType<
diff --git a/src/models/responseserrorfield.ts b/src/models/responseserrorfield.ts
index 4a5d2523..1c81b4b9 100644
--- a/src/models/responseserrorfield.ts
+++ b/src/models/responseserrorfield.ts
@@ -4,7 +4,8 @@
import * as z from "zod/v4";
import { safeParse } from "../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
@@ -39,11 +40,8 @@ export type ResponsesErrorField = {
};
/** @internal */
-export const CodeEnum$inboundSchema: z.ZodType = z
- .union([
- z.enum(CodeEnum),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+export const CodeEnum$inboundSchema: z.ZodType = openEnums
+ .inboundSchema(CodeEnum);
/** @internal */
export const ResponsesErrorField$inboundSchema: z.ZodType<
diff --git a/src/models/responsessearchcontextsize.ts b/src/models/responsessearchcontextsize.ts
index 80989c19..5bb9e554 100644
--- a/src/models/responsessearchcontextsize.ts
+++ b/src/models/responsessearchcontextsize.ts
@@ -3,11 +3,8 @@
*/
import * as z from "zod/v4";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
/**
* Size of the search context for web search tools
@@ -28,16 +25,9 @@ export type ResponsesSearchContextSize = OpenEnum<
export const ResponsesSearchContextSize$inboundSchema: z.ZodType<
ResponsesSearchContextSize,
unknown
-> = z
- .union([
- z.enum(ResponsesSearchContextSize),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ResponsesSearchContextSize);
/** @internal */
export const ResponsesSearchContextSize$outboundSchema: z.ZodType<
- ResponsesSearchContextSize,
+ string,
ResponsesSearchContextSize
-> = z.union([
- z.enum(ResponsesSearchContextSize),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(ResponsesSearchContextSize);
diff --git a/src/models/responsetextconfig.ts b/src/models/responsetextconfig.ts
index f7d8f409..e36ea294 100644
--- a/src/models/responsetextconfig.ts
+++ b/src/models/responsetextconfig.ts
@@ -4,7 +4,8 @@
import * as z from "zod/v4";
import { safeParse } from "../lib/schemas.js";
-import { catchUnrecognizedEnum, OpenEnum } from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
import {
@@ -36,11 +37,7 @@ export type ResponseTextConfig = {
export const ResponseTextConfigVerbosity$inboundSchema: z.ZodType<
ResponseTextConfigVerbosity,
unknown
-> = z
- .union([
- z.enum(ResponseTextConfigVerbosity),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(ResponseTextConfigVerbosity);
/** @internal */
export const ResponseTextConfig$inboundSchema: z.ZodType<
diff --git a/src/models/toolcallstatus.ts b/src/models/toolcallstatus.ts
index 131ee4eb..79485fd7 100644
--- a/src/models/toolcallstatus.ts
+++ b/src/models/toolcallstatus.ts
@@ -3,11 +3,8 @@
*/
import * as z from "zod/v4";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const ToolCallStatus = {
InProgress: "in_progress",
@@ -18,16 +15,7 @@ export type ToolCallStatus = OpenEnum;
/** @internal */
export const ToolCallStatus$inboundSchema: z.ZodType =
- z
- .union([
- z.enum(ToolCallStatus),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+ openEnums.inboundSchema(ToolCallStatus);
/** @internal */
-export const ToolCallStatus$outboundSchema: z.ZodType<
- ToolCallStatus,
- ToolCallStatus
-> = z.union([
- z.enum(ToolCallStatus),
- z.string().and(z.custom>()),
-]);
+export const ToolCallStatus$outboundSchema: z.ZodType =
+ openEnums.outboundSchema(ToolCallStatus);
diff --git a/src/models/websearchstatus.ts b/src/models/websearchstatus.ts
index ef4dcf47..ac6dbc70 100644
--- a/src/models/websearchstatus.ts
+++ b/src/models/websearchstatus.ts
@@ -3,11 +3,8 @@
*/
import * as z from "zod/v4";
-import {
- catchUnrecognizedEnum,
- OpenEnum,
- Unrecognized,
-} from "../types/enums.js";
+import * as openEnums from "../types/enums.js";
+import { OpenEnum } from "../types/enums.js";
export const WebSearchStatus = {
Completed: "completed",
@@ -21,16 +18,9 @@ export type WebSearchStatus = OpenEnum;
export const WebSearchStatus$inboundSchema: z.ZodType<
WebSearchStatus,
unknown
-> = z
- .union([
- z.enum(WebSearchStatus),
- z.string().transform(catchUnrecognizedEnum),
- ]);
+> = openEnums.inboundSchema(WebSearchStatus);
/** @internal */
export const WebSearchStatus$outboundSchema: z.ZodType<
- WebSearchStatus,
+ string,
WebSearchStatus
-> = z.union([
- z.enum(WebSearchStatus),
- z.string().and(z.custom>()),
-]);
+> = openEnums.outboundSchema(WebSearchStatus);
diff --git a/src/types/enums.ts b/src/types/enums.ts
index 6fb6d910..7e4fa30b 100644
--- a/src/types/enums.ts
+++ b/src/types/enums.ts
@@ -2,15 +2,64 @@
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
+import * as z from "zod/v4";
+
declare const __brand: unique symbol;
export type Unrecognized = T & { [__brand]: "unrecognized" };
+export type ClosedEnum>> =
+ T[keyof T];
+export type OpenEnum>> =
+ | T[keyof T]
+ | Unrecognized;
-export function catchUnrecognizedEnum(value: T): Unrecognized {
+function unrecognized(value: T): Unrecognized {
+ unrecognizedCount++;
return value as Unrecognized;
}
-type Prettify = { [K in keyof T]: T[K] } & {};
-export type ClosedEnum = T[keyof T];
-export type OpenEnum =
- | Prettify
- | Unrecognized;
+let unrecognizedCount = 0;
+let refCount = 0;
+export function unrecognizedCounter() {
+ refCount++;
+ const start = unrecognizedCount;
+ return {
+ count: () => {
+ const count = unrecognizedCount - start;
+ if (--refCount === 0) unrecognizedCount = 0;
+ return count;
+ },
+ };
+}
+
+export function inboundSchema>(
+ enumObj: T,
+): z.ZodType, unknown> {
+ const options = Object.values(enumObj);
+ return z.union([
+ ...options.map(x => z.literal(x)),
+ z.string().transform(x => unrecognized(x)),
+ ] as any);
+}
+
+export function inboundSchemaInt>(
+ enumObj: T,
+): z.ZodType, unknown> {
+ // For numeric enums, Object.values returns both numbers and string keys
+ const options = Object.values(enumObj).filter(v => typeof v === "number");
+ return z.union([
+ ...options.map(x => z.literal(x)),
+ z.int().transform(x => unrecognized(x)),
+ ] as any);
+}
+
+export function outboundSchema>(
+ _: T,
+): z.ZodType> {
+ return z.string() as any;
+}
+
+export function outboundSchemaInt>(
+ _: T,
+): z.ZodType> {
+ return z.int() as any;
+}
diff --git a/src/types/index.ts b/src/types/index.ts
index e124e817..92d9f734 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -3,7 +3,6 @@
*/
export { blobLikeSchema, isBlobLike } from "./blobs.js";
-export { catchUnrecognizedEnum } from "./enums.js";
export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js";
export type { Result } from "./fp.js";
export type { PageIterator, Paginator } from "./operations.js";