diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 3826d05cf..f8b47d8c0 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: "" id: "" management: - docChecksum: bc16bd026c616fcef4340cb1ef091220 + docChecksum: 385bc33bfc0886239f6dd00eb6ffaf35 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.5.27 - configChecksum: 78c0bf261275cb5d160a5a0495cea528 + releaseVersion: 1.5.28 + configChecksum: dac2e6eedb9a8c40d8452ccf46e1a042 repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git installationURL: https://github.com/OpenRouterTeam/typescript-sdk published: true persistentEdits: - generation_id: fcbbabb8-7fd3-4dba-91c7-41f7962ad7a4 - pristine_commit_hash: c5dc24b3a20a3add332ff48b5685438b9b7eece6 - pristine_tree_hash: be1f92e22a07a0ad85f5ca99b51b7b90457c6351 + generation_id: b8a82f8b-9002-4294-80f2-88a19baf311c + pristine_commit_hash: e61991a0cfb007673fe7a5acc06ff6a1b751d63e + pristine_tree_hash: 627a7a775f92f1febbb7be0ae2266c569e9616f3 features: typescript: acceptHeaders: 2.81.2 @@ -8455,12 +8455,20 @@ trackedFiles: deleted: true docs/models/openresponsesresult.mdx: id: 293f41224d3d - last_write_checksum: sha1:e56cc1cf9828d797c2be234a1528259a46053a51 - pristine_git_object: 6352735b2b9624e04439e10b7b108bc30bd3ffef + last_write_checksum: sha1:579458bc2fc1ce5ba7932d10a123fa796e73d997 + pristine_git_object: 819f7fdc2b9f34dcd67c8c1334bbb39390a02a1d + docs/models/openresponsesresultaccessprograms.mdx: + id: 04534bc4a8d3 + last_write_checksum: sha1:857a83c2cbc18452f1fba953a609ac1950e09566 + pristine_git_object: 83356d5e5e3a575aa6f3f22dfa17c1b45715737e docs/models/openresponsesresultallowedcaller.mdx: id: 2139a5bcc11f last_write_checksum: sha1:a141f90181fd081907251f2e5a7db3545e4bd545 pristine_git_object: 594e5a4f377cc46a9acf8501e3759a8e345a70e9 + docs/models/openresponsesresultcyber.mdx: + id: bcf1c1c50e81 + last_write_checksum: sha1:10b03a174f59de76e9da508abf1704bd9cfacce1 + pristine_git_object: 92886fc6123e942038d2050545b0311e42b1810e docs/models/openresponsesresultobject.md: id: a67bbc1f8fe1 last_write_checksum: sha1:7f55da79b4452480a8775b48cb4b6111d1d23216 @@ -13274,12 +13282,20 @@ trackedFiles: deleted: true docs/models/responsesrequest.mdx: id: 947c781fc5e6 - last_write_checksum: sha1:5d63a7197c0ba54a88a1b1432a7db3207a645b30 - pristine_git_object: 4c5016b3c42473900323bcaaa7508c85d818cf67 + last_write_checksum: sha1:c72822346e4b9da1548840c992dc9c5172c7dd03 + pristine_git_object: 8a65f1152d397aaa3eaf771abf710912a6862f7e + docs/models/responsesrequestaccessprograms.mdx: + id: 4926812b7358 + last_write_checksum: sha1:0c5750028bc5d502eadcbefe83f6b33c657b483c + pristine_git_object: 046d295c2ec0536807e397a4fd7a844ea2c163f0 docs/models/responsesrequestallowedcaller.mdx: id: b86d49b2d3a5 last_write_checksum: sha1:738c9d55cdf9a76c55c2c2c6a25b987a8c9c6975 pristine_git_object: a0be49208aed222b0c347a661928782520bc8218 + docs/models/responsesrequestcyber.mdx: + id: e7e37b98a619 + last_write_checksum: sha1:b4441c9496c8b2196726dcacc58252a4e0e1e749 + pristine_git_object: 59aa2f1096969487447480e8ef4ca53dcde06e88 docs/models/responsesrequestignore.md: id: c4f071afde0b last_write_checksum: sha1:1d8443ce44e3c7f5a15fbbcedb391e780e158cbd @@ -16003,12 +16019,12 @@ trackedFiles: pristine_git_object: 410efafd6a7f50d91ccb87131fedbe0c3d47e15a jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:dc777d62818dc5d7f8741ec5f864857b4f178900 - pristine_git_object: 1ec1a4f73ad49d93a2d454144e5776fd6999cd7a + last_write_checksum: sha1:e15c2eaf2ebb6583d508aefdbeee9b6bd83deac2 + pristine_git_object: 128af7e40504c922c0c51f810830242fe93b482d package.json: id: 7030d0b2f71b - last_write_checksum: sha1:07893642068670874266ffb7e529bf8fe8a22fc6 - pristine_git_object: 16a00480c236fa375ff8104cc1f3d60f2b32fac0 + last_write_checksum: sha1:6b36b7e948afd53d4518d70e050f0fc9abc2ce85 + pristine_git_object: 5c95e1a4b3629ea0161e2433fb747446a98672aa src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:5aa66b0b6a5964f3eea7f3098c2eb3c0ee9c0131 @@ -16615,8 +16631,8 @@ trackedFiles: pristine_git_object: a187e58707bdb726ca2aff74941efe7493422d4e src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:76761a9ac0067539bf300e18e97b600e7d2252db - pristine_git_object: e2d1ce99ea6ca2723e0771d640f88d4a087d3c55 + last_write_checksum: sha1:f014eb0da0856340ea19d2105c95f11974b4b286 + pristine_git_object: ec44287cd68336d79d627db75583ae3f112ae463 src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:eaac763b22717206a6199104e0403ed17a4e2711 @@ -19029,8 +19045,8 @@ trackedFiles: pristine_git_object: 364907411826c3fa6e2b65c7d5bbdc569d4ea08b src/models/openresponsesresult.ts: id: 95391b93fcbf - last_write_checksum: sha1:b894c27aad089fa29786c3cd739e9d2777d69efc - pristine_git_object: 3013ab9045294a7ea8578569a894c8d133a17bf6 + last_write_checksum: sha1:834cfdea77c02dba7eed2f9ec3771599e53e35c4 + pristine_git_object: 522ba2127731ca31da6682f2298c0ca48cc603f3 src/models/openrouterfile.ts: id: acb151305aa2 last_write_checksum: sha1:13efa47e00f89091a90808aa87d0617aa571c714 @@ -20201,8 +20217,8 @@ trackedFiles: pristine_git_object: 9e0f74740007f9a0041481f2aab78f8f69544add src/models/responsesrequest.ts: id: 39799702f982 - last_write_checksum: sha1:38d6118cc9f4e64a532efece432fb36f53335610 - pristine_git_object: 95634b77e115caeb4e57d7d4c04bd7dd09bd90ce + last_write_checksum: sha1:8c4439c20fa7e4529c4035e901dc9c66c180c589 + pristine_git_object: 62c03dcf5d04858f4ee00058e72a61ddf9433eb5 src/models/responsesstreamingresponse.ts: id: 69284d63df45 last_write_checksum: sha1:215a40ab5dab91267bbc60f1e7c7e9d3cf6082d2 @@ -25676,4 +25692,4 @@ examples: "529": application/json: {"error": {"code": 529, "message": "Provider returned error"}} examplesVersion: 1.0.2 -releaseNotes: "## Typescript SDK Changes:\n* `openrouter.models.listForUser()`: \n * `request.client` **Added**\n" +releaseNotes: "## Typescript SDK Changes:\n* `openrouter.batch.createBatches()`: `response.results[].response.body.union(OpenResponsesResult).accessPrograms` **Added**\n* `openrouter.batch.getBatches()`: `response.results[].response.body.union(OpenResponsesResult).accessPrograms` **Added**\n* `openrouter.presets.createPresetsResponses()`: \n * `request.responsesRequest.accessPrograms` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index b720a4b25..ee1c61d43 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -38,7 +38,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true typescript: - version: 1.5.27 + version: 1.5.28 acceptHeaderEnum: false additionalDependencies: dependencies: diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index d536972e3..90cf40b39 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -23614,6 +23614,24 @@ components: allOf: - $ref: '#/components/schemas/BaseResponsesResult' - properties: + access_programs: + default: null + description: 'Access program the upstream provider reported for this response (OpenAI `access_programs`). `null` when the provider reported none, including OpenAI''s implicit Standard program.' + example: + cyber: 'standard' + properties: + cyber: + enum: + - 'standard' + - 'daybreak_blue' + - 'daybreak_red' + type: 'string' + x-speakeasy-unknown-values: allow + required: + - 'cyber' + type: + - 'object' + - 'null' alignment: $ref: '#/components/schemas/Alignment' error: @@ -29642,6 +29660,19 @@ components: type: 'function' top_p: 0.9 properties: + access_programs: + description: 'OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter''s own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter''s OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program.' + example: + cyber: 'standard' + properties: + cyber: + enum: + - 'standard' + - 'daybreak_blue' + - 'daybreak_red' + type: 'string' + x-speakeasy-unknown-values: allow + type: 'object' background: type: - 'boolean' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0a5a5b741..c02537a25 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:cfe17794f14d83dd3d95f52f35860b434d55323544db9edae08c404feb7d190a - sourceBlobDigest: sha256:151c7144a8b6b7bc154f6eb266bfc50602ef610c5f94c0b4437859d4e78d2885 + sourceRevisionDigest: sha256:c62594e70066d4d650785b3c91462710d37b06bface67c235e674692db5d3513 + sourceBlobDigest: sha256:0e91138c909f3b7374a29f0a07110b26544ce2f648e9342319018043442f431e tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:cfe17794f14d83dd3d95f52f35860b434d55323544db9edae08c404feb7d190a - sourceBlobDigest: sha256:151c7144a8b6b7bc154f6eb266bfc50602ef610c5f94c0b4437859d4e78d2885 + sourceRevisionDigest: sha256:c62594e70066d4d650785b3c91462710d37b06bface67c235e674692db5d3513 + sourceBlobDigest: sha256:0e91138c909f3b7374a29f0a07110b26544ce2f648e9342319018043442f431e codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:652c37fcdcb847e99776eabc7559f419456a0b2a617ca431ea00ec5d1231b2b4 + codeSamplesRevisionDigest: sha256:6b66a47258f7d1220f91f4ba92d3df5a27f08b85c11c1818cdb647a88a3de7ee workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 75ad85d48..4b4ea3500 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4656,4 +4656,14 @@ Based on: ### Generated - [typescript v1.5.27] . ### Releases -- [NPM v1.5.27] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.27 - . \ No newline at end of file +- [NPM v1.5.27] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.27 - . + +## 2026-10-30 13:17:35 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.5.28] . +### Releases +- [NPM v1.5.28] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.28 - . \ No newline at end of file diff --git a/docs/models/openresponsesresult.mdx b/docs/models/openresponsesresult.mdx index 6352735b2..819f7fdc2 100644 --- a/docs/models/openresponsesresult.mdx +++ b/docs/models/openresponsesresult.mdx @@ -82,6 +82,7 @@ let value: OpenResponsesResult = { | `truncation` | [models.Truncation](../models/truncation.mdx) | ➖ | N/A | auto | | `usage` | [models.Usage](../models/usage.mdx) | ➖ | 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* | ➖ | N/A | | +| `accessPrograms` | [models.OpenResponsesResultAccessPrograms](../models/openresponsesresultaccessprograms.mdx) | ➖ | Access program the upstream provider reported for this response (OpenAI `access_programs`). `null` when the provider reported none, including OpenAI's implicit Standard program. | \{
"cyber": "standard"
} | | `alignment` | [models.Alignment](../models/alignment.mdx) | ➖ | Beta. The result of the alignment plugin for this request; the shape may change. | \{
"calls": [
\{
"call": 1,
"outcome": "allowed",
"rules": [
\{
"applicable": true,
"broken": false,
"probability": 0.04
}
]
}
]
} | | `errorType` | [models.ApiErrorType](../models/apierrortype.mdx) | ➖ | Canonical OpenRouter error type, stable across all API formats | rate_limit_exceeded | | `openrouterMetadata` | [models.OpenRouterMetadata](../models/openroutermetadata.mdx) | ➖ | N/A | \{
"attempt": 1,
"endpoints": \{
"available": [
\{
"model": "openai/gpt-4o",
"provider": "OpenAI",
"selected": true
}
],
"total": 1
},
"generation_time": 2016,
"is_byok": false,
"region": "iad",
"requested": "openai/gpt-4o",
"strategy": "direct",
"summary": "available=1, selected=OpenAI"
} | diff --git a/docs/models/openresponsesresultaccessprograms.mdx b/docs/models/openresponsesresultaccessprograms.mdx new file mode 100644 index 000000000..83356d5e5 --- /dev/null +++ b/docs/models/openresponsesresultaccessprograms.mdx @@ -0,0 +1,21 @@ +--- +title: "OpenResponsesResultAccessPrograms" +--- + +Access program the upstream provider reported for this response (OpenAI `access_programs`). `null` when the provider reported none, including OpenAI's implicit Standard program. + +## Example Usage + +```typescript +import { OpenResponsesResultAccessPrograms } from "@openrouter/sdk/models"; + +let value: OpenResponsesResultAccessPrograms = { + cyber: "standard", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `cyber` | [models.OpenResponsesResultCyber](../models/openresponsesresultcyber.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/openresponsesresultcyber.mdx b/docs/models/openresponsesresultcyber.mdx new file mode 100644 index 000000000..92886fc61 --- /dev/null +++ b/docs/models/openresponsesresultcyber.mdx @@ -0,0 +1,19 @@ +--- +title: "OpenResponsesResultCyber" +--- + +## Example Usage + +```typescript +import { OpenResponsesResultCyber } from "@openrouter/sdk/models"; + +let value: OpenResponsesResultCyber = "standard"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"standard" | "daybreak_blue" | "daybreak_red" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/responsesrequest.mdx b/docs/models/responsesrequest.mdx index 4c5016b3c..8a65f1152 100644 --- a/docs/models/responsesrequest.mdx +++ b/docs/models/responsesrequest.mdx @@ -14,46 +14,47 @@ let value: ResponsesRequest = {}; ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `background` | *boolean* | ➖ | N/A | | -| `cacheControl` | [models.AnthropicCacheControlDirective](../models/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | -| `debug` | [models.ChatDebugOptions](../models/chatdebugoptions.mdx) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferredTools` | [models.DeferredToolsControl](../models/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | -| `frequencyPenalty` | *number* | ➖ | N/A | | -| `imageConfig` | Record\ | ➖ | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | -| `include` | [models.ResponseIncludesEnum](../models/responseincludesenum.mdx)[] | ➖ | N/A | | -| `input` | *models.InputsUnion* | ➖ | Input for a response request - can be a string or array of items | [
\{
"content": "What is the weather today?",
"role": "user"
}
] | -| `instructions` | *string* | ➖ | N/A | | -| `maxOutputTokens` | *number* | ➖ | N/A | | -| `maxToolCalls` | *number* | ➖ | Maximum number of server-tool (e.g. `openrouter:web_search`) agent steps the model may take during a request. Defaults to 30, which is also the maximum. Ignored when `stop_server_tools_when` is set. | 30 | -| `metadata` | Record\ | ➖ | 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"
} | -| `modalities` | [models.OutputModalityEnum](../models/outputmodalityenum.mdx)[] | ➖ | Output modalities for the response. Supported values are "text" and "image". | [
"text",
"image"
] | -| `model` | *string* | ➖ | N/A | | -| `models` | *string*[] | ➖ | N/A | | -| `parallelToolCalls` | *boolean* | ➖ | N/A | | -| `plugins` | *models.ResponsesRequestPlugin*[] | ➖ | Plugins you want to enable for this request, including their settings. | | -| `presencePenalty` | *number* | ➖ | N/A | | -| `previousResponseId` | *any* | ➖ | Not supported on this proxy. Each response request is independent: no responses are stored, so a previous response cannot be referenced. Requests with a non-null value are rejected with a 400 error. Send the full conversation history in `input` instead. | | -| `prompt` | [models.StoredPromptTemplate](../models/storedprompttemplate.mdx) | ➖ | N/A | \{
"id": "prompt-abc123",
"variables": \{
"name": "John"
}
} | -| `promptCacheKey` | *string* | ➖ | N/A | | -| `promptCacheOptions` | [models.PromptCacheOptions](../models/promptcacheoptions.mdx) | ➖ | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. `ttl` sets the minimum cache lifetime for every breakpoint the request writes: "30m" (default) or "12h" (billed at the higher 12h cache-write rate). Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | -| `provider` | [models.ProviderPreferences](../models/providerpreferences.mdx) | ➖ | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | -| `reasoning` | [models.ReasoningConfig](../models/reasoningconfig.mdx) | ➖ | Configuration for reasoning mode in the response | \{
"enabled": true,
"summary": "auto"
} | -| `safetyIdentifier` | *string* | ➖ | Recommended per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, OpenRouter folds it into the hashed identity sent upstream and never forwards it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account. | user-123 | -| `serviceTier` | [models.ResponsesRequestServiceTier](../models/responsesrequestservicetier.mdx) | ➖ | The service tier to use for processing this request. `fast` is accepted as an alias for `priority`. `ultrafast` prefers ultrafast endpoints and falls back to `priority`, then default endpoints. | | -| `sessionId` | *string* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | | -| `stop` | *models.ResponsesRequestStop* | ➖ | Stop sequences (up to 4) | [
"\n"
] | -| `stopServerToolsWhen` | *models.StopServerToolsWhenCondition*[] | ➖ | Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call. | [
\{
"step_count": 5,
"type": "step_count_is"
},
\{
"max_cost_in_dollars": 0.5,
"type": "max_cost"
}
] | -| `store` | *false* | ➖ | N/A | | -| `stream` | *boolean* | ➖ | N/A | | -| `temperature` | *number* | ➖ | N/A | | -| `text` | [models.TextExtendedConfig](../models/textextendedconfig.mdx) | ➖ | Text output configuration including format and verbosity | \{
"format": \{
"type": "text"
}
} | -| `toolChoice` | *models.OpenAIResponsesToolChoiceUnion* | ➖ | N/A | auto | -| `tools` | *models.ResponsesRequestToolUnion*[] | ➖ | N/A | | -| `topK` | *number* | ➖ | N/A | | -| `topLogprobs` | *number* | ➖ | N/A | | -| `topP` | *number* | ➖ | N/A | | -| `trace` | [models.TraceConfig](../models/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | -| `truncation` | [models.OpenAIResponsesTruncation](../models/openairesponsestruncation.mdx) | ➖ | N/A | auto | -| `user` | *string* | ➖ | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accessPrograms` | [models.ResponsesRequestAccessPrograms](../models/responsesrequestaccessprograms.mdx) | ➖ | OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program. | \{
"cyber": "standard"
} | +| `background` | *boolean* | ➖ | N/A | | +| `cacheControl` | [models.AnthropicCacheControlDirective](../models/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `debug` | [models.ChatDebugOptions](../models/chatdebugoptions.mdx) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | +| `deferredTools` | [models.DeferredToolsControl](../models/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `frequencyPenalty` | *number* | ➖ | N/A | | +| `imageConfig` | Record\ | ➖ | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | +| `include` | [models.ResponseIncludesEnum](../models/responseincludesenum.mdx)[] | ➖ | N/A | | +| `input` | *models.InputsUnion* | ➖ | Input for a response request - can be a string or array of items | [
\{
"content": "What is the weather today?",
"role": "user"
}
] | +| `instructions` | *string* | ➖ | N/A | | +| `maxOutputTokens` | *number* | ➖ | N/A | | +| `maxToolCalls` | *number* | ➖ | Maximum number of server-tool (e.g. `openrouter:web_search`) agent steps the model may take during a request. Defaults to 30, which is also the maximum. Ignored when `stop_server_tools_when` is set. | 30 | +| `metadata` | Record\ | ➖ | 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"
} | +| `modalities` | [models.OutputModalityEnum](../models/outputmodalityenum.mdx)[] | ➖ | Output modalities for the response. Supported values are "text" and "image". | [
"text",
"image"
] | +| `model` | *string* | ➖ | N/A | | +| `models` | *string*[] | ➖ | N/A | | +| `parallelToolCalls` | *boolean* | ➖ | N/A | | +| `plugins` | *models.ResponsesRequestPlugin*[] | ➖ | Plugins you want to enable for this request, including their settings. | | +| `presencePenalty` | *number* | ➖ | N/A | | +| `previousResponseId` | *any* | ➖ | Not supported on this proxy. Each response request is independent: no responses are stored, so a previous response cannot be referenced. Requests with a non-null value are rejected with a 400 error. Send the full conversation history in `input` instead. | | +| `prompt` | [models.StoredPromptTemplate](../models/storedprompttemplate.mdx) | ➖ | N/A | \{
"id": "prompt-abc123",
"variables": \{
"name": "John"
}
} | +| `promptCacheKey` | *string* | ➖ | N/A | | +| `promptCacheOptions` | [models.PromptCacheOptions](../models/promptcacheoptions.mdx) | ➖ | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. `ttl` sets the minimum cache lifetime for every breakpoint the request writes: "30m" (default) or "12h" (billed at the higher 12h cache-write rate). Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | +| `provider` | [models.ProviderPreferences](../models/providerpreferences.mdx) | ➖ | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | +| `reasoning` | [models.ReasoningConfig](../models/reasoningconfig.mdx) | ➖ | Configuration for reasoning mode in the response | \{
"enabled": true,
"summary": "auto"
} | +| `safetyIdentifier` | *string* | ➖ | Recommended per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, OpenRouter folds it into the hashed identity sent upstream and never forwards it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account. | user-123 | +| `serviceTier` | [models.ResponsesRequestServiceTier](../models/responsesrequestservicetier.mdx) | ➖ | The service tier to use for processing this request. `fast` is accepted as an alias for `priority`. `ultrafast` prefers ultrafast endpoints and falls back to `priority`, then default endpoints. | | +| `sessionId` | *string* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | | +| `stop` | *models.ResponsesRequestStop* | ➖ | Stop sequences (up to 4) | [
"\n"
] | +| `stopServerToolsWhen` | *models.StopServerToolsWhenCondition*[] | ➖ | Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call. | [
\{
"step_count": 5,
"type": "step_count_is"
},
\{
"max_cost_in_dollars": 0.5,
"type": "max_cost"
}
] | +| `store` | *false* | ➖ | N/A | | +| `stream` | *boolean* | ➖ | N/A | | +| `temperature` | *number* | ➖ | N/A | | +| `text` | [models.TextExtendedConfig](../models/textextendedconfig.mdx) | ➖ | Text output configuration including format and verbosity | \{
"format": \{
"type": "text"
}
} | +| `toolChoice` | *models.OpenAIResponsesToolChoiceUnion* | ➖ | N/A | auto | +| `tools` | *models.ResponsesRequestToolUnion*[] | ➖ | N/A | | +| `topK` | *number* | ➖ | N/A | | +| `topLogprobs` | *number* | ➖ | N/A | | +| `topP` | *number* | ➖ | N/A | | +| `trace` | [models.TraceConfig](../models/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | +| `truncation` | [models.OpenAIResponsesTruncation](../models/openairesponsestruncation.mdx) | ➖ | N/A | auto | +| `user` | *string* | ➖ | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters. | | \ No newline at end of file diff --git a/docs/models/responsesrequestaccessprograms.mdx b/docs/models/responsesrequestaccessprograms.mdx new file mode 100644 index 000000000..046d295c2 --- /dev/null +++ b/docs/models/responsesrequestaccessprograms.mdx @@ -0,0 +1,19 @@ +--- +title: "ResponsesRequestAccessPrograms" +--- + +OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program. + +## Example Usage + +```typescript +import { ResponsesRequestAccessPrograms } from "@openrouter/sdk/models"; + +let value: ResponsesRequestAccessPrograms = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `cyber` | [models.ResponsesRequestCyber](../models/responsesrequestcyber.mdx) | ➖ | N/A | \ No newline at end of file diff --git a/docs/models/responsesrequestcyber.mdx b/docs/models/responsesrequestcyber.mdx new file mode 100644 index 000000000..59aa2f109 --- /dev/null +++ b/docs/models/responsesrequestcyber.mdx @@ -0,0 +1,19 @@ +--- +title: "ResponsesRequestCyber" +--- + +## Example Usage + +```typescript +import { ResponsesRequestCyber } from "@openrouter/sdk/models"; + +let value: ResponsesRequestCyber = "daybreak_blue"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"standard" | "daybreak_blue" | "daybreak_red" | Unrecognized +``` \ No newline at end of file diff --git a/jsr.json b/jsr.json index 1ec1a4f73..128af7e40 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@openrouter/sdk", - "version": "1.5.27", + "version": "1.5.28", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index 16a00480c..5c95e1a4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/sdk", - "version": "1.5.27", + "version": "1.5.28", "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 && node scripts/unbarrel-imports.js", "prepublishOnly": "npm run build", - "test:e2e": "vitest --run --project e2e", "typecheck": "tsc --noEmit", - "typecheck:transit": "exit 0", "compile": "tsc && node scripts/unbarrel-imports.js", "postinstall": "node scripts/check-types.js || true", - "prepare": "npm run build", "test:transit": "exit 0", - "test:watch": "vitest --watch --project unit", - "test": "vitest --run --project unit" + "typecheck:transit": "exit 0", + "prepare": "npm run build", + "test": "vitest --run --project unit", + "test:e2e": "vitest --run --project e2e", + "test:watch": "vitest --watch --project unit" }, "peerDependencies": { diff --git a/src/lib/config.ts b/src/lib/config.ts index 39687ea29..e753a7ae5 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.5.27", + sdkVersion: "1.5.28", genVersion: "2.950.13", - userAgent: "speakeasy-sdk/typescript 1.5.27 2.950.13 1.0.0 @openrouter/sdk", + userAgent: "speakeasy-sdk/typescript 1.5.28 2.950.13 1.0.0 @openrouter/sdk", } as const; diff --git a/src/models/openresponsesresult.ts b/src/models/openresponsesresult.ts index 3013ab904..522ba2127 100644 --- a/src/models/openresponsesresult.ts +++ b/src/models/openresponsesresult.ts @@ -208,6 +208,22 @@ export type Usage = { serverToolUseDetails?: ServerToolUseDetails | null | undefined; }; +export const OpenResponsesResultCyber = { + Standard: "standard", + DaybreakBlue: "daybreak_blue", + DaybreakRed: "daybreak_red", +} as const; +export type OpenResponsesResultCyber = OpenEnum< + typeof OpenResponsesResultCyber +>; + +/** + * Access program the upstream provider reported for this response (OpenAI `access_programs`). `null` when the provider reported none, including OpenAI's implicit Standard program. + */ +export type OpenResponsesResultAccessPrograms = { + cyber: OpenResponsesResultCyber; +}; + /** * Complete non-streaming response from the Responses API */ @@ -281,6 +297,10 @@ export type OpenResponsesResult = { */ usage?: Usage | null | undefined; user?: string | null | undefined; + /** + * Access program the upstream provider reported for this response (OpenAI `access_programs`). `null` when the provider reported none, including OpenAI's implicit Standard program. + */ + accessPrograms?: OpenResponsesResultAccessPrograms | null | undefined; /** * Beta. The result of the alignment plugin for this request; the shape may change. */ @@ -507,6 +527,30 @@ export function usageFromJSON( ); } +/** @internal */ +export const OpenResponsesResultCyber$inboundSchema: z.ZodType< + OpenResponsesResultCyber, + unknown +> = openEnums.inboundSchema(OpenResponsesResultCyber); + +/** @internal */ +export const OpenResponsesResultAccessPrograms$inboundSchema: z.ZodType< + OpenResponsesResultAccessPrograms, + unknown +> = z.object({ + cyber: OpenResponsesResultCyber$inboundSchema, +}); + +export function openResponsesResultAccessProgramsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => OpenResponsesResultAccessPrograms$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'OpenResponsesResultAccessPrograms' from JSON`, + ); +} + /** @internal */ export const OpenResponsesResult$inboundSchema: z.ZodType< OpenResponsesResult, @@ -590,6 +634,9 @@ export const OpenResponsesResult$inboundSchema: z.ZodType< truncation: z.nullable(Truncation$inboundSchema).optional(), usage: z.nullable(z.lazy(() => Usage$inboundSchema)).optional(), user: z.nullable(z.string()).optional(), + access_programs: z.nullable( + z.lazy(() => OpenResponsesResultAccessPrograms$inboundSchema), + ).optional(), alignment: Alignment$inboundSchema.optional(), error_type: ApiErrorType$inboundSchema.optional(), openrouter_metadata: OpenRouterMetadata$inboundSchema.optional(), @@ -613,6 +660,7 @@ export const OpenResponsesResult$inboundSchema: z.ZodType< "tool_choice": "toolChoice", "top_logprobs": "topLogprobs", "top_p": "topP", + "access_programs": "accessPrograms", "error_type": "errorType", "openrouter_metadata": "openrouterMetadata", "safeguard_results": "safeguardResults", diff --git a/src/models/responsesrequest.ts b/src/models/responsesrequest.ts index 95634b77e..62c03dcf5 100644 --- a/src/models/responsesrequest.ts +++ b/src/models/responsesrequest.ts @@ -301,6 +301,20 @@ import { WebSearchServerToolOpenRouter$outboundSchema, } from "./websearchservertoolopenrouter.js"; +export const ResponsesRequestCyber = { + Standard: "standard", + DaybreakBlue: "daybreak_blue", + DaybreakRed: "daybreak_red", +} as const; +export type ResponsesRequestCyber = OpenEnum; + +/** + * OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program. + */ +export type ResponsesRequestAccessPrograms = { + cyber?: ResponsesRequestCyber | undefined; +}; + export type ResponsesRequestPlugin = | AlignmentPlugin | ArmorPlugin @@ -425,6 +439,10 @@ export type ResponsesRequestToolUnion = * Request schema for Responses endpoint */ export type ResponsesRequest = { + /** + * OpenAI access programs for this request. `cyber` selects the Cyber access program: `standard`, `daybreak_blue`, or `daybreak_red`. A program other than `standard` is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run `standard`. Omit the field unless your key is enrolled in a Daybreak program. + */ + accessPrograms?: ResponsesRequestAccessPrograms | undefined; background?: boolean | null | undefined; /** * Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. @@ -585,6 +603,35 @@ export type ResponsesRequest = { user?: string | undefined; }; +/** @internal */ +export const ResponsesRequestCyber$outboundSchema: z.ZodType< + string, + ResponsesRequestCyber +> = openEnums.outboundSchema(ResponsesRequestCyber); + +/** @internal */ +export type ResponsesRequestAccessPrograms$Outbound = { + cyber?: string | undefined; +}; + +/** @internal */ +export const ResponsesRequestAccessPrograms$outboundSchema: z.ZodType< + ResponsesRequestAccessPrograms$Outbound, + ResponsesRequestAccessPrograms +> = z.object({ + cyber: ResponsesRequestCyber$outboundSchema.optional(), +}); + +export function responsesRequestAccessProgramsToJSON( + responsesRequestAccessPrograms: ResponsesRequestAccessPrograms, +): string { + return JSON.stringify( + ResponsesRequestAccessPrograms$outboundSchema.parse( + responsesRequestAccessPrograms, + ), + ); +} + /** @internal */ export type ResponsesRequestPlugin$Outbound = | AlignmentPlugin$Outbound @@ -870,6 +917,7 @@ export function responsesRequestToolUnionToJSON( /** @internal */ export type ResponsesRequest$Outbound = { + access_programs?: ResponsesRequestAccessPrograms$Outbound | undefined; background?: boolean | null | undefined; cache_control?: AnthropicCacheControlDirective$Outbound | undefined; debug?: ChatDebugOptions$Outbound | undefined; @@ -980,6 +1028,8 @@ export const ResponsesRequest$outboundSchema: z.ZodType< ResponsesRequest$Outbound, ResponsesRequest > = z.object({ + accessPrograms: z.lazy(() => ResponsesRequestAccessPrograms$outboundSchema) + .optional(), background: z.nullable(z.boolean()).optional(), cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(), debug: ChatDebugOptions$outboundSchema.optional(), @@ -1125,6 +1175,7 @@ export const ResponsesRequest$outboundSchema: z.ZodType< user: z.string().optional(), }).transform((v) => { return remap$(v, { + accessPrograms: "access_programs", cacheControl: "cache_control", deferredTools: "deferred_tools", frequencyPenalty: "frequency_penalty",