@deeprelay/sdk 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +4 -0
- package/README.md +4 -2
- package/dist/apis/ApiKeysApi.d.ts +2 -2
- package/dist/apis/ApiKeysApi.js +2 -2
- package/dist/apis/InferenceApi.d.ts +3 -2
- package/dist/apis/InferenceApi.js +5 -2
- package/dist/apis/RequestsApi.d.ts +4 -2
- package/dist/apis/RequestsApi.js +8 -2
- package/dist/esm/apis/ApiKeysApi.d.ts +2 -2
- package/dist/esm/apis/ApiKeysApi.js +2 -2
- package/dist/esm/apis/InferenceApi.d.ts +3 -2
- package/dist/esm/apis/InferenceApi.js +5 -2
- package/dist/esm/apis/RequestsApi.d.ts +4 -2
- package/dist/esm/apis/RequestsApi.js +8 -2
- package/dist/esm/models/ApiKey.d.ts +19 -0
- package/dist/esm/models/ApiKey.js +9 -0
- package/dist/esm/models/ApiKeyCreate.d.ts +6 -0
- package/dist/esm/models/ApiKeyCreate.js +2 -0
- package/dist/esm/models/ApiKeyCreated.d.ts +19 -0
- package/dist/esm/models/ApiKeyCreated.js +9 -0
- package/dist/esm/models/ApiKeyFallbackEntry.d.ts +65 -0
- package/dist/esm/models/ApiKeyFallbackEntry.js +67 -0
- package/dist/esm/models/ApiKeyUpdate.d.ts +7 -1
- package/dist/esm/models/ApiKeyUpdate.js +2 -0
- package/dist/esm/models/ChatCompletionRequest.d.ts +6 -0
- package/dist/esm/models/ChatCompletionRequest.js +2 -0
- package/dist/esm/models/CreateWebhookEndpointRequest.d.ts +1 -0
- package/dist/esm/models/CreateWebhookEndpointRequest.js +2 -1
- package/dist/esm/models/RequestAttempt.d.ts +71 -0
- package/dist/esm/models/RequestAttempt.js +67 -0
- package/dist/esm/models/RequestLogEntry.d.ts +25 -0
- package/dist/esm/models/RequestLogEntry.js +9 -0
- package/dist/esm/models/WebhookEndpoint.d.ts +1 -0
- package/dist/esm/models/WebhookEndpoint.js +2 -1
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/ApiKey.d.ts +19 -0
- package/dist/models/ApiKey.js +9 -0
- package/dist/models/ApiKeyCreate.d.ts +6 -0
- package/dist/models/ApiKeyCreate.js +2 -0
- package/dist/models/ApiKeyCreated.d.ts +19 -0
- package/dist/models/ApiKeyCreated.js +9 -0
- package/dist/models/ApiKeyFallbackEntry.d.ts +65 -0
- package/dist/models/ApiKeyFallbackEntry.js +75 -0
- package/dist/models/ApiKeyUpdate.d.ts +7 -1
- package/dist/models/ApiKeyUpdate.js +2 -0
- package/dist/models/ChatCompletionRequest.d.ts +6 -0
- package/dist/models/ChatCompletionRequest.js +2 -0
- package/dist/models/CreateWebhookEndpointRequest.d.ts +1 -0
- package/dist/models/CreateWebhookEndpointRequest.js +2 -1
- package/dist/models/RequestAttempt.d.ts +71 -0
- package/dist/models/RequestAttempt.js +75 -0
- package/dist/models/RequestLogEntry.d.ts +25 -0
- package/dist/models/RequestLogEntry.js +9 -0
- package/dist/models/WebhookEndpoint.d.ts +1 -0
- package/dist/models/WebhookEndpoint.js +2 -1
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/runtime.js +1 -1
- package/docs/ApiKey.md +6 -0
- package/docs/ApiKeyCreate.md +2 -0
- package/docs/ApiKeyCreated.md +6 -0
- package/docs/ApiKeyFallbackEntry.md +43 -0
- package/docs/ApiKeyUpdate.md +3 -1
- package/docs/ApiKeysApi.md +1 -1
- package/docs/ChatCompletionRequest.md +2 -0
- package/docs/InferenceApi.md +29 -26
- package/docs/RequestAttempt.md +45 -0
- package/docs/RequestLogEntry.md +8 -0
- package/docs/RequestsApi.md +9 -3
- package/package.json +1 -1
- package/src/apis/ApiKeysApi.ts +2 -2
- package/src/apis/InferenceApi.ts +7 -2
- package/src/apis/RequestsApi.ts +12 -2
- package/src/models/ApiKey.ts +32 -0
- package/src/models/ApiKeyCreate.ts +8 -0
- package/src/models/ApiKeyCreated.ts +32 -0
- package/src/models/ApiKeyFallbackEntry.ts +114 -0
- package/src/models/ApiKeyUpdate.ts +9 -1
- package/src/models/ChatCompletionRequest.ts +8 -0
- package/src/models/CreateWebhookEndpointRequest.ts +2 -1
- package/src/models/RequestAttempt.ts +121 -0
- package/src/models/RequestLogEntry.ts +40 -0
- package/src/models/WebhookEndpoint.ts +2 -1
- package/src/models/index.ts +2 -0
- package/src/runtime.ts +1 -1
package/src/apis/RequestsApi.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface ExportRequestsRequest {
|
|
|
38
38
|
clientRequestId?: string;
|
|
39
39
|
from?: Date;
|
|
40
40
|
to?: Date;
|
|
41
|
+
fallback?: boolean;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export interface GetRequestRequest {
|
|
@@ -53,6 +54,7 @@ export interface ListRequestsRequest {
|
|
|
53
54
|
clientRequestId?: string;
|
|
54
55
|
from?: Date;
|
|
55
56
|
to?: Date;
|
|
57
|
+
fallback?: boolean;
|
|
56
58
|
cursor?: string;
|
|
57
59
|
limit?: number;
|
|
58
60
|
}
|
|
@@ -100,6 +102,10 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
100
102
|
queryParameters['to'] = (requestParameters['to'] as any).toISOString();
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
if (requestParameters['fallback'] != null) {
|
|
106
|
+
queryParameters['fallback'] = requestParameters['fallback'];
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
104
110
|
|
|
105
111
|
if (this.configuration && this.configuration.accessToken) {
|
|
@@ -122,7 +128,7 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
/**
|
|
125
|
-
* 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.
|
|
131
|
+
* 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.
|
|
126
132
|
* Export the request log as CSV
|
|
127
133
|
*/
|
|
128
134
|
async exportRequestsRaw(requestParameters: ExportRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>> {
|
|
@@ -137,7 +143,7 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
/**
|
|
140
|
-
* 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.
|
|
146
|
+
* 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.
|
|
141
147
|
* Export the request log as CSV
|
|
142
148
|
*/
|
|
143
149
|
async exportRequests(requestParameters: ExportRequestsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
|
|
@@ -238,6 +244,10 @@ export class RequestsApi extends runtime.BaseAPI {
|
|
|
238
244
|
queryParameters['to'] = (requestParameters['to'] as any).toISOString();
|
|
239
245
|
}
|
|
240
246
|
|
|
247
|
+
if (requestParameters['fallback'] != null) {
|
|
248
|
+
queryParameters['fallback'] = requestParameters['fallback'];
|
|
249
|
+
}
|
|
250
|
+
|
|
241
251
|
if (requestParameters['cursor'] != null) {
|
|
242
252
|
queryParameters['cursor'] = requestParameters['cursor'];
|
|
243
253
|
}
|
package/src/models/ApiKey.ts
CHANGED
|
@@ -20,6 +20,13 @@ import {
|
|
|
20
20
|
ApiKeyScopesToJSON,
|
|
21
21
|
ApiKeyScopesToJSONTyped,
|
|
22
22
|
} from './ApiKeyScopes';
|
|
23
|
+
import type { ApiKeyFallbackEntry } from './ApiKeyFallbackEntry';
|
|
24
|
+
import {
|
|
25
|
+
ApiKeyFallbackEntryFromJSON,
|
|
26
|
+
ApiKeyFallbackEntryFromJSONTyped,
|
|
27
|
+
ApiKeyFallbackEntryToJSON,
|
|
28
|
+
ApiKeyFallbackEntryToJSONTyped,
|
|
29
|
+
} from './ApiKeyFallbackEntry';
|
|
23
30
|
|
|
24
31
|
/**
|
|
25
32
|
* An API key's metadata and limits. Never carries the secret.
|
|
@@ -87,6 +94,24 @@ export interface ApiKey {
|
|
|
87
94
|
* @memberof ApiKey
|
|
88
95
|
*/
|
|
89
96
|
staleModels?: Array<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Backup models in priority order, applied to every model this key calls. Null means model fallback is off (the default). If every provider for the requested model fails before the first token with a temporary error, the next entry is tried. Entries are kept when a model leaves the plan roster or the catalog and are skipped at request time; see `fallback_entries`. Not applied to Liquid.
|
|
99
|
+
* @type {Array<string>}
|
|
100
|
+
* @memberof ApiKey
|
|
101
|
+
*/
|
|
102
|
+
fallbackModels: Array<string> | null;
|
|
103
|
+
/**
|
|
104
|
+
* Present when `fallback_models` is set: one entry per backup, in order, explaining it as of now.
|
|
105
|
+
* @type {Array<ApiKeyFallbackEntry>}
|
|
106
|
+
* @memberof ApiKey
|
|
107
|
+
*/
|
|
108
|
+
fallbackEntries?: Array<ApiKeyFallbackEntry>;
|
|
109
|
+
/**
|
|
110
|
+
* The model this key requested most over the last 30 days, which `above_primary` is measured against. Present only for a key with `fallback_models` and recent usage.
|
|
111
|
+
* @type {string}
|
|
112
|
+
* @memberof ApiKey
|
|
113
|
+
*/
|
|
114
|
+
primaryModel?: string;
|
|
90
115
|
/**
|
|
91
116
|
*
|
|
92
117
|
* @type {number}
|
|
@@ -136,6 +161,7 @@ export function instanceOfApiKey(value: object): value is ApiKey {
|
|
|
136
161
|
if (!('scopes' in value) || value['scopes'] === undefined) return false;
|
|
137
162
|
if ((!('budgetCents' in (value as Record<string, any>)) && !('budget_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['budgetCents'] === undefined && (value as Record<string, any>)['budget_cents'] === undefined)) return false;
|
|
138
163
|
if ((!('allowedModels' in (value as Record<string, any>)) && !('allowed_models' in (value as Record<string, any>))) || ((value as Record<string, any>)['allowedModels'] === undefined && (value as Record<string, any>)['allowed_models'] === undefined)) return false;
|
|
164
|
+
if ((!('fallbackModels' in (value as Record<string, any>)) && !('fallback_models' in (value as Record<string, any>))) || ((value as Record<string, any>)['fallbackModels'] === undefined && (value as Record<string, any>)['fallback_models'] === undefined)) return false;
|
|
139
165
|
if ((!('rateLimitRps' in (value as Record<string, any>)) && !('rate_limit_rps' in (value as Record<string, any>))) || ((value as Record<string, any>)['rateLimitRps'] === undefined && (value as Record<string, any>)['rate_limit_rps'] === undefined)) return false;
|
|
140
166
|
if ((!('rateLimitBurst' in (value as Record<string, any>)) && !('rate_limit_burst' in (value as Record<string, any>))) || ((value as Record<string, any>)['rateLimitBurst'] === undefined && (value as Record<string, any>)['rate_limit_burst'] === undefined)) return false;
|
|
141
167
|
if ((!('expiresAt' in (value as Record<string, any>)) && !('expires_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['expiresAt'] === undefined && (value as Record<string, any>)['expires_at'] === undefined)) return false;
|
|
@@ -164,6 +190,9 @@ export function ApiKeyFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ap
|
|
|
164
190
|
'budgetResetsAt': json['budget_resets_at'] == null ? undefined : (new Date(json['budget_resets_at'])),
|
|
165
191
|
'allowedModels': json['allowed_models'] == null ? null : json['allowed_models'],
|
|
166
192
|
'staleModels': json['stale_models'] == null ? undefined : json['stale_models'],
|
|
193
|
+
'fallbackModels': json['fallback_models'] == null ? null : json['fallback_models'],
|
|
194
|
+
'fallbackEntries': json['fallback_entries'] == null ? undefined : ((json['fallback_entries'] as Array<any>).map(ApiKeyFallbackEntryFromJSON)),
|
|
195
|
+
'primaryModel': json['primary_model'] == null ? undefined : json['primary_model'],
|
|
167
196
|
'rateLimitRps': json['rate_limit_rps'],
|
|
168
197
|
'rateLimitBurst': json['rate_limit_burst'],
|
|
169
198
|
'expiresAt': (json['expires_at'] == null ? null : new Date(json['expires_at'])),
|
|
@@ -194,6 +223,9 @@ export function ApiKeyToJSONTyped(value?: ApiKey | null, ignoreDiscriminator: bo
|
|
|
194
223
|
'budget_resets_at': value['budgetResetsAt'] == null ? value['budgetResetsAt'] : value['budgetResetsAt'].toISOString(),
|
|
195
224
|
'allowed_models': value['allowedModels'],
|
|
196
225
|
'stale_models': value['staleModels'],
|
|
226
|
+
'fallback_models': value['fallbackModels'],
|
|
227
|
+
'fallback_entries': value['fallbackEntries'] == null ? undefined : ((value['fallbackEntries'] as Array<any>).map(ApiKeyFallbackEntryToJSON)),
|
|
228
|
+
'primary_model': value['primaryModel'],
|
|
197
229
|
'rate_limit_rps': value['rateLimitRps'],
|
|
198
230
|
'rate_limit_burst': value['rateLimitBurst'],
|
|
199
231
|
'expires_at': value['expiresAt'] == null ? value['expiresAt'] : value['expiresAt'].toISOString(),
|
|
@@ -43,6 +43,12 @@ export interface ApiKeyCreate {
|
|
|
43
43
|
* @memberof ApiKeyCreate
|
|
44
44
|
*/
|
|
45
45
|
allowedModels?: Array<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Backup models in priority order. Omit it to leave model fallback off. Each entry must be a chat model in the catalog and, when the key has `allowed_models`, on that list. Duplicates are removed. An empty array, more than 3 models or an invalid entry is a 422 `validation_failed` naming the `fallback_models` field.
|
|
48
|
+
* @type {Array<string>}
|
|
49
|
+
* @memberof ApiKeyCreate
|
|
50
|
+
*/
|
|
51
|
+
fallbackModels?: Array<string>;
|
|
46
52
|
/**
|
|
47
53
|
*
|
|
48
54
|
* @type {number}
|
|
@@ -86,6 +92,7 @@ export function ApiKeyCreateFromJSONTyped(json: any, ignoreDiscriminator: boolea
|
|
|
86
92
|
'scopes': json['scopes'],
|
|
87
93
|
'budgetCents': json['budget_cents'] == null ? undefined : json['budget_cents'],
|
|
88
94
|
'allowedModels': json['allowed_models'] == null ? undefined : json['allowed_models'],
|
|
95
|
+
'fallbackModels': json['fallback_models'] == null ? undefined : json['fallback_models'],
|
|
89
96
|
'rateLimitRps': json['rate_limit_rps'] == null ? undefined : json['rate_limit_rps'],
|
|
90
97
|
'rateLimitBurst': json['rate_limit_burst'] == null ? undefined : json['rate_limit_burst'],
|
|
91
98
|
'expiresAt': json['expires_at'] == null ? undefined : (new Date(json['expires_at'])),
|
|
@@ -107,6 +114,7 @@ export function ApiKeyCreateToJSONTyped(value?: ApiKeyCreate | null, ignoreDiscr
|
|
|
107
114
|
'scopes': value['scopes'],
|
|
108
115
|
'budget_cents': value['budgetCents'],
|
|
109
116
|
'allowed_models': value['allowedModels'],
|
|
117
|
+
'fallback_models': value['fallbackModels'],
|
|
110
118
|
'rate_limit_rps': value['rateLimitRps'],
|
|
111
119
|
'rate_limit_burst': value['rateLimitBurst'],
|
|
112
120
|
'expires_at': value['expiresAt'] == null ? value['expiresAt'] : value['expiresAt'].toISOString(),
|
|
@@ -20,6 +20,13 @@ import {
|
|
|
20
20
|
ApiKeyScopesToJSON,
|
|
21
21
|
ApiKeyScopesToJSONTyped,
|
|
22
22
|
} from './ApiKeyScopes';
|
|
23
|
+
import type { ApiKeyFallbackEntry } from './ApiKeyFallbackEntry';
|
|
24
|
+
import {
|
|
25
|
+
ApiKeyFallbackEntryFromJSON,
|
|
26
|
+
ApiKeyFallbackEntryFromJSONTyped,
|
|
27
|
+
ApiKeyFallbackEntryToJSON,
|
|
28
|
+
ApiKeyFallbackEntryToJSONTyped,
|
|
29
|
+
} from './ApiKeyFallbackEntry';
|
|
23
30
|
|
|
24
31
|
/**
|
|
25
32
|
* The new key's metadata plus its secret (`key`), returned exactly once. The same fields as `ApiKey`, plus `key`.
|
|
@@ -87,6 +94,24 @@ export interface ApiKeyCreated {
|
|
|
87
94
|
* @memberof ApiKeyCreated
|
|
88
95
|
*/
|
|
89
96
|
staleModels?: Array<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Backup models in priority order, applied to every model this key calls. Null means model fallback is off (the default). If every provider for the requested model fails before the first token with a temporary error, the next entry is tried. Entries are kept when a model leaves the plan roster or the catalog and are skipped at request time; see `fallback_entries`. Not applied to Liquid.
|
|
99
|
+
* @type {Array<string>}
|
|
100
|
+
* @memberof ApiKeyCreated
|
|
101
|
+
*/
|
|
102
|
+
fallbackModels: Array<string> | null;
|
|
103
|
+
/**
|
|
104
|
+
* Present when `fallback_models` is set: one entry per backup, in order, explaining it as of now.
|
|
105
|
+
* @type {Array<ApiKeyFallbackEntry>}
|
|
106
|
+
* @memberof ApiKeyCreated
|
|
107
|
+
*/
|
|
108
|
+
fallbackEntries?: Array<ApiKeyFallbackEntry>;
|
|
109
|
+
/**
|
|
110
|
+
* The model this key requested most over the last 30 days, which `above_primary` is measured against. Present only for a key with `fallback_models` and recent usage.
|
|
111
|
+
* @type {string}
|
|
112
|
+
* @memberof ApiKeyCreated
|
|
113
|
+
*/
|
|
114
|
+
primaryModel?: string;
|
|
90
115
|
/**
|
|
91
116
|
*
|
|
92
117
|
* @type {number}
|
|
@@ -142,6 +167,7 @@ export function instanceOfApiKeyCreated(value: object): value is ApiKeyCreated {
|
|
|
142
167
|
if (!('scopes' in value) || value['scopes'] === undefined) return false;
|
|
143
168
|
if ((!('budgetCents' in (value as Record<string, any>)) && !('budget_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['budgetCents'] === undefined && (value as Record<string, any>)['budget_cents'] === undefined)) return false;
|
|
144
169
|
if ((!('allowedModels' in (value as Record<string, any>)) && !('allowed_models' in (value as Record<string, any>))) || ((value as Record<string, any>)['allowedModels'] === undefined && (value as Record<string, any>)['allowed_models'] === undefined)) return false;
|
|
170
|
+
if ((!('fallbackModels' in (value as Record<string, any>)) && !('fallback_models' in (value as Record<string, any>))) || ((value as Record<string, any>)['fallbackModels'] === undefined && (value as Record<string, any>)['fallback_models'] === undefined)) return false;
|
|
145
171
|
if ((!('rateLimitRps' in (value as Record<string, any>)) && !('rate_limit_rps' in (value as Record<string, any>))) || ((value as Record<string, any>)['rateLimitRps'] === undefined && (value as Record<string, any>)['rate_limit_rps'] === undefined)) return false;
|
|
146
172
|
if ((!('rateLimitBurst' in (value as Record<string, any>)) && !('rate_limit_burst' in (value as Record<string, any>))) || ((value as Record<string, any>)['rateLimitBurst'] === undefined && (value as Record<string, any>)['rate_limit_burst'] === undefined)) return false;
|
|
147
173
|
if ((!('expiresAt' in (value as Record<string, any>)) && !('expires_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['expiresAt'] === undefined && (value as Record<string, any>)['expires_at'] === undefined)) return false;
|
|
@@ -171,6 +197,9 @@ export function ApiKeyCreatedFromJSONTyped(json: any, ignoreDiscriminator: boole
|
|
|
171
197
|
'budgetResetsAt': json['budget_resets_at'] == null ? undefined : (new Date(json['budget_resets_at'])),
|
|
172
198
|
'allowedModels': json['allowed_models'] == null ? null : json['allowed_models'],
|
|
173
199
|
'staleModels': json['stale_models'] == null ? undefined : json['stale_models'],
|
|
200
|
+
'fallbackModels': json['fallback_models'] == null ? null : json['fallback_models'],
|
|
201
|
+
'fallbackEntries': json['fallback_entries'] == null ? undefined : ((json['fallback_entries'] as Array<any>).map(ApiKeyFallbackEntryFromJSON)),
|
|
202
|
+
'primaryModel': json['primary_model'] == null ? undefined : json['primary_model'],
|
|
174
203
|
'rateLimitRps': json['rate_limit_rps'],
|
|
175
204
|
'rateLimitBurst': json['rate_limit_burst'],
|
|
176
205
|
'expiresAt': (json['expires_at'] == null ? null : new Date(json['expires_at'])),
|
|
@@ -202,6 +231,9 @@ export function ApiKeyCreatedToJSONTyped(value?: ApiKeyCreated | null, ignoreDis
|
|
|
202
231
|
'budget_resets_at': value['budgetResetsAt'] == null ? value['budgetResetsAt'] : value['budgetResetsAt'].toISOString(),
|
|
203
232
|
'allowed_models': value['allowedModels'],
|
|
204
233
|
'stale_models': value['staleModels'],
|
|
234
|
+
'fallback_models': value['fallbackModels'],
|
|
235
|
+
'fallback_entries': value['fallbackEntries'] == null ? undefined : ((value['fallbackEntries'] as Array<any>).map(ApiKeyFallbackEntryToJSON)),
|
|
236
|
+
'primary_model': value['primaryModel'],
|
|
205
237
|
'rate_limit_rps': value['rateLimitRps'],
|
|
206
238
|
'rate_limit_burst': value['rateLimitBurst'],
|
|
207
239
|
'expires_at': value['expiresAt'] == null ? value['expiresAt'] : value['expiresAt'].toISOString(),
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* deeprelay Public Developer API
|
|
5
|
+
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details. Keys minted from the dashboard or `deeprelay login` belong to the Production server, https://api.deeprelay.ai/v1. The Demo server is an internal staging environment with its own key store. Versioning: `/v1` is the API version. `info.version` is the revision of this `/v1` document, not a separate API. OpenAI compatibility: chat completions follow the OpenAI request and response shapes, but not every OpenAI parameter is carried. Some are rejected with 400 `unsupported_parameter` and any parameter not declared in this spec is accepted and ignored. The full table is at https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@deeprelay.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* One backup model on a key, as it stands now.
|
|
18
|
+
* @export
|
|
19
|
+
* @interface ApiKeyFallbackEntry
|
|
20
|
+
*/
|
|
21
|
+
export interface ApiKeyFallbackEntry {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof ApiKeyFallbackEntry
|
|
26
|
+
*/
|
|
27
|
+
model: string;
|
|
28
|
+
/**
|
|
29
|
+
* `ok`: usable as a backup. `wallet_only`: the model is not on the subscription plan roster, so it backs up only requests billed to the wallet; a plan-covered request skips it. `unavailable`: the model is no longer in the catalog and is always skipped.
|
|
30
|
+
* @type {ApiKeyFallbackEntryStateEnum}
|
|
31
|
+
* @memberof ApiKeyFallbackEntry
|
|
32
|
+
*/
|
|
33
|
+
state: ApiKeyFallbackEntryStateEnum;
|
|
34
|
+
/**
|
|
35
|
+
* Current input price per 1M tokens, in micro-cents. 0 when unknown or unavailable.
|
|
36
|
+
* @type {number}
|
|
37
|
+
* @memberof ApiKeyFallbackEntry
|
|
38
|
+
*/
|
|
39
|
+
inputPer1mTokensMicrocents: number;
|
|
40
|
+
/**
|
|
41
|
+
* Current output price per 1M tokens, in micro-cents. 0 when unknown or unavailable.
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @memberof ApiKeyFallbackEntry
|
|
44
|
+
*/
|
|
45
|
+
outputPer1mTokensMicrocents: number;
|
|
46
|
+
/**
|
|
47
|
+
* True when this backup's input plus output price is above `primary_model`'s. Pricier backups are allowed; a request served by one is billed at its own price, and the key budget is checked at that price.
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
* @memberof ApiKeyFallbackEntry
|
|
50
|
+
*/
|
|
51
|
+
abovePrimary: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @export
|
|
57
|
+
*/
|
|
58
|
+
export const ApiKeyFallbackEntryStateEnum = {
|
|
59
|
+
Ok: 'ok',
|
|
60
|
+
WalletOnly: 'wallet_only',
|
|
61
|
+
Unavailable: 'unavailable'
|
|
62
|
+
} as const;
|
|
63
|
+
export type ApiKeyFallbackEntryStateEnum = typeof ApiKeyFallbackEntryStateEnum[keyof typeof ApiKeyFallbackEntryStateEnum];
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Check if a given object implements the ApiKeyFallbackEntry interface.
|
|
68
|
+
*/
|
|
69
|
+
export function instanceOfApiKeyFallbackEntry(value: object): value is ApiKeyFallbackEntry {
|
|
70
|
+
if (!('model' in value) || value['model'] === undefined) return false;
|
|
71
|
+
if (!('state' in value) || value['state'] === undefined) return false;
|
|
72
|
+
if ((!('inputPer1mTokensMicrocents' in (value as Record<string, any>)) && !('input_per_1m_tokens_microcents' in (value as Record<string, any>))) || ((value as Record<string, any>)['inputPer1mTokensMicrocents'] === undefined && (value as Record<string, any>)['input_per_1m_tokens_microcents'] === undefined)) return false;
|
|
73
|
+
if ((!('outputPer1mTokensMicrocents' in (value as Record<string, any>)) && !('output_per_1m_tokens_microcents' in (value as Record<string, any>))) || ((value as Record<string, any>)['outputPer1mTokensMicrocents'] === undefined && (value as Record<string, any>)['output_per_1m_tokens_microcents'] === undefined)) return false;
|
|
74
|
+
if ((!('abovePrimary' in (value as Record<string, any>)) && !('above_primary' in (value as Record<string, any>))) || ((value as Record<string, any>)['abovePrimary'] === undefined && (value as Record<string, any>)['above_primary'] === undefined)) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function ApiKeyFallbackEntryFromJSON(json: any): ApiKeyFallbackEntry {
|
|
79
|
+
return ApiKeyFallbackEntryFromJSONTyped(json, false);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function ApiKeyFallbackEntryFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiKeyFallbackEntry {
|
|
83
|
+
if (json == null) {
|
|
84
|
+
return json;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
|
|
88
|
+
'model': json['model'],
|
|
89
|
+
'state': json['state'],
|
|
90
|
+
'inputPer1mTokensMicrocents': json['input_per_1m_tokens_microcents'],
|
|
91
|
+
'outputPer1mTokensMicrocents': json['output_per_1m_tokens_microcents'],
|
|
92
|
+
'abovePrimary': json['above_primary'],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function ApiKeyFallbackEntryToJSON(json: any): ApiKeyFallbackEntry {
|
|
97
|
+
return ApiKeyFallbackEntryToJSONTyped(json, false);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function ApiKeyFallbackEntryToJSONTyped(value?: ApiKeyFallbackEntry | null, ignoreDiscriminator: boolean = false): any {
|
|
101
|
+
if (value == null) {
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
|
|
107
|
+
'model': value['model'],
|
|
108
|
+
'state': value['state'],
|
|
109
|
+
'input_per_1m_tokens_microcents': value['inputPer1mTokensMicrocents'],
|
|
110
|
+
'output_per_1m_tokens_microcents': value['outputPer1mTokensMicrocents'],
|
|
111
|
+
'above_primary': value['abovePrimary'],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
16
|
/**
|
|
17
|
-
* Send only the fields to change. `null` clears `budget_cents`, `allowed_models` or `expires_at`. `scopes` cannot be changed.
|
|
17
|
+
* Send only the fields to change. `null` clears `budget_cents`, `allowed_models`, `fallback_models` or `expires_at`. `scopes` cannot be changed.
|
|
18
18
|
* @export
|
|
19
19
|
* @interface ApiKeyUpdate
|
|
20
20
|
*/
|
|
@@ -37,6 +37,12 @@ export interface ApiKeyUpdate {
|
|
|
37
37
|
* @memberof ApiKeyUpdate
|
|
38
38
|
*/
|
|
39
39
|
allowedModels?: Array<string> | null;
|
|
40
|
+
/**
|
|
41
|
+
* Replace the backup list (priority order), or `null` to turn model fallback off. Same rules as on create, judged against the key's allowlist after this update. An empty array is a 422 `validation_failed`; send `null` instead.
|
|
42
|
+
* @type {Array<string>}
|
|
43
|
+
* @memberof ApiKeyUpdate
|
|
44
|
+
*/
|
|
45
|
+
fallbackModels?: Array<string> | null;
|
|
40
46
|
/**
|
|
41
47
|
*
|
|
42
48
|
* @type {number}
|
|
@@ -77,6 +83,7 @@ export function ApiKeyUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolea
|
|
|
77
83
|
'name': json['name'] == null ? undefined : json['name'],
|
|
78
84
|
'budgetCents': json['budget_cents'] === undefined ? undefined : json['budget_cents'] === null ? null : json['budget_cents'],
|
|
79
85
|
'allowedModels': json['allowed_models'] === undefined ? undefined : json['allowed_models'] === null ? null : json['allowed_models'],
|
|
86
|
+
'fallbackModels': json['fallback_models'] === undefined ? undefined : json['fallback_models'] === null ? null : json['fallback_models'],
|
|
80
87
|
'rateLimitRps': json['rate_limit_rps'] == null ? undefined : json['rate_limit_rps'],
|
|
81
88
|
'rateLimitBurst': json['rate_limit_burst'] == null ? undefined : json['rate_limit_burst'],
|
|
82
89
|
'expiresAt': json['expires_at'] === undefined ? undefined : json['expires_at'] === null ? null : (new Date(json['expires_at'])),
|
|
@@ -97,6 +104,7 @@ export function ApiKeyUpdateToJSONTyped(value?: ApiKeyUpdate | null, ignoreDiscr
|
|
|
97
104
|
'name': value['name'],
|
|
98
105
|
'budget_cents': value['budgetCents'],
|
|
99
106
|
'allowed_models': value['allowedModels'],
|
|
107
|
+
'fallback_models': value['fallbackModels'],
|
|
100
108
|
'rate_limit_rps': value['rateLimitRps'],
|
|
101
109
|
'rate_limit_burst': value['rateLimitBurst'],
|
|
102
110
|
'expires_at': value['expiresAt'] == null ? value['expiresAt'] : value['expiresAt'].toISOString(),
|
|
@@ -61,6 +61,12 @@ export interface ChatCompletionRequest {
|
|
|
61
61
|
* @memberof ChatCompletionRequest
|
|
62
62
|
*/
|
|
63
63
|
model: string;
|
|
64
|
+
/**
|
|
65
|
+
* OpenRouter-compatible backup models for this request. `model` is the requested model and `models` lists the backups in priority order; when `model` is empty, the first entry of `models` is the requested model. An entry naming the requested model is ignored. At most 3 backups. The list replaces the API key's `fallback_models` for this request, and an empty array turns model fallback off for this request. Each backup must still pass the key's model allowlist, the request's billing mode and its capability needs, or it is skipped. Sending both `models` and the X-Deeprelay-Fallback-Models header is a 400 `invalid_request`. Chat completions only; on `/messages` and `/responses` use the header.
|
|
66
|
+
* @type {Array<string>}
|
|
67
|
+
* @memberof ChatCompletionRequest
|
|
68
|
+
*/
|
|
69
|
+
models?: Array<string> | null;
|
|
64
70
|
/**
|
|
65
71
|
*
|
|
66
72
|
* @type {Array<ChatMessage>}
|
|
@@ -186,6 +192,7 @@ export function ChatCompletionRequestFromJSONTyped(json: any, ignoreDiscriminato
|
|
|
186
192
|
return {
|
|
187
193
|
|
|
188
194
|
'model': json['model'],
|
|
195
|
+
'models': json['models'] === undefined ? undefined : json['models'] === null ? null : json['models'],
|
|
189
196
|
'messages': ((json['messages'] as Array<any>).map(ChatMessageFromJSON)),
|
|
190
197
|
'temperature': json['temperature'] == null ? undefined : json['temperature'],
|
|
191
198
|
'maxTokens': json['max_tokens'] == null ? undefined : json['max_tokens'],
|
|
@@ -217,6 +224,7 @@ export function ChatCompletionRequestToJSONTyped(value?: ChatCompletionRequest |
|
|
|
217
224
|
return {
|
|
218
225
|
|
|
219
226
|
'model': value['model'],
|
|
227
|
+
'models': value['models'],
|
|
220
228
|
'messages': ((value['messages'] as Array<any>).map(ChatMessageToJSON)),
|
|
221
229
|
'temperature': value['temperature'],
|
|
222
230
|
'max_tokens': value['maxTokens'],
|
|
@@ -47,7 +47,8 @@ export const CreateWebhookEndpointRequestEventTypesEnum = {
|
|
|
47
47
|
BalanceLow: 'balance.low',
|
|
48
48
|
SubscriptionQuotaThreshold: 'subscription_quota.threshold',
|
|
49
49
|
ApiKeyBudgetThreshold: 'api_key_budget.threshold',
|
|
50
|
-
MemberSpendThreshold: 'member_spend.threshold'
|
|
50
|
+
MemberSpendThreshold: 'member_spend.threshold',
|
|
51
|
+
PlanRosterModelRemoved: 'plan_roster.model_removed'
|
|
51
52
|
} as const;
|
|
52
53
|
export type CreateWebhookEndpointRequestEventTypesEnum = typeof CreateWebhookEndpointRequestEventTypesEnum[keyof typeof CreateWebhookEndpointRequestEventTypesEnum];
|
|
53
54
|
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* deeprelay Public Developer API
|
|
5
|
+
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details. Keys minted from the dashboard or `deeprelay login` belong to the Production server, https://api.deeprelay.ai/v1. The Demo server is an internal staging environment with its own key store. Versioning: `/v1` is the API version. `info.version` is the revision of this `/v1` document, not a separate API. OpenAI compatibility: chat completions follow the OpenAI request and response shapes, but not every OpenAI parameter is carried. Some are rejected with 400 `unsupported_parameter` and any parameter not declared in this spec is accepted and ignored. The full table is at https://deeprelay.ai/docs/api/inference#openai-compatibility.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@deeprelay.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* One model in a request's backup-model trail.
|
|
18
|
+
* @export
|
|
19
|
+
* @interface RequestAttempt
|
|
20
|
+
*/
|
|
21
|
+
export interface RequestAttempt {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof RequestAttempt
|
|
26
|
+
*/
|
|
27
|
+
model: string;
|
|
28
|
+
/**
|
|
29
|
+
* `ok`: this model served. `failed`: it was dialled and every provider failed before the first token. `skipped`: it was passed over without being dialled.
|
|
30
|
+
* @type {RequestAttemptOutcomeEnum}
|
|
31
|
+
* @memberof RequestAttempt
|
|
32
|
+
*/
|
|
33
|
+
outcome: RequestAttemptOutcomeEnum;
|
|
34
|
+
/**
|
|
35
|
+
* Why the attempt failed (a public error code such as `upstream_timeout`) or was skipped: `model_not_allowed_for_key`, `subscription_quota_exhausted`, `api_key_budget_exceeded`, `member_spend_limit_reached`, `insufficient_balance`, `daily_limit_reached`, `spending_limit_reached`, `wallet_only` (not on the plan roster, for a plan-covered request), `unavailable`, `capability_mismatch`, `context_window_too_small`, `breaker_open` or `deadline_exhausted` (too little time was left to start another model).
|
|
36
|
+
* @type {string}
|
|
37
|
+
* @memberof RequestAttempt
|
|
38
|
+
*/
|
|
39
|
+
reason?: string;
|
|
40
|
+
/**
|
|
41
|
+
* How long this model's attempt took, in milliseconds.
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @memberof RequestAttempt
|
|
44
|
+
*/
|
|
45
|
+
durationMs: number;
|
|
46
|
+
/**
|
|
47
|
+
* Time to first token, for the model that served a streamed call.
|
|
48
|
+
* @type {number}
|
|
49
|
+
* @memberof RequestAttempt
|
|
50
|
+
*/
|
|
51
|
+
ttftMs?: number;
|
|
52
|
+
/**
|
|
53
|
+
* How many upstream attempts were made for this model. 0 for a skipped model.
|
|
54
|
+
* @type {number}
|
|
55
|
+
* @memberof RequestAttempt
|
|
56
|
+
*/
|
|
57
|
+
tries: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @export
|
|
63
|
+
*/
|
|
64
|
+
export const RequestAttemptOutcomeEnum = {
|
|
65
|
+
Ok: 'ok',
|
|
66
|
+
Failed: 'failed',
|
|
67
|
+
Skipped: 'skipped'
|
|
68
|
+
} as const;
|
|
69
|
+
export type RequestAttemptOutcomeEnum = typeof RequestAttemptOutcomeEnum[keyof typeof RequestAttemptOutcomeEnum];
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Check if a given object implements the RequestAttempt interface.
|
|
74
|
+
*/
|
|
75
|
+
export function instanceOfRequestAttempt(value: object): value is RequestAttempt {
|
|
76
|
+
if (!('model' in value) || value['model'] === undefined) return false;
|
|
77
|
+
if (!('outcome' in value) || value['outcome'] === undefined) return false;
|
|
78
|
+
if ((!('durationMs' in (value as Record<string, any>)) && !('duration_ms' in (value as Record<string, any>))) || ((value as Record<string, any>)['durationMs'] === undefined && (value as Record<string, any>)['duration_ms'] === undefined)) return false;
|
|
79
|
+
if (!('tries' in value) || value['tries'] === undefined) return false;
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function RequestAttemptFromJSON(json: any): RequestAttempt {
|
|
84
|
+
return RequestAttemptFromJSONTyped(json, false);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function RequestAttemptFromJSONTyped(json: any, ignoreDiscriminator: boolean): RequestAttempt {
|
|
88
|
+
if (json == null) {
|
|
89
|
+
return json;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
|
|
93
|
+
'model': json['model'],
|
|
94
|
+
'outcome': json['outcome'],
|
|
95
|
+
'reason': json['reason'] == null ? undefined : json['reason'],
|
|
96
|
+
'durationMs': json['duration_ms'],
|
|
97
|
+
'ttftMs': json['ttft_ms'] == null ? undefined : json['ttft_ms'],
|
|
98
|
+
'tries': json['tries'],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function RequestAttemptToJSON(json: any): RequestAttempt {
|
|
103
|
+
return RequestAttemptToJSONTyped(json, false);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function RequestAttemptToJSONTyped(value?: RequestAttempt | null, ignoreDiscriminator: boolean = false): any {
|
|
107
|
+
if (value == null) {
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
|
|
113
|
+
'model': value['model'],
|
|
114
|
+
'outcome': value['outcome'],
|
|
115
|
+
'reason': value['reason'],
|
|
116
|
+
'duration_ms': value['durationMs'],
|
|
117
|
+
'ttft_ms': value['ttftMs'],
|
|
118
|
+
'tries': value['tries'],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
|
+
import type { RequestAttempt } from './RequestAttempt';
|
|
17
|
+
import {
|
|
18
|
+
RequestAttemptFromJSON,
|
|
19
|
+
RequestAttemptFromJSONTyped,
|
|
20
|
+
RequestAttemptToJSON,
|
|
21
|
+
RequestAttemptToJSONTyped,
|
|
22
|
+
} from './RequestAttempt';
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
25
|
* One inference call as the request log records it. Never carries prompt or completion content. Optional numeric fields are omitted when they do not apply (for example token counts on a rejected call).
|
|
18
26
|
* @export
|
|
@@ -181,6 +189,30 @@ export interface RequestLogEntry {
|
|
|
181
189
|
* @memberof RequestLogEntry
|
|
182
190
|
*/
|
|
183
191
|
suppressedCount?: number;
|
|
192
|
+
/**
|
|
193
|
+
* The model the request asked for. Always present; equal to `model` unless a backup model was tried.
|
|
194
|
+
* @type {string}
|
|
195
|
+
* @memberof RequestLogEntry
|
|
196
|
+
*/
|
|
197
|
+
requestedModel?: string;
|
|
198
|
+
/**
|
|
199
|
+
* The model that produced the response. Omitted when no model served (a failed or rejected call). When a backup served, `model` is this model and the row is billed at its price.
|
|
200
|
+
* @type {string}
|
|
201
|
+
* @memberof RequestLogEntry
|
|
202
|
+
*/
|
|
203
|
+
servedModel?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Set when backup models were tried: the requested model's public error code (for example `upstream_timeout`). Rows with it set are the ones `fallback=true` returns.
|
|
206
|
+
* @type {string}
|
|
207
|
+
* @memberof RequestLogEntry
|
|
208
|
+
*/
|
|
209
|
+
fallbackReason?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Present when backup models were tried: every model the request went through, in order, including skipped backups. Upstream providers are never named.
|
|
212
|
+
* @type {Array<RequestAttempt>}
|
|
213
|
+
* @memberof RequestLogEntry
|
|
214
|
+
*/
|
|
215
|
+
attempts?: Array<RequestAttempt>;
|
|
184
216
|
}
|
|
185
217
|
|
|
186
218
|
|
|
@@ -261,6 +293,10 @@ export function RequestLogEntryFromJSONTyped(json: any, ignoreDiscriminator: boo
|
|
|
261
293
|
'imageCount': json['image_count'] == null ? undefined : json['image_count'],
|
|
262
294
|
'videoSeconds': json['video_seconds'] == null ? undefined : json['video_seconds'],
|
|
263
295
|
'suppressedCount': json['suppressed_count'] == null ? undefined : json['suppressed_count'],
|
|
296
|
+
'requestedModel': json['requested_model'] == null ? undefined : json['requested_model'],
|
|
297
|
+
'servedModel': json['served_model'] == null ? undefined : json['served_model'],
|
|
298
|
+
'fallbackReason': json['fallback_reason'] == null ? undefined : json['fallback_reason'],
|
|
299
|
+
'attempts': json['attempts'] == null ? undefined : ((json['attempts'] as Array<any>).map(RequestAttemptFromJSON)),
|
|
264
300
|
};
|
|
265
301
|
}
|
|
266
302
|
|
|
@@ -302,6 +338,10 @@ export function RequestLogEntryToJSONTyped(value?: RequestLogEntry | null, ignor
|
|
|
302
338
|
'image_count': value['imageCount'],
|
|
303
339
|
'video_seconds': value['videoSeconds'],
|
|
304
340
|
'suppressed_count': value['suppressedCount'],
|
|
341
|
+
'requested_model': value['requestedModel'],
|
|
342
|
+
'served_model': value['servedModel'],
|
|
343
|
+
'fallback_reason': value['fallbackReason'],
|
|
344
|
+
'attempts': value['attempts'] == null ? undefined : ((value['attempts'] as Array<any>).map(RequestAttemptToJSON)),
|
|
305
345
|
};
|
|
306
346
|
}
|
|
307
347
|
|
|
@@ -71,7 +71,8 @@ export const WebhookEndpointEventTypesEnum = {
|
|
|
71
71
|
BalanceLow: 'balance.low',
|
|
72
72
|
SubscriptionQuotaThreshold: 'subscription_quota.threshold',
|
|
73
73
|
ApiKeyBudgetThreshold: 'api_key_budget.threshold',
|
|
74
|
-
MemberSpendThreshold: 'member_spend.threshold'
|
|
74
|
+
MemberSpendThreshold: 'member_spend.threshold',
|
|
75
|
+
PlanRosterModelRemoved: 'plan_roster.model_removed'
|
|
75
76
|
} as const;
|
|
76
77
|
export type WebhookEndpointEventTypesEnum = typeof WebhookEndpointEventTypesEnum[keyof typeof WebhookEndpointEventTypesEnum];
|
|
77
78
|
|
package/src/models/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './AlertSettingsUpdate';
|
|
|
6
6
|
export * from './ApiKey';
|
|
7
7
|
export * from './ApiKeyCreate';
|
|
8
8
|
export * from './ApiKeyCreated';
|
|
9
|
+
export * from './ApiKeyFallbackEntry';
|
|
9
10
|
export * from './ApiKeyList';
|
|
10
11
|
export * from './ApiKeyScopes';
|
|
11
12
|
export * from './ApiKeyUpdate';
|
|
@@ -45,6 +46,7 @@ export * from './PeakWindow';
|
|
|
45
46
|
export * from './Problem';
|
|
46
47
|
export * from './RefereeStatus';
|
|
47
48
|
export * from './Referral';
|
|
49
|
+
export * from './RequestAttempt';
|
|
48
50
|
export * from './RequestLogEntry';
|
|
49
51
|
export * from './RequestLogPage';
|
|
50
52
|
export * from './ResponseFormatJSONObject';
|
package/src/runtime.ts
CHANGED
|
@@ -75,7 +75,7 @@ export class Configuration {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
get headers(): HTTPHeaders | undefined {
|
|
78
|
-
return { 'User-Agent': 'deeprelay-sdk-ts/0.4.
|
|
78
|
+
return { 'User-Agent': 'deeprelay-sdk-ts/0.4.2', ...this.configuration.headers };
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
get credentials(): RequestCredentials | undefined {
|