fix: add overlay to remove nullable from pagination offset params (#121)

This commit is contained in:
Matt Apperson
2026-04-14 12:48:15 -04:00
committed by GitHub
parent 2bba049182
commit b2386114cd
440 changed files with 36150 additions and 32168 deletions
+147 -185
View File
@@ -10,41 +10,25 @@ if TYPE_CHECKING:
BulkAssignKeysToGuardrailGlobals,
BulkAssignKeysToGuardrailGlobalsTypedDict,
BulkAssignKeysToGuardrailRequest,
BulkAssignKeysToGuardrailRequestBody,
BulkAssignKeysToGuardrailRequestBodyTypedDict,
BulkAssignKeysToGuardrailRequestTypedDict,
BulkAssignKeysToGuardrailResponse,
BulkAssignKeysToGuardrailResponseTypedDict,
)
from .bulkassignmemberstoguardrail import (
BulkAssignMembersToGuardrailGlobals,
BulkAssignMembersToGuardrailGlobalsTypedDict,
BulkAssignMembersToGuardrailRequest,
BulkAssignMembersToGuardrailRequestBody,
BulkAssignMembersToGuardrailRequestBodyTypedDict,
BulkAssignMembersToGuardrailRequestTypedDict,
BulkAssignMembersToGuardrailResponse,
BulkAssignMembersToGuardrailResponseTypedDict,
)
from .bulkunassignkeysfromguardrail import (
BulkUnassignKeysFromGuardrailGlobals,
BulkUnassignKeysFromGuardrailGlobalsTypedDict,
BulkUnassignKeysFromGuardrailRequest,
BulkUnassignKeysFromGuardrailRequestBody,
BulkUnassignKeysFromGuardrailRequestBodyTypedDict,
BulkUnassignKeysFromGuardrailRequestTypedDict,
BulkUnassignKeysFromGuardrailResponse,
BulkUnassignKeysFromGuardrailResponseTypedDict,
)
from .bulkunassignmembersfromguardrail import (
BulkUnassignMembersFromGuardrailGlobals,
BulkUnassignMembersFromGuardrailGlobalsTypedDict,
BulkUnassignMembersFromGuardrailRequest,
BulkUnassignMembersFromGuardrailRequestBody,
BulkUnassignMembersFromGuardrailRequestBodyTypedDict,
BulkUnassignMembersFromGuardrailRequestTypedDict,
BulkUnassignMembersFromGuardrailResponse,
BulkUnassignMembersFromGuardrailResponseTypedDict,
)
from .createauthkeyscode import (
CreateAuthKeysCodeCodeChallengeMethod,
@@ -60,12 +44,6 @@ if TYPE_CHECKING:
CreateAuthKeysCodeResponseTypedDict,
UsageLimitType,
)
from .createcoinbasecharge import (
CreateCoinbaseChargeGlobals,
CreateCoinbaseChargeGlobalsTypedDict,
CreateCoinbaseChargeRequest,
CreateCoinbaseChargeRequestTypedDict,
)
from .createembeddings import (
Content,
ContentImageURL,
@@ -85,6 +63,8 @@ if TYPE_CHECKING:
CreateEmbeddingsResponseBody,
CreateEmbeddingsResponseBodyTypedDict,
CreateEmbeddingsResponseTypedDict,
CreateEmbeddingsUsage,
CreateEmbeddingsUsageTypedDict,
Embedding,
EmbeddingTypedDict,
EncodingFormat,
@@ -98,22 +78,12 @@ if TYPE_CHECKING:
ObjectEmbedding,
TypeImageURL,
TypeText,
Usage,
UsageTypedDict,
)
from .createguardrail import (
CreateGuardrailData,
CreateGuardrailDataTypedDict,
CreateGuardrailGlobals,
CreateGuardrailGlobalsTypedDict,
CreateGuardrailRequest,
CreateGuardrailRequestBody,
CreateGuardrailRequestBodyTypedDict,
CreateGuardrailRequestTypedDict,
CreateGuardrailResetIntervalRequest,
CreateGuardrailResetIntervalResponse,
CreateGuardrailResponse,
CreateGuardrailResponseTypedDict,
)
from .createkeys import (
CreateKeysData,
@@ -128,6 +98,24 @@ if TYPE_CHECKING:
CreateKeysResponse,
CreateKeysResponseTypedDict,
)
from .creatererank import (
CreateRerankGlobals,
CreateRerankGlobalsTypedDict,
CreateRerankRequest,
CreateRerankRequestBody,
CreateRerankRequestBodyTypedDict,
CreateRerankRequestTypedDict,
CreateRerankResponse,
CreateRerankResponseBody,
CreateRerankResponseBodyTypedDict,
CreateRerankResponseTypedDict,
CreateRerankUsage,
CreateRerankUsageTypedDict,
Document,
DocumentTypedDict,
Result,
ResultTypedDict,
)
from .createresponses import (
CreateResponsesGlobals,
CreateResponsesGlobalsTypedDict,
@@ -138,13 +126,17 @@ if TYPE_CHECKING:
CreateResponsesResponseBodyTypedDict,
CreateResponsesResponseTypedDict,
)
from .createvideos import (
CreateVideosGlobals,
CreateVideosGlobalsTypedDict,
CreateVideosRequest,
CreateVideosRequestTypedDict,
)
from .deleteguardrail import (
DeleteGuardrailGlobals,
DeleteGuardrailGlobalsTypedDict,
DeleteGuardrailRequest,
DeleteGuardrailRequestTypedDict,
DeleteGuardrailResponse,
DeleteGuardrailResponseTypedDict,
)
from .deletekeys import (
DeleteKeysGlobals,
@@ -197,20 +189,12 @@ if TYPE_CHECKING:
GetGenerationRequestTypedDict,
GetGenerationResponse,
GetGenerationResponseTypedDict,
ProviderName,
ProviderResponse,
ProviderResponseTypedDict,
)
from .getguardrail import (
GetGuardrailData,
GetGuardrailDataTypedDict,
GetGuardrailGlobals,
GetGuardrailGlobalsTypedDict,
GetGuardrailRequest,
GetGuardrailRequestTypedDict,
GetGuardrailResetInterval,
GetGuardrailResponse,
GetGuardrailResponseTypedDict,
)
from .getkey import (
GetKeyData,
@@ -234,8 +218,12 @@ if TYPE_CHECKING:
GetUserActivityGlobalsTypedDict,
GetUserActivityRequest,
GetUserActivityRequestTypedDict,
GetUserActivityResponse,
GetUserActivityResponseTypedDict,
)
from .getvideos import (
GetVideosGlobals,
GetVideosGlobalsTypedDict,
GetVideosRequest,
GetVideosRequestTypedDict,
)
from .list import (
ListData,
@@ -270,8 +258,6 @@ if TYPE_CHECKING:
ListEndpointsZdrResponseTypedDict,
)
from .listguardrailkeyassignments import (
ListGuardrailKeyAssignmentsData,
ListGuardrailKeyAssignmentsDataTypedDict,
ListGuardrailKeyAssignmentsGlobals,
ListGuardrailKeyAssignmentsGlobalsTypedDict,
ListGuardrailKeyAssignmentsRequest,
@@ -280,8 +266,6 @@ if TYPE_CHECKING:
ListGuardrailKeyAssignmentsResponseTypedDict,
)
from .listguardrailmemberassignments import (
ListGuardrailMemberAssignmentsData,
ListGuardrailMemberAssignmentsDataTypedDict,
ListGuardrailMemberAssignmentsGlobals,
ListGuardrailMemberAssignmentsGlobalsTypedDict,
ListGuardrailMemberAssignmentsRequest,
@@ -290,19 +274,14 @@ if TYPE_CHECKING:
ListGuardrailMemberAssignmentsResponseTypedDict,
)
from .listguardrails import (
ListGuardrailsData,
ListGuardrailsDataTypedDict,
ListGuardrailsGlobals,
ListGuardrailsGlobalsTypedDict,
ListGuardrailsRequest,
ListGuardrailsRequestTypedDict,
ListGuardrailsResetInterval,
ListGuardrailsResponse,
ListGuardrailsResponseTypedDict,
)
from .listkeyassignments import (
ListKeyAssignmentsData,
ListKeyAssignmentsDataTypedDict,
ListKeyAssignmentsGlobals,
ListKeyAssignmentsGlobalsTypedDict,
ListKeyAssignmentsRequest,
@@ -311,8 +290,6 @@ if TYPE_CHECKING:
ListKeyAssignmentsResponseTypedDict,
)
from .listmemberassignments import (
ListMemberAssignmentsData,
ListMemberAssignmentsDataTypedDict,
ListMemberAssignmentsGlobals,
ListMemberAssignmentsGlobalsTypedDict,
ListMemberAssignmentsRequest,
@@ -334,6 +311,19 @@ if TYPE_CHECKING:
ListModelsUserSecurity,
ListModelsUserSecurityTypedDict,
)
from .listorganizationmembers import (
ListOrganizationMembersData,
ListOrganizationMembersDataTypedDict,
ListOrganizationMembersGlobals,
ListOrganizationMembersGlobalsTypedDict,
ListOrganizationMembersRequest,
ListOrganizationMembersRequestTypedDict,
ListOrganizationMembersResponse,
ListOrganizationMembersResponseBody,
ListOrganizationMembersResponseBodyTypedDict,
ListOrganizationMembersResponseTypedDict,
Role,
)
from .listproviders import (
Datacenter,
Headquarters,
@@ -346,6 +336,18 @@ if TYPE_CHECKING:
ListProvidersResponse,
ListProvidersResponseTypedDict,
)
from .listvideoscontent import (
ListVideosContentGlobals,
ListVideosContentGlobalsTypedDict,
ListVideosContentRequest,
ListVideosContentRequestTypedDict,
)
from .listvideosmodels import (
ListVideosModelsGlobals,
ListVideosModelsGlobalsTypedDict,
ListVideosModelsRequest,
ListVideosModelsRequestTypedDict,
)
from .sendchatcompletionrequest import (
SendChatCompletionRequestGlobals,
SendChatCompletionRequestGlobalsTypedDict,
@@ -357,18 +359,10 @@ if TYPE_CHECKING:
SendChatCompletionRequestResponseTypedDict,
)
from .updateguardrail import (
UpdateGuardrailData,
UpdateGuardrailDataTypedDict,
UpdateGuardrailGlobals,
UpdateGuardrailGlobalsTypedDict,
UpdateGuardrailRequest,
UpdateGuardrailRequestBody,
UpdateGuardrailRequestBodyTypedDict,
UpdateGuardrailRequestTypedDict,
UpdateGuardrailResetIntervalRequest,
UpdateGuardrailResetIntervalResponse,
UpdateGuardrailResponse,
UpdateGuardrailResponseTypedDict,
)
from .updatekeys import (
UpdateKeysData,
@@ -389,35 +383,19 @@ __all__ = [
"BulkAssignKeysToGuardrailGlobals",
"BulkAssignKeysToGuardrailGlobalsTypedDict",
"BulkAssignKeysToGuardrailRequest",
"BulkAssignKeysToGuardrailRequestBody",
"BulkAssignKeysToGuardrailRequestBodyTypedDict",
"BulkAssignKeysToGuardrailRequestTypedDict",
"BulkAssignKeysToGuardrailResponse",
"BulkAssignKeysToGuardrailResponseTypedDict",
"BulkAssignMembersToGuardrailGlobals",
"BulkAssignMembersToGuardrailGlobalsTypedDict",
"BulkAssignMembersToGuardrailRequest",
"BulkAssignMembersToGuardrailRequestBody",
"BulkAssignMembersToGuardrailRequestBodyTypedDict",
"BulkAssignMembersToGuardrailRequestTypedDict",
"BulkAssignMembersToGuardrailResponse",
"BulkAssignMembersToGuardrailResponseTypedDict",
"BulkUnassignKeysFromGuardrailGlobals",
"BulkUnassignKeysFromGuardrailGlobalsTypedDict",
"BulkUnassignKeysFromGuardrailRequest",
"BulkUnassignKeysFromGuardrailRequestBody",
"BulkUnassignKeysFromGuardrailRequestBodyTypedDict",
"BulkUnassignKeysFromGuardrailRequestTypedDict",
"BulkUnassignKeysFromGuardrailResponse",
"BulkUnassignKeysFromGuardrailResponseTypedDict",
"BulkUnassignMembersFromGuardrailGlobals",
"BulkUnassignMembersFromGuardrailGlobalsTypedDict",
"BulkUnassignMembersFromGuardrailRequest",
"BulkUnassignMembersFromGuardrailRequestBody",
"BulkUnassignMembersFromGuardrailRequestBodyTypedDict",
"BulkUnassignMembersFromGuardrailRequestTypedDict",
"BulkUnassignMembersFromGuardrailResponse",
"BulkUnassignMembersFromGuardrailResponseTypedDict",
"Category",
"Content",
"ContentImageURL",
@@ -436,10 +414,6 @@ __all__ = [
"CreateAuthKeysCodeRequestTypedDict",
"CreateAuthKeysCodeResponse",
"CreateAuthKeysCodeResponseTypedDict",
"CreateCoinbaseChargeGlobals",
"CreateCoinbaseChargeGlobalsTypedDict",
"CreateCoinbaseChargeRequest",
"CreateCoinbaseChargeRequestTypedDict",
"CreateEmbeddingsData",
"CreateEmbeddingsDataTypedDict",
"CreateEmbeddingsGlobals",
@@ -452,18 +426,12 @@ __all__ = [
"CreateEmbeddingsResponseBody",
"CreateEmbeddingsResponseBodyTypedDict",
"CreateEmbeddingsResponseTypedDict",
"CreateGuardrailData",
"CreateGuardrailDataTypedDict",
"CreateEmbeddingsUsage",
"CreateEmbeddingsUsageTypedDict",
"CreateGuardrailGlobals",
"CreateGuardrailGlobalsTypedDict",
"CreateGuardrailRequest",
"CreateGuardrailRequestBody",
"CreateGuardrailRequestBodyTypedDict",
"CreateGuardrailRequestTypedDict",
"CreateGuardrailResetIntervalRequest",
"CreateGuardrailResetIntervalResponse",
"CreateGuardrailResponse",
"CreateGuardrailResponseTypedDict",
"CreateKeysData",
"CreateKeysDataTypedDict",
"CreateKeysGlobals",
@@ -475,6 +443,18 @@ __all__ = [
"CreateKeysRequestTypedDict",
"CreateKeysResponse",
"CreateKeysResponseTypedDict",
"CreateRerankGlobals",
"CreateRerankGlobalsTypedDict",
"CreateRerankRequest",
"CreateRerankRequestBody",
"CreateRerankRequestBodyTypedDict",
"CreateRerankRequestTypedDict",
"CreateRerankResponse",
"CreateRerankResponseBody",
"CreateRerankResponseBodyTypedDict",
"CreateRerankResponseTypedDict",
"CreateRerankUsage",
"CreateRerankUsageTypedDict",
"CreateResponsesGlobals",
"CreateResponsesGlobalsTypedDict",
"CreateResponsesRequest",
@@ -483,19 +463,23 @@ __all__ = [
"CreateResponsesResponseBody",
"CreateResponsesResponseBodyTypedDict",
"CreateResponsesResponseTypedDict",
"CreateVideosGlobals",
"CreateVideosGlobalsTypedDict",
"CreateVideosRequest",
"CreateVideosRequestTypedDict",
"Datacenter",
"DeleteGuardrailGlobals",
"DeleteGuardrailGlobalsTypedDict",
"DeleteGuardrailRequest",
"DeleteGuardrailRequestTypedDict",
"DeleteGuardrailResponse",
"DeleteGuardrailResponseTypedDict",
"DeleteKeysGlobals",
"DeleteKeysGlobalsTypedDict",
"DeleteKeysRequest",
"DeleteKeysRequestTypedDict",
"DeleteKeysResponse",
"DeleteKeysResponseTypedDict",
"Document",
"DocumentTypedDict",
"Embedding",
"EmbeddingTypedDict",
"EncodingFormat",
@@ -532,15 +516,10 @@ __all__ = [
"GetGenerationRequestTypedDict",
"GetGenerationResponse",
"GetGenerationResponseTypedDict",
"GetGuardrailData",
"GetGuardrailDataTypedDict",
"GetGuardrailGlobals",
"GetGuardrailGlobalsTypedDict",
"GetGuardrailRequest",
"GetGuardrailRequestTypedDict",
"GetGuardrailResetInterval",
"GetGuardrailResponse",
"GetGuardrailResponseTypedDict",
"GetKeyData",
"GetKeyDataTypedDict",
"GetKeyGlobals",
@@ -557,8 +536,10 @@ __all__ = [
"GetUserActivityGlobalsTypedDict",
"GetUserActivityRequest",
"GetUserActivityRequestTypedDict",
"GetUserActivityResponse",
"GetUserActivityResponseTypedDict",
"GetVideosGlobals",
"GetVideosGlobalsTypedDict",
"GetVideosRequest",
"GetVideosRequestTypedDict",
"Headquarters",
"ImageURL",
"ImageURLTypedDict",
@@ -586,41 +567,30 @@ __all__ = [
"ListEndpointsZdrResponseTypedDict",
"ListGlobals",
"ListGlobalsTypedDict",
"ListGuardrailKeyAssignmentsData",
"ListGuardrailKeyAssignmentsDataTypedDict",
"ListGuardrailKeyAssignmentsGlobals",
"ListGuardrailKeyAssignmentsGlobalsTypedDict",
"ListGuardrailKeyAssignmentsRequest",
"ListGuardrailKeyAssignmentsRequestTypedDict",
"ListGuardrailKeyAssignmentsResponse",
"ListGuardrailKeyAssignmentsResponseTypedDict",
"ListGuardrailMemberAssignmentsData",
"ListGuardrailMemberAssignmentsDataTypedDict",
"ListGuardrailMemberAssignmentsGlobals",
"ListGuardrailMemberAssignmentsGlobalsTypedDict",
"ListGuardrailMemberAssignmentsRequest",
"ListGuardrailMemberAssignmentsRequestTypedDict",
"ListGuardrailMemberAssignmentsResponse",
"ListGuardrailMemberAssignmentsResponseTypedDict",
"ListGuardrailsData",
"ListGuardrailsDataTypedDict",
"ListGuardrailsGlobals",
"ListGuardrailsGlobalsTypedDict",
"ListGuardrailsRequest",
"ListGuardrailsRequestTypedDict",
"ListGuardrailsResetInterval",
"ListGuardrailsResponse",
"ListGuardrailsResponseTypedDict",
"ListKeyAssignmentsData",
"ListKeyAssignmentsDataTypedDict",
"ListKeyAssignmentsGlobals",
"ListKeyAssignmentsGlobalsTypedDict",
"ListKeyAssignmentsRequest",
"ListKeyAssignmentsRequestTypedDict",
"ListKeyAssignmentsResponse",
"ListKeyAssignmentsResponseTypedDict",
"ListMemberAssignmentsData",
"ListMemberAssignmentsDataTypedDict",
"ListMemberAssignmentsGlobals",
"ListMemberAssignmentsGlobalsTypedDict",
"ListMemberAssignmentsRequest",
@@ -637,6 +607,16 @@ __all__ = [
"ListModelsUserRequestTypedDict",
"ListModelsUserSecurity",
"ListModelsUserSecurityTypedDict",
"ListOrganizationMembersData",
"ListOrganizationMembersDataTypedDict",
"ListOrganizationMembersGlobals",
"ListOrganizationMembersGlobalsTypedDict",
"ListOrganizationMembersRequest",
"ListOrganizationMembersRequestTypedDict",
"ListOrganizationMembersResponse",
"ListOrganizationMembersResponseBody",
"ListOrganizationMembersResponseBodyTypedDict",
"ListOrganizationMembersResponseTypedDict",
"ListProvidersData",
"ListProvidersDataTypedDict",
"ListProvidersGlobals",
@@ -649,13 +629,21 @@ __all__ = [
"ListRequestTypedDict",
"ListResponse",
"ListResponseTypedDict",
"ListVideosContentGlobals",
"ListVideosContentGlobalsTypedDict",
"ListVideosContentRequest",
"ListVideosContentRequestTypedDict",
"ListVideosModelsGlobals",
"ListVideosModelsGlobalsTypedDict",
"ListVideosModelsRequest",
"ListVideosModelsRequestTypedDict",
"Object",
"ObjectEmbedding",
"ProviderName",
"ProviderResponse",
"ProviderResponseTypedDict",
"RateLimit",
"RateLimitTypedDict",
"Result",
"ResultTypedDict",
"Role",
"SendChatCompletionRequestGlobals",
"SendChatCompletionRequestGlobalsTypedDict",
"SendChatCompletionRequestRequest",
@@ -666,18 +654,10 @@ __all__ = [
"SendChatCompletionRequestResponseTypedDict",
"TypeImageURL",
"TypeText",
"UpdateGuardrailData",
"UpdateGuardrailDataTypedDict",
"UpdateGuardrailGlobals",
"UpdateGuardrailGlobalsTypedDict",
"UpdateGuardrailRequest",
"UpdateGuardrailRequestBody",
"UpdateGuardrailRequestBodyTypedDict",
"UpdateGuardrailRequestTypedDict",
"UpdateGuardrailResetIntervalRequest",
"UpdateGuardrailResetIntervalResponse",
"UpdateGuardrailResponse",
"UpdateGuardrailResponseTypedDict",
"UpdateKeysData",
"UpdateKeysDataTypedDict",
"UpdateKeysGlobals",
@@ -689,44 +669,26 @@ __all__ = [
"UpdateKeysRequestTypedDict",
"UpdateKeysResponse",
"UpdateKeysResponseTypedDict",
"Usage",
"UsageLimitType",
"UsageTypedDict",
]
_dynamic_imports: dict[str, str] = {
"BulkAssignKeysToGuardrailGlobals": ".bulkassignkeystoguardrail",
"BulkAssignKeysToGuardrailGlobalsTypedDict": ".bulkassignkeystoguardrail",
"BulkAssignKeysToGuardrailRequest": ".bulkassignkeystoguardrail",
"BulkAssignKeysToGuardrailRequestBody": ".bulkassignkeystoguardrail",
"BulkAssignKeysToGuardrailRequestBodyTypedDict": ".bulkassignkeystoguardrail",
"BulkAssignKeysToGuardrailRequestTypedDict": ".bulkassignkeystoguardrail",
"BulkAssignKeysToGuardrailResponse": ".bulkassignkeystoguardrail",
"BulkAssignKeysToGuardrailResponseTypedDict": ".bulkassignkeystoguardrail",
"BulkAssignMembersToGuardrailGlobals": ".bulkassignmemberstoguardrail",
"BulkAssignMembersToGuardrailGlobalsTypedDict": ".bulkassignmemberstoguardrail",
"BulkAssignMembersToGuardrailRequest": ".bulkassignmemberstoguardrail",
"BulkAssignMembersToGuardrailRequestBody": ".bulkassignmemberstoguardrail",
"BulkAssignMembersToGuardrailRequestBodyTypedDict": ".bulkassignmemberstoguardrail",
"BulkAssignMembersToGuardrailRequestTypedDict": ".bulkassignmemberstoguardrail",
"BulkAssignMembersToGuardrailResponse": ".bulkassignmemberstoguardrail",
"BulkAssignMembersToGuardrailResponseTypedDict": ".bulkassignmemberstoguardrail",
"BulkUnassignKeysFromGuardrailGlobals": ".bulkunassignkeysfromguardrail",
"BulkUnassignKeysFromGuardrailGlobalsTypedDict": ".bulkunassignkeysfromguardrail",
"BulkUnassignKeysFromGuardrailRequest": ".bulkunassignkeysfromguardrail",
"BulkUnassignKeysFromGuardrailRequestBody": ".bulkunassignkeysfromguardrail",
"BulkUnassignKeysFromGuardrailRequestBodyTypedDict": ".bulkunassignkeysfromguardrail",
"BulkUnassignKeysFromGuardrailRequestTypedDict": ".bulkunassignkeysfromguardrail",
"BulkUnassignKeysFromGuardrailResponse": ".bulkunassignkeysfromguardrail",
"BulkUnassignKeysFromGuardrailResponseTypedDict": ".bulkunassignkeysfromguardrail",
"BulkUnassignMembersFromGuardrailGlobals": ".bulkunassignmembersfromguardrail",
"BulkUnassignMembersFromGuardrailGlobalsTypedDict": ".bulkunassignmembersfromguardrail",
"BulkUnassignMembersFromGuardrailRequest": ".bulkunassignmembersfromguardrail",
"BulkUnassignMembersFromGuardrailRequestBody": ".bulkunassignmembersfromguardrail",
"BulkUnassignMembersFromGuardrailRequestBodyTypedDict": ".bulkunassignmembersfromguardrail",
"BulkUnassignMembersFromGuardrailRequestTypedDict": ".bulkunassignmembersfromguardrail",
"BulkUnassignMembersFromGuardrailResponse": ".bulkunassignmembersfromguardrail",
"BulkUnassignMembersFromGuardrailResponseTypedDict": ".bulkunassignmembersfromguardrail",
"CreateAuthKeysCodeCodeChallengeMethod": ".createauthkeyscode",
"CreateAuthKeysCodeData": ".createauthkeyscode",
"CreateAuthKeysCodeDataTypedDict": ".createauthkeyscode",
@@ -739,10 +701,6 @@ _dynamic_imports: dict[str, str] = {
"CreateAuthKeysCodeResponse": ".createauthkeyscode",
"CreateAuthKeysCodeResponseTypedDict": ".createauthkeyscode",
"UsageLimitType": ".createauthkeyscode",
"CreateCoinbaseChargeGlobals": ".createcoinbasecharge",
"CreateCoinbaseChargeGlobalsTypedDict": ".createcoinbasecharge",
"CreateCoinbaseChargeRequest": ".createcoinbasecharge",
"CreateCoinbaseChargeRequestTypedDict": ".createcoinbasecharge",
"Content": ".createembeddings",
"ContentImageURL": ".createembeddings",
"ContentImageURLTypedDict": ".createembeddings",
@@ -761,6 +719,8 @@ _dynamic_imports: dict[str, str] = {
"CreateEmbeddingsResponseBody": ".createembeddings",
"CreateEmbeddingsResponseBodyTypedDict": ".createembeddings",
"CreateEmbeddingsResponseTypedDict": ".createembeddings",
"CreateEmbeddingsUsage": ".createembeddings",
"CreateEmbeddingsUsageTypedDict": ".createembeddings",
"Embedding": ".createembeddings",
"EmbeddingTypedDict": ".createembeddings",
"EncodingFormat": ".createembeddings",
@@ -774,20 +734,10 @@ _dynamic_imports: dict[str, str] = {
"ObjectEmbedding": ".createembeddings",
"TypeImageURL": ".createembeddings",
"TypeText": ".createembeddings",
"Usage": ".createembeddings",
"UsageTypedDict": ".createembeddings",
"CreateGuardrailData": ".createguardrail",
"CreateGuardrailDataTypedDict": ".createguardrail",
"CreateGuardrailGlobals": ".createguardrail",
"CreateGuardrailGlobalsTypedDict": ".createguardrail",
"CreateGuardrailRequest": ".createguardrail",
"CreateGuardrailRequestBody": ".createguardrail",
"CreateGuardrailRequestBodyTypedDict": ".createguardrail",
"CreateGuardrailRequestTypedDict": ".createguardrail",
"CreateGuardrailResetIntervalRequest": ".createguardrail",
"CreateGuardrailResetIntervalResponse": ".createguardrail",
"CreateGuardrailResponse": ".createguardrail",
"CreateGuardrailResponseTypedDict": ".createguardrail",
"CreateKeysData": ".createkeys",
"CreateKeysDataTypedDict": ".createkeys",
"CreateKeysGlobals": ".createkeys",
@@ -799,6 +749,22 @@ _dynamic_imports: dict[str, str] = {
"CreateKeysRequestTypedDict": ".createkeys",
"CreateKeysResponse": ".createkeys",
"CreateKeysResponseTypedDict": ".createkeys",
"CreateRerankGlobals": ".creatererank",
"CreateRerankGlobalsTypedDict": ".creatererank",
"CreateRerankRequest": ".creatererank",
"CreateRerankRequestBody": ".creatererank",
"CreateRerankRequestBodyTypedDict": ".creatererank",
"CreateRerankRequestTypedDict": ".creatererank",
"CreateRerankResponse": ".creatererank",
"CreateRerankResponseBody": ".creatererank",
"CreateRerankResponseBodyTypedDict": ".creatererank",
"CreateRerankResponseTypedDict": ".creatererank",
"CreateRerankUsage": ".creatererank",
"CreateRerankUsageTypedDict": ".creatererank",
"Document": ".creatererank",
"DocumentTypedDict": ".creatererank",
"Result": ".creatererank",
"ResultTypedDict": ".creatererank",
"CreateResponsesGlobals": ".createresponses",
"CreateResponsesGlobalsTypedDict": ".createresponses",
"CreateResponsesRequest": ".createresponses",
@@ -807,12 +773,14 @@ _dynamic_imports: dict[str, str] = {
"CreateResponsesResponseBody": ".createresponses",
"CreateResponsesResponseBodyTypedDict": ".createresponses",
"CreateResponsesResponseTypedDict": ".createresponses",
"CreateVideosGlobals": ".createvideos",
"CreateVideosGlobalsTypedDict": ".createvideos",
"CreateVideosRequest": ".createvideos",
"CreateVideosRequestTypedDict": ".createvideos",
"DeleteGuardrailGlobals": ".deleteguardrail",
"DeleteGuardrailGlobalsTypedDict": ".deleteguardrail",
"DeleteGuardrailRequest": ".deleteguardrail",
"DeleteGuardrailRequestTypedDict": ".deleteguardrail",
"DeleteGuardrailResponse": ".deleteguardrail",
"DeleteGuardrailResponseTypedDict": ".deleteguardrail",
"DeleteKeysGlobals": ".deletekeys",
"DeleteKeysGlobalsTypedDict": ".deletekeys",
"DeleteKeysRequest": ".deletekeys",
@@ -855,18 +823,10 @@ _dynamic_imports: dict[str, str] = {
"GetGenerationRequestTypedDict": ".getgeneration",
"GetGenerationResponse": ".getgeneration",
"GetGenerationResponseTypedDict": ".getgeneration",
"ProviderName": ".getgeneration",
"ProviderResponse": ".getgeneration",
"ProviderResponseTypedDict": ".getgeneration",
"GetGuardrailData": ".getguardrail",
"GetGuardrailDataTypedDict": ".getguardrail",
"GetGuardrailGlobals": ".getguardrail",
"GetGuardrailGlobalsTypedDict": ".getguardrail",
"GetGuardrailRequest": ".getguardrail",
"GetGuardrailRequestTypedDict": ".getguardrail",
"GetGuardrailResetInterval": ".getguardrail",
"GetGuardrailResponse": ".getguardrail",
"GetGuardrailResponseTypedDict": ".getguardrail",
"GetKeyData": ".getkey",
"GetKeyDataTypedDict": ".getkey",
"GetKeyGlobals": ".getkey",
@@ -884,8 +844,10 @@ _dynamic_imports: dict[str, str] = {
"GetUserActivityGlobalsTypedDict": ".getuseractivity",
"GetUserActivityRequest": ".getuseractivity",
"GetUserActivityRequestTypedDict": ".getuseractivity",
"GetUserActivityResponse": ".getuseractivity",
"GetUserActivityResponseTypedDict": ".getuseractivity",
"GetVideosGlobals": ".getvideos",
"GetVideosGlobalsTypedDict": ".getvideos",
"GetVideosRequest": ".getvideos",
"GetVideosRequestTypedDict": ".getvideos",
"ListData": ".list",
"ListDataTypedDict": ".list",
"ListGlobals": ".list",
@@ -910,41 +872,30 @@ _dynamic_imports: dict[str, str] = {
"ListEndpointsZdrRequestTypedDict": ".listendpointszdr",
"ListEndpointsZdrResponse": ".listendpointszdr",
"ListEndpointsZdrResponseTypedDict": ".listendpointszdr",
"ListGuardrailKeyAssignmentsData": ".listguardrailkeyassignments",
"ListGuardrailKeyAssignmentsDataTypedDict": ".listguardrailkeyassignments",
"ListGuardrailKeyAssignmentsGlobals": ".listguardrailkeyassignments",
"ListGuardrailKeyAssignmentsGlobalsTypedDict": ".listguardrailkeyassignments",
"ListGuardrailKeyAssignmentsRequest": ".listguardrailkeyassignments",
"ListGuardrailKeyAssignmentsRequestTypedDict": ".listguardrailkeyassignments",
"ListGuardrailKeyAssignmentsResponse": ".listguardrailkeyassignments",
"ListGuardrailKeyAssignmentsResponseTypedDict": ".listguardrailkeyassignments",
"ListGuardrailMemberAssignmentsData": ".listguardrailmemberassignments",
"ListGuardrailMemberAssignmentsDataTypedDict": ".listguardrailmemberassignments",
"ListGuardrailMemberAssignmentsGlobals": ".listguardrailmemberassignments",
"ListGuardrailMemberAssignmentsGlobalsTypedDict": ".listguardrailmemberassignments",
"ListGuardrailMemberAssignmentsRequest": ".listguardrailmemberassignments",
"ListGuardrailMemberAssignmentsRequestTypedDict": ".listguardrailmemberassignments",
"ListGuardrailMemberAssignmentsResponse": ".listguardrailmemberassignments",
"ListGuardrailMemberAssignmentsResponseTypedDict": ".listguardrailmemberassignments",
"ListGuardrailsData": ".listguardrails",
"ListGuardrailsDataTypedDict": ".listguardrails",
"ListGuardrailsGlobals": ".listguardrails",
"ListGuardrailsGlobalsTypedDict": ".listguardrails",
"ListGuardrailsRequest": ".listguardrails",
"ListGuardrailsRequestTypedDict": ".listguardrails",
"ListGuardrailsResetInterval": ".listguardrails",
"ListGuardrailsResponse": ".listguardrails",
"ListGuardrailsResponseTypedDict": ".listguardrails",
"ListKeyAssignmentsData": ".listkeyassignments",
"ListKeyAssignmentsDataTypedDict": ".listkeyassignments",
"ListKeyAssignmentsGlobals": ".listkeyassignments",
"ListKeyAssignmentsGlobalsTypedDict": ".listkeyassignments",
"ListKeyAssignmentsRequest": ".listkeyassignments",
"ListKeyAssignmentsRequestTypedDict": ".listkeyassignments",
"ListKeyAssignmentsResponse": ".listkeyassignments",
"ListKeyAssignmentsResponseTypedDict": ".listkeyassignments",
"ListMemberAssignmentsData": ".listmemberassignments",
"ListMemberAssignmentsDataTypedDict": ".listmemberassignments",
"ListMemberAssignmentsGlobals": ".listmemberassignments",
"ListMemberAssignmentsGlobalsTypedDict": ".listmemberassignments",
"ListMemberAssignmentsRequest": ".listmemberassignments",
@@ -961,6 +912,17 @@ _dynamic_imports: dict[str, str] = {
"ListModelsUserRequestTypedDict": ".listmodelsuser",
"ListModelsUserSecurity": ".listmodelsuser",
"ListModelsUserSecurityTypedDict": ".listmodelsuser",
"ListOrganizationMembersData": ".listorganizationmembers",
"ListOrganizationMembersDataTypedDict": ".listorganizationmembers",
"ListOrganizationMembersGlobals": ".listorganizationmembers",
"ListOrganizationMembersGlobalsTypedDict": ".listorganizationmembers",
"ListOrganizationMembersRequest": ".listorganizationmembers",
"ListOrganizationMembersRequestTypedDict": ".listorganizationmembers",
"ListOrganizationMembersResponse": ".listorganizationmembers",
"ListOrganizationMembersResponseBody": ".listorganizationmembers",
"ListOrganizationMembersResponseBodyTypedDict": ".listorganizationmembers",
"ListOrganizationMembersResponseTypedDict": ".listorganizationmembers",
"Role": ".listorganizationmembers",
"Datacenter": ".listproviders",
"Headquarters": ".listproviders",
"ListProvidersData": ".listproviders",
@@ -971,6 +933,14 @@ _dynamic_imports: dict[str, str] = {
"ListProvidersRequestTypedDict": ".listproviders",
"ListProvidersResponse": ".listproviders",
"ListProvidersResponseTypedDict": ".listproviders",
"ListVideosContentGlobals": ".listvideoscontent",
"ListVideosContentGlobalsTypedDict": ".listvideoscontent",
"ListVideosContentRequest": ".listvideoscontent",
"ListVideosContentRequestTypedDict": ".listvideoscontent",
"ListVideosModelsGlobals": ".listvideosmodels",
"ListVideosModelsGlobalsTypedDict": ".listvideosmodels",
"ListVideosModelsRequest": ".listvideosmodels",
"ListVideosModelsRequestTypedDict": ".listvideosmodels",
"SendChatCompletionRequestGlobals": ".sendchatcompletionrequest",
"SendChatCompletionRequestGlobalsTypedDict": ".sendchatcompletionrequest",
"SendChatCompletionRequestRequest": ".sendchatcompletionrequest",
@@ -979,18 +949,10 @@ _dynamic_imports: dict[str, str] = {
"SendChatCompletionRequestResponseBody": ".sendchatcompletionrequest",
"SendChatCompletionRequestResponseBodyTypedDict": ".sendchatcompletionrequest",
"SendChatCompletionRequestResponseTypedDict": ".sendchatcompletionrequest",
"UpdateGuardrailData": ".updateguardrail",
"UpdateGuardrailDataTypedDict": ".updateguardrail",
"UpdateGuardrailGlobals": ".updateguardrail",
"UpdateGuardrailGlobalsTypedDict": ".updateguardrail",
"UpdateGuardrailRequest": ".updateguardrail",
"UpdateGuardrailRequestBody": ".updateguardrail",
"UpdateGuardrailRequestBodyTypedDict": ".updateguardrail",
"UpdateGuardrailRequestTypedDict": ".updateguardrail",
"UpdateGuardrailResetIntervalRequest": ".updateguardrail",
"UpdateGuardrailResetIntervalResponse": ".updateguardrail",
"UpdateGuardrailResponse": ".updateguardrail",
"UpdateGuardrailResponseTypedDict": ".updateguardrail",
"UpdateKeysData": ".updatekeys",
"UpdateKeysDataTypedDict": ".updatekeys",
"UpdateKeysGlobals": ".updatekeys",
@@ -1,6 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import (
bulkassignkeysrequest as components_bulkassignkeysrequest,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
@@ -9,7 +12,7 @@ from openrouter.utils import (
RequestMetadata,
)
import pydantic
from typing import List, Optional
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -59,20 +62,12 @@ class BulkAssignKeysToGuardrailGlobals(BaseModel):
"""
class BulkAssignKeysToGuardrailRequestBodyTypedDict(TypedDict):
key_hashes: List[str]
r"""Array of API key hashes to assign to the guardrail"""
class BulkAssignKeysToGuardrailRequestBody(BaseModel):
key_hashes: List[str]
r"""Array of API key hashes to assign to the guardrail"""
class BulkAssignKeysToGuardrailRequestTypedDict(TypedDict):
id: str
r"""The unique identifier of the guardrail"""
request_body: BulkAssignKeysToGuardrailRequestBodyTypedDict
bulk_assign_keys_request: (
components_bulkassignkeysrequest.BulkAssignKeysRequestTypedDict
)
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.
@@ -94,8 +89,8 @@ class BulkAssignKeysToGuardrailRequest(BaseModel):
]
r"""The unique identifier of the guardrail"""
request_body: Annotated[
BulkAssignKeysToGuardrailRequestBody,
bulk_assign_keys_request: Annotated[
components_bulkassignkeysrequest.BulkAssignKeysRequest,
FieldMetadata(request=RequestMetadata(media_type="application/json")),
]
@@ -126,17 +121,3 @@ class BulkAssignKeysToGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class BulkAssignKeysToGuardrailResponseTypedDict(TypedDict):
r"""Assignment result"""
assigned_count: float
r"""Number of keys successfully assigned"""
class BulkAssignKeysToGuardrailResponse(BaseModel):
r"""Assignment result"""
assigned_count: float
r"""Number of keys successfully assigned"""
@@ -1,6 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import (
bulkassignmembersrequest as components_bulkassignmembersrequest,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
@@ -9,7 +12,7 @@ from openrouter.utils import (
RequestMetadata,
)
import pydantic
from typing import List, Optional
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -59,20 +62,12 @@ class BulkAssignMembersToGuardrailGlobals(BaseModel):
"""
class BulkAssignMembersToGuardrailRequestBodyTypedDict(TypedDict):
member_user_ids: List[str]
r"""Array of member user IDs to assign to the guardrail"""
class BulkAssignMembersToGuardrailRequestBody(BaseModel):
member_user_ids: List[str]
r"""Array of member user IDs to assign to the guardrail"""
class BulkAssignMembersToGuardrailRequestTypedDict(TypedDict):
id: str
r"""The unique identifier of the guardrail"""
request_body: BulkAssignMembersToGuardrailRequestBodyTypedDict
bulk_assign_members_request: (
components_bulkassignmembersrequest.BulkAssignMembersRequestTypedDict
)
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.
@@ -94,8 +89,8 @@ class BulkAssignMembersToGuardrailRequest(BaseModel):
]
r"""The unique identifier of the guardrail"""
request_body: Annotated[
BulkAssignMembersToGuardrailRequestBody,
bulk_assign_members_request: Annotated[
components_bulkassignmembersrequest.BulkAssignMembersRequest,
FieldMetadata(request=RequestMetadata(media_type="application/json")),
]
@@ -126,17 +121,3 @@ class BulkAssignMembersToGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class BulkAssignMembersToGuardrailResponseTypedDict(TypedDict):
r"""Assignment result"""
assigned_count: float
r"""Number of members successfully assigned"""
class BulkAssignMembersToGuardrailResponse(BaseModel):
r"""Assignment result"""
assigned_count: float
r"""Number of members successfully assigned"""
@@ -1,6 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import (
bulkunassignkeysrequest as components_bulkunassignkeysrequest,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
@@ -9,7 +12,7 @@ from openrouter.utils import (
RequestMetadata,
)
import pydantic
from typing import List, Optional
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -59,20 +62,12 @@ class BulkUnassignKeysFromGuardrailGlobals(BaseModel):
"""
class BulkUnassignKeysFromGuardrailRequestBodyTypedDict(TypedDict):
key_hashes: List[str]
r"""Array of API key hashes to unassign from the guardrail"""
class BulkUnassignKeysFromGuardrailRequestBody(BaseModel):
key_hashes: List[str]
r"""Array of API key hashes to unassign from the guardrail"""
class BulkUnassignKeysFromGuardrailRequestTypedDict(TypedDict):
id: str
r"""The unique identifier of the guardrail"""
request_body: BulkUnassignKeysFromGuardrailRequestBodyTypedDict
bulk_unassign_keys_request: (
components_bulkunassignkeysrequest.BulkUnassignKeysRequestTypedDict
)
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.
@@ -94,8 +89,8 @@ class BulkUnassignKeysFromGuardrailRequest(BaseModel):
]
r"""The unique identifier of the guardrail"""
request_body: Annotated[
BulkUnassignKeysFromGuardrailRequestBody,
bulk_unassign_keys_request: Annotated[
components_bulkunassignkeysrequest.BulkUnassignKeysRequest,
FieldMetadata(request=RequestMetadata(media_type="application/json")),
]
@@ -126,17 +121,3 @@ class BulkUnassignKeysFromGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class BulkUnassignKeysFromGuardrailResponseTypedDict(TypedDict):
r"""Unassignment result"""
unassigned_count: float
r"""Number of keys successfully unassigned"""
class BulkUnassignKeysFromGuardrailResponse(BaseModel):
r"""Unassignment result"""
unassigned_count: float
r"""Number of keys successfully unassigned"""
@@ -1,6 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import (
bulkunassignmembersrequest as components_bulkunassignmembersrequest,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
@@ -9,7 +12,7 @@ from openrouter.utils import (
RequestMetadata,
)
import pydantic
from typing import List, Optional
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -59,20 +62,12 @@ class BulkUnassignMembersFromGuardrailGlobals(BaseModel):
"""
class BulkUnassignMembersFromGuardrailRequestBodyTypedDict(TypedDict):
member_user_ids: List[str]
r"""Array of member user IDs to unassign from the guardrail"""
class BulkUnassignMembersFromGuardrailRequestBody(BaseModel):
member_user_ids: List[str]
r"""Array of member user IDs to unassign from the guardrail"""
class BulkUnassignMembersFromGuardrailRequestTypedDict(TypedDict):
id: str
r"""The unique identifier of the guardrail"""
request_body: BulkUnassignMembersFromGuardrailRequestBodyTypedDict
bulk_unassign_members_request: (
components_bulkunassignmembersrequest.BulkUnassignMembersRequestTypedDict
)
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.
@@ -94,8 +89,8 @@ class BulkUnassignMembersFromGuardrailRequest(BaseModel):
]
r"""The unique identifier of the guardrail"""
request_body: Annotated[
BulkUnassignMembersFromGuardrailRequestBody,
bulk_unassign_members_request: Annotated[
components_bulkunassignmembersrequest.BulkUnassignMembersRequest,
FieldMetadata(request=RequestMetadata(media_type="application/json")),
]
@@ -126,17 +121,3 @@ class BulkUnassignMembersFromGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class BulkUnassignMembersFromGuardrailResponseTypedDict(TypedDict):
r"""Unassignment result"""
unassigned_count: float
r"""Number of members successfully unassigned"""
class BulkUnassignMembersFromGuardrailResponse(BaseModel):
r"""Unassignment result"""
unassigned_count: float
r"""Number of members successfully unassigned"""
+13 -13
View File
@@ -97,12 +97,12 @@ class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict):
r"""PKCE code challenge for enhanced security"""
code_challenge_method: NotRequired[CreateAuthKeysCodeCodeChallengeMethod]
r"""The method used to generate the code challenge"""
limit: NotRequired[float]
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."""
limit: NotRequired[float]
r"""Credit limit for the API key to be created"""
usage_limit_type: NotRequired[UsageLimitType]
r"""Optional credit limit reset interval. When set, the credit limit resets on this interval."""
@@ -120,15 +120,15 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
] = None
r"""The method used to generate the code challenge"""
limit: Optional[float] = None
r"""Credit limit for the API key to be created"""
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."""
limit: Optional[float] = None
r"""Credit limit for the API key to be created"""
usage_limit_type: Annotated[
Optional[UsageLimitType], PlainValidator(validate_open_enum(False))
] = None
@@ -139,9 +139,9 @@ class CreateAuthKeysCodeRequestBody(BaseModel):
optional_fields = [
"code_challenge",
"code_challenge_method",
"limit",
"expires_at",
"key_label",
"limit",
"usage_limit_type",
]
nullable_fields = ["expires_at"]
@@ -227,26 +227,26 @@ class CreateAuthKeysCodeRequest(BaseModel):
class CreateAuthKeysCodeDataTypedDict(TypedDict):
r"""Auth code data"""
id: str
r"""The authorization code ID to use in the exchange request"""
app_id: float
app_id: int
r"""The application ID associated with this auth code"""
created_at: str
r"""ISO 8601 timestamp of when the auth code was created"""
id: str
r"""The authorization code ID to use in the exchange request"""
class CreateAuthKeysCodeData(BaseModel):
r"""Auth code data"""
id: str
r"""The authorization code ID to use in the exchange request"""
app_id: float
app_id: int
r"""The application ID associated with this auth code"""
created_at: str
r"""ISO 8601 timestamp of when the auth code was created"""
id: str
r"""The authorization code ID to use in the exchange request"""
class CreateAuthKeysCodeResponseTypedDict(TypedDict):
r"""Successfully created authorization code"""
+147 -55
View File
@@ -2,7 +2,14 @@
from __future__ import annotations
from openrouter.components import providerpreferences as components_providerpreferences
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
@@ -11,7 +18,7 @@ from openrouter.utils import (
validate_open_enum,
)
import pydantic
from pydantic import Discriminator, Tag
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -63,7 +70,14 @@ class CreateEmbeddingsGlobals(BaseModel):
"""
TypeImageURL = Literal["image_url",]
EncodingFormat = Union[
Literal[
"float",
"base64",
],
UnrecognizedStr,
]
r"""The format of the output embeddings"""
class ImageURLTypedDict(TypedDict):
@@ -74,30 +88,33 @@ class ImageURL(BaseModel):
url: str
TypeImageURL = Literal["image_url",]
class ContentImageURLTypedDict(TypedDict):
type: TypeImageURL
image_url: ImageURLTypedDict
type: TypeImageURL
class ContentImageURL(BaseModel):
type: TypeImageURL
image_url: ImageURL
type: TypeImageURL
TypeText = Literal["text",]
class ContentTextTypedDict(TypedDict):
type: TypeText
text: str
type: TypeText
class ContentText(BaseModel):
type: TypeText
text: str
type: TypeText
ContentTypedDict = TypeAliasType(
"ContentTypedDict", Union[ContentTextTypedDict, ContentImageURLTypedDict]
@@ -125,50 +142,97 @@ InputUnionTypedDict = TypeAliasType(
"InputUnionTypedDict",
Union[str, List[str], List[float], List[List[float]], List[InputTypedDict]],
)
r"""Text, token, or multimodal input(s) to embed"""
InputUnion = TypeAliasType(
"InputUnion", Union[str, List[str], List[float], List[List[float]], List[Input]]
)
EncodingFormat = Union[
Literal[
"float",
"base64",
],
UnrecognizedStr,
]
r"""Text, token, or multimodal input(s) to embed"""
class CreateEmbeddingsRequestBodyTypedDict(TypedDict):
r"""Embeddings request input"""
input: InputUnionTypedDict
r"""Text, token, or multimodal input(s) to embed"""
model: str
encoding_format: NotRequired[EncodingFormat]
r"""The model to use for embeddings"""
dimensions: NotRequired[int]
user: NotRequired[str]
provider: NotRequired[components_providerpreferences.ProviderPreferencesTypedDict]
r"""Provider routing preferences for the request."""
r"""The number of dimensions for the output embeddings"""
encoding_format: NotRequired[EncodingFormat]
r"""The format of the output embeddings"""
input_type: NotRequired[str]
r"""The type of input (e.g. search_query, search_document)"""
provider: NotRequired[
Nullable[components_providerpreferences.ProviderPreferencesTypedDict]
]
user: NotRequired[str]
r"""A unique identifier for the end-user"""
class CreateEmbeddingsRequestBody(BaseModel):
r"""Embeddings request input"""
input: InputUnion
r"""Text, token, or multimodal input(s) to embed"""
model: str
r"""The model to use for embeddings"""
dimensions: Optional[int] = None
r"""The number of dimensions for the output embeddings"""
encoding_format: Annotated[
Optional[EncodingFormat], PlainValidator(validate_open_enum(False))
] = None
dimensions: Optional[int] = None
user: Optional[str] = None
provider: Optional[components_providerpreferences.ProviderPreferences] = None
r"""Provider routing preferences for the request."""
r"""The format of the output embeddings"""
input_type: Optional[str] = None
r"""The type of input (e.g. search_query, search_document)"""
provider: OptionalNullable[components_providerpreferences.ProviderPreferences] = (
UNSET
)
user: Optional[str] = None
r"""A unique identifier for the end-user"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"dimensions",
"encoding_format",
"input_type",
"provider",
"user",
]
nullable_fields = ["provider"]
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 CreateEmbeddingsRequestTypedDict(TypedDict):
@@ -223,68 +287,96 @@ class CreateEmbeddingsRequest(BaseModel):
"""
Object = Literal["list",]
EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str])
r"""Embedding vector as an array of floats or a base64 string"""
Embedding = TypeAliasType("Embedding", Union[List[float], str])
r"""Embedding vector as an array of floats or a base64 string"""
ObjectEmbedding = Literal["embedding",]
EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str])
Embedding = TypeAliasType("Embedding", Union[List[float], str])
class CreateEmbeddingsDataTypedDict(TypedDict):
object: ObjectEmbedding
r"""A single embedding object"""
embedding: EmbeddingTypedDict
index: NotRequired[float]
r"""Embedding vector as an array of floats or a base64 string"""
object: ObjectEmbedding
index: NotRequired[int]
r"""Index of the embedding in the input list"""
class CreateEmbeddingsData(BaseModel):
object: ObjectEmbedding
r"""A single embedding object"""
embedding: Embedding
r"""Embedding vector as an array of floats or a base64 string"""
index: Optional[float] = None
object: ObjectEmbedding
index: Optional[int] = None
r"""Index of the embedding in the input list"""
class UsageTypedDict(TypedDict):
prompt_tokens: float
total_tokens: float
Object = Literal["list",]
class CreateEmbeddingsUsageTypedDict(TypedDict):
r"""Token usage statistics"""
prompt_tokens: int
r"""Number of tokens in the input"""
total_tokens: int
r"""Total number of tokens used"""
cost: NotRequired[float]
r"""Cost of the request in credits"""
class Usage(BaseModel):
prompt_tokens: float
class CreateEmbeddingsUsage(BaseModel):
r"""Token usage statistics"""
total_tokens: float
prompt_tokens: int
r"""Number of tokens in the input"""
total_tokens: int
r"""Total number of tokens used"""
cost: Optional[float] = None
r"""Cost of the request in credits"""
class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
r"""Embedding response"""
r"""Embeddings response containing embedding vectors"""
object: Object
data: List[CreateEmbeddingsDataTypedDict]
r"""List of embedding objects"""
model: str
r"""The model used for embeddings"""
object: Object
id: NotRequired[str]
usage: NotRequired[UsageTypedDict]
r"""Unique identifier for the embeddings response"""
usage: NotRequired[CreateEmbeddingsUsageTypedDict]
r"""Token usage statistics"""
class CreateEmbeddingsResponseBody(BaseModel):
r"""Embedding response"""
r"""Embeddings response containing embedding vectors"""
data: List[CreateEmbeddingsData]
r"""List of embedding objects"""
model: str
r"""The model used for embeddings"""
object: Object
data: List[CreateEmbeddingsData]
model: str
id: Optional[str] = None
r"""Unique identifier for the embeddings response"""
usage: Optional[Usage] = None
usage: Optional[CreateEmbeddingsUsage] = None
r"""Token usage statistics"""
CreateEmbeddingsResponseTypedDict = TypeAliasType(
+10 -264
View File
@@ -1,24 +1,13 @@
"""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 (
FieldMetadata,
HeaderMetadata,
RequestMetadata,
validate_open_enum,
from openrouter.components import (
createguardrailrequest as components_createguardrailrequest,
)
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -68,113 +57,10 @@ class CreateGuardrailGlobals(BaseModel):
"""
CreateGuardrailResetIntervalRequest = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
class CreateGuardrailRequestBodyTypedDict(TypedDict):
name: str
r"""Name for the new guardrail"""
description: NotRequired[Nullable[str]]
r"""Description of the guardrail"""
limit_usd: NotRequired[Nullable[float]]
r"""Spending limit in USD"""
reset_interval: NotRequired[Nullable[CreateGuardrailResetIntervalRequest]]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model identifiers (slug or canonical_slug accepted)"""
enforce_zdr: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention"""
class CreateGuardrailRequestBody(BaseModel):
name: str
r"""Name for the new guardrail"""
description: OptionalNullable[str] = UNSET
r"""Description of the guardrail"""
limit_usd: OptionalNullable[float] = UNSET
r"""Spending limit in USD"""
reset_interval: Annotated[
OptionalNullable[CreateGuardrailResetIntervalRequest],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model identifiers (slug or canonical_slug accepted)"""
enforce_zdr: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
nullable_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
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 CreateGuardrailRequestTypedDict(TypedDict):
request_body: CreateGuardrailRequestBodyTypedDict
create_guardrail_request: (
components_createguardrailrequest.CreateGuardrailRequestTypedDict
)
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.
@@ -191,8 +77,8 @@ class CreateGuardrailRequestTypedDict(TypedDict):
class CreateGuardrailRequest(BaseModel):
request_body: Annotated[
CreateGuardrailRequestBody,
create_guardrail_request: Annotated[
components_createguardrailrequest.CreateGuardrailRequest,
FieldMetadata(request=RequestMetadata(media_type="application/json")),
]
@@ -223,143 +109,3 @@ class CreateGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
CreateGuardrailResetIntervalResponse = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
class CreateGuardrailDataTypedDict(TypedDict):
r"""The created guardrail"""
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: NotRequired[Nullable[str]]
r"""Description of the guardrail"""
limit_usd: NotRequired[Nullable[float]]
r"""Spending limit in USD"""
reset_interval: NotRequired[Nullable[CreateGuardrailResetIntervalResponse]]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention"""
updated_at: NotRequired[Nullable[str]]
r"""ISO 8601 timestamp of when the guardrail was last updated"""
class CreateGuardrailData(BaseModel):
r"""The created guardrail"""
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: OptionalNullable[str] = UNSET
r"""Description of the guardrail"""
limit_usd: OptionalNullable[float] = UNSET
r"""Spending limit in USD"""
reset_interval: Annotated[
OptionalNullable[CreateGuardrailResetIntervalResponse],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention"""
updated_at: OptionalNullable[str] = UNSET
r"""ISO 8601 timestamp of when the guardrail was last updated"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
nullable_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
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 CreateGuardrailResponseTypedDict(TypedDict):
r"""Guardrail created successfully"""
data: CreateGuardrailDataTypedDict
r"""The created guardrail"""
class CreateGuardrailResponse(BaseModel):
r"""Guardrail created successfully"""
data: CreateGuardrailData
r"""The created guardrail"""
+76 -70
View File
@@ -83,20 +83,31 @@ r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no
class CreateKeysRequestBodyTypedDict(TypedDict):
name: str
r"""Name for the new API key"""
creator_user_id: NotRequired[Nullable[str]]
r"""Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific member is creating the key."""
expires_at: NotRequired[Nullable[datetime]]
r"""Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected"""
include_byok_in_limit: NotRequired[bool]
r"""Whether to include BYOK usage in the limit"""
limit: NotRequired[Nullable[float]]
r"""Optional spending limit for the API key in USD"""
limit_reset: NotRequired[Nullable[CreateKeysLimitReset]]
r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday."""
include_byok_in_limit: NotRequired[bool]
r"""Whether to include BYOK usage in the limit"""
expires_at: NotRequired[Nullable[datetime]]
r"""Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected"""
class CreateKeysRequestBody(BaseModel):
name: str
r"""Name for the new API key"""
creator_user_id: OptionalNullable[str] = UNSET
r"""Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific member is creating the key."""
expires_at: OptionalNullable[datetime] = UNSET
r"""Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected"""
include_byok_in_limit: Optional[bool] = None
r"""Whether to include BYOK usage in the limit"""
limit: OptionalNullable[float] = UNSET
r"""Optional spending limit for the API key in USD"""
@@ -106,21 +117,16 @@ class CreateKeysRequestBody(BaseModel):
] = UNSET
r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday."""
include_byok_in_limit: Optional[bool] = None
r"""Whether to include BYOK usage in the limit"""
expires_at: OptionalNullable[datetime] = UNSET
r"""Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"creator_user_id",
"expires_at",
"include_byok_in_limit",
"limit",
"limit_reset",
"include_byok_in_limit",
"expires_at",
]
nullable_fields = ["limit", "limit_reset", "expires_at"]
nullable_fields = ["creator_user_id", "expires_at", "limit", "limit_reset"]
null_default_fields = []
serialized = handler(self)
@@ -203,44 +209,44 @@ class CreateKeysRequest(BaseModel):
class CreateKeysDataTypedDict(TypedDict):
r"""The created API key information"""
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -248,18 +254,36 @@ class CreateKeysDataTypedDict(TypedDict):
class CreateKeysData(BaseModel):
r"""The created API key information"""
hash: str
r"""Unique hash identifier for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
name: str
r"""Name of the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
label: str
r"""Human-readable label for the API key"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
@@ -269,8 +293,11 @@ class CreateKeysData(BaseModel):
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
@@ -278,32 +305,11 @@ class CreateKeysData(BaseModel):
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -312,12 +318,12 @@ class CreateKeysData(BaseModel):
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"creator_user_id",
"expires_at",
"limit",
"limit_remaining",
"limit_reset",
"updated_at",
"expires_at",
"creator_user_id",
]
null_default_fields = []
+286
View File
@@ -0,0 +1,286 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import providerpreferences as components_providerpreferences
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
from pydantic import model_serializer
from typing import List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
class CreateRerankGlobalsTypedDict(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 CreateRerankGlobals(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 CreateRerankRequestBodyTypedDict(TypedDict):
r"""Rerank request input"""
documents: List[str]
r"""The list of documents to rerank"""
model: str
r"""The rerank model to use"""
query: str
r"""The search query to rerank documents against"""
provider: NotRequired[
Nullable[components_providerpreferences.ProviderPreferencesTypedDict]
]
top_n: NotRequired[int]
r"""Number of most relevant documents to return"""
class CreateRerankRequestBody(BaseModel):
r"""Rerank request input"""
documents: List[str]
r"""The list of documents to rerank"""
model: str
r"""The rerank model to use"""
query: str
r"""The search query to rerank documents against"""
provider: OptionalNullable[components_providerpreferences.ProviderPreferences] = (
UNSET
)
top_n: Optional[int] = None
r"""Number of most relevant documents to return"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["provider", "top_n"]
nullable_fields = ["provider"]
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 CreateRerankRequestTypedDict(TypedDict):
request_body: CreateRerankRequestBodyTypedDict
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 CreateRerankRequest(BaseModel):
request_body: Annotated[
CreateRerankRequestBody,
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.
"""
class DocumentTypedDict(TypedDict):
r"""The document object containing the original text"""
text: str
r"""The document text"""
class Document(BaseModel):
r"""The document object containing the original text"""
text: str
r"""The document text"""
class ResultTypedDict(TypedDict):
r"""A single rerank result"""
document: DocumentTypedDict
r"""The document object containing the original text"""
index: int
r"""Index of the document in the original input list"""
relevance_score: float
r"""Relevance score of the document to the query"""
class Result(BaseModel):
r"""A single rerank result"""
document: Document
r"""The document object containing the original text"""
index: int
r"""Index of the document in the original input list"""
relevance_score: float
r"""Relevance score of the document to the query"""
class CreateRerankUsageTypedDict(TypedDict):
r"""Usage statistics"""
cost: NotRequired[float]
r"""Cost of the request in credits"""
search_units: NotRequired[int]
r"""Number of search units consumed (Cohere billing)"""
total_tokens: NotRequired[int]
r"""Total number of tokens used"""
class CreateRerankUsage(BaseModel):
r"""Usage statistics"""
cost: Optional[float] = None
r"""Cost of the request in credits"""
search_units: Optional[int] = None
r"""Number of search units consumed (Cohere billing)"""
total_tokens: Optional[int] = None
r"""Total number of tokens used"""
class CreateRerankResponseBodyTypedDict(TypedDict):
r"""Rerank response containing ranked results"""
model: str
r"""The model used for reranking"""
results: List[ResultTypedDict]
r"""List of rerank results sorted by relevance"""
id: NotRequired[str]
r"""Unique identifier for the rerank response (ORID format)"""
provider: NotRequired[str]
r"""The provider that served the rerank request"""
usage: NotRequired[CreateRerankUsageTypedDict]
r"""Usage statistics"""
class CreateRerankResponseBody(BaseModel):
r"""Rerank response containing ranked results"""
model: str
r"""The model used for reranking"""
results: List[Result]
r"""List of rerank results sorted by relevance"""
id: Optional[str] = None
r"""Unique identifier for the rerank response (ORID format)"""
provider: Optional[str] = None
r"""The provider that served the rerank request"""
usage: Optional[CreateRerankUsage] = None
r"""Usage statistics"""
CreateRerankResponseTypedDict = TypeAliasType(
"CreateRerankResponseTypedDict", Union[CreateRerankResponseBodyTypedDict, str]
)
CreateRerankResponse = TypeAliasType(
"CreateRerankResponse", Union[CreateRerankResponseBody, str]
)
+111
View File
@@ -0,0 +1,111 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import (
videogenerationrequest as components_videogenerationrequest,
)
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class CreateVideosGlobalsTypedDict(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 CreateVideosGlobals(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 CreateVideosRequestTypedDict(TypedDict):
video_generation_request: (
components_videogenerationrequest.VideoGenerationRequestTypedDict
)
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 CreateVideosRequest(BaseModel):
video_generation_request: Annotated[
components_videogenerationrequest.VideoGenerationRequest,
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.
"""
+2 -25
View File
@@ -2,15 +2,9 @@
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
validate_const,
)
from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal, Optional
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -111,20 +105,3 @@ class DeleteGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class DeleteGuardrailResponseTypedDict(TypedDict):
r"""Guardrail deleted successfully"""
deleted: Literal[True]
r"""Confirmation that the guardrail was deleted"""
class DeleteGuardrailResponse(BaseModel):
r"""Guardrail deleted successfully"""
DELETED: Annotated[
Annotated[Literal[True], AfterValidator(validate_const(True))],
pydantic.Field(alias="deleted"),
] = True
r"""Confirmation that the guardrail was deleted"""
@@ -81,30 +81,30 @@ r"""The method used to generate the code challenge"""
class ExchangeAuthCodeForAPIKeyRequestBodyTypedDict(TypedDict):
code: str
r"""The authorization code received from the OAuth redirect"""
code_verifier: NotRequired[str]
r"""The code verifier if code_challenge was used in the authorization request"""
code_challenge_method: NotRequired[
Nullable[ExchangeAuthCodeForAPIKeyCodeChallengeMethod]
]
r"""The method used to generate the code challenge"""
code_verifier: NotRequired[str]
r"""The code verifier if code_challenge was used in the authorization request"""
class ExchangeAuthCodeForAPIKeyRequestBody(BaseModel):
code: str
r"""The authorization code received from the OAuth redirect"""
code_verifier: Optional[str] = None
r"""The code verifier if code_challenge was used in the authorization request"""
code_challenge_method: Annotated[
OptionalNullable[ExchangeAuthCodeForAPIKeyCodeChallengeMethod],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""The method used to generate the code challenge"""
code_verifier: Optional[str] = None
r"""The code verifier if code_challenge was used in the authorization request"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["code_verifier", "code_challenge_method"]
optional_fields = ["code_challenge_method", "code_verifier"]
nullable_fields = ["code_challenge_method"]
null_default_fields = []
+51 -51
View File
@@ -114,12 +114,12 @@ class GetCurrentKeyRequest(BaseModel):
class RateLimitTypedDict(TypedDict):
r"""Legacy rate limit information about a key. Will always return -1."""
requests: float
r"""Number of requests allowed per interval"""
interval: str
r"""Rate limit interval"""
note: str
r"""Note about the rate limit"""
requests: int
r"""Number of requests allowed per interval"""
@deprecated(
@@ -128,55 +128,55 @@ class RateLimitTypedDict(TypedDict):
class RateLimit(BaseModel):
r"""Legacy rate limit information about a key. Will always return -1."""
requests: float
r"""Number of requests allowed per interval"""
interval: str
r"""Rate limit interval"""
note: str
r"""Note about the rate limit"""
requests: int
r"""Number of requests allowed per interval"""
class GetCurrentKeyDataTypedDict(TypedDict):
r"""Current API key information"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
is_free_tier: bool
r"""Whether this is a free tier API key"""
is_management_key: bool
r"""Whether this is a management key"""
is_provisioning_key: bool
r"""Whether this is a management key"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
rate_limit: RateLimitTypedDict
r"""Legacy rate limit information about a key. Will always return -1."""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -184,35 +184,23 @@ class GetCurrentKeyDataTypedDict(TypedDict):
class GetCurrentKeyData(BaseModel):
r"""Current API key information"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
is_free_tier: bool
r"""Whether this is a free tier API key"""
@@ -228,18 +216,18 @@ class GetCurrentKeyData(BaseModel):
]
r"""Whether this is a management key"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
rate_limit: Annotated[
RateLimit,
pydantic.Field(
@@ -248,6 +236,18 @@ class GetCurrentKeyData(BaseModel):
]
r"""Legacy rate limit information about a key. Will always return -1."""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -255,11 +255,11 @@ class GetCurrentKeyData(BaseModel):
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"creator_user_id",
"expires_at",
"limit",
"limit_remaining",
"limit_reset",
"expires_at",
"creator_user_id",
]
null_default_fields = []
+167 -318
View File
@@ -1,7 +1,15 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.components import providerresponse as components_providerresponse
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
@@ -63,6 +71,7 @@ class GetGenerationGlobals(BaseModel):
class GetGenerationRequestTypedDict(TypedDict):
id: str
r"""The generation ID"""
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.
@@ -82,6 +91,7 @@ class GetGenerationRequest(BaseModel):
id: Annotated[
str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
]
r"""The generation ID"""
http_referer: Annotated[
Optional[str],
@@ -116,6 +126,7 @@ APIType = Union[
Literal[
"completions",
"embeddings",
"rerank",
"video",
],
UnrecognizedStr,
@@ -123,403 +134,241 @@ APIType = Union[
r"""Type of API used for the generation"""
ProviderName = Union[
Literal[
"AnyScale",
"Atoma",
"Cent-ML",
"CrofAI",
"Enfer",
"GoPomelo",
"HuggingFace",
"Hyperbolic 2",
"InoCloud",
"Kluster",
"Lambda",
"Lepton",
"Lynn 2",
"Lynn",
"Mancer",
"Meta",
"Modal",
"Nineteen",
"OctoAI",
"Recursal",
"Reflection",
"Replicate",
"SambaNova 2",
"SF Compute",
"Targon",
"Together 2",
"Ubicloud",
"01.AI",
"AkashML",
"AI21",
"AionLabs",
"Alibaba",
"Ambient",
"Amazon Bedrock",
"Amazon Nova",
"Anthropic",
"Arcee AI",
"AtlasCloud",
"Avian",
"Azure",
"BaseTen",
"BytePlus",
"Black Forest Labs",
"Cerebras",
"Chutes",
"Cirrascale",
"Clarifai",
"Cloudflare",
"Cohere",
"Crusoe",
"DeepInfra",
"DeepSeek",
"Featherless",
"Fireworks",
"Friendli",
"GMICloud",
"Google",
"Google AI Studio",
"Groq",
"Hyperbolic",
"Inception",
"Inceptron",
"InferenceNet",
"Ionstream",
"Infermatic",
"Io Net",
"Inflection",
"Liquid",
"Mara",
"Mancer 2",
"Minimax",
"ModelRun",
"Mistral",
"Modular",
"Moonshot AI",
"Morph",
"NCompass",
"Nebius",
"NextBit",
"Novita",
"Nvidia",
"OpenAI",
"OpenInference",
"Parasail",
"Perplexity",
"Phala",
"Reka",
"Relace",
"SambaNova",
"Seed",
"SiliconFlow",
"Sourceful",
"StepFun",
"Stealth",
"StreamLake",
"Switchpoint",
"Together",
"Upstage",
"Venice",
"WandB",
"Xiaomi",
"xAI",
"Z.AI",
"FakeProvider",
],
UnrecognizedStr,
]
class ProviderResponseTypedDict(TypedDict):
status: Nullable[float]
id: NotRequired[str]
endpoint_id: NotRequired[str]
model_permaslug: NotRequired[str]
provider_name: NotRequired[ProviderName]
latency: NotRequired[float]
is_byok: NotRequired[bool]
class ProviderResponse(BaseModel):
status: Nullable[float]
id: Optional[str] = None
endpoint_id: Optional[str] = None
model_permaslug: Optional[str] = None
provider_name: Annotated[
Optional[ProviderName], PlainValidator(validate_open_enum(False))
] = None
latency: Optional[float] = None
is_byok: Optional[bool] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"id",
"endpoint_id",
"model_permaslug",
"provider_name",
"latency",
"is_byok",
]
nullable_fields = ["status"]
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 GetGenerationDataTypedDict(TypedDict):
r"""Generation data"""
id: str
r"""Unique identifier for the generation"""
upstream_id: Nullable[str]
r"""Upstream provider's identifier for this generation"""
total_cost: float
r"""Total cost of the generation in USD"""
api_type: Nullable[APIType]
r"""Type of API used for the generation"""
app_id: Nullable[int]
r"""ID of the app that made the request"""
cache_discount: Nullable[float]
r"""Discount applied due to caching"""
upstream_inference_cost: Nullable[float]
r"""Cost charged by the upstream provider"""
created_at: str
r"""ISO 8601 timestamp of when the generation was created"""
model: str
r"""Model used for the generation"""
app_id: Nullable[float]
r"""ID of the app that made the request"""
streamed: Nullable[bool]
r"""Whether the response was streamed"""
cancelled: Nullable[bool]
r"""Whether the generation was cancelled"""
provider_name: Nullable[str]
r"""Name of the provider that served the request"""
latency: Nullable[float]
r"""Total latency in milliseconds"""
moderation_latency: Nullable[float]
r"""Moderation latency in milliseconds"""
generation_time: Nullable[float]
r"""Time taken for generation in milliseconds"""
created_at: str
r"""ISO 8601 timestamp of when the generation was created"""
external_user: Nullable[str]
r"""External user identifier"""
finish_reason: Nullable[str]
r"""Reason the generation finished"""
tokens_prompt: Nullable[float]
r"""Number of tokens in the prompt"""
tokens_completion: Nullable[float]
r"""Number of tokens in the completion"""
native_tokens_prompt: Nullable[float]
r"""Native prompt tokens as reported by provider"""
native_tokens_completion: Nullable[float]
r"""Native completion tokens as reported by provider"""
native_tokens_completion_images: Nullable[float]
r"""Native completion image tokens as reported by provider"""
native_tokens_reasoning: Nullable[float]
r"""Native reasoning tokens as reported by provider"""
native_tokens_cached: Nullable[float]
generation_time: Nullable[float]
r"""Time taken for generation in milliseconds"""
http_referer: Nullable[str]
r"""Referer header from the request"""
id: str
r"""Unique identifier for the generation"""
is_byok: bool
r"""Whether this used bring-your-own-key"""
latency: Nullable[float]
r"""Total latency in milliseconds"""
model: str
r"""Model used for the generation"""
moderation_latency: Nullable[float]
r"""Moderation latency in milliseconds"""
native_finish_reason: Nullable[str]
r"""Native finish reason as reported by provider"""
native_tokens_cached: Nullable[int]
r"""Native cached tokens as reported by provider"""
num_media_prompt: Nullable[float]
r"""Number of media items in the prompt"""
num_input_audio_prompt: Nullable[float]
native_tokens_completion: Nullable[int]
r"""Native completion tokens as reported by provider"""
native_tokens_completion_images: Nullable[int]
r"""Native completion image tokens as reported by provider"""
native_tokens_prompt: Nullable[int]
r"""Native prompt tokens as reported by provider"""
native_tokens_reasoning: Nullable[int]
r"""Native reasoning tokens as reported by provider"""
num_input_audio_prompt: Nullable[int]
r"""Number of audio inputs in the prompt"""
num_media_completion: Nullable[float]
num_media_completion: Nullable[int]
r"""Number of media items in the completion"""
num_search_results: Nullable[float]
num_media_prompt: Nullable[int]
r"""Number of media items in the prompt"""
num_search_results: Nullable[int]
r"""Number of search results included"""
origin: str
r"""Origin URL of the request"""
usage: float
r"""Usage amount in USD"""
is_byok: bool
r"""Whether this used bring-your-own-key"""
native_finish_reason: Nullable[str]
r"""Native finish reason as reported by provider"""
external_user: Nullable[str]
r"""External user identifier"""
api_type: Nullable[APIType]
r"""Type of API used for the generation"""
provider_name: Nullable[str]
r"""Name of the provider that served the request"""
provider_responses: Nullable[
List[components_providerresponse.ProviderResponseTypedDict]
]
r"""List of provider responses for this generation, including fallback attempts"""
router: Nullable[str]
r"""Router used for the request (e.g., openrouter/auto)"""
provider_responses: Nullable[List[ProviderResponseTypedDict]]
r"""List of provider responses for this generation, including fallback attempts"""
streamed: Nullable[bool]
r"""Whether the response was streamed"""
tokens_completion: Nullable[int]
r"""Number of tokens in the completion"""
tokens_prompt: Nullable[int]
r"""Number of tokens in the prompt"""
total_cost: float
r"""Total cost of the generation in USD"""
upstream_id: Nullable[str]
r"""Upstream provider's identifier for this generation"""
upstream_inference_cost: Nullable[float]
r"""Cost charged by the upstream provider"""
usage: float
r"""Usage amount in USD"""
user_agent: Nullable[str]
r"""User-Agent header from the request"""
http_referer: Nullable[str]
r"""Referer header from the request"""
request_id: NotRequired[Nullable[str]]
r"""Unique identifier grouping all generations from a single API request"""
session_id: NotRequired[Nullable[str]]
r"""Session identifier grouping multiple generations in the same session"""
class GetGenerationData(BaseModel):
r"""Generation data"""
id: str
r"""Unique identifier for the generation"""
api_type: Annotated[Nullable[APIType], PlainValidator(validate_open_enum(False))]
r"""Type of API used for the generation"""
upstream_id: Nullable[str]
r"""Upstream provider's identifier for this generation"""
total_cost: float
r"""Total cost of the generation in USD"""
app_id: Nullable[int]
r"""ID of the app that made the request"""
cache_discount: Nullable[float]
r"""Discount applied due to caching"""
upstream_inference_cost: Nullable[float]
r"""Cost charged by the upstream provider"""
cancelled: Nullable[bool]
r"""Whether the generation was cancelled"""
created_at: str
r"""ISO 8601 timestamp of when the generation was created"""
model: str
r"""Model used for the generation"""
app_id: Nullable[float]
r"""ID of the app that made the request"""
streamed: Nullable[bool]
r"""Whether the response was streamed"""
cancelled: Nullable[bool]
r"""Whether the generation was cancelled"""
provider_name: Nullable[str]
r"""Name of the provider that served the request"""
latency: Nullable[float]
r"""Total latency in milliseconds"""
moderation_latency: Nullable[float]
r"""Moderation latency in milliseconds"""
generation_time: Nullable[float]
r"""Time taken for generation in milliseconds"""
external_user: Nullable[str]
r"""External user identifier"""
finish_reason: Nullable[str]
r"""Reason the generation finished"""
tokens_prompt: Nullable[float]
r"""Number of tokens in the prompt"""
generation_time: Nullable[float]
r"""Time taken for generation in milliseconds"""
tokens_completion: Nullable[float]
r"""Number of tokens in the completion"""
http_referer: Nullable[str]
r"""Referer header from the request"""
native_tokens_prompt: Nullable[float]
r"""Native prompt tokens as reported by provider"""
id: str
r"""Unique identifier for the generation"""
native_tokens_completion: Nullable[float]
r"""Native completion tokens as reported by provider"""
is_byok: bool
r"""Whether this used bring-your-own-key"""
native_tokens_completion_images: Nullable[float]
r"""Native completion image tokens as reported by provider"""
latency: Nullable[float]
r"""Total latency in milliseconds"""
native_tokens_reasoning: Nullable[float]
r"""Native reasoning tokens as reported by provider"""
model: str
r"""Model used for the generation"""
native_tokens_cached: Nullable[float]
moderation_latency: Nullable[float]
r"""Moderation latency in milliseconds"""
native_finish_reason: Nullable[str]
r"""Native finish reason as reported by provider"""
native_tokens_cached: Nullable[int]
r"""Native cached tokens as reported by provider"""
num_media_prompt: Nullable[float]
r"""Number of media items in the prompt"""
native_tokens_completion: Nullable[int]
r"""Native completion tokens as reported by provider"""
num_input_audio_prompt: Nullable[float]
native_tokens_completion_images: Nullable[int]
r"""Native completion image tokens as reported by provider"""
native_tokens_prompt: Nullable[int]
r"""Native prompt tokens as reported by provider"""
native_tokens_reasoning: Nullable[int]
r"""Native reasoning tokens as reported by provider"""
num_input_audio_prompt: Nullable[int]
r"""Number of audio inputs in the prompt"""
num_media_completion: Nullable[float]
num_media_completion: Nullable[int]
r"""Number of media items in the completion"""
num_search_results: Nullable[float]
num_media_prompt: Nullable[int]
r"""Number of media items in the prompt"""
num_search_results: Nullable[int]
r"""Number of search results included"""
origin: str
r"""Origin URL of the request"""
usage: float
r"""Usage amount in USD"""
provider_name: Nullable[str]
r"""Name of the provider that served the request"""
is_byok: bool
r"""Whether this used bring-your-own-key"""
native_finish_reason: Nullable[str]
r"""Native finish reason as reported by provider"""
external_user: Nullable[str]
r"""External user identifier"""
api_type: Annotated[Nullable[APIType], PlainValidator(validate_open_enum(False))]
r"""Type of API used for the generation"""
provider_responses: Nullable[List[components_providerresponse.ProviderResponse]]
r"""List of provider responses for this generation, including fallback attempts"""
router: Nullable[str]
r"""Router used for the request (e.g., openrouter/auto)"""
provider_responses: Nullable[List[ProviderResponse]]
r"""List of provider responses for this generation, including fallback attempts"""
streamed: Nullable[bool]
r"""Whether the response was streamed"""
tokens_completion: Nullable[int]
r"""Number of tokens in the completion"""
tokens_prompt: Nullable[int]
r"""Number of tokens in the prompt"""
total_cost: float
r"""Total cost of the generation in USD"""
upstream_id: Nullable[str]
r"""Upstream provider's identifier for this generation"""
upstream_inference_cost: Nullable[float]
r"""Cost charged by the upstream provider"""
usage: float
r"""Usage amount in USD"""
user_agent: Nullable[str]
r"""User-Agent header from the request"""
http_referer: Nullable[str]
r"""Referer header from the request"""
request_id: OptionalNullable[str] = UNSET
r"""Unique identifier grouping all generations from a single API request"""
session_id: OptionalNullable[str] = UNSET
r"""Session identifier grouping multiple generations in the same session"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
optional_fields = ["request_id", "session_id"]
nullable_fields = [
"upstream_id",
"cache_discount",
"upstream_inference_cost",
"api_type",
"app_id",
"streamed",
"cache_discount",
"cancelled",
"provider_name",
"external_user",
"finish_reason",
"generation_time",
"http_referer",
"latency",
"moderation_latency",
"generation_time",
"finish_reason",
"tokens_prompt",
"tokens_completion",
"native_tokens_prompt",
"native_finish_reason",
"native_tokens_cached",
"native_tokens_completion",
"native_tokens_completion_images",
"native_tokens_prompt",
"native_tokens_reasoning",
"native_tokens_cached",
"num_media_prompt",
"num_input_audio_prompt",
"num_media_completion",
"num_media_prompt",
"num_search_results",
"native_finish_reason",
"external_user",
"api_type",
"router",
"provider_name",
"provider_responses",
"request_id",
"router",
"session_id",
"streamed",
"tokens_completion",
"tokens_prompt",
"upstream_id",
"upstream_inference_cost",
"user_agent",
"http_referer",
]
null_default_fields = []
+3 -157
View File
@@ -1,24 +1,10 @@
"""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 (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
validate_open_enum,
)
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -119,143 +105,3 @@ class GetGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
GetGuardrailResetInterval = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
class GetGuardrailDataTypedDict(TypedDict):
r"""The guardrail"""
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: NotRequired[Nullable[str]]
r"""Description of the guardrail"""
limit_usd: NotRequired[Nullable[float]]
r"""Spending limit in USD"""
reset_interval: NotRequired[Nullable[GetGuardrailResetInterval]]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention"""
updated_at: NotRequired[Nullable[str]]
r"""ISO 8601 timestamp of when the guardrail was last updated"""
class GetGuardrailData(BaseModel):
r"""The guardrail"""
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: OptionalNullable[str] = UNSET
r"""Description of the guardrail"""
limit_usd: OptionalNullable[float] = UNSET
r"""Spending limit in USD"""
reset_interval: Annotated[
OptionalNullable[GetGuardrailResetInterval],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention"""
updated_at: OptionalNullable[str] = UNSET
r"""ISO 8601 timestamp of when the guardrail was last updated"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
nullable_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
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 GetGuardrailResponseTypedDict(TypedDict):
r"""Guardrail details"""
data: GetGuardrailDataTypedDict
r"""The guardrail"""
class GetGuardrailResponse(BaseModel):
r"""Guardrail details"""
data: GetGuardrailData
r"""The guardrail"""
+57 -57
View File
@@ -118,44 +118,44 @@ class GetKeyRequest(BaseModel):
class GetKeyDataTypedDict(TypedDict):
r"""The API key information"""
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -163,18 +163,36 @@ class GetKeyDataTypedDict(TypedDict):
class GetKeyData(BaseModel):
r"""The API key information"""
hash: str
r"""Unique hash identifier for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
name: str
r"""Name of the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
label: str
r"""Human-readable label for the API key"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
@@ -184,8 +202,11 @@ class GetKeyData(BaseModel):
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
@@ -193,32 +214,11 @@ class GetKeyData(BaseModel):
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -227,12 +227,12 @@ class GetKeyData(BaseModel):
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"creator_user_id",
"expires_at",
"limit",
"limit_remaining",
"limit_reset",
"updated_at",
"expires_at",
"creator_user_id",
]
null_default_fields = []
+2
View File
@@ -97,6 +97,7 @@ class GetModelsRequestTypedDict(TypedDict):
category: NotRequired[Category]
r"""Filter models by use case category"""
supported_parameters: NotRequired[str]
r"""Filter models by supported parameter (comma-separated)"""
output_modalities: NotRequired[str]
r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\"."""
@@ -140,6 +141,7 @@ class GetModelsRequest(BaseModel):
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter models by supported parameter (comma-separated)"""
output_modalities: Annotated[
Optional[str],
+15 -14
View File
@@ -1,11 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.components import activityitem as components_activityitem
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from typing import List, Optional
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -71,6 +70,10 @@ class GetUserActivityRequestTypedDict(TypedDict):
"""
date_: NotRequired[str]
r"""Filter by a single UTC date in the last 30 days (YYYY-MM-DD format)."""
api_key_hash: NotRequired[str]
r"""Filter by API key hash (SHA-256 hex string, as returned by the keys API)."""
user_id: NotRequired[str]
r"""Filter by org member user ID. Only applicable for organization accounts."""
class GetUserActivityRequest(BaseModel):
@@ -109,16 +112,14 @@ class GetUserActivityRequest(BaseModel):
] = None
r"""Filter by a single UTC date in the last 30 days (YYYY-MM-DD format)."""
api_key_hash: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter by API key hash (SHA-256 hex string, as returned by the keys API)."""
class GetUserActivityResponseTypedDict(TypedDict):
r"""Returns user activity data grouped by endpoint"""
data: List[components_activityitem.ActivityItemTypedDict]
r"""List of activity items"""
class GetUserActivityResponse(BaseModel):
r"""Returns user activity data grouped by endpoint"""
data: List[components_activityitem.ActivityItem]
r"""List of activity items"""
user_id: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter by org member user ID. Only applicable for organization accounts."""
+107
View File
@@ -0,0 +1,107 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class GetVideosGlobalsTypedDict(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 GetVideosGlobals(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 GetVideosRequestTypedDict(TypedDict):
job_id: str
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 GetVideosRequest(BaseModel):
job_id: Annotated[
str,
pydantic.Field(alias="jobId"),
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
]
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.
"""
+61 -61
View File
@@ -76,9 +76,9 @@ class ListRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
include_disabled: NotRequired[str]
include_disabled: NotRequired[bool]
r"""Whether to include disabled API keys in the response"""
offset: NotRequired[str]
offset: NotRequired[int]
r"""Number of API keys to skip for pagination"""
@@ -112,74 +112,92 @@ class ListRequest(BaseModel):
"""
include_disabled: Annotated[
Optional[str],
Optional[bool],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Whether to include disabled API keys in the response"""
offset: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of API keys to skip for pagination"""
class ListDataTypedDict(TypedDict):
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
class ListData(BaseModel):
hash: str
r"""Unique hash identifier for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
name: str
r"""Name of the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
label: str
r"""Human-readable label for the API key"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
@@ -189,8 +207,11 @@ class ListData(BaseModel):
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
@@ -198,32 +219,11 @@ class ListData(BaseModel):
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -232,12 +232,12 @@ class ListData(BaseModel):
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"creator_user_id",
"expires_at",
"limit",
"limit_remaining",
"limit_reset",
"updated_at",
"expires_at",
"creator_user_id",
]
null_default_fields = []
@@ -59,7 +59,9 @@ class ListEndpointsGlobals(BaseModel):
class ListEndpointsRequestTypedDict(TypedDict):
author: str
r"""The author/organization of the model"""
slug: str
r"""The model slug"""
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.
@@ -79,10 +81,12 @@ class ListEndpointsRequest(BaseModel):
author: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The author/organization of the model"""
slug: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""The model slug"""
http_referer: Annotated[
Optional[str],
@@ -1,7 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from openrouter.components import (
listkeyassignmentsresponse as components_listkeyassignmentsresponse,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
@@ -9,8 +12,7 @@ from openrouter.utils import (
QueryParamMetadata,
)
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing import Awaitable, Callable, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -76,9 +78,9 @@ class ListGuardrailKeyAssignmentsRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
offset: NotRequired[str]
offset: NotRequired[int]
r"""Number of records to skip for pagination"""
limit: NotRequired[str]
limit: NotRequired[int]
r"""Maximum number of records to return (max 100)"""
@@ -117,102 +119,26 @@ class ListGuardrailKeyAssignmentsRequest(BaseModel):
"""
offset: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of records to skip for pagination"""
limit: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Maximum number of records to return (max 100)"""
class ListGuardrailKeyAssignmentsDataTypedDict(TypedDict):
id: str
r"""Unique identifier for the assignment"""
key_hash: str
r"""Hash of the assigned API key"""
guardrail_id: str
r"""ID of the guardrail"""
key_name: str
r"""Name of the API key"""
key_label: str
r"""Label of the API key"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
class ListGuardrailKeyAssignmentsData(BaseModel):
id: str
r"""Unique identifier for the assignment"""
key_hash: str
r"""Hash of the assigned API key"""
guardrail_id: str
r"""ID of the guardrail"""
key_name: str
r"""Name of the API key"""
key_label: str
r"""Label of the API key"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["assigned_by"]
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 ListGuardrailKeyAssignmentsResponseTypedDict(TypedDict):
r"""List of key assignments"""
data: List[ListGuardrailKeyAssignmentsDataTypedDict]
r"""List of key assignments"""
total_count: float
r"""Total number of key assignments for this guardrail"""
result: components_listkeyassignmentsresponse.ListKeyAssignmentsResponseTypedDict
class ListGuardrailKeyAssignmentsResponse(BaseModel):
r"""List of key assignments"""
next: Union[
Callable[[], Optional[ListGuardrailKeyAssignmentsResponse]],
Callable[[], Awaitable[Optional[ListGuardrailKeyAssignmentsResponse]]],
]
data: List[ListGuardrailKeyAssignmentsData]
r"""List of key assignments"""
total_count: float
r"""Total number of key assignments for this guardrail"""
result: components_listkeyassignmentsresponse.ListKeyAssignmentsResponse
@@ -1,7 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from openrouter.components import (
listmemberassignmentsresponse as components_listmemberassignmentsresponse,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
@@ -9,8 +12,7 @@ from openrouter.utils import (
QueryParamMetadata,
)
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing import Awaitable, Callable, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -76,9 +78,9 @@ class ListGuardrailMemberAssignmentsRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
offset: NotRequired[str]
offset: NotRequired[int]
r"""Number of records to skip for pagination"""
limit: NotRequired[str]
limit: NotRequired[int]
r"""Maximum number of records to return (max 100)"""
@@ -117,97 +119,28 @@ class ListGuardrailMemberAssignmentsRequest(BaseModel):
"""
offset: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of records to skip for pagination"""
limit: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Maximum number of records to return (max 100)"""
class ListGuardrailMemberAssignmentsDataTypedDict(TypedDict):
id: str
r"""Unique identifier for the assignment"""
user_id: str
r"""Clerk user ID of the assigned member"""
organization_id: str
r"""Organization ID"""
guardrail_id: str
r"""ID of the guardrail"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
class ListGuardrailMemberAssignmentsData(BaseModel):
id: str
r"""Unique identifier for the assignment"""
user_id: str
r"""Clerk user ID of the assigned member"""
organization_id: str
r"""Organization ID"""
guardrail_id: str
r"""ID of the guardrail"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["assigned_by"]
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 ListGuardrailMemberAssignmentsResponseTypedDict(TypedDict):
r"""List of member assignments"""
data: List[ListGuardrailMemberAssignmentsDataTypedDict]
r"""List of member assignments"""
total_count: float
r"""Total number of member assignments"""
result: (
components_listmemberassignmentsresponse.ListMemberAssignmentsResponseTypedDict
)
class ListGuardrailMemberAssignmentsResponse(BaseModel):
r"""List of member assignments"""
next: Union[
Callable[[], Optional[ListGuardrailMemberAssignmentsResponse]],
Callable[[], Awaitable[Optional[ListGuardrailMemberAssignmentsResponse]]],
]
data: List[ListGuardrailMemberAssignmentsData]
r"""List of member assignments"""
total_count: float
r"""Total number of member assignments"""
result: components_listmemberassignmentsresponse.ListMemberAssignmentsResponse
+15 -154
View File
@@ -1,24 +1,13 @@
"""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 (
FieldMetadata,
HeaderMetadata,
QueryParamMetadata,
validate_open_enum,
from openrouter.components import (
listguardrailsresponse as components_listguardrailsresponse,
)
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing import Awaitable, Callable, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -82,9 +71,9 @@ class ListGuardrailsRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
offset: NotRequired[str]
offset: NotRequired[int]
r"""Number of records to skip for pagination"""
limit: NotRequired[str]
limit: NotRequired[int]
r"""Maximum number of records to return (max 100)"""
@@ -118,154 +107,26 @@ class ListGuardrailsRequest(BaseModel):
"""
offset: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of records to skip for pagination"""
limit: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Maximum number of records to return (max 100)"""
ListGuardrailsResetInterval = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
class ListGuardrailsDataTypedDict(TypedDict):
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: NotRequired[Nullable[str]]
r"""Description of the guardrail"""
limit_usd: NotRequired[Nullable[float]]
r"""Spending limit in USD"""
reset_interval: NotRequired[Nullable[ListGuardrailsResetInterval]]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention"""
updated_at: NotRequired[Nullable[str]]
r"""ISO 8601 timestamp of when the guardrail was last updated"""
class ListGuardrailsData(BaseModel):
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: OptionalNullable[str] = UNSET
r"""Description of the guardrail"""
limit_usd: OptionalNullable[float] = UNSET
r"""Spending limit in USD"""
reset_interval: Annotated[
OptionalNullable[ListGuardrailsResetInterval],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention"""
updated_at: OptionalNullable[str] = UNSET
r"""ISO 8601 timestamp of when the guardrail was last updated"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
nullable_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
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 ListGuardrailsResponseTypedDict(TypedDict):
r"""List of guardrails"""
data: List[ListGuardrailsDataTypedDict]
r"""List of guardrails"""
total_count: float
r"""Total number of guardrails"""
result: components_listguardrailsresponse.ListGuardrailsResponseTypedDict
class ListGuardrailsResponse(BaseModel):
r"""List of guardrails"""
next: Union[
Callable[[], Optional[ListGuardrailsResponse]],
Callable[[], Awaitable[Optional[ListGuardrailsResponse]]],
]
data: List[ListGuardrailsData]
r"""List of guardrails"""
total_count: float
r"""Total number of guardrails"""
result: components_listguardrailsresponse.ListGuardrailsResponse
+15 -89
View File
@@ -1,11 +1,13 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from openrouter.components import (
listkeyassignmentsresponse as components_listkeyassignmentsresponse,
)
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing import Awaitable, Callable, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -69,9 +71,9 @@ class ListKeyAssignmentsRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
offset: NotRequired[str]
offset: NotRequired[int]
r"""Number of records to skip for pagination"""
limit: NotRequired[str]
limit: NotRequired[int]
r"""Maximum number of records to return (max 100)"""
@@ -105,102 +107,26 @@ class ListKeyAssignmentsRequest(BaseModel):
"""
offset: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of records to skip for pagination"""
limit: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Maximum number of records to return (max 100)"""
class ListKeyAssignmentsDataTypedDict(TypedDict):
id: str
r"""Unique identifier for the assignment"""
key_hash: str
r"""Hash of the assigned API key"""
guardrail_id: str
r"""ID of the guardrail"""
key_name: str
r"""Name of the API key"""
key_label: str
r"""Label of the API key"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
class ListKeyAssignmentsData(BaseModel):
id: str
r"""Unique identifier for the assignment"""
key_hash: str
r"""Hash of the assigned API key"""
guardrail_id: str
r"""ID of the guardrail"""
key_name: str
r"""Name of the API key"""
key_label: str
r"""Label of the API key"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["assigned_by"]
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 ListKeyAssignmentsResponseTypedDict(TypedDict):
r"""List of key assignments"""
data: List[ListKeyAssignmentsDataTypedDict]
r"""List of key assignments"""
total_count: float
r"""Total number of key assignments for this guardrail"""
result: components_listkeyassignmentsresponse.ListKeyAssignmentsResponseTypedDict
class ListKeyAssignmentsResponse(BaseModel):
r"""List of key assignments"""
next: Union[
Callable[[], Optional[ListKeyAssignmentsResponse]],
Callable[[], Awaitable[Optional[ListKeyAssignmentsResponse]]],
]
data: List[ListKeyAssignmentsData]
r"""List of key assignments"""
total_count: float
r"""Total number of key assignments for this guardrail"""
result: components_listkeyassignmentsresponse.ListKeyAssignmentsResponse
@@ -1,11 +1,13 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from openrouter.components import (
listmemberassignmentsresponse as components_listmemberassignmentsresponse,
)
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing import Awaitable, Callable, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -69,9 +71,9 @@ class ListMemberAssignmentsRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
offset: NotRequired[str]
offset: NotRequired[int]
r"""Number of records to skip for pagination"""
limit: NotRequired[str]
limit: NotRequired[int]
r"""Maximum number of records to return (max 100)"""
@@ -105,97 +107,28 @@ class ListMemberAssignmentsRequest(BaseModel):
"""
offset: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of records to skip for pagination"""
limit: Annotated[
Optional[str],
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Maximum number of records to return (max 100)"""
class ListMemberAssignmentsDataTypedDict(TypedDict):
id: str
r"""Unique identifier for the assignment"""
user_id: str
r"""Clerk user ID of the assigned member"""
organization_id: str
r"""Organization ID"""
guardrail_id: str
r"""ID of the guardrail"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
class ListMemberAssignmentsData(BaseModel):
id: str
r"""Unique identifier for the assignment"""
user_id: str
r"""Clerk user ID of the assigned member"""
organization_id: str
r"""Organization ID"""
guardrail_id: str
r"""ID of the guardrail"""
assigned_by: Nullable[str]
r"""User ID of who made the assignment"""
created_at: str
r"""ISO 8601 timestamp of when the assignment was created"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["assigned_by"]
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 ListMemberAssignmentsResponseTypedDict(TypedDict):
r"""List of member assignments"""
data: List[ListMemberAssignmentsDataTypedDict]
r"""List of member assignments"""
total_count: float
r"""Total number of member assignments"""
result: (
components_listmemberassignmentsresponse.ListMemberAssignmentsResponseTypedDict
)
class ListMemberAssignmentsResponse(BaseModel):
r"""List of member assignments"""
next: Union[
Callable[[], Optional[ListMemberAssignmentsResponse]],
Callable[[], Awaitable[Optional[ListMemberAssignmentsResponse]]],
]
data: List[ListMemberAssignmentsData]
r"""List of member assignments"""
total_count: float
r"""Total number of member assignments"""
result: components_listmemberassignmentsresponse.ListMemberAssignmentsResponse
@@ -0,0 +1,225 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
QueryParamMetadata,
validate_open_enum,
)
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Awaitable, Callable, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class ListOrganizationMembersGlobalsTypedDict(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 ListOrganizationMembersGlobals(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 ListOrganizationMembersRequestTypedDict(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.
"""
offset: NotRequired[int]
r"""Number of records to skip for pagination"""
limit: NotRequired[int]
r"""Maximum number of records to return (max 100)"""
class ListOrganizationMembersRequest(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.
"""
offset: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Number of records to skip for pagination"""
limit: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Maximum number of records to return (max 100)"""
Role = Union[
Literal[
"org:admin",
"org:member",
],
UnrecognizedStr,
]
r"""Role of the member in the organization"""
class ListOrganizationMembersDataTypedDict(TypedDict):
email: str
r"""Email address of the member"""
first_name: Nullable[str]
r"""First name of the member"""
id: str
r"""User ID of the organization member"""
last_name: Nullable[str]
r"""Last name of the member"""
role: Role
r"""Role of the member in the organization"""
class ListOrganizationMembersData(BaseModel):
email: str
r"""Email address of the member"""
first_name: Nullable[str]
r"""First name of the member"""
id: str
r"""User ID of the organization member"""
last_name: Nullable[str]
r"""Last name of the member"""
role: Annotated[Role, PlainValidator(validate_open_enum(False))]
r"""Role of the member in the organization"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["first_name", "last_name"]
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 ListOrganizationMembersResponseBodyTypedDict(TypedDict):
r"""List of organization members"""
data: List[ListOrganizationMembersDataTypedDict]
r"""List of organization members"""
total_count: int
r"""Total number of members in the organization"""
class ListOrganizationMembersResponseBody(BaseModel):
r"""List of organization members"""
data: List[ListOrganizationMembersData]
r"""List of organization members"""
total_count: int
r"""Total number of members in the organization"""
class ListOrganizationMembersResponseTypedDict(TypedDict):
result: ListOrganizationMembersResponseBodyTypedDict
class ListOrganizationMembersResponse(BaseModel):
next: Union[
Callable[[], Optional[ListOrganizationMembersResponse]],
Callable[[], Awaitable[Optional[ListOrganizationMembersResponse]]],
]
result: ListOrganizationMembersResponseBody
+284 -284
View File
@@ -109,6 +109,262 @@ class ListProvidersRequest(BaseModel):
"""
Datacenter = Union[
Literal[
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AO",
"AQ",
"AR",
"AS",
"AT",
"AU",
"AW",
"AX",
"AZ",
"BA",
"BB",
"BD",
"BE",
"BF",
"BG",
"BH",
"BI",
"BJ",
"BL",
"BM",
"BN",
"BO",
"BQ",
"BR",
"BS",
"BT",
"BV",
"BW",
"BY",
"BZ",
"CA",
"CC",
"CD",
"CF",
"CG",
"CH",
"CI",
"CK",
"CL",
"CM",
"CN",
"CO",
"CR",
"CU",
"CV",
"CW",
"CX",
"CY",
"CZ",
"DE",
"DJ",
"DK",
"DM",
"DO",
"DZ",
"EC",
"EE",
"EG",
"EH",
"ER",
"ES",
"ET",
"FI",
"FJ",
"FK",
"FM",
"FO",
"FR",
"GA",
"GB",
"GD",
"GE",
"GF",
"GG",
"GH",
"GI",
"GL",
"GM",
"GN",
"GP",
"GQ",
"GR",
"GS",
"GT",
"GU",
"GW",
"GY",
"HK",
"HM",
"HN",
"HR",
"HT",
"HU",
"ID",
"IE",
"IL",
"IM",
"IN",
"IO",
"IQ",
"IR",
"IS",
"IT",
"JE",
"JM",
"JO",
"JP",
"KE",
"KG",
"KH",
"KI",
"KM",
"KN",
"KP",
"KR",
"KW",
"KY",
"KZ",
"LA",
"LB",
"LC",
"LI",
"LK",
"LR",
"LS",
"LT",
"LU",
"LV",
"LY",
"MA",
"MC",
"MD",
"ME",
"MF",
"MG",
"MH",
"MK",
"ML",
"MM",
"MN",
"MO",
"MP",
"MQ",
"MR",
"MS",
"MT",
"MU",
"MV",
"MW",
"MX",
"MY",
"MZ",
"NA",
"NC",
"NE",
"NF",
"NG",
"NI",
"NL",
"NO",
"NP",
"NR",
"NU",
"NZ",
"OM",
"PA",
"PE",
"PF",
"PG",
"PH",
"PK",
"PL",
"PM",
"PN",
"PR",
"PS",
"PT",
"PW",
"PY",
"QA",
"RE",
"RO",
"RS",
"RU",
"RW",
"SA",
"SB",
"SC",
"SD",
"SE",
"SG",
"SH",
"SI",
"SJ",
"SK",
"SL",
"SM",
"SN",
"SO",
"SR",
"SS",
"ST",
"SV",
"SX",
"SY",
"SZ",
"TC",
"TD",
"TF",
"TG",
"TH",
"TJ",
"TK",
"TL",
"TM",
"TN",
"TO",
"TR",
"TT",
"TV",
"TW",
"TZ",
"UA",
"UG",
"UM",
"US",
"UY",
"UZ",
"VA",
"VC",
"VE",
"VG",
"VI",
"VN",
"VU",
"WF",
"WS",
"YE",
"YT",
"ZA",
"ZM",
"ZW",
],
UnrecognizedStr,
]
Headquarters = Union[
Literal[
"AD",
@@ -366,319 +622,63 @@ Headquarters = Union[
r"""ISO 3166-1 Alpha-2 country code of the provider headquarters"""
Datacenter = Union[
Literal[
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AO",
"AQ",
"AR",
"AS",
"AT",
"AU",
"AW",
"AX",
"AZ",
"BA",
"BB",
"BD",
"BE",
"BF",
"BG",
"BH",
"BI",
"BJ",
"BL",
"BM",
"BN",
"BO",
"BQ",
"BR",
"BS",
"BT",
"BV",
"BW",
"BY",
"BZ",
"CA",
"CC",
"CD",
"CF",
"CG",
"CH",
"CI",
"CK",
"CL",
"CM",
"CN",
"CO",
"CR",
"CU",
"CV",
"CW",
"CX",
"CY",
"CZ",
"DE",
"DJ",
"DK",
"DM",
"DO",
"DZ",
"EC",
"EE",
"EG",
"EH",
"ER",
"ES",
"ET",
"FI",
"FJ",
"FK",
"FM",
"FO",
"FR",
"GA",
"GB",
"GD",
"GE",
"GF",
"GG",
"GH",
"GI",
"GL",
"GM",
"GN",
"GP",
"GQ",
"GR",
"GS",
"GT",
"GU",
"GW",
"GY",
"HK",
"HM",
"HN",
"HR",
"HT",
"HU",
"ID",
"IE",
"IL",
"IM",
"IN",
"IO",
"IQ",
"IR",
"IS",
"IT",
"JE",
"JM",
"JO",
"JP",
"KE",
"KG",
"KH",
"KI",
"KM",
"KN",
"KP",
"KR",
"KW",
"KY",
"KZ",
"LA",
"LB",
"LC",
"LI",
"LK",
"LR",
"LS",
"LT",
"LU",
"LV",
"LY",
"MA",
"MC",
"MD",
"ME",
"MF",
"MG",
"MH",
"MK",
"ML",
"MM",
"MN",
"MO",
"MP",
"MQ",
"MR",
"MS",
"MT",
"MU",
"MV",
"MW",
"MX",
"MY",
"MZ",
"NA",
"NC",
"NE",
"NF",
"NG",
"NI",
"NL",
"NO",
"NP",
"NR",
"NU",
"NZ",
"OM",
"PA",
"PE",
"PF",
"PG",
"PH",
"PK",
"PL",
"PM",
"PN",
"PR",
"PS",
"PT",
"PW",
"PY",
"QA",
"RE",
"RO",
"RS",
"RU",
"RW",
"SA",
"SB",
"SC",
"SD",
"SE",
"SG",
"SH",
"SI",
"SJ",
"SK",
"SL",
"SM",
"SN",
"SO",
"SR",
"SS",
"ST",
"SV",
"SX",
"SY",
"SZ",
"TC",
"TD",
"TF",
"TG",
"TH",
"TJ",
"TK",
"TL",
"TM",
"TN",
"TO",
"TR",
"TT",
"TV",
"TW",
"TZ",
"UA",
"UG",
"UM",
"US",
"UY",
"UZ",
"VA",
"VC",
"VE",
"VG",
"VI",
"VN",
"VU",
"WF",
"WS",
"YE",
"YT",
"ZA",
"ZM",
"ZW",
],
UnrecognizedStr,
]
class ListProvidersDataTypedDict(TypedDict):
name: str
r"""Display name of the provider"""
slug: str
r"""URL-friendly identifier for the provider"""
privacy_policy_url: Nullable[str]
r"""URL to the provider's privacy policy"""
terms_of_service_url: NotRequired[Nullable[str]]
r"""URL to the provider's terms of service"""
status_page_url: NotRequired[Nullable[str]]
r"""URL to the provider's status page"""
headquarters: NotRequired[Nullable[Headquarters]]
r"""ISO 3166-1 Alpha-2 country code of the provider headquarters"""
slug: str
r"""URL-friendly identifier for the provider"""
datacenters: NotRequired[Nullable[List[Datacenter]]]
r"""ISO 3166-1 Alpha-2 country codes of the provider datacenter locations"""
headquarters: NotRequired[Nullable[Headquarters]]
r"""ISO 3166-1 Alpha-2 country code of the provider headquarters"""
status_page_url: NotRequired[Nullable[str]]
r"""URL to the provider's status page"""
terms_of_service_url: NotRequired[Nullable[str]]
r"""URL to the provider's terms of service"""
class ListProvidersData(BaseModel):
name: str
r"""Display name of the provider"""
slug: str
r"""URL-friendly identifier for the provider"""
privacy_policy_url: Nullable[str]
r"""URL to the provider's privacy policy"""
terms_of_service_url: OptionalNullable[str] = UNSET
r"""URL to the provider's terms of service"""
status_page_url: OptionalNullable[str] = UNSET
r"""URL to the provider's status page"""
headquarters: Annotated[
OptionalNullable[Headquarters], PlainValidator(validate_open_enum(False))
] = UNSET
r"""ISO 3166-1 Alpha-2 country code of the provider headquarters"""
slug: str
r"""URL-friendly identifier for the provider"""
datacenters: OptionalNullable[
List[Annotated[Datacenter, PlainValidator(validate_open_enum(False))]]
] = UNSET
r"""ISO 3166-1 Alpha-2 country codes of the provider datacenter locations"""
headquarters: Annotated[
OptionalNullable[Headquarters], PlainValidator(validate_open_enum(False))
] = UNSET
r"""ISO 3166-1 Alpha-2 country code of the provider headquarters"""
status_page_url: OptionalNullable[str] = UNSET
r"""URL to the provider's status page"""
terms_of_service_url: OptionalNullable[str] = UNSET
r"""URL to the provider's terms of service"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"terms_of_service_url",
"status_page_url",
"headquarters",
"datacenters",
"headquarters",
"status_page_url",
"terms_of_service_url",
]
nullable_fields = [
"privacy_policy_url",
"terms_of_service_url",
"status_page_url",
"headquarters",
"datacenters",
"headquarters",
"privacy_policy_url",
"status_page_url",
"terms_of_service_url",
]
null_default_fields = []
@@ -0,0 +1,154 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, OptionalNullable, UNSET_SENTINEL
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
QueryParamMetadata,
)
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ListVideosContentGlobalsTypedDict(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 ListVideosContentGlobals(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 ListVideosContentRequestTypedDict(TypedDict):
job_id: str
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.
"""
index: NotRequired[Nullable[int]]
class ListVideosContentRequest(BaseModel):
job_id: Annotated[
str,
pydantic.Field(alias="jobId"),
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
]
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.
"""
index: Annotated[
OptionalNullable[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = 0
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"HTTP-Referer",
"X-OpenRouter-Title",
"X-OpenRouter-Categories",
"index",
]
nullable_fields = ["index"]
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
@@ -8,7 +8,7 @@ from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class CreateCoinbaseChargeGlobalsTypedDict(TypedDict):
class ListVideosModelsGlobalsTypedDict(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.
@@ -24,7 +24,7 @@ class CreateCoinbaseChargeGlobalsTypedDict(TypedDict):
"""
class CreateCoinbaseChargeGlobals(BaseModel):
class ListVideosModelsGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
@@ -54,7 +54,7 @@ class CreateCoinbaseChargeGlobals(BaseModel):
"""
class CreateCoinbaseChargeRequestTypedDict(TypedDict):
class ListVideosModelsRequestTypedDict(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.
@@ -70,7 +70,7 @@ class CreateCoinbaseChargeRequestTypedDict(TypedDict):
"""
class CreateCoinbaseChargeRequest(BaseModel):
class ListVideosModelsRequest(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
+9 -260
View File
@@ -1,25 +1,18 @@
"""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.components import (
updateguardrailrequest as components_updateguardrailrequest,
)
from openrouter.types import BaseModel
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
PathParamMetadata,
RequestMetadata,
validate_open_enum,
)
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -69,116 +62,12 @@ class UpdateGuardrailGlobals(BaseModel):
"""
UpdateGuardrailResetIntervalRequest = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
class UpdateGuardrailRequestBodyTypedDict(TypedDict):
name: NotRequired[str]
r"""New name for the guardrail"""
description: NotRequired[Nullable[str]]
r"""New description for the guardrail"""
limit_usd: NotRequired[Nullable[float]]
r"""New spending limit in USD"""
reset_interval: NotRequired[Nullable[UpdateGuardrailResetIntervalRequest]]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""New list of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model identifiers (slug or canonical_slug accepted)"""
enforce_zdr: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention"""
class UpdateGuardrailRequestBody(BaseModel):
name: Optional[str] = None
r"""New name for the guardrail"""
description: OptionalNullable[str] = UNSET
r"""New description for the guardrail"""
limit_usd: OptionalNullable[float] = UNSET
r"""New spending limit in USD"""
reset_interval: Annotated[
OptionalNullable[UpdateGuardrailResetIntervalRequest],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""New list of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model identifiers (slug or canonical_slug accepted)"""
enforce_zdr: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"name",
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
nullable_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
]
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 UpdateGuardrailRequestTypedDict(TypedDict):
id: str
r"""The unique identifier of the guardrail to update"""
request_body: UpdateGuardrailRequestBodyTypedDict
update_guardrail_request: (
components_updateguardrailrequest.UpdateGuardrailRequestTypedDict
)
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.
@@ -200,8 +89,8 @@ class UpdateGuardrailRequest(BaseModel):
]
r"""The unique identifier of the guardrail to update"""
request_body: Annotated[
UpdateGuardrailRequestBody,
update_guardrail_request: Annotated[
components_updateguardrailrequest.UpdateGuardrailRequest,
FieldMetadata(request=RequestMetadata(media_type="application/json")),
]
@@ -232,143 +121,3 @@ class UpdateGuardrailRequest(BaseModel):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
UpdateGuardrailResetIntervalResponse = Union[
Literal[
"daily",
"weekly",
"monthly",
],
UnrecognizedStr,
]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
class UpdateGuardrailDataTypedDict(TypedDict):
r"""The updated guardrail"""
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: NotRequired[Nullable[str]]
r"""Description of the guardrail"""
limit_usd: NotRequired[Nullable[float]]
r"""Spending limit in USD"""
reset_interval: NotRequired[Nullable[UpdateGuardrailResetIntervalResponse]]
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: NotRequired[Nullable[List[str]]]
r"""List of allowed provider IDs"""
ignored_providers: NotRequired[Nullable[List[str]]]
r"""List of provider IDs to exclude from routing"""
allowed_models: NotRequired[Nullable[List[str]]]
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: NotRequired[Nullable[bool]]
r"""Whether to enforce zero data retention"""
updated_at: NotRequired[Nullable[str]]
r"""ISO 8601 timestamp of when the guardrail was last updated"""
class UpdateGuardrailData(BaseModel):
r"""The updated guardrail"""
id: str
r"""Unique identifier for the guardrail"""
name: str
r"""Name of the guardrail"""
created_at: str
r"""ISO 8601 timestamp of when the guardrail was created"""
description: OptionalNullable[str] = UNSET
r"""Description of the guardrail"""
limit_usd: OptionalNullable[float] = UNSET
r"""Spending limit in USD"""
reset_interval: Annotated[
OptionalNullable[UpdateGuardrailResetIntervalResponse],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Interval at which the limit resets (daily, weekly, monthly)"""
allowed_providers: OptionalNullable[List[str]] = UNSET
r"""List of allowed provider IDs"""
ignored_providers: OptionalNullable[List[str]] = UNSET
r"""List of provider IDs to exclude from routing"""
allowed_models: OptionalNullable[List[str]] = UNSET
r"""Array of model canonical_slugs (immutable identifiers)"""
enforce_zdr: OptionalNullable[bool] = UNSET
r"""Whether to enforce zero data retention"""
updated_at: OptionalNullable[str] = UNSET
r"""ISO 8601 timestamp of when the guardrail was last updated"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
nullable_fields = [
"description",
"limit_usd",
"reset_interval",
"allowed_providers",
"ignored_providers",
"allowed_models",
"enforce_zdr",
"updated_at",
]
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 UpdateGuardrailResponseTypedDict(TypedDict):
r"""Guardrail updated successfully"""
data: UpdateGuardrailDataTypedDict
r"""The updated guardrail"""
class UpdateGuardrailResponse(BaseModel):
r"""Guardrail updated successfully"""
data: UpdateGuardrailData
r"""The updated guardrail"""
+68 -68
View File
@@ -82,25 +82,25 @@ r"""New limit reset type for the API key (daily, weekly, monthly, or null for no
class UpdateKeysRequestBodyTypedDict(TypedDict):
name: NotRequired[str]
r"""New name for the API key"""
disabled: NotRequired[bool]
r"""Whether to disable the API key"""
include_byok_in_limit: NotRequired[bool]
r"""Whether to include BYOK usage in the limit"""
limit: NotRequired[Nullable[float]]
r"""New spending limit for the API key in USD"""
limit_reset: NotRequired[Nullable[UpdateKeysLimitReset]]
r"""New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday."""
include_byok_in_limit: NotRequired[bool]
r"""Whether to include BYOK usage in the limit"""
name: NotRequired[str]
r"""New name for the API key"""
class UpdateKeysRequestBody(BaseModel):
name: Optional[str] = None
r"""New name for the API key"""
disabled: Optional[bool] = None
r"""Whether to disable the API key"""
include_byok_in_limit: Optional[bool] = None
r"""Whether to include BYOK usage in the limit"""
limit: OptionalNullable[float] = UNSET
r"""New spending limit for the API key in USD"""
@@ -110,17 +110,17 @@ class UpdateKeysRequestBody(BaseModel):
] = UNSET
r"""New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday."""
include_byok_in_limit: Optional[bool] = None
r"""Whether to include BYOK usage in the limit"""
name: Optional[str] = None
r"""New name for the API key"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"name",
"disabled",
"include_byok_in_limit",
"limit",
"limit_reset",
"include_byok_in_limit",
"name",
]
nullable_fields = ["limit", "limit_reset"]
null_default_fields = []
@@ -212,44 +212,44 @@ class UpdateKeysRequest(BaseModel):
class UpdateKeysDataTypedDict(TypedDict):
r"""The updated API key information"""
hash: str
r"""Unique hash identifier for the API key"""
name: str
r"""Name of the API key"""
label: str
r"""Human-readable label for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
limit_remaining: Nullable[float]
r"""Remaining spending limit in USD"""
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: NotRequired[Nullable[datetime]]
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -257,18 +257,36 @@ class UpdateKeysDataTypedDict(TypedDict):
class UpdateKeysData(BaseModel):
r"""The updated API key information"""
hash: str
r"""Unique hash identifier for the API key"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
name: str
r"""Name of the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
label: str
r"""Human-readable label for the API key"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
disabled: bool
r"""Whether the API key is disabled"""
hash: str
r"""Unique hash identifier for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
label: str
r"""Human-readable label for the API key"""
limit: Nullable[float]
r"""Spending limit for the API key in USD"""
@@ -278,8 +296,11 @@ class UpdateKeysData(BaseModel):
limit_reset: Nullable[str]
r"""Type of limit reset for the API key"""
include_byok_in_limit: bool
r"""Whether to include external BYOK usage in the credit limit"""
name: str
r"""Name of the API key"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
usage: float
r"""Total OpenRouter credit usage (in USD) for the API key"""
@@ -287,32 +308,11 @@ class UpdateKeysData(BaseModel):
usage_daily: float
r"""OpenRouter credit usage (in USD) for the current UTC day"""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
usage_monthly: float
r"""OpenRouter credit usage (in USD) for the current UTC month"""
byok_usage: float
r"""Total external BYOK usage (in USD) for the API key"""
byok_usage_daily: float
r"""External BYOK usage (in USD) for the current UTC day"""
byok_usage_weekly: float
r"""External BYOK usage (in USD) for the current UTC week (Monday-Sunday)"""
byok_usage_monthly: float
r"""External BYOK usage (in USD) for current UTC month"""
created_at: str
r"""ISO 8601 timestamp of when the API key was created"""
updated_at: Nullable[str]
r"""ISO 8601 timestamp of when the API key was last updated"""
creator_user_id: Nullable[str]
r"""The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID."""
usage_weekly: float
r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)"""
expires_at: OptionalNullable[datetime] = UNSET
r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration"""
@@ -321,12 +321,12 @@ class UpdateKeysData(BaseModel):
def serialize_model(self, handler):
optional_fields = ["expires_at"]
nullable_fields = [
"creator_user_id",
"expires_at",
"limit",
"limit_remaining",
"limit_reset",
"updated_at",
"expires_at",
"creator_user_id",
]
null_default_fields = []