diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1b6e5086d..0a4a1644f 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 9b1eaacc1871bd7b91f7dbd0b165094a + docChecksum: 5928953dfb1f69885a3505a285a82551 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.193 - configChecksum: d12f25ef12f72c8f2d1944d1713704a5 + releaseVersion: 1.3.194 + configChecksum: b43dffaedfc8522b9da28d1e82a8f7c3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: a79de1ea-e6b7-40f8-a2cf-ae7f35b1f451 - pristine_commit_hash: 91628015c1be34b6bd47bd89953fa93ec49cb0c6 - pristine_tree_hash: e8be533b3a8caa4aa328fd220bb5b731836341e7 + generation_id: 2d1e3ed5-8d10-4fc5-9f5b-89ac64d3d571 + pristine_commit_hash: 02244129e7485babfd19411babf519c5db84cc25 + pristine_tree_hash: 43bd2ee7a17b41c2b5571cb7efceeb2a7b0d5862 features: python: acceptHeaders: 3.0.0 @@ -8304,8 +8304,8 @@ trackedFiles: pristine_git_object: 45d1eef7be13575aac15391f23c310480852abf8 docs/components/sttrequest.mdx: id: 6a5e33cf6dbe - last_write_checksum: sha1:c76e3b7840564aff121bd08d2b07b1a58e1e5cfa - pristine_git_object: b2794f52672cb6cc93db342094b7cf56016144af + last_write_checksum: sha1:2c5793e08104df77d4fde45f972de781a25b8e6a + pristine_git_object: f74dd50e2c9bc571bacc9721c0ead7742b14cde0 docs/components/sttrequestdatacollection.mdx: id: d8523e72c962 last_write_checksum: sha1:485caf2a759a45e6666f611663eea23924032df6 @@ -9716,8 +9716,8 @@ trackedFiles: pristine_git_object: 8445acfbfdb1f7ca08c133f6fde0287b4ca77b2d docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx: id: 0550cc56c73a - last_write_checksum: sha1:84f8b56be6b63632fd82b48490e9b7623bfd7a7a - pristine_git_object: 9e528aad195e2ee28c9d8172c5d7571345e15adb + last_write_checksum: sha1:65429fc23d879ba9d0541306ead947c6237180eb + pristine_git_object: 67ec63ac55263eea457d41b73b4b8ec13820b6a5 docs/operations/createaudiotranscriptionsrequest.mdx: id: 68a813383936 last_write_checksum: sha1:22960be5d9477f0e1c0c1e701f7873c7442bbc81 @@ -11664,8 +11664,8 @@ trackedFiles: pristine_git_object: 6b829448efce633995225efd4cb68ab138381afb docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 - last_write_checksum: sha1:0e88efab8bed1237da03a0c5164c363da96ff806 - pristine_git_object: 0133c3a1ebae62a3581bc0503b6dbf61343e6470 + last_write_checksum: sha1:a72a850312d8c2f8d6b00c588d35b48af7978f15 + pristine_git_object: 00bfa3bfcde0768983447bb0566eae511074bafd docs/sdks/systemone/README.mdx: id: 55c317c71f3d last_write_checksum: sha1:b2c7fa64183a73b951c0c05ca68156bee092c2b4 @@ -11696,8 +11696,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:4f442f636cb1a8c8d226dc8c2ca631057027bc11 - pristine_git_object: ca7837e7452d7692a26517ea7edebf53433d898b + last_write_checksum: sha1:4cc6ef7b624ab0b56e02154fbba11d3be76f0a31 + pristine_git_object: c30b65628bc4a3a5a57d3d10487d93847245f528 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11724,8 +11724,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:c11fa4f89990eec4b3a0688e7a9d8404893ef46b - pristine_git_object: 0b62064995b1cc275cb895693cba709ba5e3f846 + last_write_checksum: sha1:16288773611768ebe415309bd8736c9e27a0bbe3 + pristine_git_object: 0732c7cec623b1fea863a251926f1454d1bdaa42 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -15180,8 +15180,8 @@ trackedFiles: pristine_git_object: 75281f477b0ce85cd1032ed4b0c949a30a51b7f9 src/openrouter/components/sttrequest.py: id: 5fb1d469e16e - last_write_checksum: sha1:9fc09c624a8f623eadbc2fda5263711b2fd08fa6 - pristine_git_object: 7bb4e08db69c27a195cc9b4637677e8bfae4d52d + last_write_checksum: sha1:62855ff6312010f40d1397b08550cdcc87fb7464 + pristine_git_object: 6be8bee3bf7b3fc84b3ef4d6cb68890fe17947c8 src/openrouter/components/sttresponse.py: id: 2dc8eb8daaca last_write_checksum: sha1:420c65736ba0db3da84592d5639b41b81b6f87c4 @@ -15884,8 +15884,8 @@ trackedFiles: pristine_git_object: 4e8414f223370bff1e4f060919f36f70da6ec40c src/openrouter/operations/createaudiotranscriptions_multipart.py: id: da07d463225a - last_write_checksum: sha1:8682e1f679b20c9f20ed9cbc303d129764c4eb84 - pristine_git_object: 62e0f114856f94fed418ea19cf5b279ea918bcd7 + last_write_checksum: sha1:5b3777d9bf1170ed765c71d1a6281e4a7094fa10 + pristine_git_object: 2acdd403559a9ffbde62a0badfce393bfa0c466b src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 last_write_checksum: sha1:69075ec4cb208d6eb6f6085b48a301d38708d388 @@ -16540,8 +16540,8 @@ trackedFiles: pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 src/openrouter/stt.py: id: fc0c2f669423 - last_write_checksum: sha1:99ebb0748e169ba4a19d5c9f56bc08dcd625d7f0 - pristine_git_object: b1ca52f0b8add09f9e24547584775e84373b738d + last_write_checksum: sha1:d411ba27355a5f7bdb3c3970fc89ea2b45d829b4 + pristine_git_object: 62e503c4b2f2a0a97e53245fdb87211e171a94e6 src/openrouter/systemone.py: id: 7e0a0e237bb1 last_write_checksum: sha1:550af693684424feec5e4f8e044f8243b74daeb0 @@ -21747,3 +21747,7 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: | + ## Python SDK Changes: + * `open_router.stt.create_transcription()`: `request.prompt` **Added** + * `open_router.stt.create_transcription_multipart()`: `request.prompt` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 5074ab838..0c94cab11 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.193 + version: 1.3.194 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index a4755651e..991f9fe5d 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -35083,6 +35083,10 @@ components: description: 'STT model identifier' example: 'openai/whisper-large-v3' type: 'string' + prompt: + description: 'Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty.' + example: 'A discussion about OpenRouter and speech recognition.' + type: 'string' provider: description: 'Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options' properties: @@ -41228,6 +41232,9 @@ paths: model: description: 'The model to use for transcription.' type: 'string' + prompt: + description: 'Context to guide transcription on providers that support contextual prompting. Takes precedence over provider-specific prompt options, including when empty.' + type: 'string' provider: description: 'JSON-encoded provider preferences object, the same shape as the JSON body field: { "zdr": true, "data_collection": "deny", "options": { "": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.' type: 'string' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e8a4b3c41..333dc401e 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:f85fc2900ce989da5dfa7c02b5a1ea427a32bac5b21871a93caeecafd266aa54 - sourceBlobDigest: sha256:b5435972d1e8941e0ee84fdc49dbf46f996f18d5444376a2e3bf47564514b852 + sourceRevisionDigest: sha256:d2a065fc6f56085a1e126f144517568a6fa4e69b262530d3d75e2de353a8c9f0 + sourceBlobDigest: sha256:cdc1920471b27ea7c0bf892ab1f9495b1959b053ec9e229ab901f3be5fa8e00c tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:f85fc2900ce989da5dfa7c02b5a1ea427a32bac5b21871a93caeecafd266aa54 - sourceBlobDigest: sha256:b5435972d1e8941e0ee84fdc49dbf46f996f18d5444376a2e3bf47564514b852 + sourceRevisionDigest: sha256:d2a065fc6f56085a1e126f144517568a6fa4e69b262530d3d75e2de353a8c9f0 + sourceBlobDigest: sha256:cdc1920471b27ea7c0bf892ab1f9495b1959b053ec9e229ab901f3be5fa8e00c codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:ebfc1c6009f2fcd8e5354d9c19bdc073271432b1775a15e550114f7d5349a8bf + codeSamplesRevisionDigest: sha256:40b9eb17a2f8db677c205746a0158c692f2548209dd69782ee6b2b736d3fdc03 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 0ff4fdc71..f3a366678 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4699,4 +4699,14 @@ Based on: ### Generated - [python v1.3.193] . ### Releases -- [PyPI v1.3.193] https://pypi.org/project/openrouter/1.3.193 - . \ No newline at end of file +- [PyPI v1.3.193] https://pypi.org/project/openrouter/1.3.193 - . + +## 2026-11-19 10:04:15 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.194] . +### Releases +- [PyPI v1.3.194] https://pypi.org/project/openrouter/1.3.194 - . \ No newline at end of file diff --git a/docs/components/sttrequest.mdx b/docs/components/sttrequest.mdx index b2794f526..f74dd50e2 100644 --- a/docs/components/sttrequest.mdx +++ b/docs/components/sttrequest.mdx @@ -14,6 +14,7 @@ Speech-to-text request input. Accepts a JSON body with input_audio containing ba | `keyterms` | List[*str*] | ➖ | Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. | [
"OpenRouter",
"Scribe"
] | | `language` | *Optional[str]* | ➖ | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | | `model` | *str* | ✔️ | STT model identifier | openai/whisper-large-v3 | +| `prompt` | *Optional[str]* | ➖ | Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty. | A discussion about OpenRouter and speech recognition. | | `provider` | [Optional[components.STTRequestProvider]](../components/sttrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `response_format` | [Optional[components.STTRequestResponseFormat]](../components/sttrequestresponseformat.mdx) | ➖ | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | | `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | diff --git a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx index 9e528aad1..67ec63ac5 100644 --- a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx +++ b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx @@ -11,6 +11,7 @@ title: "CreateAudioTranscriptionsMultipartRequestBody" | `keyterms` | List[*str*] | ➖ | Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. | | `language` | *Optional[str]* | ➖ | The language of the input audio (ISO-639-1). | | `model` | *str* | ✔️ | The model to use for transcription. | +| `prompt` | *Optional[str]* | ➖ | Context to guide transcription on providers that support contextual prompting. Takes precedence over provider-specific prompt options, including when empty. | | `provider` | *Optional[str]* | ➖ | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "zdr": true, "data_collection": "deny", "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | | `response_format` | [Optional[operations.ResponseFormat]](../operations/responseformat.mdx) | ➖ | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | | `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. | diff --git a/docs/sdks/stt/README.mdx b/docs/sdks/stt/README.mdx index 0133c3a1e..00bfa3bfc 100644 --- a/docs/sdks/stt/README.mdx +++ b/docs/sdks/stt/README.mdx @@ -52,6 +52,7 @@ with OpenRouter( | `diarize` | *Optional[bool]* | ➖ | Label each word with the speaker who said it. Speaker labels are returned on the words array (speaker, speaker_label), so response_format must be "verbose_json" (a "json" request is rejected with a 400) and word timestamps are included even when timestamp_granularities omits "word". Only supported by some providers; the request is rejected with a 400 when the selected model cannot diarize. Providers may charge extra. | true | | `keyterms` | List[*str*] | ➖ | Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. | [
"OpenRouter",
"Scribe"
] | | `language` | *Optional[str]* | ➖ | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | +| `prompt` | *Optional[str]* | ➖ | Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty. | A discussion about OpenRouter and speech recognition. | | `provider` | [Optional[components.STTRequestProvider]](../../components/sttrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `response_format` | [Optional[components.STTRequestResponseFormat]](../../components/sttrequestresponseformat.mdx) | ➖ | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | | `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | @@ -124,6 +125,7 @@ with OpenRouter( | `file` | [Optional[operations.CreateAudioTranscriptionsMultipartFile]](../../operations/createaudiotranscriptionsmultipartfile.mdx) | ➖ | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio, or by URL via source_url. Exactly one of file or source_url is required. | | `keyterms` | List[*str*] | ➖ | Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. | | `language` | *Optional[str]* | ➖ | The language of the input audio (ISO-639-1). | +| `prompt` | *Optional[str]* | ➖ | Context to guide transcription on providers that support contextual prompting. Takes precedence over provider-specific prompt options, including when empty. | | `provider` | *Optional[str]* | ➖ | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "zdr": true, "data_collection": "deny", "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | | `response_format` | [Optional[operations.ResponseFormat]](../../operations/responseformat.mdx) | ➖ | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | | `session_id` | *Optional[str]* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. | diff --git a/pyproject.toml b/pyproject.toml index ca7837e74..c30b65628 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.193" +version = "1.3.194" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 0b6206499..0732c7cec 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.193" +__version__: str = "1.3.194" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.193 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.194 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/sttrequest.py b/src/openrouter/components/sttrequest.py index 7bb4e08db..6be8bee3b 100644 --- a/src/openrouter/components/sttrequest.py +++ b/src/openrouter/components/sttrequest.py @@ -177,6 +177,8 @@ class STTRequestTypedDict(TypedDict): r"""Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra.""" language: NotRequired[str] r"""ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.""" + prompt: NotRequired[str] + r"""Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty.""" provider: NotRequired[STTRequestProviderTypedDict] r"""Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" response_format: NotRequired[STTRequestResponseFormat] @@ -211,6 +213,9 @@ class STTRequest(BaseModel): language: Optional[str] = None r"""ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.""" + prompt: Optional[str] = None + r"""Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty.""" + provider: Optional[STTRequestProvider] = None r"""Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" @@ -239,6 +244,7 @@ def serialize_model(self, handler): "diarize", "keyterms", "language", + "prompt", "provider", "response_format", "session_id", diff --git a/src/openrouter/operations/createaudiotranscriptions_multipart.py b/src/openrouter/operations/createaudiotranscriptions_multipart.py index 62e0f1148..2acdd4035 100644 --- a/src/openrouter/operations/createaudiotranscriptions_multipart.py +++ b/src/openrouter/operations/createaudiotranscriptions_multipart.py @@ -149,6 +149,8 @@ class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict): r"""Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms.""" language: NotRequired[str] r"""The language of the input audio (ISO-639-1).""" + prompt: NotRequired[str] + r"""Context to guide transcription on providers that support contextual prompting. Takes precedence over provider-specific prompt options, including when empty.""" provider: NotRequired[str] r"""JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.""" response_format: NotRequired[ResponseFormat] @@ -190,6 +192,9 @@ class CreateAudioTranscriptionsMultipartRequestBody(BaseModel): language: Annotated[Optional[str], FieldMetadata(multipart=True)] = None r"""The language of the input audio (ISO-639-1).""" + prompt: Annotated[Optional[str], FieldMetadata(multipart=True)] = None + r"""Context to guide transcription on providers that support contextual prompting. Takes precedence over provider-specific prompt options, including when empty.""" + provider: Annotated[Optional[str], FieldMetadata(multipart=True)] = None r"""JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.""" @@ -228,6 +233,7 @@ def serialize_model(self, handler): "file", "keyterms[]", "language", + "prompt", "provider", "response_format", "session_id", diff --git a/src/openrouter/stt.py b/src/openrouter/stt.py index b1ca52f0b..62e503c4b 100644 --- a/src/openrouter/stt.py +++ b/src/openrouter/stt.py @@ -23,6 +23,7 @@ def create_transcription( diarize: Optional[bool] = None, keyterms: Optional[Iterable[str]] = None, language: Optional[str] = None, + prompt: Optional[str] = None, provider: Optional[ Union[components.STTRequestProvider, components.STTRequestProviderTypedDict] ] = None, @@ -57,6 +58,7 @@ def create_transcription( :param diarize: Label each word with the speaker who said it. Speaker labels are returned on the words array (speaker, speaker_label), so response_format must be \"verbose_json\" (a \"json\" request is rejected with a 400) and word timestamps are included even when timestamp_granularities omits \"word\". Only supported by some providers; the request is rejected with a 400 when the selected model cannot diarize. Providers may charge extra. :param keyterms: Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. + :param prompt: Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty. :param provider: Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. @@ -91,6 +93,7 @@ def create_transcription( keyterms=utils.unmarshal(keyterms, Optional[List[str]]), language=language, model=model, + prompt=prompt, provider=utils.get_pydantic_model( provider, Optional[components.STTRequestProvider] ), @@ -252,6 +255,7 @@ async def create_transcription_async( diarize: Optional[bool] = None, keyterms: Optional[Iterable[str]] = None, language: Optional[str] = None, + prompt: Optional[str] = None, provider: Optional[ Union[components.STTRequestProvider, components.STTRequestProviderTypedDict] ] = None, @@ -286,6 +290,7 @@ async def create_transcription_async( :param diarize: Label each word with the speaker who said it. Speaker labels are returned on the words array (speaker, speaker_label), so response_format must be \"verbose_json\" (a \"json\" request is rejected with a 400) and word timestamps are included even when timestamp_granularities omits \"word\". Only supported by some providers; the request is rejected with a 400 when the selected model cannot diarize. Providers may charge extra. :param keyterms: Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. + :param prompt: Context to guide transcription, such as domain vocabulary or a previous segment. Honored by OpenAI (except gpt-4o-transcribe-diarize), Azure OpenAI, Groq, Together, Alibaba, and AssemblyAI endpoints with prompted pricing configured. Other providers ignore it; use keyterms for supported keyword boosting. Takes precedence over provider-specific prompt options, including when empty. :param provider: Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. @@ -320,6 +325,7 @@ async def create_transcription_async( keyterms=utils.unmarshal(keyterms, Optional[List[str]]), language=language, model=model, + prompt=prompt, provider=utils.get_pydantic_model( provider, Optional[components.STTRequestProvider] ), @@ -486,6 +492,7 @@ def create_transcription_multipart( ] = None, keyterms: Optional[Iterable[str]] = None, language: Optional[str] = None, + prompt: Optional[str] = None, provider: Optional[str] = None, response_format: Optional[operations.ResponseFormat] = None, session_id: Optional[str] = None, @@ -517,6 +524,7 @@ def create_transcription_multipart( :param file: The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio, or by URL via source_url. Exactly one of file or source_url is required. :param keyterms: Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. :param language: The language of the input audio (ISO-639-1). + :param prompt: Context to guide transcription on providers that support contextual prompting. Takes precedence over provider-specific prompt options, including when empty. :param provider: JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. @@ -552,6 +560,7 @@ def create_transcription_multipart( keyterms=utils.unmarshal(keyterms, Optional[List[str]]), language=language, model=model, + prompt=prompt, provider=provider, response_format=response_format, session_id=session_id, @@ -721,6 +730,7 @@ async def create_transcription_multipart_async( ] = None, keyterms: Optional[Iterable[str]] = None, language: Optional[str] = None, + prompt: Optional[str] = None, provider: Optional[str] = None, response_format: Optional[operations.ResponseFormat] = None, session_id: Optional[str] = None, @@ -752,6 +762,7 @@ async def create_transcription_multipart_async( :param file: The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio, or by URL via source_url. Exactly one of file or source_url is required. :param keyterms: Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. :param language: The language of the input audio (ISO-639-1). + :param prompt: Context to guide transcription on providers that support contextual prompting. Takes precedence over provider-specific prompt options, including when empty. :param provider: JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. @@ -787,6 +798,7 @@ async def create_transcription_multipart_async( keyterms=utils.unmarshal(keyterms, Optional[List[str]]), language=language, model=model, + prompt=prompt, provider=provider, response_format=response_format, session_id=session_id, diff --git a/uv.lock b/uv.lock index d3ba62725..4e49cc74d 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.193" +version = "1.3.194" source = { editable = "." } dependencies = [ { name = "httpcore" },