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
47 changes: 29 additions & 18 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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**
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ generation:
documentation: mintlify
preApplyUnionDiscriminators: true
typescript:
version: 0.13.48
version: 0.13.49
acceptHeaderEnum: false
additionalDependencies:
dependencies:
Expand Down
4 changes: 4 additions & 0 deletions .speakeasy/out.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -11891,6 +11893,8 @@ components:
type: string
usage:
properties:
cache_creation:
$ref: '#/components/schemas/AnthropicCacheCreation'
cache_creation_input_tokens:
nullable: true
type: integer
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ 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
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
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - .
- [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 - .
21 changes: 21 additions & 0 deletions docs/models/anthropiccachecreation.mdx
Original file line number Diff line number Diff line change
@@ -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 |
1 change: 1 addition & 0 deletions docs/models/imagegenerationusage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let value: ImageGenerationUsage = {

| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `cacheCreation` | [models.AnthropicCacheCreation](../models/anthropiccachecreation.mdx) | :heavy_minus_sign: | N/A | \{<br/>"ephemeral_1h_input_tokens": 0,<br/>"ephemeral_5m_input_tokens": 100<br/>} |
| `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 | |
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.13.48",
"version": "0.13.49",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -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",
Expand Down Expand Up @@ -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"
},
Expand Down
4 changes: 2 additions & 2 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
39 changes: 39 additions & 0 deletions src/models/anthropiccachecreation.ts
Original file line number Diff line number Diff line change
@@ -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<AnthropicCacheCreation, SDKValidationError> {
return safeParse(
jsonString,
(x) => AnthropicCacheCreation$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AnthropicCacheCreation' from JSON`,
);
}
7 changes: 7 additions & 0 deletions src/models/imagegenerationusage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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),
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Loading