diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock
index d23d85deb..6bf63e98b 100644
--- a/.speakeasy/gen.lock
+++ b/.speakeasy/gen.lock
@@ -1,19 +1,19 @@
lockVersion: ""
id: ""
management:
- docChecksum: eaaf882a7a1b67d88c54534f59459d1c
+ docChecksum: 9c58655790b7a4ed98d87603a68afeca
docVersion: 1.0.0
speakeasyVersion: 1.787.0
generationVersion: 2.914.0
- releaseVersion: 1.2.84
- configChecksum: 0a888da6a061a2071a94265b6476be66
+ releaseVersion: 1.2.85
+ configChecksum: a53df84e83f58e97fae6f8718fc2bd5a
repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git
installationURL: https://github.com/OpenRouterTeam/typescript-sdk
published: true
persistentEdits:
- generation_id: 328037ef-1980-422c-b52e-824f95d3b918
- pristine_commit_hash: ec9fa7582b27ca6e9059e55bb5e976a2c01e56b6
- pristine_tree_hash: e205ec33fb182e7084039a9e306d21b5c2143ea3
+ generation_id: 6bcc4c16-23a3-4d1b-bd67-f84633995c04
+ pristine_commit_hash: ea337edb35f385a10c8c80ef756b660ce668c232
+ pristine_tree_hash: c126cd8f998334ecded33ec518660ce4cbbdaadc
features:
typescript:
acceptHeaders: 2.81.2
@@ -2426,8 +2426,8 @@ trackedFiles:
deleted: true
docs/models/chatusage.mdx:
id: 2012779f0b90
- last_write_checksum: sha1:a3613b1cf9371180149ac373b9a7464cd61a36b5
- pristine_git_object: f3b6d7388091888f395795ce8f9ac0292a894f3e
+ last_write_checksum: sha1:cbf484f635fcd266feccb33faa1ba0873d294390
+ pristine_git_object: 00a1c07bbe593dd355572c6359571d697027d001
docs/models/chatusagecompletiontokensdetails.md:
id: f1fa0fba88d0
last_write_checksum: sha1:c22122ca9340a1dbe7e0807b2aba7a2ad34d47ac
@@ -3084,8 +3084,8 @@ trackedFiles:
pristine_git_object: a29683fbb6049b11f8f731404cfd8a76a258bccc
docs/models/costdetails.mdx:
id: 98114795418d
- last_write_checksum: sha1:f2a8726cef656e2438555b5406da5d1e84dbf4aa
- pristine_git_object: ccca31c0512dbd09ca2ba9b76bacc125c24f7417
+ last_write_checksum: sha1:e2c176423b3c91b665460060808258d898e86c74
+ pristine_git_object: 0036c89e87f72b1f3c3cb254f98287153223678b
docs/models/createbyokkeyrequest.md:
id: 8c9d2e34f7fb
last_write_checksum: sha1:094bf0a4ff52bedc265feb9ebbbfbe98f5a30eb3
@@ -4669,8 +4669,8 @@ trackedFiles:
deleted: true
docs/models/imagegenerationusage.mdx:
id: "607217109e15"
- last_write_checksum: sha1:f5eea5987dc7f53a9defe45afa44bd56e376e839
- pristine_git_object: 694f2529fba61777bdb5174dbb523498591cb0fd
+ last_write_checksum: sha1:8306f44aeb44584ac7d43bf5b457f9b83d20429f
+ pristine_git_object: 206e72d77bf549f1f81492f418c32487cd34b0f1
docs/models/imagegenerationusagecompletiontokensdetails.md:
id: a2d59e0dafbb
last_write_checksum: sha1:860a5b547207fe171c8af394d0bf131379541187
@@ -6765,8 +6765,8 @@ trackedFiles:
deleted: true
docs/models/openresponsesresult.mdx:
id: 293f41224d3d
- last_write_checksum: sha1:44ba6802d1e1f472d6670f1648214765b066c5fc
- pristine_git_object: 7d978a022179d62ecb2a03290f9a770fa54ff7d6
+ last_write_checksum: sha1:323b84674def4591f35539a1fa5f191238d5eccb
+ pristine_git_object: 1030ac63aaa3e4b44d69b8e4764c01d808185dc7
docs/models/openresponsesresultobject.md:
id: a67bbc1f8fe1
last_write_checksum: sha1:7f55da79b4452480a8775b48cb4b6111d1d23216
@@ -7103,8 +7103,8 @@ trackedFiles:
deleted: true
docs/models/operations/createembeddingsusage.mdx:
id: "618888409156"
- last_write_checksum: sha1:206538c213029e344eb3f46ee4634ed753ee5879
- pristine_git_object: 518b2109c4a142a4bebd5659d66906c53f5ab4c6
+ last_write_checksum: sha1:9a4e3a04bcf3116c71b8a9ee365d6794a2015780
+ pristine_git_object: 653e3af62bd693ac2da5378aed02927bc004d381
docs/models/operations/createguardrailglobals.mdx:
id: 8f57a311ef27
last_write_checksum: sha1:a8878e65916d84eefba4e1683b9090d2de8e7b25
@@ -12420,8 +12420,8 @@ trackedFiles:
deleted: true
docs/models/usagecostdetails.mdx:
id: 057173c3344b
- last_write_checksum: sha1:24819ba6f14d7a1fb20f5e48687fdb987b043c93
- pristine_git_object: 386f70f0e5831df2b8c293b225e6d668def64164
+ last_write_checksum: sha1:2395d1293ea119f4f08666b31833fbee0dae0b02
+ pristine_git_object: ed411c1a502593a8e9c8edaea4af5077f117ff09
docs/models/userlocation.md:
id: 59ff2a5148a6
last_write_checksum: sha1:7385e0777bb0eee1ce8a154b63f53e4cd6d756b2
@@ -13053,12 +13053,12 @@ trackedFiles:
pristine_git_object: 410efafd6a7f50d91ccb87131fedbe0c3d47e15a
jsr.json:
id: 7f6ab7767282
- last_write_checksum: sha1:4d5a04302be94e17617cdbf2df43368c397abb4c
- pristine_git_object: 2d3aeeff84a8c953196ff2f213c6818435b64f36
+ last_write_checksum: sha1:b198fa74804a97a0d985a783e327d4f4f70cd382
+ pristine_git_object: 53517d9fef468ded89ace58bb3fa72c80497290a
package.json:
id: 7030d0b2f71b
- last_write_checksum: sha1:a19980a2939550a781afce63dc271900ad472373
- pristine_git_object: 500886f60361741a9b4cd7ae32ff62c09473ed24
+ last_write_checksum: sha1:60d7a365a11bb71c8ae0e5a4011403c7bb15d6c7
+ pristine_git_object: ae31d6beb55f159a5c2d51f5f028610597d448e7
src/core.ts:
id: f431fdbcd144
last_write_checksum: sha1:5aa66b0b6a5964f3eea7f3098c2eb3c0ee9c0131
@@ -13485,8 +13485,8 @@ trackedFiles:
pristine_git_object: a187e58707bdb726ca2aff74941efe7493422d4e
src/lib/config.ts:
id: 320761608fb3
- last_write_checksum: sha1:9b3a82e5bb7d685f333c590d3a82039286325632
- pristine_git_object: 309300d35d853393b6aaef32c02bf1830c4a78da
+ last_write_checksum: sha1:7a6d7784f481dac70ab30873e4312969adaaef8d
+ pristine_git_object: 5f8fd9c7f9bb400bfb9a3d1d803bbd8b2194c1be
src/lib/dlv.ts:
id: b1988214835a
last_write_checksum: sha1:eaac763b22717206a6199104e0403ed17a4e2711
@@ -14235,8 +14235,8 @@ trackedFiles:
pristine_git_object: a604de27444bedf8b3505567cb633b17ae75d719
src/models/costdetails.ts:
id: a9138bf3f716
- last_write_checksum: sha1:fe74f55852b76ed3e381d8f179ba5ba1ec4a7f99
- pristine_git_object: 81fcaf72ea3b3146afeddf0cb58d15c253224c63
+ last_write_checksum: sha1:d37348f6228fad7bd2a9f92f3b2186e3ac3df4c8
+ pristine_git_object: 241ca438ea7312ea98cc9d2af599c92edf41803c
src/models/createbyokkeyrequest.ts:
id: 5adb6ef47627
last_write_checksum: sha1:e4f708b41cf79b31be2273c47f8c4ebc0c6101ec
@@ -15171,8 +15171,8 @@ trackedFiles:
pristine_git_object: 364907411826c3fa6e2b65c7d5bbdc569d4ea08b
src/models/openresponsesresult.ts:
id: 95391b93fcbf
- last_write_checksum: sha1:3384d0c73412733583030716f00a6c6092dee583
- pristine_git_object: 5eaad6174305d76a7cd039aaaf9b0ff0b463ed21
+ last_write_checksum: sha1:c0fe9c08a7240d32e4d79698c6eae82ae189286a
+ pristine_git_object: 642df9d9c762e764958933b04fa367f1b0f2bfe2
src/models/openrouterfile.ts:
id: acb151305aa2
last_write_checksum: sha1:13efa47e00f89091a90808aa87d0617aa571c714
@@ -18571,3 +18571,10 @@ examples:
"503":
application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}}
examplesVersion: 1.0.2
+releaseNotes: |
+ ## Typescript SDK Changes:
+ * `openrouter.chat.send()`: `response` **Changed**
+ * `openrouter.embeddings.generate()`: `response.usage.costDetails.serverToolCost` **Added**
+ * `openrouter.images.generate()`: `response` **Changed**
+ * `openrouter.responses.send()`: `response` **Changed**
+ * `openrouter.beta.responses.send()`: `response` **Changed**
diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml
index 0fdab1892..278cb0753 100644
--- a/.speakeasy/gen.yaml
+++ b/.speakeasy/gen.yaml
@@ -37,7 +37,7 @@ generation:
documentation: mintlify
preApplyUnionDiscriminators: true
typescript:
- version: 1.2.84
+ version: 1.2.85
acceptHeaderEnum: false
additionalDependencies:
dependencies:
diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml
index aa8693f6b..b09a98bbb 100644
--- a/.speakeasy/out.openapi.yaml
+++ b/.speakeasy/out.openapi.yaml
@@ -7102,10 +7102,17 @@ components:
CostDetails:
description: 'Breakdown of upstream inference costs'
example:
+ server_tool_cost: null
upstream_inference_completions_cost: 0.0004
upstream_inference_cost: null
upstream_inference_prompt_cost: 0.0008
properties:
+ server_tool_cost:
+ description: 'Metered server-tool execution cost (for example, shell sandbox time) billed for this request, in USD. Matches the billed checkpoint and settlement amounts exactly.'
+ format: 'double'
+ type:
+ - 'number'
+ - 'null'
upstream_inference_completions_cost:
format: 'double'
type: 'number'
@@ -26030,6 +26037,12 @@ components:
- 'null'
cost_details:
properties:
+ server_tool_cost:
+ description: 'Metered server-tool execution cost (for example, shell sandbox time) billed for this request, in USD. Matches the billed checkpoint and settlement amounts exactly.'
+ format: 'double'
+ type:
+ - 'number'
+ - 'null'
upstream_inference_cost:
format: 'double'
type:
@@ -26056,6 +26069,7 @@ components:
example:
cost: 0.0012
cost_details:
+ server_tool_cost: null
upstream_inference_cost: null
upstream_inference_input_cost: 0.0008
upstream_inference_output_cost: 0.0004
diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock
index f0e12ffe5..2438e9243 100644
--- a/.speakeasy/workflow.lock
+++ b/.speakeasy/workflow.lock
@@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0
sources:
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
- sourceRevisionDigest: sha256:9f7ddeb0022f5b427a966a793b3abddfa5965842a39eb9a03fc3f45e5412e3a8
- sourceBlobDigest: sha256:c76cfaa783718d110c25abe72ae06da75c4c7d44a8bc102572fc0cb92edf3bab
+ sourceRevisionDigest: sha256:caedac3b2a337662358d64c5b4494af7543aa90e4902566e732ba4c3add15bbc
+ sourceBlobDigest: sha256:6145ed7ea999e32cf82d7141c9b2d1998b3c8bcada1ded2ffe05dc8a8a609811
tags:
- latest
- 1.0.0
@@ -11,10 +11,10 @@ targets:
openrouter:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
- sourceRevisionDigest: sha256:9f7ddeb0022f5b427a966a793b3abddfa5965842a39eb9a03fc3f45e5412e3a8
- sourceBlobDigest: sha256:c76cfaa783718d110c25abe72ae06da75c4c7d44a8bc102572fc0cb92edf3bab
+ sourceRevisionDigest: sha256:caedac3b2a337662358d64c5b4494af7543aa90e4902566e732ba4c3add15bbc
+ sourceBlobDigest: sha256:6145ed7ea999e32cf82d7141c9b2d1998b3c8bcada1ded2ffe05dc8a8a609811
codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples
- codeSamplesRevisionDigest: sha256:151e23abe9028889c6f63c0efa44962901fc8279af81c2a103e3cb028aabe094
+ codeSamplesRevisionDigest: sha256:103edd2ec24b11b992e128fff3ffee360bb51a278d38ae59ad14074de793179a
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.787.0
diff --git a/RELEASES.md b/RELEASES.md
index 19bd7390f..c54de51b5 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -3136,4 +3136,14 @@ Based on:
### Generated
- [typescript v1.2.84] .
### Releases
-- [NPM v1.2.84] https://www.npmjs.com/package/@openrouter/sdk/v/1.2.84 - .
\ No newline at end of file
+- [NPM v1.2.84] https://www.npmjs.com/package/@openrouter/sdk/v/1.2.84 - .
+
+## 2026-08-31 03:06:43
+### Changes
+Based on:
+- OpenAPI Doc
+- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [typescript v1.2.85] .
+### Releases
+- [NPM v1.2.85] https://www.npmjs.com/package/@openrouter/sdk/v/1.2.85 - .
\ No newline at end of file
diff --git a/docs/models/chatusage.mdx b/docs/models/chatusage.mdx
index f3b6d7388..00a1c07bb 100644
--- a/docs/models/chatusage.mdx
+++ b/docs/models/chatusage.mdx
@@ -18,14 +18,14 @@ let value: ChatUsage = {
## Fields
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
-| `completionTokens` | *number* | :heavy_check_mark: | Number of tokens in the completion | |
-| `completionTokensDetails` | [models.ChatUsageCompletionTokensDetails](../models/chatusagecompletiontokensdetails.mdx) | :heavy_minus_sign: | Detailed completion token usage | |
-| `cost` | *number* | :heavy_minus_sign: | Cost of the completion | |
-| `costDetails` | [models.CostDetails](../models/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} |
-| `isByok` | *boolean* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | |
-| `promptTokens` | *number* | :heavy_check_mark: | Number of tokens in the prompt | |
-| `promptTokensDetails` | [models.ChatUsagePromptTokensDetails](../models/chatusageprompttokensdetails.mdx) | :heavy_minus_sign: | Detailed prompt token usage | |
-| `serverToolUseDetails` | [models.ServerToolUseDetails](../models/servertoolusedetails.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | \{
"tool_calls_executed": 2,
"tool_calls_requested": 2,
"web_search_requests": 2
} |
-| `totalTokens` | *number* | :heavy_check_mark: | Total number of tokens | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `completionTokens` | *number* | :heavy_check_mark: | Number of tokens in the completion | |
+| `completionTokensDetails` | [models.ChatUsageCompletionTokensDetails](../models/chatusagecompletiontokensdetails.mdx) | :heavy_minus_sign: | Detailed completion token usage | |
+| `cost` | *number* | :heavy_minus_sign: | Cost of the completion | |
+| `costDetails` | [models.CostDetails](../models/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"server_tool_cost": null,
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} |
+| `isByok` | *boolean* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | |
+| `promptTokens` | *number* | :heavy_check_mark: | Number of tokens in the prompt | |
+| `promptTokensDetails` | [models.ChatUsagePromptTokensDetails](../models/chatusageprompttokensdetails.mdx) | :heavy_minus_sign: | Detailed prompt token usage | |
+| `serverToolUseDetails` | [models.ServerToolUseDetails](../models/servertoolusedetails.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | \{
"tool_calls_executed": 2,
"tool_calls_requested": 2,
"web_search_requests": 2
} |
+| `totalTokens` | *number* | :heavy_check_mark: | Total number of tokens | |
\ No newline at end of file
diff --git a/docs/models/costdetails.mdx b/docs/models/costdetails.mdx
index ccca31c05..0036c89e8 100644
--- a/docs/models/costdetails.mdx
+++ b/docs/models/costdetails.mdx
@@ -17,8 +17,9 @@ let value: CostDetails = {
## Fields
-| Field | Type | Required | Description |
-| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- |
-| `upstreamInferenceCompletionsCost` | *number* | :heavy_check_mark: | N/A |
-| `upstreamInferenceCost` | *number* | :heavy_minus_sign: | N/A |
-| `upstreamInferencePromptCost` | *number* | :heavy_check_mark: | N/A |
\ No newline at end of file
+| Field | Type | Required | Description |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `serverToolCost` | *number* | :heavy_minus_sign: | Metered server-tool execution cost (for example, shell sandbox time) billed for this request, in USD. Matches the billed checkpoint and settlement amounts exactly. |
+| `upstreamInferenceCompletionsCost` | *number* | :heavy_check_mark: | N/A |
+| `upstreamInferenceCost` | *number* | :heavy_minus_sign: | N/A |
+| `upstreamInferencePromptCost` | *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 694f2529f..206e72d77 100644
--- a/docs/models/imagegenerationusage.mdx
+++ b/docs/models/imagegenerationusage.mdx
@@ -18,18 +18,18 @@ let value: ImageGenerationUsage = {
## Fields
-| 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 | |
-| `costDetails` | [models.CostDetails](../models/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} |
-| `isByok` | *boolean* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | |
-| `iterations` | *models.AnthropicUsageIteration*[] | :heavy_minus_sign: | N/A | |
-| `promptTokens` | *number* | :heavy_check_mark: | Including images, input audio, and tools if any | |
-| `promptTokensDetails` | [models.ImageGenerationUsagePromptTokensDetails](../models/imagegenerationusageprompttokensdetails.mdx) | :heavy_minus_sign: | Breakdown of tokens used in the prompt. | |
-| `serverToolUse` | [models.ServerToolUse](../models/servertooluse.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | |
-| `serviceTier` | *string* | :heavy_minus_sign: | The service tier used by the upstream provider for this request | |
-| `speed` | [models.AnthropicSpeed](../models/anthropicspeed.mdx) | :heavy_minus_sign: | N/A | standard |
-| `totalTokens` | *number* | :heavy_check_mark: | Sum of the above two fields | |
\ No newline at end of file
+| 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 | |
+| `costDetails` | [models.CostDetails](../models/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"server_tool_cost": null,
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} |
+| `isByok` | *boolean* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | |
+| `iterations` | *models.AnthropicUsageIteration*[] | :heavy_minus_sign: | N/A | |
+| `promptTokens` | *number* | :heavy_check_mark: | Including images, input audio, and tools if any | |
+| `promptTokensDetails` | [models.ImageGenerationUsagePromptTokensDetails](../models/imagegenerationusageprompttokensdetails.mdx) | :heavy_minus_sign: | Breakdown of tokens used in the prompt. | |
+| `serverToolUse` | [models.ServerToolUse](../models/servertooluse.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | |
+| `serviceTier` | *string* | :heavy_minus_sign: | The service tier used by the upstream provider for this request | |
+| `speed` | [models.AnthropicSpeed](../models/anthropicspeed.mdx) | :heavy_minus_sign: | N/A | standard |
+| `totalTokens` | *number* | :heavy_check_mark: | Sum of the above two fields | |
\ No newline at end of file
diff --git a/docs/models/openresponsesresult.mdx b/docs/models/openresponsesresult.mdx
index 7d978a022..1030ac63a 100644
--- a/docs/models/openresponsesresult.mdx
+++ b/docs/models/openresponsesresult.mdx
@@ -45,42 +45,42 @@ let value: OpenResponsesResult = {
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `background` | *boolean* | :heavy_minus_sign: | N/A | |
-| `completedAt` | *number* | :heavy_check_mark: | N/A | |
-| `createdAt` | *number* | :heavy_check_mark: | N/A | |
-| `error` | [models.ResponsesErrorField](../models/responseserrorfield.mdx) | :heavy_check_mark: | Error information returned from the API | \{
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Please try again later."
} |
-| `frequencyPenalty` | *number* | :heavy_check_mark: | N/A | |
-| `id` | *string* | :heavy_check_mark: | N/A | |
-| `incompleteDetails` | [models.IncompleteDetails](../models/incompletedetails.mdx) | :heavy_check_mark: | N/A | \{
"reason": "max_output_tokens"
} |
-| `instructions` | *models.BaseInputsUnion* | :heavy_check_mark: | N/A | [
\{
"content": "What is the weather today?",
"role": "user"
}
] |
-| `maxOutputTokens` | *number* | :heavy_minus_sign: | N/A | |
-| `maxToolCalls` | *number* | :heavy_minus_sign: | N/A | |
-| `metadata` | Record\ | :heavy_check_mark: | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. | \{
"session_id": "abc-def-ghi",
"user_id": "123"
} |
-| `model` | *string* | :heavy_check_mark: | N/A | |
-| `object` | [models.OpenResponsesResultObject](../models/openresponsesresultobject.mdx) | :heavy_check_mark: | N/A | |
-| `output` | *models.OutputItems*[] | :heavy_check_mark: | N/A | |
-| `outputText` | *string* | :heavy_minus_sign: | N/A | |
-| `parallelToolCalls` | *boolean* | :heavy_check_mark: | N/A | |
-| `presencePenalty` | *number* | :heavy_check_mark: | N/A | |
-| `previousResponseId` | *string* | :heavy_minus_sign: | N/A | |
-| `prompt` | [models.StoredPromptTemplate](../models/storedprompttemplate.mdx) | :heavy_minus_sign: | N/A | \{
"id": "prompt-abc123",
"variables": \{
"name": "John"
}
} |
-| `promptCacheKey` | *string* | :heavy_minus_sign: | N/A | |
-| `promptCacheOptions` | [models.PromptCacheOptions](../models/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} |
-| `reasoning` | [models.BaseReasoningConfig](../models/basereasoningconfig.mdx) | :heavy_minus_sign: | N/A | \{
"effort": "medium",
"summary": "auto"
} |
-| `safetyIdentifier` | *string* | :heavy_minus_sign: | N/A | |
-| `serviceTier` | *string* | :heavy_minus_sign: | N/A | |
-| `status` | [models.OpenAIResponsesResponseStatus](../models/openairesponsesresponsestatus.mdx) | :heavy_check_mark: | N/A | completed |
-| `store` | *boolean* | :heavy_minus_sign: | N/A | |
-| `temperature` | *number* | :heavy_check_mark: | N/A | |
-| `text` | [models.TextExtendedConfig](../models/textextendedconfig.mdx) | :heavy_minus_sign: | Text output configuration including format and verbosity | \{
"format": \{
"type": "text"
}
} |
-| `toolChoice` | *models.OpenAIResponsesToolChoiceUnion* | :heavy_check_mark: | N/A | auto |
-| `tools` | *models.OpenResponsesResultToolUnion*[] | :heavy_check_mark: | N/A | |
-| `topLogprobs` | *number* | :heavy_minus_sign: | N/A | |
-| `topP` | *number* | :heavy_check_mark: | N/A | |
-| `truncation` | [models.Truncation](../models/truncation.mdx) | :heavy_minus_sign: | N/A | auto |
-| `usage` | [models.Usage](../models/usage.mdx) | :heavy_minus_sign: | Token usage information for the response | \{
"cost": 0.0012,
"cost_details": \{
"upstream_inference_cost": null,
"upstream_inference_input_cost": 0.0008,
"upstream_inference_output_cost": 0.0004
},
"input_tokens": 10,
"input_tokens_details": \{
"cached_tokens": 0
},
"output_tokens": 25,
"output_tokens_details": \{
"reasoning_tokens": 0
},
"total_tokens": 35
} |
-| `user` | *string* | :heavy_minus_sign: | N/A | |
-| `errorType` | [models.ApiErrorType](../models/apierrortype.mdx) | :heavy_minus_sign: | Canonical OpenRouter error type, stable across all API formats | rate_limit_exceeded |
-| `openrouterMetadata` | [models.OpenRouterMetadata](../models/openroutermetadata.mdx) | :heavy_minus_sign: | N/A | \{
"attempt": 1,
"endpoints": \{
"available": [
\{
"model": "openai/gpt-4o",
"provider": "OpenAI",
"selected": true
}
],
"total": 1
},
"is_byok": false,
"region": "iad",
"requested": "openai/gpt-4o",
"strategy": "direct",
"summary": "available=1, selected=OpenAI"
} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `background` | *boolean* | :heavy_minus_sign: | N/A | |
+| `completedAt` | *number* | :heavy_check_mark: | N/A | |
+| `createdAt` | *number* | :heavy_check_mark: | N/A | |
+| `error` | [models.ResponsesErrorField](../models/responseserrorfield.mdx) | :heavy_check_mark: | Error information returned from the API | \{
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Please try again later."
} |
+| `frequencyPenalty` | *number* | :heavy_check_mark: | N/A | |
+| `id` | *string* | :heavy_check_mark: | N/A | |
+| `incompleteDetails` | [models.IncompleteDetails](../models/incompletedetails.mdx) | :heavy_check_mark: | N/A | \{
"reason": "max_output_tokens"
} |
+| `instructions` | *models.BaseInputsUnion* | :heavy_check_mark: | N/A | [
\{
"content": "What is the weather today?",
"role": "user"
}
] |
+| `maxOutputTokens` | *number* | :heavy_minus_sign: | N/A | |
+| `maxToolCalls` | *number* | :heavy_minus_sign: | N/A | |
+| `metadata` | Record\ | :heavy_check_mark: | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. | \{
"session_id": "abc-def-ghi",
"user_id": "123"
} |
+| `model` | *string* | :heavy_check_mark: | N/A | |
+| `object` | [models.OpenResponsesResultObject](../models/openresponsesresultobject.mdx) | :heavy_check_mark: | N/A | |
+| `output` | *models.OutputItems*[] | :heavy_check_mark: | N/A | |
+| `outputText` | *string* | :heavy_minus_sign: | N/A | |
+| `parallelToolCalls` | *boolean* | :heavy_check_mark: | N/A | |
+| `presencePenalty` | *number* | :heavy_check_mark: | N/A | |
+| `previousResponseId` | *string* | :heavy_minus_sign: | N/A | |
+| `prompt` | [models.StoredPromptTemplate](../models/storedprompttemplate.mdx) | :heavy_minus_sign: | N/A | \{
"id": "prompt-abc123",
"variables": \{
"name": "John"
}
} |
+| `promptCacheKey` | *string* | :heavy_minus_sign: | N/A | |
+| `promptCacheOptions` | [models.PromptCacheOptions](../models/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} |
+| `reasoning` | [models.BaseReasoningConfig](../models/basereasoningconfig.mdx) | :heavy_minus_sign: | N/A | \{
"effort": "medium",
"summary": "auto"
} |
+| `safetyIdentifier` | *string* | :heavy_minus_sign: | N/A | |
+| `serviceTier` | *string* | :heavy_minus_sign: | N/A | |
+| `status` | [models.OpenAIResponsesResponseStatus](../models/openairesponsesresponsestatus.mdx) | :heavy_check_mark: | N/A | completed |
+| `store` | *boolean* | :heavy_minus_sign: | N/A | |
+| `temperature` | *number* | :heavy_check_mark: | N/A | |
+| `text` | [models.TextExtendedConfig](../models/textextendedconfig.mdx) | :heavy_minus_sign: | Text output configuration including format and verbosity | \{
"format": \{
"type": "text"
}
} |
+| `toolChoice` | *models.OpenAIResponsesToolChoiceUnion* | :heavy_check_mark: | N/A | auto |
+| `tools` | *models.OpenResponsesResultToolUnion*[] | :heavy_check_mark: | N/A | |
+| `topLogprobs` | *number* | :heavy_minus_sign: | N/A | |
+| `topP` | *number* | :heavy_check_mark: | N/A | |
+| `truncation` | [models.Truncation](../models/truncation.mdx) | :heavy_minus_sign: | N/A | auto |
+| `usage` | [models.Usage](../models/usage.mdx) | :heavy_minus_sign: | Token usage information for the response | \{
"cost": 0.0012,
"cost_details": \{
"server_tool_cost": null,
"upstream_inference_cost": null,
"upstream_inference_input_cost": 0.0008,
"upstream_inference_output_cost": 0.0004
},
"input_tokens": 10,
"input_tokens_details": \{
"cached_tokens": 0
},
"output_tokens": 25,
"output_tokens_details": \{
"reasoning_tokens": 0
},
"total_tokens": 35
} |
+| `user` | *string* | :heavy_minus_sign: | N/A | |
+| `errorType` | [models.ApiErrorType](../models/apierrortype.mdx) | :heavy_minus_sign: | Canonical OpenRouter error type, stable across all API formats | rate_limit_exceeded |
+| `openrouterMetadata` | [models.OpenRouterMetadata](../models/openroutermetadata.mdx) | :heavy_minus_sign: | N/A | \{
"attempt": 1,
"endpoints": \{
"available": [
\{
"model": "openai/gpt-4o",
"provider": "OpenAI",
"selected": true
}
],
"total": 1
},
"is_byok": false,
"region": "iad",
"requested": "openai/gpt-4o",
"strategy": "direct",
"summary": "available=1, selected=OpenAI"
} |
\ No newline at end of file
diff --git a/docs/models/operations/createembeddingsusage.mdx b/docs/models/operations/createembeddingsusage.mdx
index 518b2109c..653e3af62 100644
--- a/docs/models/operations/createembeddingsusage.mdx
+++ b/docs/models/operations/createembeddingsusage.mdx
@@ -20,7 +20,7 @@ let value: CreateEmbeddingsUsage = {
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cost` | *number* | :heavy_minus_sign: | Cost of the request in credits | 0.0001 |
-| `costDetails` | [models.CostDetails](../../models/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} |
+| `costDetails` | [models.CostDetails](../../models/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"server_tool_cost": null,
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} |
| `isByok` | *boolean* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | |
| `promptTokens` | *number* | :heavy_check_mark: | Number of tokens in the input | 8 |
| `promptTokensDetails` | [operations.PromptTokensDetails](../../models/operations/prompttokensdetails.mdx) | :heavy_minus_sign: | Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. | |
diff --git a/docs/models/usagecostdetails.mdx b/docs/models/usagecostdetails.mdx
index 386f70f0e..ed411c1a5 100644
--- a/docs/models/usagecostdetails.mdx
+++ b/docs/models/usagecostdetails.mdx
@@ -15,8 +15,9 @@ let value: UsageCostDetails = {
## Fields
-| Field | Type | Required | Description |
-| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- |
-| `upstreamInferenceCost` | *number* | :heavy_minus_sign: | N/A |
-| `upstreamInferenceInputCost` | *number* | :heavy_check_mark: | N/A |
-| `upstreamInferenceOutputCost` | *number* | :heavy_check_mark: | N/A |
\ No newline at end of file
+| Field | Type | Required | Description |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `serverToolCost` | *number* | :heavy_minus_sign: | Metered server-tool execution cost (for example, shell sandbox time) billed for this request, in USD. Matches the billed checkpoint and settlement amounts exactly. |
+| `upstreamInferenceCost` | *number* | :heavy_minus_sign: | N/A |
+| `upstreamInferenceInputCost` | *number* | :heavy_check_mark: | N/A |
+| `upstreamInferenceOutputCost` | *number* | :heavy_check_mark: | N/A |
\ No newline at end of file
diff --git a/jsr.json b/jsr.json
index 2d3aeeff8..53517d9fe 100644
--- a/jsr.json
+++ b/jsr.json
@@ -2,7 +2,7 @@
{
"name": "@openrouter/sdk",
- "version": "1.2.84",
+ "version": "1.2.85",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
diff --git a/package.json b/package.json
index 7cd582af6..87197543c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@openrouter/sdk",
- "version": "1.2.84",
+ "version": "1.2.85",
"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": [
@@ -73,15 +73,15 @@
"lint": "eslint --cache --max-warnings=0 src",
"build": "tsc",
"prepublishOnly": "npm run build",
- "typecheck:transit": "exit 0",
- "postinstall": "node scripts/check-types.js || true",
"test:e2e": "vitest --run --project e2e",
"typecheck": "tsc --noEmit",
"compile": "tsc",
- "prepare": "npm run build",
+ "postinstall": "node scripts/check-types.js || true",
"test": "vitest --run --project unit",
"test:transit": "exit 0",
- "test:watch": "vitest --watch --project unit"
+ "test:watch": "vitest --watch --project unit",
+ "typecheck:transit": "exit 0",
+ "prepare": "npm run build"
},
"peerDependencies": {},
"devDependencies": {
diff --git a/src/lib/config.ts b/src/lib/config.ts
index bdd5114d9..841b52bbc 100644
--- a/src/lib/config.ts
+++ b/src/lib/config.ts
@@ -79,7 +79,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "1.0.0",
- sdkVersion: "1.2.84",
+ sdkVersion: "1.2.85",
genVersion: "2.914.0",
- userAgent: "speakeasy-sdk/typescript 1.2.84 2.914.0 1.0.0 @openrouter/sdk",
+ userAgent: "speakeasy-sdk/typescript 1.2.85 2.914.0 1.0.0 @openrouter/sdk",
} as const;
diff --git a/src/models/costdetails.ts b/src/models/costdetails.ts
index 81fcaf72e..241ca438e 100644
--- a/src/models/costdetails.ts
+++ b/src/models/costdetails.ts
@@ -13,6 +13,10 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
* Breakdown of upstream inference costs
*/
export type CostDetails = {
+ /**
+ * Metered server-tool execution cost (for example, shell sandbox time) billed for this request, in USD. Matches the billed checkpoint and settlement amounts exactly.
+ */
+ serverToolCost?: number | null | undefined;
upstreamInferenceCompletionsCost: number;
upstreamInferenceCost?: number | null | undefined;
upstreamInferencePromptCost: number;
@@ -21,11 +25,13 @@ export type CostDetails = {
/** @internal */
export const CostDetails$inboundSchema: z.ZodType = z
.object({
+ server_tool_cost: z.nullable(z.number()).optional(),
upstream_inference_completions_cost: z.number(),
upstream_inference_cost: z.nullable(z.number()).optional(),
upstream_inference_prompt_cost: z.number(),
}).transform((v) => {
return remap$(v, {
+ "server_tool_cost": "serverToolCost",
"upstream_inference_completions_cost": "upstreamInferenceCompletionsCost",
"upstream_inference_cost": "upstreamInferenceCost",
"upstream_inference_prompt_cost": "upstreamInferencePromptCost",
diff --git a/src/models/openresponsesresult.ts b/src/models/openresponsesresult.ts
index 5eaad6174..642df9d9c 100644
--- a/src/models/openresponsesresult.ts
+++ b/src/models/openresponsesresult.ts
@@ -158,6 +158,10 @@ export type OutputTokensDetails = {
};
export type UsageCostDetails = {
+ /**
+ * Metered server-tool execution cost (for example, shell sandbox time) billed for this request, in USD. Matches the billed checkpoint and settlement amounts exactly.
+ */
+ serverToolCost?: number | null | undefined;
upstreamInferenceCost?: number | null | undefined;
upstreamInferenceInputCost: number;
upstreamInferenceOutputCost: number;
@@ -404,11 +408,13 @@ export const UsageCostDetails$inboundSchema: z.ZodType<
UsageCostDetails,
unknown
> = z.object({
+ server_tool_cost: z.nullable(z.number()).optional(),
upstream_inference_cost: z.nullable(z.number()).optional(),
upstream_inference_input_cost: z.number(),
upstream_inference_output_cost: z.number(),
}).transform((v) => {
return remap$(v, {
+ "server_tool_cost": "serverToolCost",
"upstream_inference_cost": "upstreamInferenceCost",
"upstream_inference_input_cost": "upstreamInferenceInputCost",
"upstream_inference_output_cost": "upstreamInferenceOutputCost",