Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ id: 8b6cd71c-ea04-44da-af45-e43968b5928d
management:
docChecksum: bcccd1abd05f6654a822386f2eefbd8a
docVersion: 1.0.0
speakeasyVersion: 1.659.0
generationVersion: 2.755.9
releaseVersion: 0.1.23
configChecksum: 991bb8e65e382038e344c12cdd982649
speakeasyVersion: 1.660.0
generationVersion: 2.760.2
releaseVersion: 0.1.24
configChecksum: 475b25558977e68908a4d0653d872817
repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git
installationURL: https://github.com/OpenRouterTeam/typescript-sdk
published: true
Expand All @@ -15,7 +15,7 @@ features:
acceptHeaders: 2.81.2
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.12
core: 3.26.7
core: 3.26.9
customCodeRegions: 0.1.0
defaultEnabledRetries: 0.1.0
deprecations: 2.81.1
Expand Down Expand Up @@ -797,6 +797,7 @@ generatedFiles:
- src/types/operations.ts
- src/types/rfcdate.ts
- src/types/streams.ts
- src/types/unrecognized.ts
- tsconfig.json
examples:
createChatCompletion:
Expand Down
4 changes: 3 additions & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ generation:
generateNewTests: true
skipResponseBodyAssertions: false
typescript:
version: 0.1.23
version: 0.1.24
acceptHeaderEnum: false
additionalDependencies:
dependencies: {}
Expand Down Expand Up @@ -71,6 +71,7 @@ typescript:
exportZodModelNamespace: false
flattenGlobalSecurity: true
flatteningOrder: parameters-first
forwardCompatibleEnumsByDefault: false
generateExamples: true
imports:
option: openapi
Expand All @@ -83,6 +84,7 @@ typescript:
inferSSEOverload: true
inputModelSuffix: input
jsonpath: rfc9535
laxMode: strict
maxMethodParams: 0
methodArguments: infer-optional-args
modelPropertyCasing: camel
Expand Down
4 changes: 2 additions & 2 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.659.0
speakeasyVersion: 1.660.0
sources:
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
Expand All @@ -14,7 +14,7 @@ targets:
sourceRevisionDigest: sha256:ffe0e925561a55a1b403667fe33bb3158e05892ef1e66f56211544c9a890b301
sourceBlobDigest: sha256:18aa7b22686c2f559af1062fea408a9f80146231027ed1fd62b68df38c71f65d
codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples
codeSamplesRevisionDigest: sha256:7ef1c761fb99fe75b91e84384cfbf9703c9d160d8e9be9a1d72dd49e7df32af3
codeSamplesRevisionDigest: sha256:f856e6a616f0d8edab5b1a77e49bfd32584caeb323d4ee7b740c6a7791c222fb
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "@openrouter/sdk",
"version": "0.1.23",
"version": "0.1.24",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openrouter/sdk",
"version": "0.1.23",
"version": "0.1.24",
"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": [
Expand Down
6 changes: 3 additions & 3 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "1.0.0",
sdkVersion: "0.1.23",
genVersion: "2.755.9",
userAgent: "speakeasy-sdk/typescript 0.1.23 2.755.9 1.0.0 @openrouter/sdk",
sdkVersion: "0.1.24",
genVersion: "2.760.2",
userAgent: "speakeasy-sdk/typescript 0.1.24 2.760.2 1.0.0 @openrouter/sdk",
} as const;
3 changes: 2 additions & 1 deletion src/models/chatstreamingresponsechunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export const ChatStreamingResponseChunk$inboundSchema: z.ZodType<
return JSON.parse(v);
} catch (err) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
input: v,
code: "custom",
message: `malformed json: ${err}`,
});
return z.NEVER;
Expand Down
3 changes: 2 additions & 1 deletion src/models/operations/createresponses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const CreateResponsesResponseBody$inboundSchema: z.ZodType<
return JSON.parse(v);
} catch (err) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
input: v,
code: "custom",
message: `malformed json: ${err}`,
});
return z.NEVER;
Expand Down
22 changes: 1 addition & 21 deletions src/types/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,14 @@
*/

import * as z from "zod/v4";
import { Unrecognized, unrecognized } from "./unrecognized.js";

declare const __brand: unique symbol;
export type Unrecognized<T> = T & { [__brand]: "unrecognized" };
export type ClosedEnum<T extends Readonly<Record<string, string | number>>> =
T[keyof T];
export type OpenEnum<T extends Readonly<Record<string, string | number>>> =
| T[keyof T]
| Unrecognized<T[keyof T] extends number ? number : string>;

function unrecognized<T>(value: T): Unrecognized<T> {
unrecognizedCount++;
return value as Unrecognized<T>;
}

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<T extends Record<string, string>>(
enumObj: T,
): z.ZodType<OpenEnum<T>, unknown> {
Expand Down
3 changes: 2 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
*/

export { blobLikeSchema, isBlobLike } from "./blobs.js";
export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js";
export type { ClosedEnum, OpenEnum } from "./enums.js";
export type { Result } from "./fp.js";
export type { PageIterator, Paginator } from "./operations.js";
export { createPageIterator } from "./operations.js";
export { RFCDate } from "./rfcdate.js";
export * from "./unrecognized.js";
27 changes: 27 additions & 0 deletions src/types/unrecognized.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/

declare const __brand: unique symbol;
export type Unrecognized<T> = T & { [__brand]: "unrecognized" };

function unrecognized<T>(value: T): Unrecognized<T> {
globalCount++;
return value as Unrecognized<T>;
}

let globalCount = 0;
let refCount = 0;
export function startCountingUnrecognized() {
refCount++;
const start = globalCount;
return {
end: () => {
const count = globalCount - start;
if (--refCount === 0) globalCount = 0;
return count;
},
};
}

export { unrecognized };