@deeprelay/sdk 0.4.0 → 0.4.2
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 +4 -0
- package/README.md +4 -2
- package/dist/apis/ApiKeysApi.d.ts +2 -2
- package/dist/apis/ApiKeysApi.js +2 -2
- package/dist/apis/InferenceApi.d.ts +3 -2
- package/dist/apis/InferenceApi.js +5 -2
- package/dist/apis/RequestsApi.d.ts +4 -2
- package/dist/apis/RequestsApi.js +8 -2
- package/dist/esm/apis/ApiKeysApi.d.ts +2 -2
- package/dist/esm/apis/ApiKeysApi.js +2 -2
- package/dist/esm/apis/InferenceApi.d.ts +3 -2
- package/dist/esm/apis/InferenceApi.js +5 -2
- package/dist/esm/apis/RequestsApi.d.ts +4 -2
- package/dist/esm/apis/RequestsApi.js +8 -2
- package/dist/esm/models/ApiKey.d.ts +19 -0
- package/dist/esm/models/ApiKey.js +9 -0
- package/dist/esm/models/ApiKeyCreate.d.ts +6 -0
- package/dist/esm/models/ApiKeyCreate.js +2 -0
- package/dist/esm/models/ApiKeyCreated.d.ts +19 -0
- package/dist/esm/models/ApiKeyCreated.js +9 -0
- package/dist/esm/models/ApiKeyFallbackEntry.d.ts +65 -0
- package/dist/esm/models/ApiKeyFallbackEntry.js +67 -0
- package/dist/esm/models/ApiKeyUpdate.d.ts +7 -1
- package/dist/esm/models/ApiKeyUpdate.js +2 -0
- package/dist/esm/models/ChatCompletionRequest.d.ts +6 -0
- package/dist/esm/models/ChatCompletionRequest.js +2 -0
- package/dist/esm/models/CreateWebhookEndpointRequest.d.ts +1 -0
- package/dist/esm/models/CreateWebhookEndpointRequest.js +2 -1
- package/dist/esm/models/RequestAttempt.d.ts +71 -0
- package/dist/esm/models/RequestAttempt.js +67 -0
- package/dist/esm/models/RequestLogEntry.d.ts +25 -0
- package/dist/esm/models/RequestLogEntry.js +9 -0
- package/dist/esm/models/WebhookEndpoint.d.ts +1 -0
- package/dist/esm/models/WebhookEndpoint.js +2 -1
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/ApiKey.d.ts +19 -0
- package/dist/models/ApiKey.js +9 -0
- package/dist/models/ApiKeyCreate.d.ts +6 -0
- package/dist/models/ApiKeyCreate.js +2 -0
- package/dist/models/ApiKeyCreated.d.ts +19 -0
- package/dist/models/ApiKeyCreated.js +9 -0
- package/dist/models/ApiKeyFallbackEntry.d.ts +65 -0
- package/dist/models/ApiKeyFallbackEntry.js +75 -0
- package/dist/models/ApiKeyUpdate.d.ts +7 -1
- package/dist/models/ApiKeyUpdate.js +2 -0
- package/dist/models/ChatCompletionRequest.d.ts +6 -0
- package/dist/models/ChatCompletionRequest.js +2 -0
- package/dist/models/CreateWebhookEndpointRequest.d.ts +1 -0
- package/dist/models/CreateWebhookEndpointRequest.js +2 -1
- package/dist/models/RequestAttempt.d.ts +71 -0
- package/dist/models/RequestAttempt.js +75 -0
- package/dist/models/RequestLogEntry.d.ts +25 -0
- package/dist/models/RequestLogEntry.js +9 -0
- package/dist/models/WebhookEndpoint.d.ts +1 -0
- package/dist/models/WebhookEndpoint.js +2 -1
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/runtime.js +1 -1
- package/docs/ApiKey.md +6 -0
- package/docs/ApiKeyCreate.md +2 -0
- package/docs/ApiKeyCreated.md +6 -0
- package/docs/ApiKeyFallbackEntry.md +43 -0
- package/docs/ApiKeyUpdate.md +3 -1
- package/docs/ApiKeysApi.md +1 -1
- package/docs/ChatCompletionRequest.md +2 -0
- package/docs/InferenceApi.md +29 -26
- package/docs/RequestAttempt.md +45 -0
- package/docs/RequestLogEntry.md +8 -0
- package/docs/RequestsApi.md +9 -3
- package/package.json +1 -1
- package/src/apis/ApiKeysApi.ts +2 -2
- package/src/apis/InferenceApi.ts +7 -2
- package/src/apis/RequestsApi.ts +12 -2
- package/src/models/ApiKey.ts +32 -0
- package/src/models/ApiKeyCreate.ts +8 -0
- package/src/models/ApiKeyCreated.ts +32 -0
- package/src/models/ApiKeyFallbackEntry.ts +114 -0
- package/src/models/ApiKeyUpdate.ts +9 -1
- package/src/models/ChatCompletionRequest.ts +8 -0
- package/src/models/CreateWebhookEndpointRequest.ts +2 -1
- package/src/models/RequestAttempt.ts +121 -0
- package/src/models/RequestLogEntry.ts +40 -0
- package/src/models/WebhookEndpoint.ts +2 -1
- package/src/models/index.ts +2 -0
- package/src/runtime.ts +1 -1
package/.openapi-generator/FILES
CHANGED
|
@@ -8,6 +8,7 @@ docs/AlertsApi.md
|
|
|
8
8
|
docs/ApiKey.md
|
|
9
9
|
docs/ApiKeyCreate.md
|
|
10
10
|
docs/ApiKeyCreated.md
|
|
11
|
+
docs/ApiKeyFallbackEntry.md
|
|
11
12
|
docs/ApiKeyList.md
|
|
12
13
|
docs/ApiKeyScopes.md
|
|
13
14
|
docs/ApiKeyUpdate.md
|
|
@@ -51,6 +52,7 @@ docs/PeakWindow.md
|
|
|
51
52
|
docs/Problem.md
|
|
52
53
|
docs/RefereeStatus.md
|
|
53
54
|
docs/Referral.md
|
|
55
|
+
docs/RequestAttempt.md
|
|
54
56
|
docs/RequestLogEntry.md
|
|
55
57
|
docs/RequestLogPage.md
|
|
56
58
|
docs/RequestsApi.md
|
|
@@ -107,6 +109,7 @@ src/models/AlertSettingsUpdate.ts
|
|
|
107
109
|
src/models/ApiKey.ts
|
|
108
110
|
src/models/ApiKeyCreate.ts
|
|
109
111
|
src/models/ApiKeyCreated.ts
|
|
112
|
+
src/models/ApiKeyFallbackEntry.ts
|
|
110
113
|
src/models/ApiKeyList.ts
|
|
111
114
|
src/models/ApiKeyScopes.ts
|
|
112
115
|
src/models/ApiKeyUpdate.ts
|
|
@@ -146,6 +149,7 @@ src/models/PeakWindow.ts
|
|
|
146
149
|
src/models/Problem.ts
|
|
147
150
|
src/models/RefereeStatus.ts
|
|
148
151
|
src/models/Referral.ts
|
|
152
|
+
src/models/RequestAttempt.ts
|
|
149
153
|
src/models/RequestLogEntry.ts
|
|
150
154
|
src/models/RequestLogPage.ts
|
|
151
155
|
src/models/ResponseFormatJSONObject.ts
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @deeprelay/sdk@0.4.
|
|
1
|
+
# @deeprelay/sdk@0.4.2
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK client for the api.deeprelay.ai API.
|
|
4
4
|
|
|
@@ -99,6 +99,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
99
99
|
- [ApiKey](docs/ApiKey.md)
|
|
100
100
|
- [ApiKeyCreate](docs/ApiKeyCreate.md)
|
|
101
101
|
- [ApiKeyCreated](docs/ApiKeyCreated.md)
|
|
102
|
+
- [ApiKeyFallbackEntry](docs/ApiKeyFallbackEntry.md)
|
|
102
103
|
- [ApiKeyList](docs/ApiKeyList.md)
|
|
103
104
|
- [ApiKeyScopes](docs/ApiKeyScopes.md)
|
|
104
105
|
- [ApiKeyUpdate](docs/ApiKeyUpdate.md)
|
|
@@ -138,6 +139,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
138
139
|
- [Problem](docs/Problem.md)
|
|
139
140
|
- [RefereeStatus](docs/RefereeStatus.md)
|
|
140
141
|
- [Referral](docs/Referral.md)
|
|
142
|
+
- [RequestAttempt](docs/RequestAttempt.md)
|
|
141
143
|
- [RequestLogEntry](docs/RequestLogEntry.md)
|
|
142
144
|
- [RequestLogPage](docs/RequestLogPage.md)
|
|
143
145
|
- [ResponseFormatJSONObject](docs/ResponseFormatJSONObject.md)
|
|
@@ -192,7 +194,7 @@ and is automatically generated by the
|
|
|
192
194
|
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
193
195
|
|
|
194
196
|
- API version: `1.0.0`
|
|
195
|
-
- Package version: `0.4.
|
|
197
|
+
- Package version: `0.4.2`
|
|
196
198
|
- Generator version: `7.24.0`
|
|
197
199
|
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
|
|
198
200
|
|
|
@@ -95,12 +95,12 @@ export declare class ApiKeysApi extends runtime.BaseAPI {
|
|
|
95
95
|
*/
|
|
96
96
|
updateApiKeyRequestOpts(requestParameters: UpdateApiKeyRequest): Promise<runtime.RequestOpts>;
|
|
97
97
|
/**
|
|
98
|
-
* 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.
|
|
98
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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.
|
|
99
99
|
* Update an API key\'s name or limits
|
|
100
100
|
*/
|
|
101
101
|
updateApiKeyRaw(requestParameters: UpdateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiKey>>;
|
|
102
102
|
/**
|
|
103
|
-
* 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.
|
|
103
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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.
|
|
104
104
|
* Update an API key\'s name or limits
|
|
105
105
|
*/
|
|
106
106
|
updateApiKey(requestParameters: UpdateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiKey>;
|
package/dist/apis/ApiKeysApi.js
CHANGED
|
@@ -260,7 +260,7 @@ class ApiKeysApi extends runtime.BaseAPI {
|
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
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.
|
|
263
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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
264
|
* Update an API key\'s name or limits
|
|
265
265
|
*/
|
|
266
266
|
updateApiKeyRaw(requestParameters, initOverrides) {
|
|
@@ -271,7 +271,7 @@ class ApiKeysApi extends runtime.BaseAPI {
|
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
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.
|
|
274
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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
275
|
* Update an API key\'s name or limits
|
|
276
276
|
*/
|
|
277
277
|
updateApiKey(requestParameters, initOverrides) {
|
|
@@ -28,6 +28,7 @@ export interface CancelVideoRequest {
|
|
|
28
28
|
export interface CreateChatCompletionRequest {
|
|
29
29
|
chatCompletionRequest: ChatCompletionRequest;
|
|
30
30
|
xClientRequestId?: string;
|
|
31
|
+
xDeeprelayFallbackModels?: string;
|
|
31
32
|
}
|
|
32
33
|
export interface CreateEmbeddingsRequest {
|
|
33
34
|
embeddingsRequest: EmbeddingsRequest;
|
|
@@ -84,12 +85,12 @@ export declare class InferenceApi extends runtime.BaseAPI {
|
|
|
84
85
|
*/
|
|
85
86
|
createChatCompletionRequestOpts(requestParameters: CreateChatCompletionRequest): Promise<runtime.RequestOpts>;
|
|
86
87
|
/**
|
|
87
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
88
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
88
89
|
* Create a chat completion (OpenAI-compatible)
|
|
89
90
|
*/
|
|
90
91
|
createChatCompletionRaw(requestParameters: CreateChatCompletionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChatCompletionResponse>>;
|
|
91
92
|
/**
|
|
92
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
93
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
93
94
|
* Create a chat completion (OpenAI-compatible)
|
|
94
95
|
*/
|
|
95
96
|
createChatCompletion(requestParameters: CreateChatCompletionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChatCompletionResponse>;
|
|
@@ -100,6 +100,9 @@ class InferenceApi extends runtime.BaseAPI {
|
|
|
100
100
|
if (requestParameters['xClientRequestId'] != null) {
|
|
101
101
|
headerParameters['X-Client-Request-Id'] = String(requestParameters['xClientRequestId']);
|
|
102
102
|
}
|
|
103
|
+
if (requestParameters['xDeeprelayFallbackModels'] != null) {
|
|
104
|
+
headerParameters['X-Deeprelay-Fallback-Models'] = String(requestParameters['xDeeprelayFallbackModels']);
|
|
105
|
+
}
|
|
103
106
|
if (this.configuration && this.configuration.accessToken) {
|
|
104
107
|
const token = this.configuration.accessToken;
|
|
105
108
|
const tokenString = yield token("bearerAuth", []);
|
|
@@ -118,7 +121,7 @@ class InferenceApi extends runtime.BaseAPI {
|
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
123
|
/**
|
|
121
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
124
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
122
125
|
* Create a chat completion (OpenAI-compatible)
|
|
123
126
|
*/
|
|
124
127
|
createChatCompletionRaw(requestParameters, initOverrides) {
|
|
@@ -129,7 +132,7 @@ class InferenceApi extends runtime.BaseAPI {
|
|
|
129
132
|
});
|
|
130
133
|
}
|
|
131
134
|
/**
|
|
132
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
135
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
133
136
|
* Create a chat completion (OpenAI-compatible)
|
|
134
137
|
*/
|
|
135
138
|
createChatCompletion(requestParameters, initOverrides) {
|
|
@@ -21,6 +21,7 @@ export interface ExportRequestsRequest {
|
|
|
21
21
|
clientRequestId?: string;
|
|
22
22
|
from?: Date;
|
|
23
23
|
to?: Date;
|
|
24
|
+
fallback?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export interface GetRequestRequest {
|
|
26
27
|
id: string;
|
|
@@ -34,6 +35,7 @@ export interface ListRequestsRequest {
|
|
|
34
35
|
clientRequestId?: string;
|
|
35
36
|
from?: Date;
|
|
36
37
|
to?: Date;
|
|
38
|
+
fallback?: boolean;
|
|
37
39
|
cursor?: string;
|
|
38
40
|
limit?: number;
|
|
39
41
|
}
|
|
@@ -46,12 +48,12 @@ export declare class RequestsApi extends runtime.BaseAPI {
|
|
|
46
48
|
*/
|
|
47
49
|
exportRequestsRequestOpts(requestParameters: ExportRequestsRequest): Promise<runtime.RequestOpts>;
|
|
48
50
|
/**
|
|
49
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
51
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
50
52
|
* Export the request log as CSV
|
|
51
53
|
*/
|
|
52
54
|
exportRequestsRaw(requestParameters: ExportRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
|
|
53
55
|
/**
|
|
54
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
56
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
55
57
|
* Export the request log as CSV
|
|
56
58
|
*/
|
|
57
59
|
exportRequests(requestParameters?: ExportRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
|
package/dist/apis/RequestsApi.js
CHANGED
|
@@ -60,6 +60,9 @@ class RequestsApi extends runtime.BaseAPI {
|
|
|
60
60
|
if (requestParameters['to'] != null) {
|
|
61
61
|
queryParameters['to'] = requestParameters['to'].toISOString();
|
|
62
62
|
}
|
|
63
|
+
if (requestParameters['fallback'] != null) {
|
|
64
|
+
queryParameters['fallback'] = requestParameters['fallback'];
|
|
65
|
+
}
|
|
63
66
|
const headerParameters = {};
|
|
64
67
|
if (this.configuration && this.configuration.accessToken) {
|
|
65
68
|
const token = this.configuration.accessToken;
|
|
@@ -78,7 +81,7 @@ class RequestsApi extends runtime.BaseAPI {
|
|
|
78
81
|
});
|
|
79
82
|
}
|
|
80
83
|
/**
|
|
81
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
84
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
82
85
|
* Export the request log as CSV
|
|
83
86
|
*/
|
|
84
87
|
exportRequestsRaw(requestParameters, initOverrides) {
|
|
@@ -94,7 +97,7 @@ class RequestsApi extends runtime.BaseAPI {
|
|
|
94
97
|
});
|
|
95
98
|
}
|
|
96
99
|
/**
|
|
97
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
100
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
98
101
|
* Export the request log as CSV
|
|
99
102
|
*/
|
|
100
103
|
exportRequests() {
|
|
@@ -181,6 +184,9 @@ class RequestsApi extends runtime.BaseAPI {
|
|
|
181
184
|
if (requestParameters['to'] != null) {
|
|
182
185
|
queryParameters['to'] = requestParameters['to'].toISOString();
|
|
183
186
|
}
|
|
187
|
+
if (requestParameters['fallback'] != null) {
|
|
188
|
+
queryParameters['fallback'] = requestParameters['fallback'];
|
|
189
|
+
}
|
|
184
190
|
if (requestParameters['cursor'] != null) {
|
|
185
191
|
queryParameters['cursor'] = requestParameters['cursor'];
|
|
186
192
|
}
|
|
@@ -95,12 +95,12 @@ export declare class ApiKeysApi extends runtime.BaseAPI {
|
|
|
95
95
|
*/
|
|
96
96
|
updateApiKeyRequestOpts(requestParameters: UpdateApiKeyRequest): Promise<runtime.RequestOpts>;
|
|
97
97
|
/**
|
|
98
|
-
* 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.
|
|
98
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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.
|
|
99
99
|
* Update an API key\'s name or limits
|
|
100
100
|
*/
|
|
101
101
|
updateApiKeyRaw(requestParameters: UpdateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiKey>>;
|
|
102
102
|
/**
|
|
103
|
-
* 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.
|
|
103
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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.
|
|
104
104
|
* Update an API key\'s name or limits
|
|
105
105
|
*/
|
|
106
106
|
updateApiKey(requestParameters: UpdateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiKey>;
|
|
@@ -257,7 +257,7 @@ export class ApiKeysApi extends runtime.BaseAPI {
|
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
|
-
* 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.
|
|
260
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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.
|
|
261
261
|
* Update an API key\'s name or limits
|
|
262
262
|
*/
|
|
263
263
|
updateApiKeyRaw(requestParameters, initOverrides) {
|
|
@@ -268,7 +268,7 @@ export class ApiKeysApi extends runtime.BaseAPI {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
/**
|
|
271
|
-
* 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.
|
|
271
|
+
* Changes a key\'s name, budget, model allowlist, backup models, rate limit or expiry. An absent field is left unchanged; an explicit `null` clears `budget_cents`, `allowed_models`, `fallback_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.
|
|
272
272
|
* Update an API key\'s name or limits
|
|
273
273
|
*/
|
|
274
274
|
updateApiKey(requestParameters, initOverrides) {
|
|
@@ -28,6 +28,7 @@ export interface CancelVideoRequest {
|
|
|
28
28
|
export interface CreateChatCompletionRequest {
|
|
29
29
|
chatCompletionRequest: ChatCompletionRequest;
|
|
30
30
|
xClientRequestId?: string;
|
|
31
|
+
xDeeprelayFallbackModels?: string;
|
|
31
32
|
}
|
|
32
33
|
export interface CreateEmbeddingsRequest {
|
|
33
34
|
embeddingsRequest: EmbeddingsRequest;
|
|
@@ -84,12 +85,12 @@ export declare class InferenceApi extends runtime.BaseAPI {
|
|
|
84
85
|
*/
|
|
85
86
|
createChatCompletionRequestOpts(requestParameters: CreateChatCompletionRequest): Promise<runtime.RequestOpts>;
|
|
86
87
|
/**
|
|
87
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
88
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
88
89
|
* Create a chat completion (OpenAI-compatible)
|
|
89
90
|
*/
|
|
90
91
|
createChatCompletionRaw(requestParameters: CreateChatCompletionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChatCompletionResponse>>;
|
|
91
92
|
/**
|
|
92
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
93
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
93
94
|
* Create a chat completion (OpenAI-compatible)
|
|
94
95
|
*/
|
|
95
96
|
createChatCompletion(requestParameters: CreateChatCompletionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChatCompletionResponse>;
|
|
@@ -97,6 +97,9 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
97
97
|
if (requestParameters['xClientRequestId'] != null) {
|
|
98
98
|
headerParameters['X-Client-Request-Id'] = String(requestParameters['xClientRequestId']);
|
|
99
99
|
}
|
|
100
|
+
if (requestParameters['xDeeprelayFallbackModels'] != null) {
|
|
101
|
+
headerParameters['X-Deeprelay-Fallback-Models'] = String(requestParameters['xDeeprelayFallbackModels']);
|
|
102
|
+
}
|
|
100
103
|
if (this.configuration && this.configuration.accessToken) {
|
|
101
104
|
const token = this.configuration.accessToken;
|
|
102
105
|
const tokenString = yield token("bearerAuth", []);
|
|
@@ -115,7 +118,7 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
115
118
|
});
|
|
116
119
|
}
|
|
117
120
|
/**
|
|
118
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
121
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
119
122
|
* Create a chat completion (OpenAI-compatible)
|
|
120
123
|
*/
|
|
121
124
|
createChatCompletionRaw(requestParameters, initOverrides) {
|
|
@@ -126,7 +129,7 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
/**
|
|
129
|
-
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
132
|
+
* OpenAI-compatible chat completion. Parameters fall into three groups: - **Semantic parameters are gated per model.** `response_format`, `tools`/`tool_choice`, `logprobs`/`top_logprobs` and `image_url` content parts are sent only to a model whose `/v1/models` entry lists the capability in `supported_parameters` (`vision` for images). A model without it returns 400 `unsupported_parameter` whose message names the models that do support it. When the model supports the parameter but none of its currently routable upstreams does, the request fails with 503 `upstream_unavailable` rather than being silently degraded. - **Hints are forwarded or dropped, never rejected.** `reasoning_effort`, `presence_penalty`, `frequency_penalty`, `seed` and `parallel_tool_calls` are forwarded to an upstream that accepts them and otherwise dropped. Every drop is reported in the `x-deeprelay-ignored-params` response header. - **Rejected everywhere.** `logit_bias` and `function_call` return 400 `unsupported_parameter`; `input_audio` and `file` content parts return 400 `unsupported_content_part`. A non-strict `json_schema` sent to a model that can only guarantee JSON is served as `json_object` and reported as `response_format:downgraded`; a strict one is rejected. A `json_schema` over 64 KiB or nested deeper than 32 levels returns 400 `unsupported_parameter` (param `response_format`). An upstream rejection of a request the relay accepted returns 400 `upstream_rejected_request`. A non-chat model id returns 404 `model_not_found`. The request body is capped at 32 MiB (413 `request_too_large`). Every successful response carries `usage.cost` and `usage.cost_details` (on a stream, only in the final usage chunk). See https://deeprelay.ai/docs/api/inference#openai-compatibility. **Backup models.** When the API key has `fallback_models`, or the request sends `models` or X-Deeprelay-Fallback-Models, and every provider for the requested model fails before the first token with a temporary error (unavailable, timed out, rate limited upstream, or stalled), deeprelay tries the next backup model. It never switches after the first byte, and never on a client error, a quota or budget refusal, or a content-filter result. A backup is billed at its own price under the same billing mode as the requested model. The body `model` and X-Deeprelay-Served-Model name the model that served; X-Deeprelay-Requested-Model names the one asked for, and X-Deeprelay-Fallback-Reason says why it was passed over. If no model serves, the response is the requested model\'s own error, with X-Deeprelay-Fallback-Attempted.
|
|
130
133
|
* Create a chat completion (OpenAI-compatible)
|
|
131
134
|
*/
|
|
132
135
|
createChatCompletion(requestParameters, initOverrides) {
|
|
@@ -21,6 +21,7 @@ export interface ExportRequestsRequest {
|
|
|
21
21
|
clientRequestId?: string;
|
|
22
22
|
from?: Date;
|
|
23
23
|
to?: Date;
|
|
24
|
+
fallback?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export interface GetRequestRequest {
|
|
26
27
|
id: string;
|
|
@@ -34,6 +35,7 @@ export interface ListRequestsRequest {
|
|
|
34
35
|
clientRequestId?: string;
|
|
35
36
|
from?: Date;
|
|
36
37
|
to?: Date;
|
|
38
|
+
fallback?: boolean;
|
|
37
39
|
cursor?: string;
|
|
38
40
|
limit?: number;
|
|
39
41
|
}
|
|
@@ -46,12 +48,12 @@ export declare class RequestsApi extends runtime.BaseAPI {
|
|
|
46
48
|
*/
|
|
47
49
|
exportRequestsRequestOpts(requestParameters: ExportRequestsRequest): Promise<runtime.RequestOpts>;
|
|
48
50
|
/**
|
|
49
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
51
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
50
52
|
* Export the request log as CSV
|
|
51
53
|
*/
|
|
52
54
|
exportRequestsRaw(requestParameters: ExportRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
|
|
53
55
|
/**
|
|
54
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
56
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
55
57
|
* Export the request log as CSV
|
|
56
58
|
*/
|
|
57
59
|
exportRequests(requestParameters?: ExportRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
|
|
@@ -57,6 +57,9 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
57
57
|
if (requestParameters['to'] != null) {
|
|
58
58
|
queryParameters['to'] = requestParameters['to'].toISOString();
|
|
59
59
|
}
|
|
60
|
+
if (requestParameters['fallback'] != null) {
|
|
61
|
+
queryParameters['fallback'] = requestParameters['fallback'];
|
|
62
|
+
}
|
|
60
63
|
const headerParameters = {};
|
|
61
64
|
if (this.configuration && this.configuration.accessToken) {
|
|
62
65
|
const token = this.configuration.accessToken;
|
|
@@ -75,7 +78,7 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
75
78
|
});
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
81
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
79
82
|
* Export the request log as CSV
|
|
80
83
|
*/
|
|
81
84
|
exportRequestsRaw(requestParameters, initOverrides) {
|
|
@@ -91,7 +94,7 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
91
94
|
});
|
|
92
95
|
}
|
|
93
96
|
/**
|
|
94
|
-
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
97
|
+
* Streams every request-log row matching the filters as a CSV attachment, oldest columns first: `request_id, client_request_id, occurred_at, surface, model, key_id, key_name, key_prefix, status, http_status, error_code, finish_reason, prompt_tokens, completion_tokens, cached_tokens, reasoning_tokens, quota_units, cost, plan_covered, ttft_ms, duration_ms, ignored_params, requested_model, served_model, fallback_reason`. Takes the same filters and visibility rules as `GET /requests`, without the cursor and limit. The export is counted before anything is written. When the filters match more rows than the export cap, the answer is 422 `export_too_large` and the problem body carries `max_rows`; narrow the time range or add a filter, then export again. Requires the `serverless:read` scope. Exports have their own, tighter per-key rate limit.
|
|
95
98
|
* Export the request log as CSV
|
|
96
99
|
*/
|
|
97
100
|
exportRequests() {
|
|
@@ -178,6 +181,9 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
178
181
|
if (requestParameters['to'] != null) {
|
|
179
182
|
queryParameters['to'] = requestParameters['to'].toISOString();
|
|
180
183
|
}
|
|
184
|
+
if (requestParameters['fallback'] != null) {
|
|
185
|
+
queryParameters['fallback'] = requestParameters['fallback'];
|
|
186
|
+
}
|
|
181
187
|
if (requestParameters['cursor'] != null) {
|
|
182
188
|
queryParameters['cursor'] = requestParameters['cursor'];
|
|
183
189
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import type { ApiKeyScopes } from './ApiKeyScopes';
|
|
13
|
+
import type { ApiKeyFallbackEntry } from './ApiKeyFallbackEntry';
|
|
13
14
|
/**
|
|
14
15
|
* An API key's metadata and limits. Never carries the secret.
|
|
15
16
|
* @export
|
|
@@ -76,6 +77,24 @@ export interface ApiKey {
|
|
|
76
77
|
* @memberof ApiKey
|
|
77
78
|
*/
|
|
78
79
|
staleModels?: Array<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Backup models in priority order, applied to every model this key calls. Null means model fallback is off (the default). If every provider for the requested model fails before the first token with a temporary error, the next entry is tried. Entries are kept when a model leaves the plan roster or the catalog and are skipped at request time; see `fallback_entries`. Not applied to Liquid.
|
|
82
|
+
* @type {Array<string>}
|
|
83
|
+
* @memberof ApiKey
|
|
84
|
+
*/
|
|
85
|
+
fallbackModels: Array<string> | null;
|
|
86
|
+
/**
|
|
87
|
+
* Present when `fallback_models` is set: one entry per backup, in order, explaining it as of now.
|
|
88
|
+
* @type {Array<ApiKeyFallbackEntry>}
|
|
89
|
+
* @memberof ApiKey
|
|
90
|
+
*/
|
|
91
|
+
fallbackEntries?: Array<ApiKeyFallbackEntry>;
|
|
92
|
+
/**
|
|
93
|
+
* The model this key requested most over the last 30 days, which `above_primary` is measured against. Present only for a key with `fallback_models` and recent usage.
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @memberof ApiKey
|
|
96
|
+
*/
|
|
97
|
+
primaryModel?: string;
|
|
79
98
|
/**
|
|
80
99
|
*
|
|
81
100
|
* @type {number}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
import { ApiKeyScopesFromJSON, ApiKeyScopesToJSON, } from './ApiKeyScopes';
|
|
15
|
+
import { ApiKeyFallbackEntryFromJSON, ApiKeyFallbackEntryToJSON, } from './ApiKeyFallbackEntry';
|
|
15
16
|
/**
|
|
16
17
|
* Check if a given object implements the ApiKey interface.
|
|
17
18
|
*/
|
|
@@ -30,6 +31,8 @@ export function instanceOfApiKey(value) {
|
|
|
30
31
|
return false;
|
|
31
32
|
if ((!('allowedModels' in value) && !('allowed_models' in value)) || (value['allowedModels'] === undefined && value['allowed_models'] === undefined))
|
|
32
33
|
return false;
|
|
34
|
+
if ((!('fallbackModels' in value) && !('fallback_models' in value)) || (value['fallbackModels'] === undefined && value['fallback_models'] === undefined))
|
|
35
|
+
return false;
|
|
33
36
|
if ((!('rateLimitRps' in value) && !('rate_limit_rps' in value)) || (value['rateLimitRps'] === undefined && value['rate_limit_rps'] === undefined))
|
|
34
37
|
return false;
|
|
35
38
|
if ((!('rateLimitBurst' in value) && !('rate_limit_burst' in value)) || (value['rateLimitBurst'] === undefined && value['rate_limit_burst'] === undefined))
|
|
@@ -60,6 +63,9 @@ export function ApiKeyFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
60
63
|
'budgetResetsAt': json['budget_resets_at'] == null ? undefined : (new Date(json['budget_resets_at'])),
|
|
61
64
|
'allowedModels': json['allowed_models'] == null ? null : json['allowed_models'],
|
|
62
65
|
'staleModels': json['stale_models'] == null ? undefined : json['stale_models'],
|
|
66
|
+
'fallbackModels': json['fallback_models'] == null ? null : json['fallback_models'],
|
|
67
|
+
'fallbackEntries': json['fallback_entries'] == null ? undefined : (json['fallback_entries'].map(ApiKeyFallbackEntryFromJSON)),
|
|
68
|
+
'primaryModel': json['primary_model'] == null ? undefined : json['primary_model'],
|
|
63
69
|
'rateLimitRps': json['rate_limit_rps'],
|
|
64
70
|
'rateLimitBurst': json['rate_limit_burst'],
|
|
65
71
|
'expiresAt': (json['expires_at'] == null ? null : new Date(json['expires_at'])),
|
|
@@ -86,6 +92,9 @@ export function ApiKeyToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
86
92
|
'budget_resets_at': value['budgetResetsAt'] == null ? value['budgetResetsAt'] : value['budgetResetsAt'].toISOString(),
|
|
87
93
|
'allowed_models': value['allowedModels'],
|
|
88
94
|
'stale_models': value['staleModels'],
|
|
95
|
+
'fallback_models': value['fallbackModels'],
|
|
96
|
+
'fallback_entries': value['fallbackEntries'] == null ? undefined : (value['fallbackEntries'].map(ApiKeyFallbackEntryToJSON)),
|
|
97
|
+
'primary_model': value['primaryModel'],
|
|
89
98
|
'rate_limit_rps': value['rateLimitRps'],
|
|
90
99
|
'rate_limit_burst': value['rateLimitBurst'],
|
|
91
100
|
'expires_at': value['expiresAt'] == null ? value['expiresAt'] : value['expiresAt'].toISOString(),
|
|
@@ -41,6 +41,12 @@ export interface ApiKeyCreate {
|
|
|
41
41
|
* @memberof ApiKeyCreate
|
|
42
42
|
*/
|
|
43
43
|
allowedModels?: Array<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Backup models in priority order. Omit it to leave model fallback off. Each entry must be a chat model in the catalog and, when the key has `allowed_models`, on that list. Duplicates are removed. An empty array, more than 3 models or an invalid entry is a 422 `validation_failed` naming the `fallback_models` field.
|
|
46
|
+
* @type {Array<string>}
|
|
47
|
+
* @memberof ApiKeyCreate
|
|
48
|
+
*/
|
|
49
|
+
fallbackModels?: Array<string>;
|
|
44
50
|
/**
|
|
45
51
|
*
|
|
46
52
|
* @type {number}
|
|
@@ -33,6 +33,7 @@ export function ApiKeyCreateFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
33
33
|
'scopes': json['scopes'],
|
|
34
34
|
'budgetCents': json['budget_cents'] == null ? undefined : json['budget_cents'],
|
|
35
35
|
'allowedModels': json['allowed_models'] == null ? undefined : json['allowed_models'],
|
|
36
|
+
'fallbackModels': json['fallback_models'] == null ? undefined : json['fallback_models'],
|
|
36
37
|
'rateLimitRps': json['rate_limit_rps'] == null ? undefined : json['rate_limit_rps'],
|
|
37
38
|
'rateLimitBurst': json['rate_limit_burst'] == null ? undefined : json['rate_limit_burst'],
|
|
38
39
|
'expiresAt': json['expires_at'] == null ? undefined : (new Date(json['expires_at'])),
|
|
@@ -50,6 +51,7 @@ export function ApiKeyCreateToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
50
51
|
'scopes': value['scopes'],
|
|
51
52
|
'budget_cents': value['budgetCents'],
|
|
52
53
|
'allowed_models': value['allowedModels'],
|
|
54
|
+
'fallback_models': value['fallbackModels'],
|
|
53
55
|
'rate_limit_rps': value['rateLimitRps'],
|
|
54
56
|
'rate_limit_burst': value['rateLimitBurst'],
|
|
55
57
|
'expires_at': value['expiresAt'] == null ? value['expiresAt'] : value['expiresAt'].toISOString(),
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import type { ApiKeyScopes } from './ApiKeyScopes';
|
|
13
|
+
import type { ApiKeyFallbackEntry } from './ApiKeyFallbackEntry';
|
|
13
14
|
/**
|
|
14
15
|
* The new key's metadata plus its secret (`key`), returned exactly once. The same fields as `ApiKey`, plus `key`.
|
|
15
16
|
* @export
|
|
@@ -76,6 +77,24 @@ export interface ApiKeyCreated {
|
|
|
76
77
|
* @memberof ApiKeyCreated
|
|
77
78
|
*/
|
|
78
79
|
staleModels?: Array<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Backup models in priority order, applied to every model this key calls. Null means model fallback is off (the default). If every provider for the requested model fails before the first token with a temporary error, the next entry is tried. Entries are kept when a model leaves the plan roster or the catalog and are skipped at request time; see `fallback_entries`. Not applied to Liquid.
|
|
82
|
+
* @type {Array<string>}
|
|
83
|
+
* @memberof ApiKeyCreated
|
|
84
|
+
*/
|
|
85
|
+
fallbackModels: Array<string> | null;
|
|
86
|
+
/**
|
|
87
|
+
* Present when `fallback_models` is set: one entry per backup, in order, explaining it as of now.
|
|
88
|
+
* @type {Array<ApiKeyFallbackEntry>}
|
|
89
|
+
* @memberof ApiKeyCreated
|
|
90
|
+
*/
|
|
91
|
+
fallbackEntries?: Array<ApiKeyFallbackEntry>;
|
|
92
|
+
/**
|
|
93
|
+
* The model this key requested most over the last 30 days, which `above_primary` is measured against. Present only for a key with `fallback_models` and recent usage.
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @memberof ApiKeyCreated
|
|
96
|
+
*/
|
|
97
|
+
primaryModel?: string;
|
|
79
98
|
/**
|
|
80
99
|
*
|
|
81
100
|
* @type {number}
|