@deeprelay/sdk 0.4.1 → 0.4.3
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/BillingApi.d.ts +2 -2
- package/dist/apis/BillingApi.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/BillingApi.d.ts +2 -2
- package/dist/esm/apis/BillingApi.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/RefereeStatus.d.ts +33 -4
- package/dist/esm/models/RefereeStatus.js +15 -1
- package/dist/esm/models/Referral.d.ts +10 -3
- package/dist/esm/models/Referral.js +2 -0
- 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/RefereeStatus.d.ts +33 -4
- package/dist/models/RefereeStatus.js +16 -2
- package/dist/models/Referral.d.ts +10 -3
- package/dist/models/Referral.js +2 -0
- 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/BillingApi.md +1 -1
- package/docs/ChatCompletionRequest.md +2 -0
- package/docs/InferenceApi.md +29 -26
- package/docs/RefereeStatus.md +6 -0
- package/docs/Referral.md +2 -0
- 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/BillingApi.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/RefereeStatus.ts +41 -5
- package/src/models/Referral.ts +12 -3
- 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,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.3', ...this.configuration.headers };
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
get credentials(): RequestCredentials | undefined {
|