@deeprelay/sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +66 -0
- package/README.md +47 -11
- package/dist/apis/AlertsApi.d.ts +50 -0
- package/dist/apis/AlertsApi.js +127 -0
- package/dist/apis/ApiKeysApi.d.ts +107 -0
- package/dist/apis/ApiKeysApi.js +284 -0
- package/dist/apis/BillingApi.d.ts +25 -7
- package/dist/apis/BillingApi.js +57 -7
- package/dist/apis/InferenceApi.d.ts +12 -1
- package/dist/apis/InferenceApi.js +22 -1
- package/dist/apis/MetaApi.d.ts +1 -1
- package/dist/apis/MetaApi.js +1 -1
- package/dist/apis/RequestsApi.d.ts +130 -0
- package/dist/apis/RequestsApi.js +269 -0
- package/dist/apis/UsageApi.d.ts +15 -1
- package/dist/apis/UsageApi.js +19 -2
- package/dist/apis/WebhooksApi.d.ts +1 -1
- package/dist/apis/WebhooksApi.js +1 -1
- package/dist/apis/index.d.ts +3 -0
- package/dist/apis/index.js +3 -0
- package/dist/esm/apis/AlertsApi.d.ts +50 -0
- package/dist/esm/apis/AlertsApi.js +123 -0
- package/dist/esm/apis/ApiKeysApi.d.ts +107 -0
- package/dist/esm/apis/ApiKeysApi.js +280 -0
- package/dist/esm/apis/BillingApi.d.ts +25 -7
- package/dist/esm/apis/BillingApi.js +57 -7
- package/dist/esm/apis/InferenceApi.d.ts +12 -1
- package/dist/esm/apis/InferenceApi.js +22 -1
- package/dist/esm/apis/MetaApi.d.ts +1 -1
- package/dist/esm/apis/MetaApi.js +1 -1
- package/dist/esm/apis/RequestsApi.d.ts +130 -0
- package/dist/esm/apis/RequestsApi.js +265 -0
- package/dist/esm/apis/UsageApi.d.ts +15 -1
- package/dist/esm/apis/UsageApi.js +18 -1
- package/dist/esm/apis/WebhooksApi.d.ts +1 -1
- package/dist/esm/apis/WebhooksApi.js +1 -1
- package/dist/esm/apis/index.d.ts +3 -0
- package/dist/esm/apis/index.js +3 -0
- package/dist/esm/models/AlertEmailToggles.d.ts +50 -0
- package/dist/esm/models/AlertEmailToggles.js +55 -0
- package/dist/esm/models/AlertSettings.d.ts +51 -0
- package/dist/esm/models/AlertSettings.js +56 -0
- package/dist/esm/models/AlertSettingsUpdate.d.ts +39 -0
- package/dist/esm/models/AlertSettingsUpdate.js +48 -0
- package/dist/esm/models/ApiKey.d.ts +123 -0
- package/dist/esm/models/ApiKey.js +96 -0
- package/dist/esm/models/ApiKeyCreate.d.ts +70 -0
- package/dist/esm/models/ApiKeyCreate.js +57 -0
- package/dist/esm/models/ApiKeyCreated.d.ts +129 -0
- package/dist/esm/models/ApiKeyCreated.js +100 -0
- package/dist/esm/models/ApiKeyList.d.ts +33 -0
- package/dist/esm/models/ApiKeyList.js +44 -0
- package/dist/esm/models/ApiKeyScopes.d.ts +65 -0
- package/dist/esm/models/ApiKeyScopes.js +66 -0
- package/dist/esm/models/ApiKeyUpdate.d.ts +62 -0
- package/dist/esm/models/ApiKeyUpdate.js +51 -0
- package/dist/esm/models/Balance.d.ts +1 -1
- package/dist/esm/models/Balance.js +1 -1
- package/dist/esm/models/ChatChoice.d.ts +11 -1
- package/dist/esm/models/ChatChoice.js +3 -1
- package/dist/esm/models/ChatCompletionRequest.d.ts +78 -2
- package/dist/esm/models/ChatCompletionRequest.js +26 -1
- package/dist/esm/models/ChatCompletionRequestResponseFormat.d.ts +31 -0
- package/dist/esm/models/ChatCompletionRequestResponseFormat.js +52 -0
- package/dist/esm/models/ChatCompletionRequestToolChoice.d.ts +23 -0
- package/dist/esm/models/ChatCompletionRequestToolChoice.js +50 -0
- package/dist/esm/models/ChatCompletionResponse.d.ts +1 -1
- package/dist/esm/models/ChatCompletionResponse.js +1 -1
- package/dist/esm/models/ChatMessage.d.ts +22 -2
- package/dist/esm/models/ChatMessage.js +10 -5
- package/dist/esm/models/CostDetails.d.ts +59 -0
- package/dist/esm/models/CostDetails.js +59 -0
- package/dist/esm/models/CreateCryptoDepositRequest.d.ts +4 -1
- package/dist/esm/models/CreateCryptoDepositRequest.js +4 -2
- package/dist/esm/models/CreateWebhookEndpointRequest.d.ts +5 -1
- package/dist/esm/models/CreateWebhookEndpointRequest.js +6 -2
- package/dist/esm/models/CryptoDeposit.d.ts +3 -1
- package/dist/esm/models/CryptoDeposit.js +4 -2
- package/dist/esm/models/Embedding.d.ts +1 -1
- package/dist/esm/models/Embedding.js +1 -1
- package/dist/esm/models/EmbeddingsRequest.d.ts +1 -1
- package/dist/esm/models/EmbeddingsRequest.js +1 -1
- package/dist/esm/models/EmbeddingsRequestInput.d.ts +1 -1
- package/dist/esm/models/EmbeddingsRequestInput.js +1 -1
- package/dist/esm/models/EmbeddingsResponse.d.ts +1 -1
- package/dist/esm/models/EmbeddingsResponse.js +1 -1
- package/dist/esm/models/EmbeddingsUsage.d.ts +1 -1
- package/dist/esm/models/EmbeddingsUsage.js +1 -1
- package/dist/esm/models/GetHealth200Response.d.ts +1 -1
- package/dist/esm/models/GetHealth200Response.js +1 -1
- package/dist/esm/models/ImagesGenerationsRequest.d.ts +2 -2
- package/dist/esm/models/ImagesGenerationsRequest.js +1 -1
- package/dist/esm/models/ImagesResponse.d.ts +1 -1
- package/dist/esm/models/ImagesResponse.js +1 -1
- package/dist/esm/models/ImagesResponseDataInner.d.ts +1 -1
- package/dist/esm/models/ImagesResponseDataInner.js +1 -1
- package/dist/esm/models/ImagesResponseUsage.d.ts +1 -1
- package/dist/esm/models/ImagesResponseUsage.js +1 -1
- package/dist/esm/models/InferencePreflight.d.ts +5 -2
- package/dist/esm/models/InferencePreflight.js +4 -1
- package/dist/esm/models/JSONSchemaFormat.d.ts +54 -0
- package/dist/esm/models/JSONSchemaFormat.js +49 -0
- package/dist/esm/models/ListDeposits200Response.d.ts +1 -1
- package/dist/esm/models/ListDeposits200Response.js +1 -1
- package/dist/esm/models/Model.d.ts +54 -5
- package/dist/esm/models/Model.js +21 -2
- package/dist/esm/models/ModelList.d.ts +1 -1
- package/dist/esm/models/ModelList.js +1 -1
- package/dist/esm/models/ModelMetrics.d.ts +101 -0
- package/dist/esm/models/ModelMetrics.js +85 -0
- package/dist/esm/models/ModelParametersInner.d.ts +1 -1
- package/dist/esm/models/ModelParametersInner.js +1 -1
- package/dist/esm/models/ModelPricing.d.ts +1 -1
- package/dist/esm/models/ModelPricing.js +1 -1
- package/dist/esm/models/ModelRate.d.ts +1 -1
- package/dist/esm/models/ModelRate.js +1 -1
- package/dist/esm/models/OpenAIErrorEnvelope.d.ts +1 -1
- package/dist/esm/models/OpenAIErrorEnvelope.js +1 -1
- package/dist/esm/models/OpenAIErrorEnvelopeError.d.ts +8 -2
- package/dist/esm/models/OpenAIErrorEnvelopeError.js +3 -1
- package/dist/esm/models/PeakWindow.d.ts +1 -1
- package/dist/esm/models/PeakWindow.js +1 -1
- package/dist/esm/models/Problem.d.ts +22 -1
- package/dist/esm/models/Problem.js +14 -1
- package/dist/esm/models/RefereeStatus.d.ts +1 -1
- package/dist/esm/models/RefereeStatus.js +1 -1
- package/dist/esm/models/Referral.d.ts +14 -2
- package/dist/esm/models/Referral.js +9 -1
- package/dist/esm/models/RequestLogEntry.d.ts +210 -0
- package/dist/esm/models/RequestLogEntry.js +129 -0
- package/dist/esm/models/RequestLogPage.d.ts +45 -0
- package/dist/esm/models/RequestLogPage.js +52 -0
- package/dist/esm/models/ResponseFormatJSONObject.d.ts +39 -0
- package/dist/esm/models/ResponseFormatJSONObject.js +51 -0
- package/dist/esm/models/ResponseFormatJSONSchema.d.ts +46 -0
- package/dist/esm/models/ResponseFormatJSONSchema.js +56 -0
- package/dist/esm/models/ResponseFormatText.d.ts +39 -0
- package/dist/esm/models/ResponseFormatText.js +51 -0
- package/dist/esm/models/SpendingLimit.d.ts +1 -1
- package/dist/esm/models/SpendingLimit.js +1 -1
- package/dist/esm/models/StreamOptions.d.ts +1 -1
- package/dist/esm/models/StreamOptions.js +1 -1
- package/dist/esm/models/Subscription.d.ts +9 -2
- package/dist/esm/models/Subscription.js +6 -1
- package/dist/esm/models/SubscriptionCheckoutRequest.d.ts +18 -4
- package/dist/esm/models/SubscriptionCheckoutRequest.js +10 -1
- package/dist/esm/models/SubscriptionCheckoutSession.d.ts +21 -1
- package/dist/esm/models/SubscriptionCheckoutSession.js +12 -1
- package/dist/esm/models/SubscriptionModelUsage.d.ts +68 -0
- package/dist/esm/models/SubscriptionModelUsage.js +67 -0
- package/dist/esm/models/SubscriptionPlan.d.ts +4 -4
- package/dist/esm/models/SubscriptionPlan.js +1 -1
- package/dist/esm/models/SubscriptionPortalRequest.d.ts +1 -1
- package/dist/esm/models/SubscriptionPortalRequest.js +1 -1
- package/dist/esm/models/SubscriptionPortalSession.d.ts +1 -1
- package/dist/esm/models/SubscriptionPortalSession.js +1 -1
- package/dist/esm/models/SubscriptionPrice.d.ts +1 -1
- package/dist/esm/models/SubscriptionPrice.js +1 -1
- package/dist/esm/models/SubscriptionQuota.d.ts +10 -4
- package/dist/esm/models/SubscriptionQuota.js +8 -4
- package/dist/esm/models/SubscriptionTier.d.ts +53 -0
- package/dist/esm/models/SubscriptionTier.js +55 -0
- package/dist/esm/models/SubscriptionUpgradeRequest.d.ts +32 -0
- package/dist/esm/models/SubscriptionUpgradeRequest.js +43 -0
- package/dist/esm/models/SubscriptionUsage.d.ts +28 -3
- package/dist/esm/models/SubscriptionUsage.js +15 -4
- package/dist/esm/models/Tool.d.ts +46 -0
- package/dist/esm/models/Tool.js +56 -0
- package/dist/esm/models/ToolCall.d.ts +60 -0
- package/dist/esm/models/ToolCall.js +56 -0
- package/dist/esm/models/ToolCallFunction.d.ts +39 -0
- package/dist/esm/models/ToolCallFunction.js +47 -0
- package/dist/esm/models/ToolChoiceFunction.d.ts +46 -0
- package/dist/esm/models/ToolChoiceFunction.js +56 -0
- package/dist/esm/models/ToolChoiceFunctionFunction.d.ts +32 -0
- package/dist/esm/models/ToolChoiceFunctionFunction.js +43 -0
- package/dist/esm/models/ToolFunction.d.ts +47 -0
- package/dist/esm/models/ToolFunction.js +47 -0
- package/dist/esm/models/UpdateSpendingLimitRequest.d.ts +1 -1
- package/dist/esm/models/UpdateSpendingLimitRequest.js +1 -1
- package/dist/esm/models/Usage.d.ts +29 -1
- package/dist/esm/models/Usage.js +12 -1
- package/dist/esm/models/UsageBucket.d.ts +39 -6
- package/dist/esm/models/UsageBucket.js +11 -1
- package/dist/esm/models/UsageCompletionTokensDetails.d.ts +32 -0
- package/dist/esm/models/UsageCompletionTokensDetails.js +41 -0
- package/dist/esm/models/UsagePage.d.ts +2 -1
- package/dist/esm/models/UsagePage.js +1 -1
- package/dist/esm/models/UsagePromptTokensDetails.d.ts +33 -0
- package/dist/esm/models/UsagePromptTokensDetails.js +41 -0
- package/dist/esm/models/VideoCreateRequest.d.ts +1 -1
- package/dist/esm/models/VideoCreateRequest.js +1 -1
- package/dist/esm/models/VideoJob.d.ts +1 -1
- package/dist/esm/models/VideoJob.js +1 -1
- package/dist/esm/models/VideoList.d.ts +1 -1
- package/dist/esm/models/VideoList.js +1 -1
- package/dist/esm/models/WebhookEndpoint.d.ts +5 -1
- package/dist/esm/models/WebhookEndpoint.js +6 -2
- package/dist/esm/models/WebhookEndpointPage.d.ts +1 -1
- package/dist/esm/models/WebhookEndpointPage.js +1 -1
- package/dist/esm/models/index.d.ts +30 -0
- package/dist/esm/models/index.js +30 -0
- package/dist/esm/runtime.d.ts +1 -1
- package/dist/esm/runtime.js +2 -2
- package/dist/models/AlertEmailToggles.d.ts +50 -0
- package/dist/models/AlertEmailToggles.js +62 -0
- package/dist/models/AlertSettings.d.ts +51 -0
- package/dist/models/AlertSettings.js +63 -0
- package/dist/models/AlertSettingsUpdate.d.ts +39 -0
- package/dist/models/AlertSettingsUpdate.js +55 -0
- package/dist/models/ApiKey.d.ts +123 -0
- package/dist/models/ApiKey.js +103 -0
- package/dist/models/ApiKeyCreate.d.ts +70 -0
- package/dist/models/ApiKeyCreate.js +64 -0
- package/dist/models/ApiKeyCreated.d.ts +129 -0
- package/dist/models/ApiKeyCreated.js +107 -0
- package/dist/models/ApiKeyList.d.ts +33 -0
- package/dist/models/ApiKeyList.js +51 -0
- package/dist/models/ApiKeyScopes.d.ts +65 -0
- package/dist/models/ApiKeyScopes.js +74 -0
- package/dist/models/ApiKeyUpdate.d.ts +62 -0
- package/dist/models/ApiKeyUpdate.js +58 -0
- package/dist/models/Balance.d.ts +1 -1
- package/dist/models/Balance.js +1 -1
- package/dist/models/ChatChoice.d.ts +11 -1
- package/dist/models/ChatChoice.js +3 -1
- package/dist/models/ChatCompletionRequest.d.ts +78 -2
- package/dist/models/ChatCompletionRequest.js +26 -1
- package/dist/models/ChatCompletionRequestResponseFormat.d.ts +31 -0
- package/dist/models/ChatCompletionRequestResponseFormat.js +58 -0
- package/dist/models/ChatCompletionRequestToolChoice.d.ts +23 -0
- package/dist/models/ChatCompletionRequestToolChoice.js +56 -0
- package/dist/models/ChatCompletionResponse.d.ts +1 -1
- package/dist/models/ChatCompletionResponse.js +1 -1
- package/dist/models/ChatMessage.d.ts +22 -2
- package/dist/models/ChatMessage.js +10 -5
- package/dist/models/CostDetails.d.ts +59 -0
- package/dist/models/CostDetails.js +66 -0
- package/dist/models/CreateCryptoDepositRequest.d.ts +4 -1
- package/dist/models/CreateCryptoDepositRequest.js +4 -2
- package/dist/models/CreateWebhookEndpointRequest.d.ts +5 -1
- package/dist/models/CreateWebhookEndpointRequest.js +6 -2
- package/dist/models/CryptoDeposit.d.ts +3 -1
- package/dist/models/CryptoDeposit.js +4 -2
- package/dist/models/Embedding.d.ts +1 -1
- package/dist/models/Embedding.js +1 -1
- package/dist/models/EmbeddingsRequest.d.ts +1 -1
- package/dist/models/EmbeddingsRequest.js +1 -1
- package/dist/models/EmbeddingsRequestInput.d.ts +1 -1
- package/dist/models/EmbeddingsRequestInput.js +1 -1
- package/dist/models/EmbeddingsResponse.d.ts +1 -1
- package/dist/models/EmbeddingsResponse.js +1 -1
- package/dist/models/EmbeddingsUsage.d.ts +1 -1
- package/dist/models/EmbeddingsUsage.js +1 -1
- package/dist/models/GetHealth200Response.d.ts +1 -1
- package/dist/models/GetHealth200Response.js +1 -1
- package/dist/models/ImagesGenerationsRequest.d.ts +2 -2
- package/dist/models/ImagesGenerationsRequest.js +1 -1
- package/dist/models/ImagesResponse.d.ts +1 -1
- package/dist/models/ImagesResponse.js +1 -1
- package/dist/models/ImagesResponseDataInner.d.ts +1 -1
- package/dist/models/ImagesResponseDataInner.js +1 -1
- package/dist/models/ImagesResponseUsage.d.ts +1 -1
- package/dist/models/ImagesResponseUsage.js +1 -1
- package/dist/models/InferencePreflight.d.ts +5 -2
- package/dist/models/InferencePreflight.js +4 -1
- package/dist/models/JSONSchemaFormat.d.ts +54 -0
- package/dist/models/JSONSchemaFormat.js +56 -0
- package/dist/models/ListDeposits200Response.d.ts +1 -1
- package/dist/models/ListDeposits200Response.js +1 -1
- package/dist/models/Model.d.ts +54 -5
- package/dist/models/Model.js +21 -2
- package/dist/models/ModelList.d.ts +1 -1
- package/dist/models/ModelList.js +1 -1
- package/dist/models/ModelMetrics.d.ts +101 -0
- package/dist/models/ModelMetrics.js +93 -0
- package/dist/models/ModelParametersInner.d.ts +1 -1
- package/dist/models/ModelParametersInner.js +1 -1
- package/dist/models/ModelPricing.d.ts +1 -1
- package/dist/models/ModelPricing.js +1 -1
- package/dist/models/ModelRate.d.ts +1 -1
- package/dist/models/ModelRate.js +1 -1
- package/dist/models/OpenAIErrorEnvelope.d.ts +1 -1
- package/dist/models/OpenAIErrorEnvelope.js +1 -1
- package/dist/models/OpenAIErrorEnvelopeError.d.ts +8 -2
- package/dist/models/OpenAIErrorEnvelopeError.js +3 -1
- package/dist/models/PeakWindow.d.ts +1 -1
- package/dist/models/PeakWindow.js +1 -1
- package/dist/models/Problem.d.ts +22 -1
- package/dist/models/Problem.js +14 -1
- package/dist/models/RefereeStatus.d.ts +1 -1
- package/dist/models/RefereeStatus.js +1 -1
- package/dist/models/Referral.d.ts +14 -2
- package/dist/models/Referral.js +9 -1
- package/dist/models/RequestLogEntry.d.ts +210 -0
- package/dist/models/RequestLogEntry.js +137 -0
- package/dist/models/RequestLogPage.d.ts +45 -0
- package/dist/models/RequestLogPage.js +59 -0
- package/dist/models/ResponseFormatJSONObject.d.ts +39 -0
- package/dist/models/ResponseFormatJSONObject.js +59 -0
- package/dist/models/ResponseFormatJSONSchema.d.ts +46 -0
- package/dist/models/ResponseFormatJSONSchema.js +64 -0
- package/dist/models/ResponseFormatText.d.ts +39 -0
- package/dist/models/ResponseFormatText.js +59 -0
- package/dist/models/SpendingLimit.d.ts +1 -1
- package/dist/models/SpendingLimit.js +1 -1
- package/dist/models/StreamOptions.d.ts +1 -1
- package/dist/models/StreamOptions.js +1 -1
- package/dist/models/Subscription.d.ts +9 -2
- package/dist/models/Subscription.js +6 -1
- package/dist/models/SubscriptionCheckoutRequest.d.ts +18 -4
- package/dist/models/SubscriptionCheckoutRequest.js +11 -1
- package/dist/models/SubscriptionCheckoutSession.d.ts +21 -1
- package/dist/models/SubscriptionCheckoutSession.js +13 -1
- package/dist/models/SubscriptionModelUsage.d.ts +68 -0
- package/dist/models/SubscriptionModelUsage.js +74 -0
- package/dist/models/SubscriptionPlan.d.ts +4 -4
- package/dist/models/SubscriptionPlan.js +1 -1
- package/dist/models/SubscriptionPortalRequest.d.ts +1 -1
- package/dist/models/SubscriptionPortalRequest.js +1 -1
- package/dist/models/SubscriptionPortalSession.d.ts +1 -1
- package/dist/models/SubscriptionPortalSession.js +1 -1
- package/dist/models/SubscriptionPrice.d.ts +1 -1
- package/dist/models/SubscriptionPrice.js +1 -1
- package/dist/models/SubscriptionQuota.d.ts +10 -4
- package/dist/models/SubscriptionQuota.js +8 -4
- package/dist/models/SubscriptionTier.d.ts +53 -0
- package/dist/models/SubscriptionTier.js +62 -0
- package/dist/models/SubscriptionUpgradeRequest.d.ts +32 -0
- package/dist/models/SubscriptionUpgradeRequest.js +50 -0
- package/dist/models/SubscriptionUsage.d.ts +28 -3
- package/dist/models/SubscriptionUsage.js +15 -4
- package/dist/models/Tool.d.ts +46 -0
- package/dist/models/Tool.js +64 -0
- package/dist/models/ToolCall.d.ts +60 -0
- package/dist/models/ToolCall.js +64 -0
- package/dist/models/ToolCallFunction.d.ts +39 -0
- package/dist/models/ToolCallFunction.js +54 -0
- package/dist/models/ToolChoiceFunction.d.ts +46 -0
- package/dist/models/ToolChoiceFunction.js +64 -0
- package/dist/models/ToolChoiceFunctionFunction.d.ts +32 -0
- package/dist/models/ToolChoiceFunctionFunction.js +50 -0
- package/dist/models/ToolFunction.d.ts +47 -0
- package/dist/models/ToolFunction.js +54 -0
- package/dist/models/UpdateSpendingLimitRequest.d.ts +1 -1
- package/dist/models/UpdateSpendingLimitRequest.js +1 -1
- package/dist/models/Usage.d.ts +29 -1
- package/dist/models/Usage.js +12 -1
- package/dist/models/UsageBucket.d.ts +39 -6
- package/dist/models/UsageBucket.js +11 -1
- package/dist/models/UsageCompletionTokensDetails.d.ts +32 -0
- package/dist/models/UsageCompletionTokensDetails.js +48 -0
- package/dist/models/UsagePage.d.ts +2 -1
- package/dist/models/UsagePage.js +1 -1
- package/dist/models/UsagePromptTokensDetails.d.ts +33 -0
- package/dist/models/UsagePromptTokensDetails.js +48 -0
- package/dist/models/VideoCreateRequest.d.ts +1 -1
- package/dist/models/VideoCreateRequest.js +1 -1
- package/dist/models/VideoJob.d.ts +1 -1
- package/dist/models/VideoJob.js +1 -1
- package/dist/models/VideoList.d.ts +1 -1
- package/dist/models/VideoList.js +1 -1
- package/dist/models/WebhookEndpoint.d.ts +5 -1
- package/dist/models/WebhookEndpoint.js +6 -2
- package/dist/models/WebhookEndpointPage.d.ts +1 -1
- package/dist/models/WebhookEndpointPage.js +1 -1
- package/dist/models/index.d.ts +30 -0
- package/dist/models/index.js +30 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -2
- package/docs/AlertEmailToggles.md +40 -0
- package/docs/AlertSettings.md +40 -0
- package/docs/AlertSettingsUpdate.md +36 -0
- package/docs/AlertsApi.md +151 -0
- package/docs/ApiKey.md +65 -0
- package/docs/ApiKeyCreate.md +46 -0
- package/docs/ApiKeyCreated.md +67 -0
- package/docs/ApiKeyList.md +34 -0
- package/docs/ApiKeyScopes.md +38 -0
- package/docs/ApiKeyUpdate.md +45 -0
- package/docs/ApiKeysApi.md +389 -0
- package/docs/BillingApi.md +83 -3
- package/docs/ChatChoice.md +2 -0
- package/docs/ChatCompletionRequest.md +22 -0
- package/docs/ChatCompletionRequestResponseFormat.md +37 -0
- package/docs/ChatCompletionRequestToolChoice.md +37 -0
- package/docs/ChatMessage.md +4 -0
- package/docs/CostDetails.md +43 -0
- package/docs/InferenceApi.md +94 -71
- package/docs/JSONSchemaFormat.md +41 -0
- package/docs/Model.md +16 -0
- package/docs/ModelMetrics.md +55 -0
- package/docs/OpenAIErrorEnvelopeError.md +2 -0
- package/docs/Problem.md +4 -0
- package/docs/Referral.md +6 -2
- package/docs/RequestLogEntry.md +87 -0
- package/docs/RequestLogPage.md +38 -0
- package/docs/RequestsApi.md +282 -0
- package/docs/ResponseFormatJSONObject.md +35 -0
- package/docs/ResponseFormatJSONSchema.md +36 -0
- package/docs/ResponseFormatText.md +34 -0
- package/docs/Subscription.md +3 -1
- package/docs/SubscriptionCheckoutRequest.md +2 -0
- package/docs/SubscriptionCheckoutSession.md +4 -0
- package/docs/SubscriptionModelUsage.md +47 -0
- package/docs/SubscriptionPlan.md +1 -1
- package/docs/SubscriptionQuota.md +5 -3
- package/docs/SubscriptionTier.md +41 -0
- package/docs/SubscriptionUpgradeRequest.md +34 -0
- package/docs/SubscriptionUsage.md +10 -2
- package/docs/Tool.md +36 -0
- package/docs/ToolCall.md +41 -0
- package/docs/ToolCallFunction.md +36 -0
- package/docs/ToolChoiceFunction.md +36 -0
- package/docs/ToolChoiceFunctionFunction.md +34 -0
- package/docs/ToolFunction.md +38 -0
- package/docs/Usage.md +8 -0
- package/docs/UsageApi.md +17 -9
- package/docs/UsageBucket.md +11 -0
- package/docs/UsageCompletionTokensDetails.md +34 -0
- package/docs/UsagePromptTokensDetails.md +35 -0
- package/package.json +1 -1
- package/src/apis/AlertsApi.ts +145 -0
- package/src/apis/ApiKeysApi.ts +357 -0
- package/src/apis/BillingApi.ts +73 -7
- package/src/apis/InferenceApi.ts +32 -1
- package/src/apis/MetaApi.ts +1 -1
- package/src/apis/RequestsApi.ts +335 -0
- package/src/apis/UsageApi.ts +23 -1
- package/src/apis/WebhooksApi.ts +1 -1
- package/src/apis/index.ts +3 -0
- package/src/models/AlertEmailToggles.ts +93 -0
- package/src/models/AlertSettings.ts +101 -0
- package/src/models/AlertSettingsUpdate.ts +83 -0
- package/src/models/ApiKey.ts +205 -0
- package/src/models/ApiKeyCreate.ts +115 -0
- package/src/models/ApiKeyCreated.ts +214 -0
- package/src/models/ApiKeyList.ts +74 -0
- package/src/models/ApiKeyScopes.ts +106 -0
- package/src/models/ApiKeyUpdate.ts +105 -0
- package/src/models/Balance.ts +1 -1
- package/src/models/ChatChoice.ts +11 -1
- package/src/models/ChatCompletionRequest.ts +118 -2
- package/src/models/ChatCompletionRequestResponseFormat.ts +84 -0
- package/src/models/ChatCompletionRequestToolChoice.ts +70 -0
- package/src/models/ChatCompletionResponse.ts +1 -1
- package/src/models/ChatMessage.ts +35 -5
- package/src/models/CostDetails.ts +105 -0
- package/src/models/CreateCryptoDepositRequest.ts +5 -2
- package/src/models/CreateWebhookEndpointRequest.ts +6 -2
- package/src/models/CryptoDeposit.ts +4 -2
- package/src/models/Embedding.ts +1 -1
- package/src/models/EmbeddingsRequest.ts +1 -1
- package/src/models/EmbeddingsRequestInput.ts +1 -1
- package/src/models/EmbeddingsResponse.ts +1 -1
- package/src/models/EmbeddingsUsage.ts +1 -1
- package/src/models/GetHealth200Response.ts +1 -1
- package/src/models/ImagesGenerationsRequest.ts +2 -2
- package/src/models/ImagesResponse.ts +1 -1
- package/src/models/ImagesResponseDataInner.ts +1 -1
- package/src/models/ImagesResponseUsage.ts +1 -1
- package/src/models/InferencePreflight.ts +5 -2
- package/src/models/JSONSchemaFormat.ts +92 -0
- package/src/models/ListDeposits200Response.ts +1 -1
- package/src/models/Model.ts +78 -6
- package/src/models/ModelList.ts +1 -1
- package/src/models/ModelMetrics.ts +165 -0
- package/src/models/ModelParametersInner.ts +1 -1
- package/src/models/ModelPricing.ts +1 -1
- package/src/models/ModelRate.ts +1 -1
- package/src/models/OpenAIErrorEnvelope.ts +1 -1
- package/src/models/OpenAIErrorEnvelopeError.ts +10 -2
- package/src/models/PeakWindow.ts +1 -1
- package/src/models/Problem.ts +26 -1
- package/src/models/RefereeStatus.ts +1 -1
- package/src/models/Referral.ts +20 -2
- package/src/models/RequestLogEntry.ts +307 -0
- package/src/models/RequestLogPage.ts +92 -0
- package/src/models/ResponseFormatJSONObject.ts +78 -0
- package/src/models/ResponseFormatJSONSchema.ts +95 -0
- package/src/models/ResponseFormatText.ts +78 -0
- package/src/models/SpendingLimit.ts +1 -1
- package/src/models/StreamOptions.ts +1 -1
- package/src/models/Subscription.ts +18 -2
- package/src/models/SubscriptionCheckoutRequest.ts +23 -4
- package/src/models/SubscriptionCheckoutSession.ts +28 -1
- package/src/models/SubscriptionModelUsage.ts +120 -0
- package/src/models/SubscriptionPlan.ts +4 -4
- package/src/models/SubscriptionPortalRequest.ts +1 -1
- package/src/models/SubscriptionPortalSession.ts +1 -1
- package/src/models/SubscriptionPrice.ts +1 -1
- package/src/models/SubscriptionQuota.ts +16 -7
- package/src/models/SubscriptionTier.ts +108 -0
- package/src/models/SubscriptionUpgradeRequest.ts +66 -0
- package/src/models/SubscriptionUsage.ts +47 -6
- package/src/models/Tool.ts +95 -0
- package/src/models/ToolCall.ts +110 -0
- package/src/models/ToolCallFunction.ts +76 -0
- package/src/models/ToolChoiceFunction.ts +95 -0
- package/src/models/ToolChoiceFunctionFunction.ts +66 -0
- package/src/models/ToolFunction.ts +83 -0
- package/src/models/UpdateSpendingLimitRequest.ts +1 -1
- package/src/models/Usage.ts +56 -1
- package/src/models/UsageBucket.ts +49 -6
- package/src/models/UsageCompletionTokensDetails.ts +65 -0
- package/src/models/UsagePage.ts +2 -1
- package/src/models/UsagePromptTokensDetails.ts +66 -0
- package/src/models/VideoCreateRequest.ts +1 -1
- package/src/models/VideoJob.ts +1 -1
- package/src/models/VideoList.ts +1 -1
- package/src/models/WebhookEndpoint.ts +6 -2
- package/src/models/WebhookEndpointPage.ts +1 -1
- package/src/models/index.ts +30 -0
- package/src/runtime.ts +2 -2
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* deeprelay Public Developer API
|
|
6
|
+
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details. Keys minted from the dashboard or `deeprelay login` belong to the Production server, https://api.deeprelay.ai/v1. The Demo server is an internal staging environment with its own key store. Versioning: `/v1` is the API version. `info.version` is the revision of this `/v1` document, not a separate API. OpenAI compatibility: chat completions follow the OpenAI request and response shapes, but not every OpenAI parameter is carried. Some are rejected with 400 `unsupported_parameter` and any parameter not declared in this spec is accepted and ignored. The full table is at https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
* Contact: support@deeprelay.ai
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ApiKeysApi = void 0;
|
|
26
|
+
const runtime = require("../runtime");
|
|
27
|
+
const ApiKey_1 = require("../models/ApiKey");
|
|
28
|
+
const ApiKeyCreate_1 = require("../models/ApiKeyCreate");
|
|
29
|
+
const ApiKeyCreated_1 = require("../models/ApiKeyCreated");
|
|
30
|
+
const ApiKeyList_1 = require("../models/ApiKeyList");
|
|
31
|
+
const ApiKeyUpdate_1 = require("../models/ApiKeyUpdate");
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
class ApiKeysApi extends runtime.BaseAPI {
|
|
36
|
+
/**
|
|
37
|
+
* Creates request options for createApiKey without sending the request
|
|
38
|
+
*/
|
|
39
|
+
createApiKeyRequestOpts(requestParameters) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
if (requestParameters['apiKeyCreate'] == null) {
|
|
42
|
+
throw new runtime.RequiredError('apiKeyCreate', 'Required parameter "apiKeyCreate" was null or undefined when calling createApiKey().');
|
|
43
|
+
}
|
|
44
|
+
const queryParameters = {};
|
|
45
|
+
const headerParameters = {};
|
|
46
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
47
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
48
|
+
const token = this.configuration.accessToken;
|
|
49
|
+
const tokenString = yield token("bearerAuth", []);
|
|
50
|
+
if (tokenString) {
|
|
51
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
let urlPath = `/api-keys`;
|
|
55
|
+
return {
|
|
56
|
+
path: urlPath,
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: headerParameters,
|
|
59
|
+
query: queryParameters,
|
|
60
|
+
body: (0, ApiKeyCreate_1.ApiKeyCreateToJSON)(requestParameters['apiKeyCreate']),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Mints a key. The response is the only place the secret (`key`) appears; store it then, because it cannot be read again. Requires the `keys:manage` capability: a `full_access` key, or a key whose scopes grant `{\"keys\": \"write\"}`. Any other key gets 403 `keys_manage_required`. A key can never mint a key stronger than itself: scopes it does not hold answer 403 `scope_exceeds_caller`, and a minting key that has a budget, a model allowlist, a rate limit or an expiry passes each down as an upper bound (422 `validation_failed` naming the `field`). Only an org admin can mint a `full_access` key.
|
|
66
|
+
* Create an API key
|
|
67
|
+
*/
|
|
68
|
+
createApiKeyRaw(requestParameters, initOverrides) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const requestOptions = yield this.createApiKeyRequestOpts(requestParameters);
|
|
71
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
72
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, ApiKeyCreated_1.ApiKeyCreatedFromJSON)(jsonValue));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Mints a key. The response is the only place the secret (`key`) appears; store it then, because it cannot be read again. Requires the `keys:manage` capability: a `full_access` key, or a key whose scopes grant `{\"keys\": \"write\"}`. Any other key gets 403 `keys_manage_required`. A key can never mint a key stronger than itself: scopes it does not hold answer 403 `scope_exceeds_caller`, and a minting key that has a budget, a model allowlist, a rate limit or an expiry passes each down as an upper bound (422 `validation_failed` naming the `field`). Only an org admin can mint a `full_access` key.
|
|
77
|
+
* Create an API key
|
|
78
|
+
*/
|
|
79
|
+
createApiKey(requestParameters, initOverrides) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const response = yield this.createApiKeyRaw(requestParameters, initOverrides);
|
|
82
|
+
return yield response.value();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates request options for getApiKey without sending the request
|
|
87
|
+
*/
|
|
88
|
+
getApiKeyRequestOpts(requestParameters) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (requestParameters['id'] == null) {
|
|
91
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getApiKey().');
|
|
92
|
+
}
|
|
93
|
+
const queryParameters = {};
|
|
94
|
+
const headerParameters = {};
|
|
95
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
96
|
+
const token = this.configuration.accessToken;
|
|
97
|
+
const tokenString = yield token("bearerAuth", []);
|
|
98
|
+
if (tokenString) {
|
|
99
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
let urlPath = `/api-keys/{id}`;
|
|
103
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
104
|
+
return {
|
|
105
|
+
path: urlPath,
|
|
106
|
+
method: 'GET',
|
|
107
|
+
headers: headerParameters,
|
|
108
|
+
query: queryParameters,
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns one key. A key the caller cannot see answers 404. Requires the `keys:read` scope.
|
|
114
|
+
* Get an API key
|
|
115
|
+
*/
|
|
116
|
+
getApiKeyRaw(requestParameters, initOverrides) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const requestOptions = yield this.getApiKeyRequestOpts(requestParameters);
|
|
119
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
120
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, ApiKey_1.ApiKeyFromJSON)(jsonValue));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns one key. A key the caller cannot see answers 404. Requires the `keys:read` scope.
|
|
125
|
+
* Get an API key
|
|
126
|
+
*/
|
|
127
|
+
getApiKey(requestParameters, initOverrides) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
const response = yield this.getApiKeyRaw(requestParameters, initOverrides);
|
|
130
|
+
return yield response.value();
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Creates request options for listApiKeys without sending the request
|
|
135
|
+
*/
|
|
136
|
+
listApiKeysRequestOpts() {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const queryParameters = {};
|
|
139
|
+
const headerParameters = {};
|
|
140
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
141
|
+
const token = this.configuration.accessToken;
|
|
142
|
+
const tokenString = yield token("bearerAuth", []);
|
|
143
|
+
if (tokenString) {
|
|
144
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
let urlPath = `/api-keys`;
|
|
148
|
+
return {
|
|
149
|
+
path: urlPath,
|
|
150
|
+
method: 'GET',
|
|
151
|
+
headers: headerParameters,
|
|
152
|
+
query: queryParameters,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Lists the organization\'s API keys with their limits and current budget use. An org admin\'s key and a `full_access` key see every key in the organization; any other key sees only the keys its owner created. The secret is never returned here. Requires the `keys:read` scope.
|
|
158
|
+
* List API keys
|
|
159
|
+
*/
|
|
160
|
+
listApiKeysRaw(initOverrides) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const requestOptions = yield this.listApiKeysRequestOpts();
|
|
163
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
164
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, ApiKeyList_1.ApiKeyListFromJSON)(jsonValue));
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Lists the organization\'s API keys with their limits and current budget use. An org admin\'s key and a `full_access` key see every key in the organization; any other key sees only the keys its owner created. The secret is never returned here. Requires the `keys:read` scope.
|
|
169
|
+
* List API keys
|
|
170
|
+
*/
|
|
171
|
+
listApiKeys(initOverrides) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const response = yield this.listApiKeysRaw(initOverrides);
|
|
174
|
+
return yield response.value();
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Creates request options for revokeApiKey without sending the request
|
|
179
|
+
*/
|
|
180
|
+
revokeApiKeyRequestOpts(requestParameters) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
if (requestParameters['id'] == null) {
|
|
183
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling revokeApiKey().');
|
|
184
|
+
}
|
|
185
|
+
const queryParameters = {};
|
|
186
|
+
const headerParameters = {};
|
|
187
|
+
if (requestParameters['idempotencyKey'] != null) {
|
|
188
|
+
headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
|
|
189
|
+
}
|
|
190
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
191
|
+
const token = this.configuration.accessToken;
|
|
192
|
+
const tokenString = yield token("bearerAuth", []);
|
|
193
|
+
if (tokenString) {
|
|
194
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
let urlPath = `/api-keys/{id}`;
|
|
198
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
199
|
+
return {
|
|
200
|
+
path: urlPath,
|
|
201
|
+
method: 'DELETE',
|
|
202
|
+
headers: headerParameters,
|
|
203
|
+
query: queryParameters,
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Revokes the key immediately; it cannot be restored. Requires the `keys:manage` capability (403 `keys_manage_required` otherwise); a member can only revoke keys they created.
|
|
209
|
+
* Revoke an API key
|
|
210
|
+
*/
|
|
211
|
+
revokeApiKeyRaw(requestParameters, initOverrides) {
|
|
212
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
const requestOptions = yield this.revokeApiKeyRequestOpts(requestParameters);
|
|
214
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
215
|
+
return new runtime.VoidApiResponse(response);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Revokes the key immediately; it cannot be restored. Requires the `keys:manage` capability (403 `keys_manage_required` otherwise); a member can only revoke keys they created.
|
|
220
|
+
* Revoke an API key
|
|
221
|
+
*/
|
|
222
|
+
revokeApiKey(requestParameters, initOverrides) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
yield this.revokeApiKeyRaw(requestParameters, initOverrides);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Creates request options for updateApiKey without sending the request
|
|
229
|
+
*/
|
|
230
|
+
updateApiKeyRequestOpts(requestParameters) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
if (requestParameters['id'] == null) {
|
|
233
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateApiKey().');
|
|
234
|
+
}
|
|
235
|
+
if (requestParameters['apiKeyUpdate'] == null) {
|
|
236
|
+
throw new runtime.RequiredError('apiKeyUpdate', 'Required parameter "apiKeyUpdate" was null or undefined when calling updateApiKey().');
|
|
237
|
+
}
|
|
238
|
+
const queryParameters = {};
|
|
239
|
+
const headerParameters = {};
|
|
240
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
241
|
+
if (requestParameters['idempotencyKey'] != null) {
|
|
242
|
+
headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
|
|
243
|
+
}
|
|
244
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
245
|
+
const token = this.configuration.accessToken;
|
|
246
|
+
const tokenString = yield token("bearerAuth", []);
|
|
247
|
+
if (tokenString) {
|
|
248
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
let urlPath = `/api-keys/{id}`;
|
|
252
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
253
|
+
return {
|
|
254
|
+
path: urlPath,
|
|
255
|
+
method: 'PATCH',
|
|
256
|
+
headers: headerParameters,
|
|
257
|
+
query: queryParameters,
|
|
258
|
+
body: (0, ApiKeyUpdate_1.ApiKeyUpdateToJSON)(requestParameters['apiKeyUpdate']),
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Changes a key\'s name, budget, model allowlist, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models` or `expires_at`. `scopes` cannot be changed after minting, and unknown fields are refused (422), so a typo never looks like a successful change. Requires the `keys:manage` capability (403 `keys_manage_required` otherwise); a member can only change keys they created.
|
|
264
|
+
* Update an API key\'s name or limits
|
|
265
|
+
*/
|
|
266
|
+
updateApiKeyRaw(requestParameters, initOverrides) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
const requestOptions = yield this.updateApiKeyRequestOpts(requestParameters);
|
|
269
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
270
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, ApiKey_1.ApiKeyFromJSON)(jsonValue));
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Changes a key\'s name, budget, model allowlist, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models` or `expires_at`. `scopes` cannot be changed after minting, and unknown fields are refused (422), so a typo never looks like a successful change. Requires the `keys:manage` capability (403 `keys_manage_required` otherwise); a member can only change keys they created.
|
|
275
|
+
* Update an API key\'s name or limits
|
|
276
|
+
*/
|
|
277
|
+
updateApiKey(requestParameters, initOverrides) {
|
|
278
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
const response = yield this.updateApiKeyRaw(requestParameters, initOverrides);
|
|
280
|
+
return yield response.value();
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.ApiKeysApi = ApiKeysApi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* deeprelay Public Developer API
|
|
3
|
-
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
|
|
3
|
+
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details. Keys minted from the dashboard or `deeprelay login` belong to the Production server, https://api.deeprelay.ai/v1. The Demo server is an internal staging environment with its own key store. Versioning: `/v1` is the API version. `info.version` is the revision of this `/v1` document, not a separate API. OpenAI compatibility: chat completions follow the OpenAI request and response shapes, but not every OpenAI parameter is carried. Some are rejected with 400 `unsupported_parameter` and any parameter not declared in this spec is accepted and ignored. The full table is at https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
4
4
|
*
|
|
5
5
|
* The version of the OpenAPI document: 1.0.0
|
|
6
6
|
* Contact: support@deeprelay.ai
|
|
@@ -21,6 +21,7 @@ import { type SubscriptionCheckoutRequest } from '../models/SubscriptionCheckout
|
|
|
21
21
|
import { type SubscriptionCheckoutSession } from '../models/SubscriptionCheckoutSession';
|
|
22
22
|
import { type SubscriptionPortalRequest } from '../models/SubscriptionPortalRequest';
|
|
23
23
|
import { type SubscriptionPortalSession } from '../models/SubscriptionPortalSession';
|
|
24
|
+
import { type SubscriptionUpgradeRequest } from '../models/SubscriptionUpgradeRequest';
|
|
24
25
|
import { type UpdateSpendingLimitRequest } from '../models/UpdateSpendingLimitRequest';
|
|
25
26
|
export interface CreateCryptoDepositOperationRequest {
|
|
26
27
|
createCryptoDepositRequest: CreateCryptoDepositRequest;
|
|
@@ -37,6 +38,9 @@ export interface GetDepositRequest {
|
|
|
37
38
|
export interface UpdateSpendingLimitOperationRequest {
|
|
38
39
|
updateSpendingLimitRequest: UpdateSpendingLimitRequest;
|
|
39
40
|
}
|
|
41
|
+
export interface UpgradeSubscriptionRequest {
|
|
42
|
+
subscriptionUpgradeRequest: SubscriptionUpgradeRequest;
|
|
43
|
+
}
|
|
40
44
|
/**
|
|
41
45
|
*
|
|
42
46
|
*/
|
|
@@ -60,12 +64,12 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
60
64
|
*/
|
|
61
65
|
createSubscriptionCheckoutRequestOpts(requestParameters: CreateSubscriptionCheckoutRequest): Promise<runtime.RequestOpts>;
|
|
62
66
|
/**
|
|
63
|
-
* Opens a hosted checkout session for
|
|
67
|
+
* Opens a hosted checkout session for a subscription plan and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". When sent, they must be on the deployment\'s dashboard origin, else 422 `validation_failed`. `plan_key` names the plan to buy: `flat` (Base, the default when the field is omitted) or `plus`. It pins the plan the client DISPLAYED — an unknown key, or a plan this deployment does not offer, is a 400 rather than a silent purchase of a different tier. The `plans` array on `/billing/subscription` lists the accepted keys. One subscription per organization: a second checkout while an entitling subscription exists is a 409. To move an existing subscription to a bigger plan use `/billing/subscription/upgrade`. `method` picks how the plan is paid: `card` (dollars, card or Link; the default) or `upi` (rupees, UPI AutoPay, India). On an organization that already subscribes, an explicit `method` in the other currency is a switch, not a second subscription: the link saves the new card or UPI AutoPay mandate (nothing is charged), and once that completes the same plan is moved to the new currency, first charged on the current renewal date (that month is already paid). The answer then carries `switch_to` and `first_charge_at`. A switch is refused (409) within two days of renewal, while the plan is set to cancel, while an upgrade waits on its UPI payment, and in the currency the plan already uses.
|
|
64
68
|
* Start a subscription checkout session
|
|
65
69
|
*/
|
|
66
70
|
createSubscriptionCheckoutRaw(requestParameters: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionCheckoutSession>>;
|
|
67
71
|
/**
|
|
68
|
-
* Opens a hosted checkout session for
|
|
72
|
+
* Opens a hosted checkout session for a subscription plan and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". When sent, they must be on the deployment\'s dashboard origin, else 422 `validation_failed`. `plan_key` names the plan to buy: `flat` (Base, the default when the field is omitted) or `plus`. It pins the plan the client DISPLAYED — an unknown key, or a plan this deployment does not offer, is a 400 rather than a silent purchase of a different tier. The `plans` array on `/billing/subscription` lists the accepted keys. One subscription per organization: a second checkout while an entitling subscription exists is a 409. To move an existing subscription to a bigger plan use `/billing/subscription/upgrade`. `method` picks how the plan is paid: `card` (dollars, card or Link; the default) or `upi` (rupees, UPI AutoPay, India). On an organization that already subscribes, an explicit `method` in the other currency is a switch, not a second subscription: the link saves the new card or UPI AutoPay mandate (nothing is charged), and once that completes the same plan is moved to the new currency, first charged on the current renewal date (that month is already paid). The answer then carries `switch_to` and `first_charge_at`. A switch is refused (409) within two days of renewal, while the plan is set to cancel, while an upgrade waits on its UPI payment, and in the currency the plan already uses.
|
|
69
73
|
* Start a subscription checkout session
|
|
70
74
|
*/
|
|
71
75
|
createSubscriptionCheckout(requestParameters?: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionCheckoutSession>;
|
|
@@ -130,12 +134,12 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
130
134
|
*/
|
|
131
135
|
getReferralRequestOpts(): Promise<runtime.RequestOpts>;
|
|
132
136
|
/**
|
|
133
|
-
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
137
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The referrer also earns `commission_pct` percent of every real deposit the friend makes, credited as spend-only promotional credit when the deposit clears (`commission_earned_cents`). Program rewards never apply to the subscription. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
134
138
|
* Get the org referral code, invite link, terms and stats
|
|
135
139
|
*/
|
|
136
140
|
getReferralRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Referral>>;
|
|
137
141
|
/**
|
|
138
|
-
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
142
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The referrer also earns `commission_pct` percent of every real deposit the friend makes, credited as spend-only promotional credit when the deposit clears (`commission_earned_cents`). Program rewards never apply to the subscription. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
139
143
|
* Get the org referral code, invite link, terms and stats
|
|
140
144
|
*/
|
|
141
145
|
getReferral(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Referral>;
|
|
@@ -158,12 +162,12 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
158
162
|
*/
|
|
159
163
|
getSubscriptionRequestOpts(): Promise<runtime.RequestOpts>;
|
|
160
164
|
/**
|
|
161
|
-
* Returns the organization\'s
|
|
165
|
+
* Returns the organization\'s subscription: whether it is entitled, the current billing period, the plan it is on and that plan\'s configured quota, and — for an entitled subscription — consumption against the limits the server enforces on every request. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. `plan` and `quota` describe the plan the organization IS on (the Base plan for an organization that never subscribed). `plans` lists every plan this deployment offers — Base, then Plus — each with its price and quota, so a client can render an upgrade offer without a second call. An organization that never subscribed is NOT an error. It gets 200 with `subscribed: false`, `status: \"none\"` and the quota the Base plan would provide, so a client can answer \"what does the plan include\" without a second endpoint and without an error path. Read `subscribed`, not `status`, to decide whether the plan applies: `status` carries the billing provider\'s vocabulary, and the two can disagree — an `active` subscription just past its period end still entitles for a short grace window (renewal-webhook lag), while `past_due` and `canceled` never entitle. `usage` is present only for an entitled subscription whose meter could be read. An absent `usage` NEVER means \"nothing used\" — reading it as zero would report a full quota to an organization that has none left. This is the plan\'s meter. For pay-as-you-go credit see `/billing/balance`, for spend against a self-set cap see `/billing/spending-limit`, and for past consumption see `/usage`.
|
|
162
166
|
* Get the org subscription status and quota usage
|
|
163
167
|
*/
|
|
164
168
|
getSubscriptionRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Subscription>>;
|
|
165
169
|
/**
|
|
166
|
-
* Returns the organization\'s
|
|
170
|
+
* Returns the organization\'s subscription: whether it is entitled, the current billing period, the plan it is on and that plan\'s configured quota, and — for an entitled subscription — consumption against the limits the server enforces on every request. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. `plan` and `quota` describe the plan the organization IS on (the Base plan for an organization that never subscribed). `plans` lists every plan this deployment offers — Base, then Plus — each with its price and quota, so a client can render an upgrade offer without a second call. An organization that never subscribed is NOT an error. It gets 200 with `subscribed: false`, `status: \"none\"` and the quota the Base plan would provide, so a client can answer \"what does the plan include\" without a second endpoint and without an error path. Read `subscribed`, not `status`, to decide whether the plan applies: `status` carries the billing provider\'s vocabulary, and the two can disagree — an `active` subscription just past its period end still entitles for a short grace window (renewal-webhook lag), while `past_due` and `canceled` never entitle. `usage` is present only for an entitled subscription whose meter could be read. An absent `usage` NEVER means \"nothing used\" — reading it as zero would report a full quota to an organization that has none left. This is the plan\'s meter. For pay-as-you-go credit see `/billing/balance`, for spend against a self-set cap see `/billing/spending-limit`, and for past consumption see `/usage`.
|
|
167
171
|
* Get the org subscription status and quota usage
|
|
168
172
|
*/
|
|
169
173
|
getSubscription(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Subscription>;
|
|
@@ -195,4 +199,18 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
195
199
|
* Set the org spending limit
|
|
196
200
|
*/
|
|
197
201
|
updateSpendingLimit(requestParameters: UpdateSpendingLimitOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SpendingLimit>;
|
|
202
|
+
/**
|
|
203
|
+
* Creates request options for upgradeSubscription without sending the request
|
|
204
|
+
*/
|
|
205
|
+
upgradeSubscriptionRequestOpts(requestParameters: UpgradeSubscriptionRequest): Promise<runtime.RequestOpts>;
|
|
206
|
+
/**
|
|
207
|
+
* Moves the organization\'s EXISTING subscription onto a bigger plan. Requires the `billing:write` scope AND organization-admin privileges — an upgrade charges the organization\'s card on file. Unlike checkout, no hosted page is involved: the subscription\'s price is swapped, the new plan\'s FULL price is charged immediately (whenever in the cycle the upgrade happens), and a new billing period starts now. There is no credit for the unused remainder of the old plan\'s period, and the usage meters start from zero on the new plan because every quota window is summed over the current period. The response is the post-upgrade subscription, in the same shape as `/billing/subscription`. `plan_key` is required and names the target plan (`plus`). The target must be bigger than the plan the organization is on: upgrading to the current plan or to a smaller one is a 409 `not_an_upgrade` — downgrades go through the billing portal. An organization with no entitling subscription gets 409 `not_subscribed` and should use checkout instead. A subscription already set to end at the period close is refused with 409 `subscription_cancelling` (the upgrade would start a new period and move that end date); resume it in the portal first. If the charge cannot be collected (card declined, no payment method) the call is a 402 `payment_failed` and NOTHING changes — the organization stays on its current plan. Fix the card in the billing portal and retry.
|
|
208
|
+
* Upgrade the subscription to a bigger plan
|
|
209
|
+
*/
|
|
210
|
+
upgradeSubscriptionRaw(requestParameters: UpgradeSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Subscription>>;
|
|
211
|
+
/**
|
|
212
|
+
* Moves the organization\'s EXISTING subscription onto a bigger plan. Requires the `billing:write` scope AND organization-admin privileges — an upgrade charges the organization\'s card on file. Unlike checkout, no hosted page is involved: the subscription\'s price is swapped, the new plan\'s FULL price is charged immediately (whenever in the cycle the upgrade happens), and a new billing period starts now. There is no credit for the unused remainder of the old plan\'s period, and the usage meters start from zero on the new plan because every quota window is summed over the current period. The response is the post-upgrade subscription, in the same shape as `/billing/subscription`. `plan_key` is required and names the target plan (`plus`). The target must be bigger than the plan the organization is on: upgrading to the current plan or to a smaller one is a 409 `not_an_upgrade` — downgrades go through the billing portal. An organization with no entitling subscription gets 409 `not_subscribed` and should use checkout instead. A subscription already set to end at the period close is refused with 409 `subscription_cancelling` (the upgrade would start a new period and move that end date); resume it in the portal first. If the charge cannot be collected (card declined, no payment method) the call is a 402 `payment_failed` and NOTHING changes — the organization stays on its current plan. Fix the card in the billing portal and retry.
|
|
213
|
+
* Upgrade the subscription to a bigger plan
|
|
214
|
+
*/
|
|
215
|
+
upgradeSubscription(requestParameters: UpgradeSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Subscription>;
|
|
198
216
|
}
|
package/dist/apis/BillingApi.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
/**
|
|
5
5
|
* deeprelay Public Developer API
|
|
6
|
-
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
|
|
6
|
+
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details. Keys minted from the dashboard or `deeprelay login` belong to the Production server, https://api.deeprelay.ai/v1. The Demo server is an internal staging environment with its own key store. Versioning: `/v1` is the API version. `info.version` is the revision of this `/v1` document, not a separate API. OpenAI compatibility: chat completions follow the OpenAI request and response shapes, but not every OpenAI parameter is carried. Some are rejected with 400 `unsupported_parameter` and any parameter not declared in this spec is accepted and ignored. The full table is at https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
7
7
|
*
|
|
8
8
|
* The version of the OpenAPI document: 1.0.0
|
|
9
9
|
* Contact: support@deeprelay.ai
|
|
@@ -35,6 +35,7 @@ const SubscriptionCheckoutRequest_1 = require("../models/SubscriptionCheckoutReq
|
|
|
35
35
|
const SubscriptionCheckoutSession_1 = require("../models/SubscriptionCheckoutSession");
|
|
36
36
|
const SubscriptionPortalRequest_1 = require("../models/SubscriptionPortalRequest");
|
|
37
37
|
const SubscriptionPortalSession_1 = require("../models/SubscriptionPortalSession");
|
|
38
|
+
const SubscriptionUpgradeRequest_1 = require("../models/SubscriptionUpgradeRequest");
|
|
38
39
|
const UpdateSpendingLimitRequest_1 = require("../models/UpdateSpendingLimitRequest");
|
|
39
40
|
/**
|
|
40
41
|
*
|
|
@@ -115,7 +116,7 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
|
-
* Opens a hosted checkout session for
|
|
119
|
+
* Opens a hosted checkout session for a subscription plan and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". When sent, they must be on the deployment\'s dashboard origin, else 422 `validation_failed`. `plan_key` names the plan to buy: `flat` (Base, the default when the field is omitted) or `plus`. It pins the plan the client DISPLAYED — an unknown key, or a plan this deployment does not offer, is a 400 rather than a silent purchase of a different tier. The `plans` array on `/billing/subscription` lists the accepted keys. One subscription per organization: a second checkout while an entitling subscription exists is a 409. To move an existing subscription to a bigger plan use `/billing/subscription/upgrade`. `method` picks how the plan is paid: `card` (dollars, card or Link; the default) or `upi` (rupees, UPI AutoPay, India). On an organization that already subscribes, an explicit `method` in the other currency is a switch, not a second subscription: the link saves the new card or UPI AutoPay mandate (nothing is charged), and once that completes the same plan is moved to the new currency, first charged on the current renewal date (that month is already paid). The answer then carries `switch_to` and `first_charge_at`. A switch is refused (409) within two days of renewal, while the plan is set to cancel, while an upgrade waits on its UPI payment, and in the currency the plan already uses.
|
|
119
120
|
* Start a subscription checkout session
|
|
120
121
|
*/
|
|
121
122
|
createSubscriptionCheckoutRaw(requestParameters, initOverrides) {
|
|
@@ -126,7 +127,7 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
126
127
|
});
|
|
127
128
|
}
|
|
128
129
|
/**
|
|
129
|
-
* Opens a hosted checkout session for
|
|
130
|
+
* Opens a hosted checkout session for a subscription plan and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". When sent, they must be on the deployment\'s dashboard origin, else 422 `validation_failed`. `plan_key` names the plan to buy: `flat` (Base, the default when the field is omitted) or `plus`. It pins the plan the client DISPLAYED — an unknown key, or a plan this deployment does not offer, is a 400 rather than a silent purchase of a different tier. The `plans` array on `/billing/subscription` lists the accepted keys. One subscription per organization: a second checkout while an entitling subscription exists is a 409. To move an existing subscription to a bigger plan use `/billing/subscription/upgrade`. `method` picks how the plan is paid: `card` (dollars, card or Link; the default) or `upi` (rupees, UPI AutoPay, India). On an organization that already subscribes, an explicit `method` in the other currency is a switch, not a second subscription: the link saves the new card or UPI AutoPay mandate (nothing is charged), and once that completes the same plan is moved to the new currency, first charged on the current renewal date (that month is already paid). The answer then carries `switch_to` and `first_charge_at`. A switch is refused (409) within two days of renewal, while the plan is set to cancel, while an upgrade waits on its UPI payment, and in the currency the plan already uses.
|
|
130
131
|
* Start a subscription checkout session
|
|
131
132
|
*/
|
|
132
133
|
createSubscriptionCheckout() {
|
|
@@ -340,7 +341,7 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
340
341
|
});
|
|
341
342
|
}
|
|
342
343
|
/**
|
|
343
|
-
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
344
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The referrer also earns `commission_pct` percent of every real deposit the friend makes, credited as spend-only promotional credit when the deposit clears (`commission_earned_cents`). Program rewards never apply to the subscription. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
344
345
|
* Get the org referral code, invite link, terms and stats
|
|
345
346
|
*/
|
|
346
347
|
getReferralRaw(initOverrides) {
|
|
@@ -351,7 +352,7 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
351
352
|
});
|
|
352
353
|
}
|
|
353
354
|
/**
|
|
354
|
-
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
355
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The referrer also earns `commission_pct` percent of every real deposit the friend makes, credited as spend-only promotional credit when the deposit clears (`commission_earned_cents`). Program rewards never apply to the subscription. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
355
356
|
* Get the org referral code, invite link, terms and stats
|
|
356
357
|
*/
|
|
357
358
|
getReferral(initOverrides) {
|
|
@@ -428,7 +429,7 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
428
429
|
});
|
|
429
430
|
}
|
|
430
431
|
/**
|
|
431
|
-
* Returns the organization\'s
|
|
432
|
+
* Returns the organization\'s subscription: whether it is entitled, the current billing period, the plan it is on and that plan\'s configured quota, and — for an entitled subscription — consumption against the limits the server enforces on every request. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. `plan` and `quota` describe the plan the organization IS on (the Base plan for an organization that never subscribed). `plans` lists every plan this deployment offers — Base, then Plus — each with its price and quota, so a client can render an upgrade offer without a second call. An organization that never subscribed is NOT an error. It gets 200 with `subscribed: false`, `status: \"none\"` and the quota the Base plan would provide, so a client can answer \"what does the plan include\" without a second endpoint and without an error path. Read `subscribed`, not `status`, to decide whether the plan applies: `status` carries the billing provider\'s vocabulary, and the two can disagree — an `active` subscription just past its period end still entitles for a short grace window (renewal-webhook lag), while `past_due` and `canceled` never entitle. `usage` is present only for an entitled subscription whose meter could be read. An absent `usage` NEVER means \"nothing used\" — reading it as zero would report a full quota to an organization that has none left. This is the plan\'s meter. For pay-as-you-go credit see `/billing/balance`, for spend against a self-set cap see `/billing/spending-limit`, and for past consumption see `/usage`.
|
|
432
433
|
* Get the org subscription status and quota usage
|
|
433
434
|
*/
|
|
434
435
|
getSubscriptionRaw(initOverrides) {
|
|
@@ -439,7 +440,7 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
439
440
|
});
|
|
440
441
|
}
|
|
441
442
|
/**
|
|
442
|
-
* Returns the organization\'s
|
|
443
|
+
* Returns the organization\'s subscription: whether it is entitled, the current billing period, the plan it is on and that plan\'s configured quota, and — for an entitled subscription — consumption against the limits the server enforces on every request. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. `plan` and `quota` describe the plan the organization IS on (the Base plan for an organization that never subscribed). `plans` lists every plan this deployment offers — Base, then Plus — each with its price and quota, so a client can render an upgrade offer without a second call. An organization that never subscribed is NOT an error. It gets 200 with `subscribed: false`, `status: \"none\"` and the quota the Base plan would provide, so a client can answer \"what does the plan include\" without a second endpoint and without an error path. Read `subscribed`, not `status`, to decide whether the plan applies: `status` carries the billing provider\'s vocabulary, and the two can disagree — an `active` subscription just past its period end still entitles for a short grace window (renewal-webhook lag), while `past_due` and `canceled` never entitle. `usage` is present only for an entitled subscription whose meter could be read. An absent `usage` NEVER means \"nothing used\" — reading it as zero would report a full quota to an organization that has none left. This is the plan\'s meter. For pay-as-you-go credit see `/billing/balance`, for spend against a self-set cap see `/billing/spending-limit`, and for past consumption see `/usage`.
|
|
443
444
|
* Get the org subscription status and quota usage
|
|
444
445
|
*/
|
|
445
446
|
getSubscription(initOverrides) {
|
|
@@ -541,5 +542,54 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
541
542
|
return yield response.value();
|
|
542
543
|
});
|
|
543
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* Creates request options for upgradeSubscription without sending the request
|
|
547
|
+
*/
|
|
548
|
+
upgradeSubscriptionRequestOpts(requestParameters) {
|
|
549
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
550
|
+
if (requestParameters['subscriptionUpgradeRequest'] == null) {
|
|
551
|
+
throw new runtime.RequiredError('subscriptionUpgradeRequest', 'Required parameter "subscriptionUpgradeRequest" was null or undefined when calling upgradeSubscription().');
|
|
552
|
+
}
|
|
553
|
+
const queryParameters = {};
|
|
554
|
+
const headerParameters = {};
|
|
555
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
556
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
557
|
+
const token = this.configuration.accessToken;
|
|
558
|
+
const tokenString = yield token("bearerAuth", []);
|
|
559
|
+
if (tokenString) {
|
|
560
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
let urlPath = `/billing/subscription/upgrade`;
|
|
564
|
+
return {
|
|
565
|
+
path: urlPath,
|
|
566
|
+
method: 'POST',
|
|
567
|
+
headers: headerParameters,
|
|
568
|
+
query: queryParameters,
|
|
569
|
+
body: (0, SubscriptionUpgradeRequest_1.SubscriptionUpgradeRequestToJSON)(requestParameters['subscriptionUpgradeRequest']),
|
|
570
|
+
};
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Moves the organization\'s EXISTING subscription onto a bigger plan. Requires the `billing:write` scope AND organization-admin privileges — an upgrade charges the organization\'s card on file. Unlike checkout, no hosted page is involved: the subscription\'s price is swapped, the new plan\'s FULL price is charged immediately (whenever in the cycle the upgrade happens), and a new billing period starts now. There is no credit for the unused remainder of the old plan\'s period, and the usage meters start from zero on the new plan because every quota window is summed over the current period. The response is the post-upgrade subscription, in the same shape as `/billing/subscription`. `plan_key` is required and names the target plan (`plus`). The target must be bigger than the plan the organization is on: upgrading to the current plan or to a smaller one is a 409 `not_an_upgrade` — downgrades go through the billing portal. An organization with no entitling subscription gets 409 `not_subscribed` and should use checkout instead. A subscription already set to end at the period close is refused with 409 `subscription_cancelling` (the upgrade would start a new period and move that end date); resume it in the portal first. If the charge cannot be collected (card declined, no payment method) the call is a 402 `payment_failed` and NOTHING changes — the organization stays on its current plan. Fix the card in the billing portal and retry.
|
|
575
|
+
* Upgrade the subscription to a bigger plan
|
|
576
|
+
*/
|
|
577
|
+
upgradeSubscriptionRaw(requestParameters, initOverrides) {
|
|
578
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
579
|
+
const requestOptions = yield this.upgradeSubscriptionRequestOpts(requestParameters);
|
|
580
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
581
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, Subscription_1.SubscriptionFromJSON)(jsonValue));
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Moves the organization\'s EXISTING subscription onto a bigger plan. Requires the `billing:write` scope AND organization-admin privileges — an upgrade charges the organization\'s card on file. Unlike checkout, no hosted page is involved: the subscription\'s price is swapped, the new plan\'s FULL price is charged immediately (whenever in the cycle the upgrade happens), and a new billing period starts now. There is no credit for the unused remainder of the old plan\'s period, and the usage meters start from zero on the new plan because every quota window is summed over the current period. The response is the post-upgrade subscription, in the same shape as `/billing/subscription`. `plan_key` is required and names the target plan (`plus`). The target must be bigger than the plan the organization is on: upgrading to the current plan or to a smaller one is a 409 `not_an_upgrade` — downgrades go through the billing portal. An organization with no entitling subscription gets 409 `not_subscribed` and should use checkout instead. A subscription already set to end at the period close is refused with 409 `subscription_cancelling` (the upgrade would start a new period and move that end date); resume it in the portal first. If the charge cannot be collected (card declined, no payment method) the call is a 402 `payment_failed` and NOTHING changes — the organization stays on its current plan. Fix the card in the billing portal and retry.
|
|
586
|
+
* Upgrade the subscription to a bigger plan
|
|
587
|
+
*/
|
|
588
|
+
upgradeSubscription(requestParameters, initOverrides) {
|
|
589
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
590
|
+
const response = yield this.upgradeSubscriptionRaw(requestParameters, initOverrides);
|
|
591
|
+
return yield response.value();
|
|
592
|
+
});
|
|
593
|
+
}
|
|
544
594
|
}
|
|
545
595
|
exports.BillingApi = BillingApi;
|