mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bd5d826d8 |
+12
-7
@@ -1,12 +1,12 @@
|
||||
lockVersion: 2.0.0
|
||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||
management:
|
||||
docChecksum: 56062ba1997e25ff8be6529c550e5de9
|
||||
docChecksum: 44cf69670d08f875912803fcbf819e62
|
||||
docVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
generationVersion: 2.768.0
|
||||
releaseVersion: 0.6.0
|
||||
configChecksum: 690b77f47b975e28d7e11a6b96fa1c2f
|
||||
releaseVersion: 0.7.3
|
||||
configChecksum: b2d1a05e03508d9e74db24120e9e88e2
|
||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||
published: true
|
||||
@@ -14,6 +14,7 @@ features:
|
||||
python:
|
||||
acceptHeaders: 3.0.0
|
||||
additionalDependencies: 1.0.0
|
||||
additionalProperties: 1.0.1
|
||||
constsAndDefaults: 1.0.5
|
||||
core: 5.23.13
|
||||
defaultEnabledRetries: 0.2.0
|
||||
@@ -424,10 +425,11 @@ generatedFiles:
|
||||
- docs/components/schema17responsehealing.md
|
||||
- docs/components/schema17web.md
|
||||
- docs/components/schema19.md
|
||||
- docs/components/schema19reasoningencrypted.md
|
||||
- docs/components/schema19reasoningsummary.md
|
||||
- docs/components/schema19reasoningtext.md
|
||||
- docs/components/schema21.md
|
||||
- docs/components/schema20.md
|
||||
- docs/components/schema20reasoningencrypted.md
|
||||
- docs/components/schema20reasoningsummary.md
|
||||
- docs/components/schema20reasoningtext.md
|
||||
- docs/components/schema22.md
|
||||
- docs/components/schema3.md
|
||||
- docs/components/schema5.md
|
||||
- docs/components/schema5enum.md
|
||||
@@ -447,6 +449,7 @@ generatedFiles:
|
||||
- docs/components/toolresponsemessagecontent.md
|
||||
- docs/components/toomanyrequestsresponseerrordata.md
|
||||
- docs/components/topproviderinfo.md
|
||||
- docs/components/trace.md
|
||||
- docs/components/truncation.md
|
||||
- docs/components/ttl.md
|
||||
- docs/components/type.md
|
||||
@@ -663,6 +666,7 @@ generatedFiles:
|
||||
- docs/operations/updatekeysrequestbody.md
|
||||
- docs/operations/updatekeysresponse.md
|
||||
- docs/operations/usage.md
|
||||
- docs/operations/usagelimittype.md
|
||||
- docs/operations/web3data.md
|
||||
- docs/sdks/analytics/README.md
|
||||
- docs/sdks/apikeys/README.md
|
||||
@@ -695,6 +699,7 @@ generatedFiles:
|
||||
- src/openrouter/components/_schema14.py
|
||||
- src/openrouter/components/_schema17.py
|
||||
- src/openrouter/components/_schema19.py
|
||||
- src/openrouter/components/_schema20.py
|
||||
- src/openrouter/components/_schema5.py
|
||||
- src/openrouter/components/activityitem.py
|
||||
- src/openrouter/components/assistantmessage.py
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ generation:
|
||||
skipResponseBodyAssertions: false
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.6.0
|
||||
version: 0.7.3
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
|
||||
+93
-15
@@ -3574,6 +3574,7 @@ components:
|
||||
- Inceptron
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Io Net
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
@@ -4094,6 +4095,25 @@ components:
|
||||
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.
|
||||
trace:
|
||||
type: object
|
||||
properties:
|
||||
trace_id:
|
||||
type: string
|
||||
trace_name:
|
||||
type: string
|
||||
span_name:
|
||||
type: string
|
||||
generation_name:
|
||||
type: string
|
||||
parent_span_id:
|
||||
type: string
|
||||
additionalProperties:
|
||||
nullable: true
|
||||
description: >-
|
||||
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.
|
||||
description: Request schema for Responses endpoint
|
||||
example:
|
||||
model: anthropic/claude-4.5-sonnet-20250929
|
||||
@@ -7191,6 +7211,25 @@ components:
|
||||
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.
|
||||
trace:
|
||||
type: object
|
||||
properties:
|
||||
trace_id:
|
||||
type: string
|
||||
trace_name:
|
||||
type: string
|
||||
span_name:
|
||||
type: string
|
||||
generation_name:
|
||||
type: string
|
||||
parent_span_id:
|
||||
type: string
|
||||
additionalProperties:
|
||||
nullable: true
|
||||
description: >-
|
||||
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.
|
||||
models:
|
||||
type: array
|
||||
items:
|
||||
@@ -7507,7 +7546,6 @@ components:
|
||||
required:
|
||||
- prompt
|
||||
- completion
|
||||
additionalProperties: false
|
||||
description: Pricing information for the model
|
||||
example:
|
||||
prompt: '0.00003'
|
||||
@@ -8015,7 +8053,6 @@ components:
|
||||
required:
|
||||
- prompt
|
||||
- completion
|
||||
additionalProperties: false
|
||||
provider_name:
|
||||
$ref: '#/components/schemas/ProviderName'
|
||||
tag:
|
||||
@@ -8350,6 +8387,7 @@ components:
|
||||
- Inceptron
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Io Net
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
@@ -8532,6 +8570,20 @@ components:
|
||||
type: string
|
||||
maxLength: 128
|
||||
__schema19:
|
||||
type: object
|
||||
properties:
|
||||
trace_id:
|
||||
type: string
|
||||
trace_name:
|
||||
type: string
|
||||
span_name:
|
||||
type: string
|
||||
generation_name:
|
||||
type: string
|
||||
parent_span_id:
|
||||
type: string
|
||||
additionalProperties: {}
|
||||
__schema20:
|
||||
oneOf:
|
||||
- type: object
|
||||
properties:
|
||||
@@ -8541,9 +8593,9 @@ components:
|
||||
summary:
|
||||
type: string
|
||||
id:
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema21'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema22'
|
||||
index:
|
||||
$ref: '#/components/schemas/__schema11'
|
||||
required:
|
||||
@@ -8557,9 +8609,9 @@ components:
|
||||
data:
|
||||
type: string
|
||||
id:
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema21'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema22'
|
||||
index:
|
||||
$ref: '#/components/schemas/__schema11'
|
||||
required:
|
||||
@@ -8579,19 +8631,19 @@ components:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
id:
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema21'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema22'
|
||||
index:
|
||||
$ref: '#/components/schemas/__schema11'
|
||||
required:
|
||||
- type
|
||||
type: object
|
||||
__schema20:
|
||||
__schema21:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
__schema21:
|
||||
__schema22:
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
@@ -8602,7 +8654,7 @@ components:
|
||||
- anthropic-claude-v1
|
||||
- google-gemini-v1
|
||||
- type: 'null'
|
||||
__schema25:
|
||||
__schema26:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/ChatCompletionFinishReason'
|
||||
- type: 'null'
|
||||
@@ -8978,7 +9030,7 @@ components:
|
||||
reasoning_details:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/__schema19'
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
images:
|
||||
type: array
|
||||
items:
|
||||
@@ -9054,6 +9106,8 @@ components:
|
||||
- type: 'null'
|
||||
required:
|
||||
- name
|
||||
cache_control:
|
||||
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
|
||||
required:
|
||||
- type
|
||||
- function
|
||||
@@ -9111,6 +9165,12 @@ components:
|
||||
observability. If provided in both the request body and the x-session-id header, the body value takes
|
||||
precedence. Maximum of 128 characters.
|
||||
$ref: '#/components/schemas/__schema18'
|
||||
trace:
|
||||
description: >-
|
||||
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.
|
||||
$ref: '#/components/schemas/__schema19'
|
||||
messages:
|
||||
minItems: 1
|
||||
type: array
|
||||
@@ -9241,6 +9301,10 @@ components:
|
||||
minimum: 0
|
||||
maximum: 2
|
||||
- type: 'null'
|
||||
parallel_tool_calls:
|
||||
anyOf:
|
||||
- type: boolean
|
||||
- type: 'null'
|
||||
tool_choice:
|
||||
$ref: '#/components/schemas/ToolChoiceOption'
|
||||
tools:
|
||||
@@ -9286,7 +9350,7 @@ components:
|
||||
type: object
|
||||
properties:
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/__schema25'
|
||||
$ref: '#/components/schemas/__schema26'
|
||||
index:
|
||||
type: number
|
||||
message:
|
||||
@@ -9344,14 +9408,14 @@ components:
|
||||
reasoning_details:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/__schema19'
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
ChatStreamingChoice:
|
||||
type: object
|
||||
properties:
|
||||
delta:
|
||||
$ref: '#/components/schemas/ChatStreamingMessageChunk'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/__schema25'
|
||||
$ref: '#/components/schemas/__schema26'
|
||||
index:
|
||||
type: number
|
||||
logprobs:
|
||||
@@ -10558,6 +10622,7 @@ paths:
|
||||
- Inceptron
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Io Net
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
@@ -13710,6 +13775,19 @@ paths:
|
||||
nullable: true
|
||||
format: date-time
|
||||
description: Optional expiration time for the API key to be created
|
||||
key_label:
|
||||
type: string
|
||||
maxLength: 100
|
||||
description: Optional custom label for the API key. Defaults to the app name if not provided.
|
||||
example: My Custom Key
|
||||
usage_limit_type:
|
||||
type: string
|
||||
enum:
|
||||
- daily
|
||||
- weekly
|
||||
- monthly
|
||||
description: Optional credit limit reset interval. When set, the credit limit resets on this interval.
|
||||
example: monthly
|
||||
required:
|
||||
- callback_url
|
||||
example:
|
||||
|
||||
+88
-15
@@ -3593,6 +3593,7 @@ components:
|
||||
- Inceptron
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Io Net
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
@@ -4097,6 +4098,23 @@ components:
|
||||
maxLength: 128
|
||||
description: >-
|
||||
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.
|
||||
trace:
|
||||
type: object
|
||||
properties:
|
||||
trace_id:
|
||||
type: string
|
||||
trace_name:
|
||||
type: string
|
||||
span_name:
|
||||
type: string
|
||||
generation_name:
|
||||
type: string
|
||||
parent_span_id:
|
||||
type: string
|
||||
additionalProperties:
|
||||
nullable: true
|
||||
description: >-
|
||||
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.
|
||||
description: Request schema for Responses endpoint
|
||||
example:
|
||||
model: anthropic/claude-4.5-sonnet-20250929
|
||||
@@ -7209,6 +7227,23 @@ components:
|
||||
maxLength: 128
|
||||
description: >-
|
||||
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.
|
||||
trace:
|
||||
type: object
|
||||
properties:
|
||||
trace_id:
|
||||
type: string
|
||||
trace_name:
|
||||
type: string
|
||||
span_name:
|
||||
type: string
|
||||
generation_name:
|
||||
type: string
|
||||
parent_span_id:
|
||||
type: string
|
||||
additionalProperties:
|
||||
nullable: true
|
||||
description: >-
|
||||
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.
|
||||
models:
|
||||
type: array
|
||||
items:
|
||||
@@ -7517,7 +7552,6 @@ components:
|
||||
required:
|
||||
- prompt
|
||||
- completion
|
||||
additionalProperties: false
|
||||
description: Pricing information for the model
|
||||
example:
|
||||
prompt: '0.00003'
|
||||
@@ -8031,7 +8065,6 @@ components:
|
||||
required:
|
||||
- prompt
|
||||
- completion
|
||||
additionalProperties: false
|
||||
provider_name:
|
||||
$ref: '#/components/schemas/ProviderName'
|
||||
tag:
|
||||
@@ -8350,6 +8383,7 @@ components:
|
||||
- Inceptron
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Io Net
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
@@ -8536,6 +8570,20 @@ components:
|
||||
type: string
|
||||
maxLength: 128
|
||||
__schema19:
|
||||
type: object
|
||||
properties:
|
||||
trace_id:
|
||||
type: string
|
||||
trace_name:
|
||||
type: string
|
||||
span_name:
|
||||
type: string
|
||||
generation_name:
|
||||
type: string
|
||||
parent_span_id:
|
||||
type: string
|
||||
additionalProperties: {}
|
||||
__schema20:
|
||||
oneOf:
|
||||
- type: object
|
||||
properties:
|
||||
@@ -8545,9 +8593,9 @@ components:
|
||||
summary:
|
||||
type: string
|
||||
id:
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema21'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema22'
|
||||
index:
|
||||
$ref: '#/components/schemas/__schema11'
|
||||
required:
|
||||
@@ -8561,9 +8609,9 @@ components:
|
||||
data:
|
||||
type: string
|
||||
id:
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema21'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema22'
|
||||
index:
|
||||
$ref: '#/components/schemas/__schema11'
|
||||
required:
|
||||
@@ -8583,19 +8631,19 @@ components:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
id:
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema21'
|
||||
format:
|
||||
$ref: '#/components/schemas/__schema22'
|
||||
index:
|
||||
$ref: '#/components/schemas/__schema11'
|
||||
required:
|
||||
- type
|
||||
type: object
|
||||
__schema20:
|
||||
__schema21:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
__schema21:
|
||||
__schema22:
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
@@ -8607,7 +8655,7 @@ components:
|
||||
- google-gemini-v1
|
||||
x-speakeasy-unknown-values: allow
|
||||
- type: 'null'
|
||||
__schema25:
|
||||
__schema26:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/ChatCompletionFinishReason'
|
||||
- type: 'null'
|
||||
@@ -8986,7 +9034,7 @@ components:
|
||||
reasoning_details:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/__schema19'
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
images:
|
||||
type: array
|
||||
items:
|
||||
@@ -9062,6 +9110,8 @@ components:
|
||||
- type: 'null'
|
||||
required:
|
||||
- name
|
||||
cache_control:
|
||||
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
|
||||
required:
|
||||
- type
|
||||
- function
|
||||
@@ -9118,6 +9168,10 @@ components:
|
||||
description: >-
|
||||
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.
|
||||
$ref: '#/components/schemas/__schema18'
|
||||
trace:
|
||||
description: >-
|
||||
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.
|
||||
$ref: '#/components/schemas/__schema19'
|
||||
messages:
|
||||
minItems: 1
|
||||
type: array
|
||||
@@ -9249,6 +9303,10 @@ components:
|
||||
minimum: 0
|
||||
maximum: 2
|
||||
- type: 'null'
|
||||
parallel_tool_calls:
|
||||
anyOf:
|
||||
- type: boolean
|
||||
- type: 'null'
|
||||
tool_choice:
|
||||
$ref: '#/components/schemas/ToolChoiceOption'
|
||||
tools:
|
||||
@@ -9295,7 +9353,7 @@ components:
|
||||
type: object
|
||||
properties:
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/__schema25'
|
||||
$ref: '#/components/schemas/__schema26'
|
||||
index:
|
||||
type: number
|
||||
message:
|
||||
@@ -9353,14 +9411,14 @@ components:
|
||||
reasoning_details:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/__schema19'
|
||||
$ref: '#/components/schemas/__schema20'
|
||||
ChatStreamingChoice:
|
||||
type: object
|
||||
properties:
|
||||
delta:
|
||||
$ref: '#/components/schemas/ChatStreamingMessageChunk'
|
||||
finish_reason:
|
||||
$ref: '#/components/schemas/__schema25'
|
||||
$ref: '#/components/schemas/__schema26'
|
||||
index:
|
||||
type: number
|
||||
logprobs:
|
||||
@@ -10587,6 +10645,7 @@ paths:
|
||||
- Inceptron
|
||||
- InferenceNet
|
||||
- Infermatic
|
||||
- Io Net
|
||||
- Inflection
|
||||
- Liquid
|
||||
- Mara
|
||||
@@ -13775,6 +13834,20 @@ paths:
|
||||
nullable: true
|
||||
format: date-time
|
||||
description: Optional expiration time for the API key to be created
|
||||
key_label:
|
||||
type: string
|
||||
maxLength: 100
|
||||
description: Optional custom label for the API key. Defaults to the app name if not provided.
|
||||
example: My Custom Key
|
||||
usage_limit_type:
|
||||
type: string
|
||||
enum:
|
||||
- daily
|
||||
- weekly
|
||||
- monthly
|
||||
description: Optional credit limit reset interval. When set, the credit limit resets on this interval.
|
||||
example: monthly
|
||||
x-speakeasy-unknown-values: allow
|
||||
required:
|
||||
- callback_url
|
||||
example:
|
||||
|
||||
@@ -8,8 +8,8 @@ sources:
|
||||
- latest
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:2dbe784978f60cb53a0d081e1b5f4cbb42ca86b1ff8f4361869fa78c42e042ee
|
||||
sourceBlobDigest: sha256:851aadf3180735f9dbfdb2904011de231d3805d187499c24a450a224cacf1ed2
|
||||
sourceRevisionDigest: sha256:c35c30cefa7374fca9158283ca25f10c981f1098509d9e4ac03cbfed356479df
|
||||
sourceBlobDigest: sha256:c09875e3f18d78b78c948d40ec1a5ac7af9be1725db1ee5c7cd2bbe8bb446ffb
|
||||
tags:
|
||||
- latest
|
||||
- main
|
||||
@@ -18,10 +18,10 @@ targets:
|
||||
open-router:
|
||||
source: OpenRouter API
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:2dbe784978f60cb53a0d081e1b5f4cbb42ca86b1ff8f4361869fa78c42e042ee
|
||||
sourceBlobDigest: sha256:851aadf3180735f9dbfdb2904011de231d3805d187499c24a450a224cacf1ed2
|
||||
sourceRevisionDigest: sha256:c35c30cefa7374fca9158283ca25f10c981f1098509d9e4ac03cbfed356479df
|
||||
sourceBlobDigest: sha256:c09875e3f18d78b78c948d40ec1a5ac7af9be1725db1ee5c7cd2bbe8bb446ffb
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:cf9f3fd9983864e3c5dd5bc3fa9198efc9493f4fbc671130e8f07e87722c43dd
|
||||
codeSamplesRevisionDigest: sha256:0fdbb46fc2029d053bd04962e251a7cd3cfcd96a19a31dcfce59f25cbf30b3b1
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.666.0
|
||||
|
||||
@@ -182,6 +182,8 @@ import os
|
||||
def main():
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_title="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
@@ -191,6 +193,8 @@ def main():
|
||||
async def amain():
|
||||
|
||||
async with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_title="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
# Rest of application here...
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
| `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema20](../components/schema20.md)] | :heavy_minus_sign: | N/A |
|
||||
| `images` | List[[components.Image](../components/image.md)] | :heavy_minus_sign: | N/A |
|
||||
@@ -10,6 +10,7 @@
|
||||
| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `trace` | [Optional[components.Schema19]](../components/schema19.md) | :heavy_minus_sign: | N/A |
|
||||
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
@@ -28,6 +29,7 @@
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A |
|
||||
| `reasoning_details` | List[[components.Schema20](../components/schema20.md)] | :heavy_minus_sign: | N/A |
|
||||
@@ -40,4 +40,5 @@ Request schema for Responses endpoint
|
||||
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `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. | |
|
||||
| `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. | |
|
||||
| `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. | |
|
||||
| `trace` | [Optional[components.Trace]](../components/trace.md) | :heavy_minus_sign: | 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. | |
|
||||
@@ -40,6 +40,7 @@
|
||||
| `INCEPTRON` | Inceptron |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `IO_NET` | Io Net |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
# Schema19
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema19ReasoningSummary`
|
||||
|
||||
```python
|
||||
value: components.Schema19ReasoningSummary = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema19ReasoningEncrypted`
|
||||
|
||||
```python
|
||||
value: components.Schema19ReasoningEncrypted = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema19ReasoningText`
|
||||
|
||||
```python
|
||||
value: components.Schema19ReasoningText = /* values here */
|
||||
```
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `trace_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `trace_name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `span_name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `generation_name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `parent_span_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,23 @@
|
||||
# Schema20
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.Schema20ReasoningSummary`
|
||||
|
||||
```python
|
||||
value: components.Schema20ReasoningSummary = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema20ReasoningEncrypted`
|
||||
|
||||
```python
|
||||
value: components.Schema20ReasoningEncrypted = /* values here */
|
||||
```
|
||||
|
||||
### `components.Schema20ReasoningText`
|
||||
|
||||
```python
|
||||
value: components.Schema20ReasoningText = /* values here */
|
||||
```
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
# Schema19ReasoningEncrypted
|
||||
# Schema20ReasoningEncrypted
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -8,5 +8,5 @@
|
||||
| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema22]](../components/schema22.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
# Schema19ReasoningSummary
|
||||
# Schema20ReasoningSummary
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -8,5 +8,5 @@
|
||||
| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A |
|
||||
| `summary` | *str* | :heavy_check_mark: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema22]](../components/schema22.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# Schema19ReasoningText
|
||||
# Schema20ReasoningText
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -9,5 +9,5 @@
|
||||
| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
|
||||
| `format_` | [OptionalNullable[components.Schema22]](../components/schema22.md) | :heavy_minus_sign: | N/A |
|
||||
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# Schema21
|
||||
# Schema22
|
||||
|
||||
|
||||
## Values
|
||||
@@ -40,6 +40,7 @@
|
||||
| `INCEPTRON` | Inceptron |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `IO_NET` | Io Net |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||
| `type` | *Literal["function"]* | :heavy_check_mark: | N/A |
|
||||
| `function` | [components.ToolDefinitionJSONFunction](../components/tooldefinitionjsonfunction.md) | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | *Literal["function"]* | :heavy_check_mark: | N/A |
|
||||
| `function` | [components.ToolDefinitionJSONFunction](../components/tooldefinitionjsonfunction.md) | :heavy_check_mark: | N/A |
|
||||
| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,15 @@
|
||||
# Trace
|
||||
|
||||
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.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------- | -------------------------- | -------------------------- | -------------------------- |
|
||||
| `trace_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `trace_name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `span_name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `generation_name` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `parent_span_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
@@ -9,4 +9,6 @@
|
||||
| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM |
|
||||
| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 |
|
||||
| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 |
|
||||
| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | |
|
||||
| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | |
|
||||
| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key |
|
||||
| `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly |
|
||||
@@ -68,6 +68,7 @@
|
||||
| `INCEPTRON` | Inceptron |
|
||||
| `INFERENCE_NET` | InferenceNet |
|
||||
| `INFERMATIC` | Infermatic |
|
||||
| `IO_NET` | Io Net |
|
||||
| `INFLECTION` | Inflection |
|
||||
| `LIQUID` | Liquid |
|
||||
| `MARA` | Mara |
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# UsageLimitType
|
||||
|
||||
Optional credit limit reset interval. When set, the credit limit resets on this interval.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| --------- | --------- |
|
||||
| `DAILY` | daily |
|
||||
| `WEEKLY` | weekly |
|
||||
| `MONTHLY` | monthly |
|
||||
@@ -46,6 +46,7 @@ with OpenRouter(
|
||||
| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `trace` | [Optional[components.Schema19]](../../components/schema19.md) | :heavy_minus_sign: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `models` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
@@ -63,6 +64,7 @@ with OpenRouter(
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A |
|
||||
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
|
||||
@@ -95,6 +95,8 @@ with OpenRouter(
|
||||
| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 |
|
||||
| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 |
|
||||
| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | |
|
||||
| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key |
|
||||
| `usage_limit_type` | [Optional[operations.UsageLimitType]](../../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
||||
|
||||
### Response
|
||||
|
||||
@@ -75,6 +75,7 @@ with OpenRouter(
|
||||
| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `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. | |
|
||||
| `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. | |
|
||||
| `trace` | [Optional[components.Trace]](../../components/trace.md) | :heavy_minus_sign: | 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. | |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
||||
|
||||
### Response
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "openrouter"
|
||||
version = "0.6.0"
|
||||
version = "0.7.3"
|
||||
description = "Official Python Client SDK for OpenRouter."
|
||||
authors = [{ name = "OpenRouter" },]
|
||||
readme = "README-PYPI.md"
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.6.0"
|
||||
__version__: str = "0.7.3"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.768.0"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.6.0 2.768.0 1.0.0 openrouter"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.7.3 2.768.0 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -32,6 +32,9 @@ class Chat(BaseSDK):
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[
|
||||
Union[components.Schema19, components.Schema19TypedDict]
|
||||
] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -57,6 +60,7 @@ class Chat(BaseSDK):
|
||||
Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
parallel_tool_calls: OptionalNullable[bool] = UNSET,
|
||||
tool_choice: Optional[Any] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
@@ -93,6 +97,7 @@ class Chat(BaseSDK):
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id:
|
||||
:param trace:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -110,6 +115,7 @@ class Chat(BaseSDK):
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param temperature:
|
||||
:param parallel_tool_calls:
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
@@ -139,6 +145,9 @@ class Chat(BaseSDK):
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[
|
||||
Union[components.Schema19, components.Schema19TypedDict]
|
||||
] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -164,6 +173,7 @@ class Chat(BaseSDK):
|
||||
Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
parallel_tool_calls: OptionalNullable[bool] = UNSET,
|
||||
tool_choice: Optional[Any] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
@@ -200,6 +210,7 @@ class Chat(BaseSDK):
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id:
|
||||
:param trace:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -217,6 +228,7 @@ class Chat(BaseSDK):
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param temperature:
|
||||
:param parallel_tool_calls:
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
@@ -245,6 +257,9 @@ class Chat(BaseSDK):
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[
|
||||
Union[components.Schema19, components.Schema19TypedDict]
|
||||
] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -270,6 +285,7 @@ class Chat(BaseSDK):
|
||||
Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
parallel_tool_calls: OptionalNullable[bool] = UNSET,
|
||||
tool_choice: Optional[Any] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
@@ -306,6 +322,7 @@ class Chat(BaseSDK):
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id:
|
||||
:param trace:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -323,6 +340,7 @@ class Chat(BaseSDK):
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param temperature:
|
||||
:param parallel_tool_calls:
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
@@ -358,6 +376,7 @@ class Chat(BaseSDK):
|
||||
route=route,
|
||||
user=user,
|
||||
session_id=session_id,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.Schema19]),
|
||||
messages=utils.get_pydantic_model(messages, List[components.Message]),
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -382,6 +401,7 @@ class Chat(BaseSDK):
|
||||
stream_options, OptionalNullable[components.ChatStreamOptions]
|
||||
),
|
||||
temperature=temperature,
|
||||
parallel_tool_calls=parallel_tool_calls,
|
||||
tool_choice=tool_choice,
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[components.ToolDefinitionJSON]]
|
||||
@@ -504,6 +524,9 @@ class Chat(BaseSDK):
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[
|
||||
Union[components.Schema19, components.Schema19TypedDict]
|
||||
] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -529,6 +552,7 @@ class Chat(BaseSDK):
|
||||
Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
parallel_tool_calls: OptionalNullable[bool] = UNSET,
|
||||
tool_choice: Optional[Any] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
@@ -565,6 +589,7 @@ class Chat(BaseSDK):
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id:
|
||||
:param trace:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -582,6 +607,7 @@ class Chat(BaseSDK):
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param temperature:
|
||||
:param parallel_tool_calls:
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
@@ -611,6 +637,9 @@ class Chat(BaseSDK):
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[
|
||||
Union[components.Schema19, components.Schema19TypedDict]
|
||||
] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -636,6 +665,7 @@ class Chat(BaseSDK):
|
||||
Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
parallel_tool_calls: OptionalNullable[bool] = UNSET,
|
||||
tool_choice: Optional[Any] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
@@ -672,6 +702,7 @@ class Chat(BaseSDK):
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id:
|
||||
:param trace:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -689,6 +720,7 @@ class Chat(BaseSDK):
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param temperature:
|
||||
:param parallel_tool_calls:
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
@@ -717,6 +749,9 @@ class Chat(BaseSDK):
|
||||
route: OptionalNullable[components.Route] = UNSET,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[
|
||||
Union[components.Schema19, components.Schema19TypedDict]
|
||||
] = None,
|
||||
model: Optional[str] = None,
|
||||
models: Optional[List[str]] = None,
|
||||
frequency_penalty: OptionalNullable[float] = UNSET,
|
||||
@@ -742,6 +777,7 @@ class Chat(BaseSDK):
|
||||
Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict]
|
||||
] = UNSET,
|
||||
temperature: OptionalNullable[float] = UNSET,
|
||||
parallel_tool_calls: OptionalNullable[bool] = UNSET,
|
||||
tool_choice: Optional[Any] = None,
|
||||
tools: Optional[
|
||||
Union[
|
||||
@@ -778,6 +814,7 @@ class Chat(BaseSDK):
|
||||
:param route:
|
||||
:param user:
|
||||
:param session_id:
|
||||
:param trace:
|
||||
:param model:
|
||||
:param models:
|
||||
:param frequency_penalty:
|
||||
@@ -795,6 +832,7 @@ class Chat(BaseSDK):
|
||||
:param stream:
|
||||
:param stream_options:
|
||||
:param temperature:
|
||||
:param parallel_tool_calls:
|
||||
:param tool_choice:
|
||||
:param tools:
|
||||
:param top_p:
|
||||
@@ -830,6 +868,7 @@ class Chat(BaseSDK):
|
||||
route=route,
|
||||
user=user,
|
||||
session_id=session_id,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.Schema19]),
|
||||
messages=utils.get_pydantic_model(messages, List[components.Message]),
|
||||
model=model,
|
||||
models=models,
|
||||
@@ -854,6 +893,7 @@ class Chat(BaseSDK):
|
||||
stream_options, OptionalNullable[components.ChatStreamOptions]
|
||||
),
|
||||
temperature=temperature,
|
||||
parallel_tool_calls=parallel_tool_calls,
|
||||
tool_choice=tool_choice,
|
||||
tools=utils.get_pydantic_model(
|
||||
tools, Optional[List[components.ToolDefinitionJSON]]
|
||||
|
||||
@@ -33,16 +33,17 @@ if TYPE_CHECKING:
|
||||
Schema17Web,
|
||||
Schema17WebTypedDict,
|
||||
)
|
||||
from ._schema19 import (
|
||||
Schema19,
|
||||
Schema19ReasoningEncrypted,
|
||||
Schema19ReasoningEncryptedTypedDict,
|
||||
Schema19ReasoningSummary,
|
||||
Schema19ReasoningSummaryTypedDict,
|
||||
Schema19ReasoningText,
|
||||
Schema19ReasoningTextTypedDict,
|
||||
Schema19TypedDict,
|
||||
Schema21,
|
||||
from ._schema19 import Schema19, Schema19TypedDict
|
||||
from ._schema20 import (
|
||||
Schema20,
|
||||
Schema20ReasoningEncrypted,
|
||||
Schema20ReasoningEncryptedTypedDict,
|
||||
Schema20ReasoningSummary,
|
||||
Schema20ReasoningSummaryTypedDict,
|
||||
Schema20ReasoningText,
|
||||
Schema20ReasoningTextTypedDict,
|
||||
Schema20TypedDict,
|
||||
Schema22,
|
||||
)
|
||||
from ._schema5 import Schema5, Schema5Enum, Schema5TypedDict
|
||||
from .activityitem import ActivityItem, ActivityItemTypedDict
|
||||
@@ -496,6 +497,8 @@ if TYPE_CHECKING:
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
ServiceTier,
|
||||
Trace,
|
||||
TraceTypedDict,
|
||||
Truncation,
|
||||
)
|
||||
from .openresponsesresponsetext import (
|
||||
@@ -1499,14 +1502,16 @@ __all__ = [
|
||||
"Schema17Web",
|
||||
"Schema17WebTypedDict",
|
||||
"Schema19",
|
||||
"Schema19ReasoningEncrypted",
|
||||
"Schema19ReasoningEncryptedTypedDict",
|
||||
"Schema19ReasoningSummary",
|
||||
"Schema19ReasoningSummaryTypedDict",
|
||||
"Schema19ReasoningText",
|
||||
"Schema19ReasoningTextTypedDict",
|
||||
"Schema19TypedDict",
|
||||
"Schema21",
|
||||
"Schema20",
|
||||
"Schema20ReasoningEncrypted",
|
||||
"Schema20ReasoningEncryptedTypedDict",
|
||||
"Schema20ReasoningSummary",
|
||||
"Schema20ReasoningSummaryTypedDict",
|
||||
"Schema20ReasoningText",
|
||||
"Schema20ReasoningTextTypedDict",
|
||||
"Schema20TypedDict",
|
||||
"Schema22",
|
||||
"Schema3",
|
||||
"Schema5",
|
||||
"Schema5Enum",
|
||||
@@ -1539,6 +1544,8 @@ __all__ = [
|
||||
"ToolResponseMessageTypedDict",
|
||||
"TopProviderInfo",
|
||||
"TopProviderInfoTypedDict",
|
||||
"Trace",
|
||||
"TraceTypedDict",
|
||||
"Truncation",
|
||||
"Type",
|
||||
"TypeResponseCompleted",
|
||||
@@ -1609,14 +1616,16 @@ _dynamic_imports: dict[str, str] = {
|
||||
"Schema17Web": "._schema17",
|
||||
"Schema17WebTypedDict": "._schema17",
|
||||
"Schema19": "._schema19",
|
||||
"Schema19ReasoningEncrypted": "._schema19",
|
||||
"Schema19ReasoningEncryptedTypedDict": "._schema19",
|
||||
"Schema19ReasoningSummary": "._schema19",
|
||||
"Schema19ReasoningSummaryTypedDict": "._schema19",
|
||||
"Schema19ReasoningText": "._schema19",
|
||||
"Schema19ReasoningTextTypedDict": "._schema19",
|
||||
"Schema19TypedDict": "._schema19",
|
||||
"Schema21": "._schema19",
|
||||
"Schema20": "._schema20",
|
||||
"Schema20ReasoningEncrypted": "._schema20",
|
||||
"Schema20ReasoningEncryptedTypedDict": "._schema20",
|
||||
"Schema20ReasoningSummary": "._schema20",
|
||||
"Schema20ReasoningSummaryTypedDict": "._schema20",
|
||||
"Schema20ReasoningText": "._schema20",
|
||||
"Schema20ReasoningTextTypedDict": "._schema20",
|
||||
"Schema20TypedDict": "._schema20",
|
||||
"Schema22": "._schema20",
|
||||
"Schema5": "._schema5",
|
||||
"Schema5Enum": "._schema5",
|
||||
"Schema5TypedDict": "._schema5",
|
||||
@@ -1981,6 +1990,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"Provider": ".openresponsesrequest",
|
||||
"ProviderTypedDict": ".openresponsesrequest",
|
||||
"ServiceTier": ".openresponsesrequest",
|
||||
"Trace": ".openresponsesrequest",
|
||||
"TraceTypedDict": ".openresponsesrequest",
|
||||
"Truncation": ".openresponsesrequest",
|
||||
"OpenResponsesResponseText": ".openresponsesresponsetext",
|
||||
"OpenResponsesResponseTextTypedDict": ".openresponsesresponsetext",
|
||||
|
||||
@@ -1,235 +1,41 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
from openrouter.types import BaseModel
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
from pydantic import ConfigDict
|
||||
from typing import Any, Dict, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
Schema21 = Union[
|
||||
Literal[
|
||||
"unknown",
|
||||
"openai-responses-v1",
|
||||
"azure-openai-responses-v1",
|
||||
"xai-responses-v1",
|
||||
"anthropic-claude-v1",
|
||||
"google-gemini-v1",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
class Schema19TypedDict(TypedDict):
|
||||
trace_id: NotRequired[str]
|
||||
trace_name: NotRequired[str]
|
||||
span_name: NotRequired[str]
|
||||
generation_name: NotRequired[str]
|
||||
parent_span_id: NotRequired[str]
|
||||
|
||||
|
||||
class Schema19ReasoningTextTypedDict(TypedDict):
|
||||
type: Literal["reasoning.text"]
|
||||
text: NotRequired[Nullable[str]]
|
||||
signature: NotRequired[Nullable[str]]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema21]]
|
||||
index: NotRequired[float]
|
||||
class Schema19(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
||||
)
|
||||
__pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)
|
||||
|
||||
trace_id: Optional[str] = None
|
||||
|
||||
class Schema19ReasoningText(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "reasoning.text"
|
||||
trace_name: Optional[str] = None
|
||||
|
||||
text: OptionalNullable[str] = UNSET
|
||||
span_name: Optional[str] = None
|
||||
|
||||
signature: OptionalNullable[str] = UNSET
|
||||
generation_name: Optional[str] = None
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
parent_span_id: Optional[str] = None
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[
|
||||
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
@property
|
||||
def additional_properties(self):
|
||||
return self.__pydantic_extra__
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["text", "signature", "id", "format", "index"]
|
||||
nullable_fields = ["text", "signature", "id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class Schema19ReasoningEncryptedTypedDict(TypedDict):
|
||||
data: str
|
||||
type: Literal["reasoning.encrypted"]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema21]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema19ReasoningEncrypted(BaseModel):
|
||||
data: str
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["reasoning.encrypted"],
|
||||
AfterValidator(validate_const("reasoning.encrypted")),
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "reasoning.encrypted"
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[
|
||||
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["id", "format", "index"]
|
||||
nullable_fields = ["id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class Schema19ReasoningSummaryTypedDict(TypedDict):
|
||||
summary: str
|
||||
type: Literal["reasoning.summary"]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema21]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema19ReasoningSummary(BaseModel):
|
||||
summary: str
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["reasoning.summary"],
|
||||
AfterValidator(validate_const("reasoning.summary")),
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "reasoning.summary"
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[
|
||||
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["id", "format", "index"]
|
||||
nullable_fields = ["id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
Schema19TypedDict = TypeAliasType(
|
||||
"Schema19TypedDict",
|
||||
Union[
|
||||
Schema19ReasoningSummaryTypedDict,
|
||||
Schema19ReasoningEncryptedTypedDict,
|
||||
Schema19ReasoningTextTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Schema19 = Annotated[
|
||||
Union[
|
||||
Annotated[Schema19ReasoningSummary, Tag("reasoning.summary")],
|
||||
Annotated[Schema19ReasoningEncrypted, Tag("reasoning.encrypted")],
|
||||
Annotated[Schema19ReasoningText, Tag("reasoning.text")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
@additional_properties.setter
|
||||
def additional_properties(self, value):
|
||||
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
Schema22 = Union[
|
||||
Literal[
|
||||
"unknown",
|
||||
"openai-responses-v1",
|
||||
"azure-openai-responses-v1",
|
||||
"xai-responses-v1",
|
||||
"anthropic-claude-v1",
|
||||
"google-gemini-v1",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class Schema20ReasoningTextTypedDict(TypedDict):
|
||||
type: Literal["reasoning.text"]
|
||||
text: NotRequired[Nullable[str]]
|
||||
signature: NotRequired[Nullable[str]]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema22]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema20ReasoningText(BaseModel):
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "reasoning.text"
|
||||
|
||||
text: OptionalNullable[str] = UNSET
|
||||
|
||||
signature: OptionalNullable[str] = UNSET
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[
|
||||
OptionalNullable[Schema22], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["text", "signature", "id", "format", "index"]
|
||||
nullable_fields = ["text", "signature", "id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class Schema20ReasoningEncryptedTypedDict(TypedDict):
|
||||
data: str
|
||||
type: Literal["reasoning.encrypted"]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema22]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema20ReasoningEncrypted(BaseModel):
|
||||
data: str
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["reasoning.encrypted"],
|
||||
AfterValidator(validate_const("reasoning.encrypted")),
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "reasoning.encrypted"
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[
|
||||
OptionalNullable[Schema22], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["id", "format", "index"]
|
||||
nullable_fields = ["id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class Schema20ReasoningSummaryTypedDict(TypedDict):
|
||||
summary: str
|
||||
type: Literal["reasoning.summary"]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[Schema22]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class Schema20ReasoningSummary(BaseModel):
|
||||
summary: str
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
Literal["reasoning.summary"],
|
||||
AfterValidator(validate_const("reasoning.summary")),
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "reasoning.summary"
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
Annotated[
|
||||
OptionalNullable[Schema22], PlainValidator(validate_open_enum(False))
|
||||
],
|
||||
pydantic.Field(alias="format"),
|
||||
] = UNSET
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["id", "format", "index"]
|
||||
nullable_fields = ["id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
Schema20TypedDict = TypeAliasType(
|
||||
"Schema20TypedDict",
|
||||
Union[
|
||||
Schema20ReasoningSummaryTypedDict,
|
||||
Schema20ReasoningEncryptedTypedDict,
|
||||
Schema20ReasoningTextTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Schema20 = Annotated[
|
||||
Union[
|
||||
Annotated[Schema20ReasoningSummary, Tag("reasoning.summary")],
|
||||
Annotated[Schema20ReasoningEncrypted, Tag("reasoning.encrypted")],
|
||||
Annotated[Schema20ReasoningText, Tag("reasoning.text")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
@@ -45,6 +45,7 @@ Schema5Enum = Union[
|
||||
"Inceptron",
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Io Net",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from ._schema19 import Schema19, Schema19TypedDict
|
||||
from ._schema20 import Schema20, Schema20TypedDict
|
||||
from .chatmessagecontentitem import (
|
||||
ChatMessageContentItem,
|
||||
ChatMessageContentItemTypedDict,
|
||||
@@ -56,7 +56,7 @@ class AssistantMessageTypedDict(TypedDict):
|
||||
tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]]
|
||||
refusal: NotRequired[Nullable[str]]
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
reasoning_details: NotRequired[List[Schema19TypedDict]]
|
||||
reasoning_details: NotRequired[List[Schema20TypedDict]]
|
||||
images: NotRequired[List[ImageTypedDict]]
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class AssistantMessage(BaseModel):
|
||||
|
||||
reasoning: OptionalNullable[str] = UNSET
|
||||
|
||||
reasoning_details: Optional[List[Schema19]] = None
|
||||
reasoning_details: Optional[List[Schema20]] = None
|
||||
|
||||
images: Optional[List[Image]] = None
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
from ._schema10 import Schema10, Schema10TypedDict
|
||||
from ._schema17 import Schema17, Schema17TypedDict
|
||||
from ._schema19 import Schema19, Schema19TypedDict
|
||||
from ._schema5 import Schema5, Schema5TypedDict
|
||||
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
|
||||
from .message import Message, MessageTypedDict
|
||||
@@ -385,6 +386,7 @@ class ChatGenerationParamsTypedDict(TypedDict):
|
||||
route: NotRequired[Nullable[Route]]
|
||||
user: NotRequired[str]
|
||||
session_id: NotRequired[str]
|
||||
trace: NotRequired[Schema19TypedDict]
|
||||
model: NotRequired[str]
|
||||
models: NotRequired[List[str]]
|
||||
frequency_penalty: NotRequired[Nullable[float]]
|
||||
@@ -402,6 +404,7 @@ class ChatGenerationParamsTypedDict(TypedDict):
|
||||
stream: NotRequired[bool]
|
||||
stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]]
|
||||
temperature: NotRequired[Nullable[float]]
|
||||
parallel_tool_calls: NotRequired[Nullable[bool]]
|
||||
tool_choice: NotRequired[Any]
|
||||
tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
|
||||
top_p: NotRequired[Nullable[float]]
|
||||
@@ -425,6 +428,8 @@ class ChatGenerationParams(BaseModel):
|
||||
|
||||
session_id: Optional[str] = None
|
||||
|
||||
trace: Optional[Schema19] = None
|
||||
|
||||
model: Optional[str] = None
|
||||
|
||||
models: Optional[List[str]] = None
|
||||
@@ -459,6 +464,8 @@ class ChatGenerationParams(BaseModel):
|
||||
|
||||
temperature: OptionalNullable[float] = UNSET
|
||||
|
||||
parallel_tool_calls: OptionalNullable[bool] = UNSET
|
||||
|
||||
tool_choice: Optional[Any] = None
|
||||
|
||||
tools: Optional[List[ToolDefinitionJSON]] = None
|
||||
@@ -481,6 +488,7 @@ class ChatGenerationParams(BaseModel):
|
||||
"route",
|
||||
"user",
|
||||
"session_id",
|
||||
"trace",
|
||||
"model",
|
||||
"models",
|
||||
"frequency_penalty",
|
||||
@@ -498,6 +506,7 @@ class ChatGenerationParams(BaseModel):
|
||||
"stream",
|
||||
"stream_options",
|
||||
"temperature",
|
||||
"parallel_tool_calls",
|
||||
"tool_choice",
|
||||
"tools",
|
||||
"top_p",
|
||||
@@ -519,6 +528,7 @@ class ChatGenerationParams(BaseModel):
|
||||
"stop",
|
||||
"stream_options",
|
||||
"temperature",
|
||||
"parallel_tool_calls",
|
||||
"top_p",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from ._schema19 import Schema19, Schema19TypedDict
|
||||
from ._schema20 import Schema20, Schema20TypedDict
|
||||
from .chatstreamingmessagetoolcall import (
|
||||
ChatStreamingMessageToolCall,
|
||||
ChatStreamingMessageToolCallTypedDict,
|
||||
@@ -27,7 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict):
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
refusal: NotRequired[Nullable[str]]
|
||||
tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]]
|
||||
reasoning_details: NotRequired[List[Schema19TypedDict]]
|
||||
reasoning_details: NotRequired[List[Schema20TypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingMessageChunk(BaseModel):
|
||||
@@ -41,7 +41,7 @@ class ChatStreamingMessageChunk(BaseModel):
|
||||
|
||||
tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None
|
||||
|
||||
reasoning_details: Optional[List[Schema19]] = None
|
||||
reasoning_details: Optional[List[Schema20]] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
|
||||
@@ -55,7 +55,7 @@ from openrouter.types import (
|
||||
)
|
||||
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
||||
import pydantic
|
||||
from pydantic import Discriminator, Tag, model_serializer
|
||||
from pydantic import ConfigDict, Discriminator, Tag, model_serializer
|
||||
from pydantic.functional_validators import AfterValidator, PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
@@ -517,6 +517,43 @@ Plugin = Annotated[
|
||||
]
|
||||
|
||||
|
||||
class TraceTypedDict(TypedDict):
|
||||
r"""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: NotRequired[str]
|
||||
trace_name: NotRequired[str]
|
||||
span_name: NotRequired[str]
|
||||
generation_name: NotRequired[str]
|
||||
parent_span_id: NotRequired[str]
|
||||
|
||||
|
||||
class Trace(BaseModel):
|
||||
r"""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."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
||||
)
|
||||
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
|
||||
|
||||
trace_id: Optional[str] = None
|
||||
|
||||
trace_name: Optional[str] = None
|
||||
|
||||
span_name: Optional[str] = None
|
||||
|
||||
generation_name: Optional[str] = None
|
||||
|
||||
parent_span_id: Optional[str] = None
|
||||
|
||||
@property
|
||||
def additional_properties(self):
|
||||
return self.__pydantic_extra__
|
||||
|
||||
@additional_properties.setter
|
||||
def additional_properties(self, value):
|
||||
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
|
||||
class OpenResponsesRequestTypedDict(TypedDict):
|
||||
r"""Request schema for Responses endpoint"""
|
||||
|
||||
@@ -564,6 +601,8 @@ class OpenResponsesRequestTypedDict(TypedDict):
|
||||
r"""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."""
|
||||
session_id: NotRequired[str]
|
||||
r"""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."""
|
||||
trace: NotRequired[TraceTypedDict]
|
||||
r"""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."""
|
||||
|
||||
|
||||
class OpenResponsesRequest(BaseModel):
|
||||
@@ -664,6 +703,9 @@ class OpenResponsesRequest(BaseModel):
|
||||
session_id: Optional[str] = None
|
||||
r"""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."""
|
||||
|
||||
trace: Optional[Trace] = None
|
||||
r"""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."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
@@ -701,6 +743,7 @@ class OpenResponsesRequest(BaseModel):
|
||||
"plugins",
|
||||
"user",
|
||||
"session_id",
|
||||
"trace",
|
||||
]
|
||||
nullable_fields = [
|
||||
"instructions",
|
||||
|
||||
@@ -42,6 +42,7 @@ ProviderName = Union[
|
||||
"Inceptron",
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Io Net",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatmessagecontentitemcachecontrol import (
|
||||
ChatMessageContentItemCacheControl,
|
||||
ChatMessageContentItemCacheControlTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
@@ -66,6 +70,7 @@ class ToolDefinitionJSONFunction(BaseModel):
|
||||
class ToolDefinitionJSONTypedDict(TypedDict):
|
||||
function: ToolDefinitionJSONFunctionTypedDict
|
||||
type: Literal["function"]
|
||||
cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict]
|
||||
|
||||
|
||||
class ToolDefinitionJSON(BaseModel):
|
||||
@@ -75,3 +80,5 @@ class ToolDefinitionJSON(BaseModel):
|
||||
Annotated[Literal["function"], AfterValidator(validate_const("function"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "function"
|
||||
|
||||
cache_control: Optional[ChatMessageContentItemCacheControl] = None
|
||||
|
||||
@@ -297,6 +297,8 @@ class OAuth(BaseSDK):
|
||||
] = None,
|
||||
limit: Optional[float] = None,
|
||||
expires_at: OptionalNullable[datetime] = UNSET,
|
||||
key_label: Optional[str] = None,
|
||||
usage_limit_type: Optional[operations.UsageLimitType] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -316,6 +318,8 @@ class OAuth(BaseSDK):
|
||||
:param code_challenge_method: The method used to generate the code challenge
|
||||
:param limit: Credit limit for the API key to be created
|
||||
:param expires_at: Optional expiration time for the API key to be created
|
||||
:param key_label: Optional custom label for the API key. Defaults to the app name if not provided.
|
||||
:param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -340,6 +344,8 @@ class OAuth(BaseSDK):
|
||||
code_challenge_method=code_challenge_method,
|
||||
limit=limit,
|
||||
expires_at=expires_at,
|
||||
key_label=key_label,
|
||||
usage_limit_type=usage_limit_type,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -439,6 +445,8 @@ class OAuth(BaseSDK):
|
||||
] = None,
|
||||
limit: Optional[float] = None,
|
||||
expires_at: OptionalNullable[datetime] = UNSET,
|
||||
key_label: Optional[str] = None,
|
||||
usage_limit_type: Optional[operations.UsageLimitType] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -458,6 +466,8 @@ class OAuth(BaseSDK):
|
||||
:param code_challenge_method: The method used to generate the code challenge
|
||||
:param limit: Credit limit for the API key to be created
|
||||
:param expires_at: Optional expiration time for the API key to be created
|
||||
:param key_label: Optional custom label for the API key. Defaults to the app name if not provided.
|
||||
:param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -482,6 +492,8 @@ class OAuth(BaseSDK):
|
||||
code_challenge_method=code_challenge_method,
|
||||
limit=limit,
|
||||
expires_at=expires_at,
|
||||
key_label=key_label,
|
||||
usage_limit_type=usage_limit_type,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ if TYPE_CHECKING:
|
||||
CreateAuthKeysCodeRequestTypedDict,
|
||||
CreateAuthKeysCodeResponse,
|
||||
CreateAuthKeysCodeResponseTypedDict,
|
||||
UsageLimitType,
|
||||
)
|
||||
from .createcoinbasecharge import (
|
||||
CallData,
|
||||
@@ -707,6 +708,7 @@ __all__ = [
|
||||
"UpdateKeysResponse",
|
||||
"UpdateKeysResponseTypedDict",
|
||||
"Usage",
|
||||
"UsageLimitType",
|
||||
"UsageTypedDict",
|
||||
"Web3Data",
|
||||
"Web3DataTypedDict",
|
||||
@@ -756,6 +758,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"CreateAuthKeysCodeRequestTypedDict": ".createauthkeyscode",
|
||||
"CreateAuthKeysCodeResponse": ".createauthkeyscode",
|
||||
"CreateAuthKeysCodeResponseTypedDict": ".createauthkeyscode",
|
||||
"UsageLimitType": ".createauthkeyscode",
|
||||
"CallData": ".createcoinbasecharge",
|
||||
"CallDataTypedDict": ".createcoinbasecharge",
|
||||
"CreateCoinbaseChargeData": ".createcoinbasecharge",
|
||||
|
||||
@@ -66,6 +66,17 @@ CreateAuthKeysCodeCodeChallengeMethod = Union[
|
||||
r"""The method used to generate the code challenge"""
|
||||
|
||||
|
||||
UsageLimitType = Union[
|
||||
Literal[
|
||||
"daily",
|
||||
"weekly",
|
||||
"monthly",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
|
||||
|
||||
|
||||
class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict):
|
||||
callback_url: str
|
||||
r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed."""
|
||||
@@ -77,6 +88,10 @@ class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict):
|
||||
r"""Credit limit for the API key to be created"""
|
||||
expires_at: NotRequired[Nullable[datetime]]
|
||||
r"""Optional expiration time for the API key to be created"""
|
||||
key_label: NotRequired[str]
|
||||
r"""Optional custom label for the API key. Defaults to the app name if not provided."""
|
||||
usage_limit_type: NotRequired[UsageLimitType]
|
||||
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
|
||||
|
||||
|
||||
class CreateAuthKeysCodeRequestBody(BaseModel):
|
||||
@@ -98,6 +113,14 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
|
||||
expires_at: OptionalNullable[datetime] = UNSET
|
||||
r"""Optional expiration time for the API key to be created"""
|
||||
|
||||
key_label: Optional[str] = None
|
||||
r"""Optional custom label for the API key. Defaults to the app name if not provided."""
|
||||
|
||||
usage_limit_type: Annotated[
|
||||
Optional[UsageLimitType], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
@@ -105,6 +128,8 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
|
||||
"code_challenge_method",
|
||||
"limit",
|
||||
"expires_at",
|
||||
"key_label",
|
||||
"usage_limit_type",
|
||||
]
|
||||
nullable_fields = ["expires_at"]
|
||||
null_default_fields = []
|
||||
|
||||
@@ -161,6 +161,7 @@ ProviderName = Union[
|
||||
"Inceptron",
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Io Net",
|
||||
"Inflection",
|
||||
"Liquid",
|
||||
"Mara",
|
||||
|
||||
@@ -93,6 +93,7 @@ class Responses(BaseSDK):
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[Union[components.Trace, components.TraceTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -140,6 +141,7 @@ class Responses(BaseSDK):
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param user: 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.
|
||||
:param session_id: 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.
|
||||
:param trace: 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.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -222,6 +224,7 @@ class Responses(BaseSDK):
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[Union[components.Trace, components.TraceTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -269,6 +272,7 @@ class Responses(BaseSDK):
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param user: 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.
|
||||
:param session_id: 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.
|
||||
:param trace: 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.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -350,6 +354,7 @@ class Responses(BaseSDK):
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[Union[components.Trace, components.TraceTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -397,6 +402,7 @@ class Responses(BaseSDK):
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param user: 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.
|
||||
:param session_id: 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.
|
||||
:param trace: 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.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -466,6 +472,7 @@ class Responses(BaseSDK):
|
||||
),
|
||||
user=user,
|
||||
session_id=session_id,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.Trace]),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -741,6 +748,7 @@ class Responses(BaseSDK):
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[Union[components.Trace, components.TraceTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -788,6 +796,7 @@ class Responses(BaseSDK):
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param user: 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.
|
||||
:param session_id: 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.
|
||||
:param trace: 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.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -870,6 +879,7 @@ class Responses(BaseSDK):
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[Union[components.Trace, components.TraceTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -917,6 +927,7 @@ class Responses(BaseSDK):
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param user: 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.
|
||||
:param session_id: 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.
|
||||
:param trace: 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.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -998,6 +1009,7 @@ class Responses(BaseSDK):
|
||||
] = None,
|
||||
user: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
trace: Optional[Union[components.Trace, components.TraceTypedDict]] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -1045,6 +1057,7 @@ class Responses(BaseSDK):
|
||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||
:param user: 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.
|
||||
:param session_id: 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.
|
||||
:param trace: 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.
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -1114,6 +1127,7 @@ class Responses(BaseSDK):
|
||||
),
|
||||
user=user,
|
||||
session_id=session_id,
|
||||
trace=utils.get_pydantic_model(trace, Optional[components.Trace]),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user