@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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
# ApiKeyFallbackEntry
|
|
3
|
+
|
|
4
|
+
One backup model on a key, as it stands now.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`model` | string
|
|
11
|
+
`state` | string
|
|
12
|
+
`inputPer1mTokensMicrocents` | number
|
|
13
|
+
`outputPer1mTokensMicrocents` | number
|
|
14
|
+
`abovePrimary` | boolean
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import type { ApiKeyFallbackEntry } from '@deeprelay/sdk'
|
|
20
|
+
|
|
21
|
+
// TODO: Update the object below with actual values
|
|
22
|
+
const example = {
|
|
23
|
+
"model": null,
|
|
24
|
+
"state": null,
|
|
25
|
+
"inputPer1mTokensMicrocents": null,
|
|
26
|
+
"outputPer1mTokensMicrocents": null,
|
|
27
|
+
"abovePrimary": null,
|
|
28
|
+
} satisfies ApiKeyFallbackEntry
|
|
29
|
+
|
|
30
|
+
console.log(example)
|
|
31
|
+
|
|
32
|
+
// Convert the instance to a JSON string
|
|
33
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
34
|
+
console.log(exampleJSON)
|
|
35
|
+
|
|
36
|
+
// Parse the JSON string back to an object
|
|
37
|
+
const exampleParsed = JSON.parse(exampleJSON) as ApiKeyFallbackEntry
|
|
38
|
+
console.log(exampleParsed)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
42
|
+
|
|
43
|
+
|
package/docs/ApiKeyUpdate.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# ApiKeyUpdate
|
|
3
3
|
|
|
4
|
-
Send only the fields to change. `null` clears `budget_cents`, `allowed_models` or `expires_at`. `scopes` cannot be changed.
|
|
4
|
+
Send only the fields to change. `null` clears `budget_cents`, `allowed_models`, `fallback_models` or `expires_at`. `scopes` cannot be changed.
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
|
@@ -10,6 +10,7 @@ Name | Type
|
|
|
10
10
|
`name` | string
|
|
11
11
|
`budgetCents` | number
|
|
12
12
|
`allowedModels` | Array<string>
|
|
13
|
+
`fallbackModels` | Array<string>
|
|
13
14
|
`rateLimitRps` | number
|
|
14
15
|
`rateLimitBurst` | number
|
|
15
16
|
`expiresAt` | Date
|
|
@@ -24,6 +25,7 @@ const example = {
|
|
|
24
25
|
"name": null,
|
|
25
26
|
"budgetCents": null,
|
|
26
27
|
"allowedModels": null,
|
|
28
|
+
"fallbackModels": null,
|
|
27
29
|
"rateLimitRps": null,
|
|
28
30
|
"rateLimitBurst": null,
|
|
29
31
|
"expiresAt": null,
|
package/docs/ApiKeysApi.md
CHANGED
|
@@ -311,7 +311,7 @@ example().catch(console.error);
|
|
|
311
311
|
|
|
312
312
|
Update an API key\'s name or limits
|
|
313
313
|
|
|
314
|
-
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.
|
|
314
|
+
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.
|
|
315
315
|
|
|
316
316
|
### Example
|
|
317
317
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
Name | Type
|
|
8
8
|
------------ | -------------
|
|
9
9
|
`model` | string
|
|
10
|
+
`models` | Array<string>
|
|
10
11
|
`messages` | [Array<ChatMessage>](ChatMessage.md)
|
|
11
12
|
`temperature` | number
|
|
12
13
|
`maxTokens` | number
|
|
@@ -32,6 +33,7 @@ import type { ChatCompletionRequest } from '@deeprelay/sdk'
|
|
|
32
33
|
// TODO: Update the object below with actual values
|
|
33
34
|
const example = {
|
|
34
35
|
"model": null,
|
|
36
|
+
"models": null,
|
|
35
37
|
"messages": null,
|
|
36
38
|
"temperature": null,
|
|
37
39
|
"maxTokens": null,
|
package/docs/InferenceApi.md
CHANGED
|
@@ -86,19 +86,19 @@ example().catch(console.error);
|
|
|
86
86
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
87
87
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
88
88
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
89
|
-
| **409** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
90
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
89
|
+
| **409** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
90
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
91
91
|
|
|
92
92
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
## createChatCompletion
|
|
96
96
|
|
|
97
|
-
> ChatCompletionResponse createChatCompletion(chatCompletionRequest, xClientRequestId)
|
|
97
|
+
> ChatCompletionResponse createChatCompletion(chatCompletionRequest, xClientRequestId, xDeeprelayFallbackModels)
|
|
98
98
|
|
|
99
99
|
Create a chat completion (OpenAI-compatible)
|
|
100
100
|
|
|
101
|
-
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.
|
|
101
|
+
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.
|
|
102
102
|
|
|
103
103
|
### Example
|
|
104
104
|
|
|
@@ -122,6 +122,8 @@ async function example() {
|
|
|
122
122
|
chatCompletionRequest: ...,
|
|
123
123
|
// string | Your own correlation id for this call, up to 128 characters. It is stored on the request-log row as `client_request_id` and can be filtered on with `GET /requests?client_request_id=`. When it is absent, an inbound `X-Request-Id` is kept in its place; the response\'s own `X-Request-Id` is always minted by deeprelay. Surrounding whitespace and control characters are removed; a longer value is dropped, never truncated. It is never used as a lookup key, so it does not need to be unique. (optional)
|
|
124
124
|
xClientRequestId: xClientRequestId_example,
|
|
125
|
+
// string | Backup models for this request only, in priority order: a comma-separated list of up to 3 model ids, for example `deeprelay/glm-5.3,deeprelay/kimi-k3`. It replaces the API key\'s `fallback_models` for this request; the two lists are never merged. `none` (or an empty value) turns model fallback off for this request. If every provider for the requested model fails before the first token with a temporary error, deeprelay tries the next listed model. Each backup must still pass the key\'s model allowlist, the request\'s billing mode and the request\'s capability needs; one that does not is skipped, so this header can never widen what the key may call. More than 3 models, a malformed id, `none` mixed with ids, or this header together with a `models` body field is a 400 `invalid_request`. Not accepted by Liquid, which always serves exactly the requested model. (optional)
|
|
126
|
+
xDeeprelayFallbackModels: deeprelay/glm-5.3,deeprelay/kimi-k3,
|
|
125
127
|
} satisfies CreateChatCompletionRequest;
|
|
126
128
|
|
|
127
129
|
try {
|
|
@@ -143,6 +145,7 @@ example().catch(console.error);
|
|
|
143
145
|
|------------- | ------------- | ------------- | -------------|
|
|
144
146
|
| **chatCompletionRequest** | [ChatCompletionRequest](ChatCompletionRequest.md) | | |
|
|
145
147
|
| **xClientRequestId** | `string` | Your own correlation id for this call, up to 128 characters. It is stored on the request-log row as `client_request_id` and can be filtered on with `GET /requests?client_request_id=`. When it is absent, an inbound `X-Request-Id` is kept in its place; the response\'s own `X-Request-Id` is always minted by deeprelay. Surrounding whitespace and control characters are removed; a longer value is dropped, never truncated. It is never used as a lookup key, so it does not need to be unique. | [Optional] [Defaults to `undefined`] |
|
|
148
|
+
| **xDeeprelayFallbackModels** | `string` | Backup models for this request only, in priority order: a comma-separated list of up to 3 model ids, for example `deeprelay/glm-5.3,deeprelay/kimi-k3`. It replaces the API key\'s `fallback_models` for this request; the two lists are never merged. `none` (or an empty value) turns model fallback off for this request. If every provider for the requested model fails before the first token with a temporary error, deeprelay tries the next listed model. Each backup must still pass the key\'s model allowlist, the request\'s billing mode and the request\'s capability needs; one that does not is skipped, so this header can never widen what the key may call. More than 3 models, a malformed id, `none` mixed with ids, or this header together with a `models` body field is a 400 `invalid_request`. Not accepted by Liquid, which always serves exactly the requested model. | [Optional] [Defaults to `undefined`] |
|
|
146
149
|
|
|
147
150
|
### Return type
|
|
148
151
|
|
|
@@ -161,17 +164,17 @@ example().catch(console.error);
|
|
|
161
164
|
### HTTP response details
|
|
162
165
|
| Status code | Description | Response headers |
|
|
163
166
|
|-------------|-------------|------------------|
|
|
164
|
-
| **200** | Successful response. application/json for non-streaming requests; text/event-stream for streaming requests (stream=true). | * x-deeprelay-ignored-params - <br> * x-deeprelay-cost - <br> * x-deeprelay-quota-input-remaining - <br> * x-deeprelay-quota-output-remaining - <br> * x-deeprelay-quota-reset - <br> * x-deeprelay-quota-weekly-input-remaining - <br> * x-deeprelay-quota-weekly-input-limit - <br> * x-deeprelay-quota-weekly-output-remaining - <br> * x-deeprelay-quota-weekly-output-limit - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> |
|
|
165
|
-
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
167
|
+
| **200** | Successful response. application/json for non-streaming requests; text/event-stream for streaming requests (stream=true). | * X-Deeprelay-Served-Model - <br> * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Reason - <br> * x-deeprelay-ignored-params - <br> * x-deeprelay-cost - <br> * x-deeprelay-quota-input-remaining - <br> * x-deeprelay-quota-output-remaining - <br> * x-deeprelay-quota-reset - <br> * x-deeprelay-quota-weekly-input-remaining - <br> * x-deeprelay-quota-weekly-input-limit - <br> * x-deeprelay-quota-weekly-output-remaining - <br> * x-deeprelay-quota-weekly-output-limit - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> |
|
|
168
|
+
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
166
169
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
167
170
|
| **402** | Insufficient balance or a spend limit reached (OpenAI error envelope, SERV-06): `insufficient_balance`, `daily_limit_reached`, `spending_limit_reached`, `api_key_budget_exceeded` (this API key\'s monthly budget) or `member_spend_limit_reached` (the member\'s monthly spend limit). Carries `x-should-retry: false`: the same request will not succeed until the wallet or the limit changes. | * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
168
171
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
169
172
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
170
173
|
| **413** | Request body too large (OpenAI error envelope, code request_too_large). | * X-Deeprelay-Error-Code - <br> |
|
|
171
174
|
| **422** | Request validation failed (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
172
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
175
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
173
176
|
| **500** | Internal server error (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
174
|
-
| **503** | No upstream could serve the request (OpenAI error envelope, `upstream_unavailable`): every capable upstream is down, shedding load, or none of the model\'s routable upstreams supports a capability the request needs. Always carries Retry-After (whole seconds, rounded up) and retry-after-ms; on an overload the wait is jittered between 2 and 2.5 seconds. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * X-Deeprelay-Error-Code - <br> |
|
|
177
|
+
| **503** | No upstream could serve the request (OpenAI error envelope, `upstream_unavailable`): every capable upstream is down, shedding load, or none of the model\'s routable upstreams supports a capability the request needs. Always carries Retry-After (whole seconds, rounded up) and retry-after-ms; on an overload the wait is jittered between 2 and 2.5 seconds. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * X-Deeprelay-Error-Code - <br> |
|
|
175
178
|
|
|
176
179
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
177
180
|
|
|
@@ -246,17 +249,17 @@ example().catch(console.error);
|
|
|
246
249
|
| Status code | Description | Response headers |
|
|
247
250
|
|-------------|-------------|------------------|
|
|
248
251
|
| **200** | One embedding vector per input, in request order. | - |
|
|
249
|
-
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
252
|
+
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
250
253
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
251
254
|
| **402** | Insufficient balance or a spend limit reached (OpenAI error envelope, SERV-06): `insufficient_balance`, `daily_limit_reached`, `spending_limit_reached`, `api_key_budget_exceeded` (this API key\'s monthly budget) or `member_spend_limit_reached` (the member\'s monthly spend limit). Carries `x-should-retry: false`: the same request will not succeed until the wallet or the limit changes. | * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
252
255
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
253
256
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
254
257
|
| **413** | Request body too large (OpenAI error envelope, code request_too_large). | * X-Deeprelay-Error-Code - <br> |
|
|
255
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
258
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
256
259
|
| **500** | Internal server error (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
257
|
-
| **502** | The upstream answered but its response could not be used (OpenAI error envelope): code upstream_response_too_large when the vector payload exceeded the per-request size limit, or upstream_error for a malformed / misaligned response. Not retryable as-is for upstream_response_too_large — send fewer inputs. | * X-Deeprelay-Error-Code - <br> |
|
|
258
|
-
| **503** | No upstream could serve the request (OpenAI error envelope, `upstream_unavailable`): every capable upstream is down, shedding load, or none of the model\'s routable upstreams supports a capability the request needs. Always carries Retry-After (whole seconds, rounded up) and retry-after-ms; on an overload the wait is jittered between 2 and 2.5 seconds. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * X-Deeprelay-Error-Code - <br> |
|
|
259
|
-
| **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | * X-Deeprelay-Error-Code - <br> |
|
|
260
|
+
| **502** | The upstream answered but its response could not be used (OpenAI error envelope): code upstream_response_too_large when the vector payload exceeded the per-request size limit, or upstream_error for a malformed / misaligned response. Not retryable as-is for upstream_response_too_large — send fewer inputs. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
261
|
+
| **503** | No upstream could serve the request (OpenAI error envelope, `upstream_unavailable`): every capable upstream is down, shedding load, or none of the model\'s routable upstreams supports a capability the request needs. Always carries Retry-After (whole seconds, rounded up) and retry-after-ms; on an overload the wait is jittered between 2 and 2.5 seconds. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * X-Deeprelay-Error-Code - <br> |
|
|
262
|
+
| **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
260
263
|
|
|
261
264
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
262
265
|
|
|
@@ -334,16 +337,16 @@ example().catch(console.error);
|
|
|
334
337
|
| Status code | Description | Response headers |
|
|
335
338
|
|-------------|-------------|------------------|
|
|
336
339
|
| **200** | OpenAI-shaped image generation response (b64_json only). | - |
|
|
337
|
-
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
340
|
+
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
338
341
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
339
342
|
| **402** | Insufficient balance or a spend limit reached (OpenAI error envelope, SERV-06): `insufficient_balance`, `daily_limit_reached`, `spending_limit_reached`, `api_key_budget_exceeded` (this API key\'s monthly budget) or `member_spend_limit_reached` (the member\'s monthly spend limit). Carries `x-should-retry: false`: the same request will not succeed until the wallet or the limit changes. | * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
340
343
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
341
344
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
342
345
|
| **422** | Request validation failed (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
343
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
346
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
344
347
|
| **500** | Internal server error (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
345
|
-
| **503** | No upstream could serve the request (OpenAI error envelope, `upstream_unavailable`): every capable upstream is down, shedding load, or none of the model\'s routable upstreams supports a capability the request needs. Always carries Retry-After (whole seconds, rounded up) and retry-after-ms; on an overload the wait is jittered between 2 and 2.5 seconds. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * X-Deeprelay-Error-Code - <br> |
|
|
346
|
-
| **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | * X-Deeprelay-Error-Code - <br> |
|
|
348
|
+
| **503** | No upstream could serve the request (OpenAI error envelope, `upstream_unavailable`): every capable upstream is down, shedding load, or none of the model\'s routable upstreams supports a capability the request needs. Always carries Retry-After (whole seconds, rounded up) and retry-after-ms; on an overload the wait is jittered between 2 and 2.5 seconds. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * X-Deeprelay-Error-Code - <br> |
|
|
349
|
+
| **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
347
350
|
|
|
348
351
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
349
352
|
|
|
@@ -421,12 +424,12 @@ example().catch(console.error);
|
|
|
421
424
|
| Status code | Description | Response headers |
|
|
422
425
|
|-------------|-------------|------------------|
|
|
423
426
|
| **200** | A video generation job object. | - |
|
|
424
|
-
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
427
|
+
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
425
428
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
426
429
|
| **402** | Insufficient balance or a spend limit reached (OpenAI error envelope, SERV-06): `insufficient_balance`, `daily_limit_reached`, `spending_limit_reached`, `api_key_budget_exceeded` (this API key\'s monthly budget) or `member_spend_limit_reached` (the member\'s monthly spend limit). Carries `x-should-retry: false`: the same request will not succeed until the wallet or the limit changes. | * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
427
430
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
428
431
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
429
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
432
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
430
433
|
| **500** | Internal server error (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
431
434
|
|
|
432
435
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -502,7 +505,7 @@ example().catch(console.error);
|
|
|
502
505
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
503
506
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
504
507
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
505
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
508
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
506
509
|
|
|
507
510
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
508
511
|
|
|
@@ -575,7 +578,7 @@ example().catch(console.error);
|
|
|
575
578
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
576
579
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
577
580
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
578
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
581
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
579
582
|
|
|
580
583
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
581
584
|
|
|
@@ -651,7 +654,7 @@ example().catch(console.error);
|
|
|
651
654
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
652
655
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
653
656
|
| **410** | The requested artifact has expired and is no longer available (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
654
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
657
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
655
658
|
|
|
656
659
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
657
660
|
|
|
@@ -724,7 +727,7 @@ example().catch(console.error);
|
|
|
724
727
|
|-------------|-------------|------------------|
|
|
725
728
|
| **200** | OK | - |
|
|
726
729
|
| **404** | Model or resource not found (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
727
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
730
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
728
731
|
|
|
729
732
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
730
733
|
|
|
@@ -800,10 +803,10 @@ example().catch(console.error);
|
|
|
800
803
|
|-------------|-------------|------------------|
|
|
801
804
|
| **200** | OpenAI-shaped model list. | * Cache-Control - `public, max-age=60` without a key; `private` with one. <br> * ETag - Strong validator for the anonymous listing. <br> |
|
|
802
805
|
| **304** | Not modified; the If-None-Match ETag still matches. | - |
|
|
803
|
-
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
806
|
+
| **400** | Invalid request (OpenAI error envelope). | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * X-Deeprelay-Error-Code - <br> |
|
|
804
807
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
805
808
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
806
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
809
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
807
810
|
|
|
808
811
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
809
812
|
|
|
@@ -878,7 +881,7 @@ example().catch(console.error);
|
|
|
878
881
|
| **200** | A page of video generation jobs. | - |
|
|
879
882
|
| **401** | Missing or invalid API key (OpenAI error envelope). | * X-Deeprelay-Error-Code - <br> |
|
|
880
883
|
| **403** | API key lacks the required scope (`insufficient_scope`), or the key has a model allowlist that does not include the requested model (`model_not_allowed_for_key`; also the answer for a model that does not exist, so a restricted key cannot probe the catalog). OpenAI error envelope. | * X-Deeprelay-Error-Code - <br> |
|
|
881
|
-
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
884
|
+
| **429** | Rate limit or subscription quota exceeded (OpenAI error envelope). A per-key or per-IP rate limit (`rate_limit_exceeded`) carries Retry-After, the whole seconds to wait, rounded up (minimum 1), and retry-after-ms, the exact wait; both are the time until one request is allowed, not a full refill. A per-key denial also carries the x-ratelimit-*-requests headers. A subscription quota denial (`subscription_quota_exhausted`, raised only when the wallet cannot cover the pay-as-you-go fallback) carries `x-should-retry: false` and no Retry-After. When the tripped gate is a rolling 7-day cap (`param: weekly_input_tokens` or `param: weekly_output_tokens`), the error object also carries `quota_frees_at`, the RFC 3339 time the window frees enough capacity — the earlier of the two windows. `param` names the tripped gate: monthly_input_tokens, monthly_output_tokens, weekly_input_tokens, weekly_output_tokens, max_usage, input_overshoot (this request\'s estimated input alone exceeds what is left in the tighter of the monthly and rolling 7-day input allowances), or output_overshoot (the same for the estimated output — the completion bound). On an overshoot the quota is not exhausted — send a smaller request (or a smaller max_tokens) or add credits. | * X-Deeprelay-Requested-Model - <br> * X-Deeprelay-Fallback-Attempted - <br> * Retry-After - Seconds the client should wait before retrying. <br> * retry-after-ms - <br> * x-ratelimit-limit-requests - <br> * x-ratelimit-remaining-requests - <br> * x-ratelimit-reset-requests - <br> * x-should-retry - <br> * X-Deeprelay-Error-Code - <br> |
|
|
882
885
|
|
|
883
886
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
884
887
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# RequestAttempt
|
|
3
|
+
|
|
4
|
+
One model in a request\'s backup-model trail.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`model` | string
|
|
11
|
+
`outcome` | string
|
|
12
|
+
`reason` | string
|
|
13
|
+
`durationMs` | number
|
|
14
|
+
`ttftMs` | number
|
|
15
|
+
`tries` | number
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type { RequestAttempt } from '@deeprelay/sdk'
|
|
21
|
+
|
|
22
|
+
// TODO: Update the object below with actual values
|
|
23
|
+
const example = {
|
|
24
|
+
"model": null,
|
|
25
|
+
"outcome": null,
|
|
26
|
+
"reason": null,
|
|
27
|
+
"durationMs": null,
|
|
28
|
+
"ttftMs": null,
|
|
29
|
+
"tries": null,
|
|
30
|
+
} satisfies RequestAttempt
|
|
31
|
+
|
|
32
|
+
console.log(example)
|
|
33
|
+
|
|
34
|
+
// Convert the instance to a JSON string
|
|
35
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
36
|
+
console.log(exampleJSON)
|
|
37
|
+
|
|
38
|
+
// Parse the JSON string back to an object
|
|
39
|
+
const exampleParsed = JSON.parse(exampleJSON) as RequestAttempt
|
|
40
|
+
console.log(exampleParsed)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
44
|
+
|
|
45
|
+
|
package/docs/RequestLogEntry.md
CHANGED
|
@@ -34,6 +34,10 @@ Name | Type
|
|
|
34
34
|
`imageCount` | number
|
|
35
35
|
`videoSeconds` | number
|
|
36
36
|
`suppressedCount` | number
|
|
37
|
+
`requestedModel` | string
|
|
38
|
+
`servedModel` | string
|
|
39
|
+
`fallbackReason` | string
|
|
40
|
+
`attempts` | [Array<RequestAttempt>](RequestAttempt.md)
|
|
37
41
|
|
|
38
42
|
## Example
|
|
39
43
|
|
|
@@ -69,6 +73,10 @@ const example = {
|
|
|
69
73
|
"imageCount": null,
|
|
70
74
|
"videoSeconds": null,
|
|
71
75
|
"suppressedCount": null,
|
|
76
|
+
"requestedModel": null,
|
|
77
|
+
"servedModel": null,
|
|
78
|
+
"fallbackReason": null,
|
|
79
|
+
"attempts": null,
|
|
72
80
|
} satisfies RequestLogEntry
|
|
73
81
|
|
|
74
82
|
console.log(example)
|
package/docs/RequestsApi.md
CHANGED
|
@@ -12,11 +12,11 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
12
12
|
|
|
13
13
|
## exportRequests
|
|
14
14
|
|
|
15
|
-
> string exportRequests(key, model, surface, status, errorCode, clientRequestId, from, to)
|
|
15
|
+
> string exportRequests(key, model, surface, status, errorCode, clientRequestId, from, to, fallback)
|
|
16
16
|
|
|
17
17
|
Export the request log as CSV
|
|
18
18
|
|
|
19
|
-
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.
|
|
19
|
+
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.
|
|
20
20
|
|
|
21
21
|
### Example
|
|
22
22
|
|
|
@@ -52,6 +52,8 @@ async function example() {
|
|
|
52
52
|
from: 2013-10-20T19:20:30+01:00,
|
|
53
53
|
// Date | Exclusive RFC 3339 range end. Defaults to now; must be after `from`. (optional)
|
|
54
54
|
to: 2013-10-20T19:20:30+01:00,
|
|
55
|
+
// boolean | `true` returns only rows a backup model served or where backups were tried (`fallback_reason` is set); `false` or absent applies no filter. Any other value is a 400. (optional)
|
|
56
|
+
fallback: true,
|
|
55
57
|
} satisfies ExportRequestsRequest;
|
|
56
58
|
|
|
57
59
|
try {
|
|
@@ -79,6 +81,7 @@ example().catch(console.error);
|
|
|
79
81
|
| **clientRequestId** | `string` | Only rows whose `X-Client-Request-Id` equals this value. | [Optional] [Defaults to `undefined`] |
|
|
80
82
|
| **from** | `Date` | Inclusive RFC 3339 range start. Defaults to the start of the 90-day window; an older value is clamped to it. | [Optional] [Defaults to `undefined`] |
|
|
81
83
|
| **to** | `Date` | Exclusive RFC 3339 range end. Defaults to now; must be after `from`. | [Optional] [Defaults to `undefined`] |
|
|
84
|
+
| **fallback** | `boolean` | `true` returns only rows a backup model served or where backups were tried (`fallback_reason` is set); `false` or absent applies no filter. Any other value is a 400. | [Optional] [Defaults to `undefined`] |
|
|
82
85
|
|
|
83
86
|
### Return type
|
|
84
87
|
|
|
@@ -182,7 +185,7 @@ example().catch(console.error);
|
|
|
182
185
|
|
|
183
186
|
## listRequests
|
|
184
187
|
|
|
185
|
-
> RequestLogPage listRequests(key, model, surface, status, errorCode, clientRequestId, from, to, cursor, limit)
|
|
188
|
+
> RequestLogPage listRequests(key, model, surface, status, errorCode, clientRequestId, from, to, fallback, cursor, limit)
|
|
186
189
|
|
|
187
190
|
List requests (the request log)
|
|
188
191
|
|
|
@@ -222,6 +225,8 @@ async function example() {
|
|
|
222
225
|
from: 2013-10-20T19:20:30+01:00,
|
|
223
226
|
// Date | Exclusive RFC 3339 range end. Defaults to now; must be after `from`. (optional)
|
|
224
227
|
to: 2013-10-20T19:20:30+01:00,
|
|
228
|
+
// boolean | `true` returns only rows a backup model served or where backups were tried (`fallback_reason` is set); `false` or absent applies no filter. Any other value is a 400. (optional)
|
|
229
|
+
fallback: true,
|
|
225
230
|
// string (optional)
|
|
226
231
|
cursor: cursor_example,
|
|
227
232
|
// number | Page size. Defaults to 50; values above 100 are clamped to 100. (optional)
|
|
@@ -253,6 +258,7 @@ example().catch(console.error);
|
|
|
253
258
|
| **clientRequestId** | `string` | Only rows whose `X-Client-Request-Id` equals this value. | [Optional] [Defaults to `undefined`] |
|
|
254
259
|
| **from** | `Date` | Inclusive RFC 3339 range start. Defaults to the start of the 90-day window; an older value is clamped to it. | [Optional] [Defaults to `undefined`] |
|
|
255
260
|
| **to** | `Date` | Exclusive RFC 3339 range end. Defaults to now; must be after `from`. | [Optional] [Defaults to `undefined`] |
|
|
261
|
+
| **fallback** | `boolean` | `true` returns only rows a backup model served or where backups were tried (`fallback_reason` is set); `false` or absent applies no filter. Any other value is a 400. | [Optional] [Defaults to `undefined`] |
|
|
256
262
|
| **cursor** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
257
263
|
| **limit** | `number` | Page size. Defaults to 50; values above 100 are clamped to 100. | [Optional] [Defaults to `50`] |
|
|
258
264
|
|
package/package.json
CHANGED
package/src/apis/ApiKeysApi.ts
CHANGED
|
@@ -335,7 +335,7 @@ export class ApiKeysApi extends runtime.BaseAPI {
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
/**
|
|
338
|
-
* 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.
|
|
338
|
+
* 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.
|
|
339
339
|
* Update an API key\'s name or limits
|
|
340
340
|
*/
|
|
341
341
|
async updateApiKeyRaw(requestParameters: UpdateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiKey>> {
|
|
@@ -346,7 +346,7 @@ export class ApiKeysApi extends runtime.BaseAPI {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
|
-
* 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.
|
|
349
|
+
* 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.
|
|
350
350
|
* Update an API key\'s name or limits
|
|
351
351
|
*/
|
|
352
352
|
async updateApiKey(requestParameters: UpdateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiKey> {
|
package/src/apis/InferenceApi.ts
CHANGED
|
@@ -86,6 +86,7 @@ export interface CancelVideoRequest {
|
|
|
86
86
|
export interface CreateChatCompletionRequest {
|
|
87
87
|
chatCompletionRequest: ChatCompletionRequest;
|
|
88
88
|
xClientRequestId?: string;
|
|
89
|
+
xDeeprelayFallbackModels?: string;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
export interface CreateEmbeddingsRequest {
|
|
@@ -210,6 +211,10 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
210
211
|
headerParameters['X-Client-Request-Id'] = String(requestParameters['xClientRequestId']);
|
|
211
212
|
}
|
|
212
213
|
|
|
214
|
+
if (requestParameters['xDeeprelayFallbackModels'] != null) {
|
|
215
|
+
headerParameters['X-Deeprelay-Fallback-Models'] = String(requestParameters['xDeeprelayFallbackModels']);
|
|
216
|
+
}
|
|
217
|
+
|
|
213
218
|
if (this.configuration && this.configuration.accessToken) {
|
|
214
219
|
const token = this.configuration.accessToken;
|
|
215
220
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -231,7 +236,7 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
231
236
|
}
|
|
232
237
|
|
|
233
238
|
/**
|
|
234
|
-
* 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.
|
|
239
|
+
* 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.
|
|
235
240
|
* Create a chat completion (OpenAI-compatible)
|
|
236
241
|
*/
|
|
237
242
|
async createChatCompletionRaw(requestParameters: CreateChatCompletionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChatCompletionResponse>> {
|
|
@@ -242,7 +247,7 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
242
247
|
}
|
|
243
248
|
|
|
244
249
|
/**
|
|
245
|
-
* 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.
|
|
250
|
+
* 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.
|
|
246
251
|
* Create a chat completion (OpenAI-compatible)
|
|
247
252
|
*/
|
|
248
253
|
async createChatCompletion(requestParameters: CreateChatCompletionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChatCompletionResponse> {
|