Skip to content

Commit 67ef52b

Browse files
authored
chore: Python SDK updates and regeneration (#24)
2 parents 06b2ccc + d4474da commit 67ef52b

27 files changed

+180
-254
lines changed

.speakeasy/gen.lock

Lines changed: 22 additions & 21 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ generation:
66
sdkClassName: OpenRouter
77
maintainOpenAPIOrder: true
88
usageSnippets:
9-
optionalPropertyRendering: withExample
9+
optionalPropertyRendering: never
1010
sdkInitStyle: constructor
1111
useClassNamesForArrayFields: true
1212
fixes:
@@ -24,13 +24,14 @@ generation:
2424
sdkHooksConfigAccess: true
2525
schemas:
2626
allOfMergeStrategy: shallowMerge
27-
requestBodyFieldName: body
27+
requestBodyFieldName: ""
2828
tests:
2929
generateTests: false
3030
generateNewTests: true
3131
skipResponseBodyAssertions: false
32+
preApplyUnionDiscriminators: true
3233
python:
33-
version: 0.1.1
34+
version: 0.0.21
3435
additionalDependencies:
3536
dev: {}
3637
main: {}
@@ -57,11 +58,12 @@ python:
5758
imports:
5859
option: openapi
5960
paths:
60-
callbacks: ""
61+
callbacks: callbacks
6162
errors: errors
6263
operations: operations
6364
shared: components
64-
webhooks: ""
65+
webhooks: webhooks
66+
inferSSEOverload: true
6567
inferUnionDiscriminators: true
6668
inputModelSuffix: input
6769
legacyPyright: false

.speakeasy/out.openapi.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3516,6 +3516,7 @@ components:
35163516
- Relace
35173517
- SambaNova
35183518
- SiliconFlow
3519+
- Sourceful
35193520
- Stealth
35203521
- StreamLake
35213522
- Switchpoint
@@ -3816,6 +3817,11 @@ components:
38163817
maxLength: 128
38173818
description: >-
38183819
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 128 characters.
3820+
session_id:
3821+
type: string
3822+
maxLength: 128
3823+
description: >-
3824+
A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
38193825
description: Request schema for Responses endpoint
38203826
example:
38213827
model: anthropic/claude-4.5-sonnet-20250929
@@ -6242,6 +6248,11 @@ paths:
62426248
- object
62436249
- data
62446250
- model
6251+
text/event-stream:
6252+
schema:
6253+
type: string
6254+
description: Not used for embeddings - embeddings do not support streaming
6255+
x-speakeasy-sse-sentinel: '[DONE]'
62456256
'400':
62466257
description: Bad Request - Invalid request parameters or malformed input
62476258
content:
@@ -6826,6 +6837,7 @@ paths:
68266837
- Relace
68276838
- SambaNova
68286839
- SiliconFlow
6840+
- Sourceful
68296841
- Stealth
68306842
- StreamLake
68316843
- Switchpoint
@@ -8437,5 +8449,3 @@ x-speakeasy-globals:
84378449
parameters:
84388450
- $ref: "#/components/parameters/AppIdentifier"
84398451
- $ref: "#/components/parameters/AppDisplayName"
8440-
- $ref: "#/components/parameters/AppIdentifier"
8441-
- $ref: "#/components/parameters/AppDisplayName"

.speakeasy/workflow.lock

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,37 @@ sources:
66
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
77
tags:
88
- latest
9+
OpenRouter API:
10+
sourceNamespace: open-router-chat-completions-api
11+
sourceRevisionDigest: sha256:9b410c8cfafe475dc6d9550f97a1e755b9a02b54513d3a85efe606e9bb05ca57
12+
sourceBlobDigest: sha256:61a2d897cc5ddd893a5131bfacad7fcc311fe5b2eaaa5641fbb0a5b3321bfde7
13+
tags:
14+
- latest
15+
- 1.0.0
916
targets:
1017
open-router:
11-
source: -OAS
18+
source: OpenRouter API
1219
sourceNamespace: open-router-chat-completions-api
13-
sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695
14-
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
20+
sourceRevisionDigest: sha256:9b410c8cfafe475dc6d9550f97a1e755b9a02b54513d3a85efe606e9bb05ca57
21+
sourceBlobDigest: sha256:61a2d897cc5ddd893a5131bfacad7fcc311fe5b2eaaa5641fbb0a5b3321bfde7
1522
workflow:
1623
workflowVersion: 1.0.0
1724
speakeasyVersion: 1.666.0
1825
sources:
19-
-OAS:
26+
OpenRouter API:
2027
inputs:
21-
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
28+
- location: .speakeasy/in.openapi.yaml
2229
overlays:
2330
- location: .speakeasy/overlays/open-enums.overlay.yaml
2431
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
2532
- location: .speakeasy/overlays/add-headers.overlay.yaml
2633
output: .speakeasy/out.openapi.yaml
2734
registry:
28-
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
35+
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
2936
targets:
3037
open-router:
3138
target: python
32-
source: -OAS
39+
source: OpenRouter API
3340
publish:
3441
pypi:
3542
token: $pypi_token

.speakeasy/workflow.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
workflowVersion: 1.0.0
22
speakeasyVersion: 1.666.0
33
sources:
4-
-OAS:
4+
OpenRouter API:
55
inputs:
6-
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
6+
- location: .speakeasy/in.openapi.yaml
77
overlays:
88
- location: .speakeasy/overlays/open-enums.overlay.yaml
99
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
1010
- location: .speakeasy/overlays/add-headers.overlay.yaml
1111
output: .speakeasy/out.openapi.yaml
1212
registry:
13-
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
13+
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
1414
targets:
1515
open-router:
1616
target: python
17-
source: -OAS
17+
source: OpenRouter API
1818
publish:
1919
pypi:
2020
token: $pypi_token
2121
codeSamples:
2222
registry:
23-
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
23+
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
2424
labelOverride:
2525
fixedValue: Python (SDK)
2626
blocking: false

USAGE.md

Lines changed: 2 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,7 @@ with OpenRouter(
99
api_key=os.getenv("OPENROUTER_API_KEY", ""),
1010
) as open_router:
1111

12-
res = open_router.beta.responses.send(input=[
13-
{
14-
"type": "message",
15-
"role": "user",
16-
"content": "Hello, how are you?",
17-
},
18-
], metadata={
19-
"user_id": "123",
20-
"session_id": "abc-def-ghi",
21-
}, tools=[
22-
{
23-
"type": "function",
24-
"name": "get_current_weather",
25-
"description": "Get the current weather in a given location",
26-
"parameters": {
27-
"type": "object",
28-
"properties": {
29-
"location": {
30-
"type": "string",
31-
},
32-
},
33-
},
34-
},
35-
], model="anthropic/claude-4.5-sonnet-20250929", text={
36-
"format_": {
37-
"type": "text",
38-
},
39-
"verbosity": "medium",
40-
}, reasoning={
41-
"summary": "auto",
42-
"enabled": True,
43-
}, temperature=0.7, top_p=0.9, prompt={
44-
"id": "<id>",
45-
"variables": {
46-
"key": {
47-
"type": "input_text",
48-
"text": "Hello, how can I help you?",
49-
},
50-
},
51-
}, service_tier="auto", truncation="auto", stream=False, provider={
52-
"data_collection": "allow",
53-
"zdr": True,
54-
"enforce_distillable_text": True,
55-
"order": [
56-
"OpenAI",
57-
],
58-
"only": [
59-
"OpenAI",
60-
],
61-
"ignore": [
62-
"OpenAI",
63-
],
64-
"quantizations": None,
65-
"sort": "price",
66-
})
12+
res = open_router.beta.responses.send(service_tier="auto", stream=False)
6713

6814
with res as event_stream:
6915
for event in event_stream:
@@ -87,61 +33,7 @@ async def main():
8733
api_key=os.getenv("OPENROUTER_API_KEY", ""),
8834
) as open_router:
8935

