diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index d64db2fcd..ad92a2ca3 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: "" id: "" management: - docChecksum: 1f17a1f75f4160092b49589d5334fc41 + docChecksum: c896403a43e3b6f37e116db8e50e2bbe docVersion: 1.0.0 speakeasyVersion: 1.763.2 generationVersion: 2.884.4 - releaseVersion: 0.13.48 - configChecksum: 6a5d8dbc50054e4ace92d83ee48dcae5 + releaseVersion: 0.13.49 + configChecksum: 71fa0fd9c04286c02dfc699622d9d566 repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git installationURL: https://github.com/OpenRouterTeam/typescript-sdk published: true persistentEdits: - generation_id: 0beee5e3-a7e4-4e92-afe0-e2c739100378 - pristine_commit_hash: 77df033032d67f583e4fffbefb5e4c7ea2d29714 - pristine_tree_hash: 8ecdbe45b2c46ad89024e27403065ec3a12ca86e + generation_id: a2cd151f-27ee-4939-92be-cfa5b3acc5c5 + pristine_commit_hash: 5d71ffa76728e491dd13a6d2ddad9f335efd6526 + pristine_tree_hash: ec09dc9ce2c57a8d66391ee8f973a53ff88d76d3 features: typescript: acceptHeaders: 2.81.2 @@ -370,6 +370,10 @@ trackedFiles: id: 34ac4d4b5a34 last_write_checksum: sha1:f59013381ad2c078f1bca40d18d8fc2df35cc6fd pristine_git_object: bdd5b6320a94abeb2239f66d4bb64bc0c76b893d + docs/models/anthropiccachecreation.mdx: + id: 5535d679b43c + last_write_checksum: sha1:d2499dd0efd7d88d41bd8742ca20f737cfde3d7c + pristine_git_object: fff3213d0a9d52a58924ecdea74242b85c638e0c docs/models/anthropiccitationcharlocationparam.md: id: 5a33c2cc933a last_write_checksum: sha1:8cdb5f36ac5266a2fe929e8caad77110e8ac514d @@ -4508,8 +4512,8 @@ trackedFiles: deleted: true docs/models/imagegenerationusage.mdx: id: "607217109e15" - last_write_checksum: sha1:b60f162b408fd4656ff6db6508a1931af816c064 - pristine_git_object: 932a99131099339274314219e6145a3ea0b126be + last_write_checksum: sha1:f5eea5987dc7f53a9defe45afa44bd56e376e839 + pristine_git_object: 694f2529fba61777bdb5174dbb523498591cb0fd docs/models/imagegenerationusagecompletiontokensdetails.md: id: a2d59e0dafbb last_write_checksum: sha1:860a5b547207fe171c8af394d0bf131379541187 @@ -12396,12 +12400,12 @@ trackedFiles: pristine_git_object: 410efafd6a7f50d91ccb87131fedbe0c3d47e15a jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:78d46827b1947019337f4523df5293fc2c3e1c6e - pristine_git_object: 3b7034abba16dea731492e84f1cd87fd2b75d9aa + last_write_checksum: sha1:1d3631c9b17da2e3e29906e09c9adb64f33c15e4 + pristine_git_object: 526c1243374cf82c411e48b0f341f1b469d146c1 package.json: id: 7030d0b2f71b - last_write_checksum: sha1:c7d93fbd007ebc45193e5466e4e7e4672d9f5b67 - pristine_git_object: 35c833b94e355c87e1998346b4eb1f646df3ba03 + last_write_checksum: sha1:8c7e5612156a59b040791c066a4ff7921a0e83e5 + pristine_git_object: 558e6f833ee5e8609061154ed35c9b4f93864b29 src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:5aa66b0b6a5964f3eea7f3098c2eb3c0ee9c0131 @@ -12780,8 +12784,8 @@ trackedFiles: pristine_git_object: a187e58707bdb726ca2aff74941efe7493422d4e src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:f2981c9ca9bd9e74a226dd2cd2b06e5d0b788515 - pristine_git_object: 271c86ed616435d19728e9a93a6d96a968af7b9d + last_write_checksum: sha1:4761ea193eb50aefde7b25ab8c07e6715d8a8b73 + pristine_git_object: fcddd429225d2270a35ff44e3e679f04228800eb src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:eaac763b22717206a6199104e0403ed17a4e2711 @@ -12906,6 +12910,10 @@ trackedFiles: id: d6c8b6f13cb1 last_write_checksum: sha1:ce33734180f67ddfe3287e5ee8939ff265c7c1de pristine_git_object: 1e06de28f0cd122795603a2a2cdbd06875a0c2fa + src/models/anthropiccachecreation.ts: + id: 6772980a7ab5 + last_write_checksum: sha1:3ac919417247ea6f324ab7194f5a7658e4997805 + pristine_git_object: 603ca745f4c5bee415f484811953e016ce85cc32 src/models/anthropiccitationcharlocationparam.ts: id: 453c0a0bfdd4 last_write_checksum: sha1:32232e3bb44d9d45fa7525e939cee7a2b347792f @@ -13908,8 +13916,8 @@ trackedFiles: pristine_git_object: db61647cd182502b2b3b5333ee3a0bba66542645 src/models/imagegenerationusage.ts: id: 4f128ace6b39 - last_write_checksum: sha1:6aa872bc89e3b10d88d0138c731037ec8104d7b0 - pristine_git_object: e6e3369520e96e14b86ad18ec3c8384e5cb14310 + last_write_checksum: sha1:9b32233d5d0797168aa3e5283eb225283258a676 + pristine_git_object: 4f4e7dd2e3640facf9d68a278529060e892806b1 src/models/imagegenpartialimageevent.ts: id: ee4283390600 last_write_checksum: sha1:0e059239eee8cb3d77ece47bf6f28ef29bd1692c @@ -13960,8 +13968,8 @@ trackedFiles: pristine_git_object: 8e109bedfdcf2c4808e49323dda861e3c6069d51 src/models/index.ts: id: f93644b0f37e - last_write_checksum: sha1:7ab40055105ee7d1225c10adf3346c1440b75072 - pristine_git_object: fb4f280b5fa0016f45b345380f24301bc6702d72 + last_write_checksum: sha1:9bf81b055f58cad03420e42f5316a9e507bcb551 + pristine_git_object: 51b7bd5798ad4c3173892e0752fa6cd442d13063 src/models/inputaudio.ts: id: 9bdc14c7565f last_write_checksum: sha1:2f8dc4c1d6a9c2927d9eb186e0ecedf7b81838e6 @@ -17264,3 +17272,6 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: | + ## Typescript SDK Changes: + * `openrouter.images.generate()`: `response` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index cf0a23d64..86cf42605 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true typescript: - version: 0.13.48 + version: 0.13.49 acceptHeaderEnum: false additionalDependencies: dependencies: diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2c8cb5362..318f0d686 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9942,6 +9942,8 @@ components: prompt_tokens: 0 total_tokens: 4175 properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' completion_tokens: description: The tokens generated type: integer @@ -11891,6 +11893,8 @@ components: type: string usage: properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' cache_creation_input_tokens: nullable: true type: integer diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 355a72c7f..801339840 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.763.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:aa8355b343c2a207cd521d502bc63573502b065d6102c207057c5b8964f26035 - sourceBlobDigest: sha256:b694b4df81e6ae168db3001449134b4766c881e2c1bff9790a53452e5853205d + sourceRevisionDigest: sha256:514f8a87f3806fe46b7b1a599f96eb7792f8711c1410f94c623478a49602c151 + sourceBlobDigest: sha256:ad10c9b668c35e875f00980ebd129329ed12bcc34066bb2b3e4d4e60d20e7318 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:aa8355b343c2a207cd521d502bc63573502b065d6102c207057c5b8964f26035 - sourceBlobDigest: sha256:b694b4df81e6ae168db3001449134b4766c881e2c1bff9790a53452e5853205d + sourceRevisionDigest: sha256:514f8a87f3806fe46b7b1a599f96eb7792f8711c1410f94c623478a49602c151 + sourceBlobDigest: sha256:ad10c9b668c35e875f00980ebd129329ed12bcc34066bb2b3e4d4e60d20e7318 codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:54a580e7cc4ca8965a22b6b6b979a4b5388fc3f0d22372914369a32b5d782f3d + codeSamplesRevisionDigest: sha256:0f1ccc9c9f2b3d79476488071d50bb50a73daa8660f4edbacba2b5d24b993723 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.763.2 diff --git a/RELEASES.md b/RELEASES.md index 47649a885..a78b80a70 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1716,4 +1716,14 @@ Based on: ### Generated - [typescript v0.13.48] . ### Releases -- [NPM v0.13.48] https://www.npmjs.com/package/@openrouter/sdk/v/0.13.48 - . \ No newline at end of file +- [NPM v0.13.48] https://www.npmjs.com/package/@openrouter/sdk/v/0.13.48 - . + +## 2026-07-14 05:35:14 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.763.2 (2.884.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.13.49] . +### Releases +- [NPM v0.13.49] https://www.npmjs.com/package/@openrouter/sdk/v/0.13.49 - . \ No newline at end of file diff --git a/docs/models/anthropiccachecreation.mdx b/docs/models/anthropiccachecreation.mdx new file mode 100644 index 000000000..fff3213d0 --- /dev/null +++ b/docs/models/anthropiccachecreation.mdx @@ -0,0 +1,21 @@ +--- +title: "AnthropicCacheCreation" +--- + +## Example Usage + +```typescript +import { AnthropicCacheCreation } from "@openrouter/sdk/models"; + +let value: AnthropicCacheCreation = { + ephemeral1hInputTokens: 0, + ephemeral5mInputTokens: 100, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `ephemeral1hInputTokens` | *number* | :heavy_check_mark: | N/A | +| `ephemeral5mInputTokens` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/imagegenerationusage.mdx b/docs/models/imagegenerationusage.mdx index 932a99131..694f2529f 100644 --- a/docs/models/imagegenerationusage.mdx +++ b/docs/models/imagegenerationusage.mdx @@ -20,6 +20,7 @@ let value: ImageGenerationUsage = { | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `cacheCreation` | [models.AnthropicCacheCreation](../models/anthropiccachecreation.mdx) | :heavy_minus_sign: | N/A | \{
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 100
} | | `completionTokens` | *number* | :heavy_check_mark: | The tokens generated | | | `completionTokensDetails` | [models.ImageGenerationUsageCompletionTokensDetails](../models/imagegenerationusagecompletiontokensdetails.mdx) | :heavy_minus_sign: | N/A | | | `cost` | *number* | :heavy_minus_sign: | Cost of the completion | | diff --git a/jsr.json b/jsr.json index 3b7034abb..526c12433 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@openrouter/sdk", - "version": "0.13.48", + "version": "0.13.49", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index 1329885fd..ace5921db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/sdk", - "version": "0.13.48", + "version": "0.13.49", "author": "OpenRouter", "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.", "keywords": [ @@ -21,8 +21,8 @@ "license": "Apache-2.0", "packageManager": "pnpm@10.22.0", "publishConfig": { - "provenance": true, - "access": "public" + "access": "public", + "provenance": true }, "type": "module", "main": "./esm/index.js", @@ -73,13 +73,13 @@ "lint": "eslint --cache --max-warnings=0 src", "build": "tsc", "prepublishOnly": "npm run build", - "test:e2e": "vitest --run --project e2e", - "test:transit": "exit 0", - "typecheck": "tsc --noEmit", - "compile": "tsc", "postinstall": "node scripts/check-types.js || true", "prepare": "npm run build", "test": "vitest --run --project unit", + "test:e2e": "vitest --run --project e2e", + "typecheck": "tsc --noEmit", + "compile": "tsc", + "test:transit": "exit 0", "test:watch": "vitest --watch --project unit", "typecheck:transit": "exit 0" }, diff --git a/src/lib/config.ts b/src/lib/config.ts index 271c86ed6..fcddd4292 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -75,7 +75,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "1.0.0", - sdkVersion: "0.13.48", + sdkVersion: "0.13.49", genVersion: "2.884.4", - userAgent: "speakeasy-sdk/typescript 0.13.48 2.884.4 1.0.0 @openrouter/sdk", + userAgent: "speakeasy-sdk/typescript 0.13.49 2.884.4 1.0.0 @openrouter/sdk", } as const; diff --git a/src/models/anthropiccachecreation.ts b/src/models/anthropiccachecreation.ts new file mode 100644 index 000000000..603ca745f --- /dev/null +++ b/src/models/anthropiccachecreation.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 6772980a7ab5 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export type AnthropicCacheCreation = { + ephemeral1hInputTokens: number; + ephemeral5mInputTokens: number; +}; + +/** @internal */ +export const AnthropicCacheCreation$inboundSchema: z.ZodType< + AnthropicCacheCreation, + unknown +> = z.object({ + ephemeral_1h_input_tokens: z.int(), + ephemeral_5m_input_tokens: z.int(), +}).transform((v) => { + return remap$(v, { + "ephemeral_1h_input_tokens": "ephemeral1hInputTokens", + "ephemeral_5m_input_tokens": "ephemeral5mInputTokens", + }); +}); + +export function anthropicCacheCreationFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AnthropicCacheCreation$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AnthropicCacheCreation' from JSON`, + ); +} diff --git a/src/models/imagegenerationusage.ts b/src/models/imagegenerationusage.ts index e6e336952..4f4e7dd2e 100644 --- a/src/models/imagegenerationusage.ts +++ b/src/models/imagegenerationusage.ts @@ -7,6 +7,10 @@ import * as z from "zod/v4"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; +import { + AnthropicCacheCreation, + AnthropicCacheCreation$inboundSchema, +} from "./anthropiccachecreation.js"; import { AnthropicSpeed, AnthropicSpeed$inboundSchema, @@ -81,6 +85,7 @@ export type ServerToolUse = { * Token and cost usage for the image generation request, when available */ export type ImageGenerationUsage = { + cacheCreation?: AnthropicCacheCreation | null | undefined; /** * The tokens generated */ @@ -223,6 +228,7 @@ export const ImageGenerationUsage$inboundSchema: z.ZodType< ImageGenerationUsage, unknown > = z.object({ + cache_creation: z.nullable(AnthropicCacheCreation$inboundSchema).optional(), completion_tokens: z.int(), completion_tokens_details: z.nullable( z.lazy(() => ImageGenerationUsageCompletionTokensDetails$inboundSchema), @@ -243,6 +249,7 @@ export const ImageGenerationUsage$inboundSchema: z.ZodType< total_tokens: z.int(), }).transform((v) => { return remap$(v, { + "cache_creation": "cacheCreation", "completion_tokens": "completionTokens", "completion_tokens_details": "completionTokensDetails", "cost_details": "costDetails", diff --git a/src/models/index.ts b/src/models/index.ts index fb4f280b5..51b7bd579 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -19,6 +19,7 @@ export * from "./anthropicbase64imagesource.js"; export * from "./anthropicbase64pdfsource.js"; export * from "./anthropiccachecontroldirective.js"; export * from "./anthropiccachecontrolttl.js"; +export * from "./anthropiccachecreation.js"; export * from "./anthropiccitationcharlocationparam.js"; export * from "./anthropiccitationcontentblocklocationparam.js"; export * from "./anthropiccitationpagelocationparam.js";