mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
160 lines
5.7 KiB
Python
160 lines
5.7 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from openrouter.components import (
|
|
chatrequest as components_chatrequest,
|
|
chatresult as components_chatresult,
|
|
chatstreamchunk as components_chatstreamchunk,
|
|
metadatalevel as components_metadatalevel,
|
|
)
|
|
from openrouter.types import BaseModel
|
|
from openrouter.utils import (
|
|
FieldMetadata,
|
|
HeaderMetadata,
|
|
RequestMetadata,
|
|
eventstreaming,
|
|
validate_open_enum,
|
|
)
|
|
import pydantic
|
|
from pydantic.functional_validators import PlainValidator
|
|
from typing import Optional, Union
|
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
|
|
|
|
class SendChatCompletionRequestGlobalsTypedDict(TypedDict):
|
|
http_referer: NotRequired[str]
|
|
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
This is used to track API usage per application.
|
|
|
|
"""
|
|
x_open_router_title: NotRequired[str]
|
|
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
|
|
"""
|
|
x_open_router_categories: NotRequired[str]
|
|
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
|
|
|
"""
|
|
|
|
|
|
class SendChatCompletionRequestGlobals(BaseModel):
|
|
http_referer: Annotated[
|
|
Optional[str],
|
|
pydantic.Field(alias="HTTP-Referer"),
|
|
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
] = None
|
|
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
This is used to track API usage per application.
|
|
|
|
"""
|
|
|
|
x_open_router_title: Annotated[
|
|
Optional[str],
|
|
pydantic.Field(alias="X-OpenRouter-Title"),
|
|
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
] = None
|
|
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
|
|
"""
|
|
|
|
x_open_router_categories: Annotated[
|
|
Optional[str],
|
|
pydantic.Field(alias="X-OpenRouter-Categories"),
|
|
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
] = None
|
|
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
|
|
|
"""
|
|
|
|
|
|
class SendChatCompletionRequestRequestTypedDict(TypedDict):
|
|
chat_request: components_chatrequest.ChatRequestTypedDict
|
|
http_referer: NotRequired[str]
|
|
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
This is used to track API usage per application.
|
|
|
|
"""
|
|
x_open_router_title: NotRequired[str]
|
|
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
|
|
"""
|
|
x_open_router_categories: NotRequired[str]
|
|
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
|
|
|
"""
|
|
x_open_router_metadata: NotRequired[components_metadatalevel.MetadataLevel]
|
|
r"""Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility."""
|
|
|
|
|
|
class SendChatCompletionRequestRequest(BaseModel):
|
|
chat_request: Annotated[
|
|
components_chatrequest.ChatRequest,
|
|
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
|
]
|
|
|
|
http_referer: Annotated[
|
|
Optional[str],
|
|
pydantic.Field(alias="HTTP-Referer"),
|
|
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
] = None
|
|
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
This is used to track API usage per application.
|
|
|
|
"""
|
|
|
|
x_open_router_title: Annotated[
|
|
Optional[str],
|
|
pydantic.Field(alias="X-OpenRouter-Title"),
|
|
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
] = None
|
|
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
|
|
"""
|
|
|
|
x_open_router_categories: Annotated[
|
|
Optional[str],
|
|
pydantic.Field(alias="X-OpenRouter-Categories"),
|
|
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
] = None
|
|
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
|
|
|
"""
|
|
|
|
x_open_router_metadata: Annotated[
|
|
Annotated[
|
|
Optional[components_metadatalevel.MetadataLevel],
|
|
PlainValidator(validate_open_enum(False)),
|
|
],
|
|
pydantic.Field(alias="X-OpenRouter-Metadata"),
|
|
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
] = None
|
|
r"""Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility."""
|
|
|
|
|
|
SendChatCompletionRequestResponseTypedDict = TypeAliasType(
|
|
"SendChatCompletionRequestResponseTypedDict",
|
|
Union[
|
|
components_chatresult.ChatResultTypedDict,
|
|
Union[
|
|
eventstreaming.EventStream[
|
|
components_chatstreamchunk.ChatStreamChunkTypedDict
|
|
],
|
|
eventstreaming.EventStreamAsync[
|
|
components_chatstreamchunk.ChatStreamChunkTypedDict
|
|
],
|
|
],
|
|
],
|
|
)
|
|
|
|
|
|
SendChatCompletionRequestResponse = TypeAliasType(
|
|
"SendChatCompletionRequestResponse",
|
|
Union[
|
|
components_chatresult.ChatResult,
|
|
Union[
|
|
eventstreaming.EventStream[components_chatstreamchunk.ChatStreamChunk],
|
|
eventstreaming.EventStreamAsync[components_chatstreamchunk.ChatStreamChunk],
|
|
],
|
|
],
|
|
)
|