90-
res = await open_router.beta.responses.send_async(input=[
91-
{
92-
"type": "message",
93-
"role": "user",
94-
"content": "Hello, how are you?",
95-
},
96-
], metadata={
97-
"user_id": "123",
98-
"session_id": "abc-def-ghi",
99-
}, tools=[
100-
{
101-
"type": "function",
102-
"name": "get_current_weather",
103-
"description": "Get the current weather in a given location",
104-
"parameters": {
105-
"type": "object",
106-
"properties": {
107-
"location": {
108-
"type": "string",
109-
},
110-
},
111-
},
112-
},
113-
], model="anthropic/claude-4.5-sonnet-20250929", text={
114-
"format_": {
115-
"type": "text",
116-
},
117-
"verbosity": "medium",
118-
}, reasoning={
119-
"summary": "auto",
120-
"enabled": True,
121-
}, temperature=0.7, top_p=0.9, prompt={
122-
"id": "<id>",
123-
"variables": {
124-
"key": {
125-
"type": "input_text",
126-
"text": "Hello, how can I help you?",
127-
},
128-
},
129-
}, service_tier="auto", truncation="auto", stream=False, provider={
130-
"data_collection": "allow",
131-
"zdr": True,
132-
"enforce_distillable_text": True,
133-
"order": [
134-
"OpenAI",
135-
],
136-
"only": [
137-
"OpenAI",
138-
],
139-
"ignore": [
140-
"OpenAI",
141-
],
142-
"quantizations": None,
143-
"sort": "price",
144-
})
36+
res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
14537

14638
async with res as event_stream:
14739
async for event in event_stream:

docs/components/openresponsesrequest.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ Request schema for Responses endpoint
3333
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
3434
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
3535
| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
36-
| `user` | *Optional[str]* | :heavy_minus_sign: | 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 128 characters. | |
36+
| `user` | *Optional[str]* | :heavy_minus_sign: | 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 128 characters. | |
37+
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |

docs/components/providername.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
| `RELACE` | Relace |
6262
| `SAMBA_NOVA` | SambaNova |
6363
| `SILICON_FLOW` | SiliconFlow |
64+
| `SOURCEFUL` | Sourceful |
6465
| `STEALTH` | Stealth |
6566
| `STREAM_LAKE` | StreamLake |
6667
| `SWITCHPOINT` | Switchpoint |

0 commit comments

Comments
 (0)