@gpuai/sdk 0.5.4 → 0.5.5
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 +56 -0
- package/README.md +50 -2
- package/dist/apis/EndpointsApi.d.ts +150 -0
- package/dist/apis/EndpointsApi.js +379 -0
- package/dist/apis/InstancesApi.d.ts +15 -0
- package/dist/apis/InstancesApi.js +45 -0
- package/dist/apis/JobsApi.d.ts +172 -0
- package/dist/apis/JobsApi.js +444 -0
- package/dist/apis/OperationsApi.d.ts +17 -0
- package/dist/apis/OperationsApi.js +48 -0
- package/dist/apis/SecretsApi.d.ts +123 -0
- package/dist/apis/SecretsApi.js +328 -0
- package/dist/apis/index.d.ts +3 -0
- package/dist/apis/index.js +3 -0
- package/dist/esm/apis/EndpointsApi.d.ts +150 -0
- package/dist/esm/apis/EndpointsApi.js +375 -0
- package/dist/esm/apis/InstancesApi.d.ts +15 -0
- package/dist/esm/apis/InstancesApi.js +45 -0
- package/dist/esm/apis/JobsApi.d.ts +172 -0
- package/dist/esm/apis/JobsApi.js +440 -0
- package/dist/esm/apis/OperationsApi.d.ts +17 -0
- package/dist/esm/apis/OperationsApi.js +48 -0
- package/dist/esm/apis/SecretsApi.d.ts +123 -0
- package/dist/esm/apis/SecretsApi.js +324 -0
- package/dist/esm/apis/index.d.ts +3 -0
- package/dist/esm/apis/index.js +3 -0
- package/dist/esm/models/DedicatedIPOffer.d.ts +98 -0
- package/dist/esm/models/DedicatedIPOffer.js +87 -0
- package/dist/esm/models/Endpoint.d.ts +147 -0
- package/dist/esm/models/Endpoint.js +121 -0
- package/dist/esm/models/EndpointCreate.d.ts +80 -0
- package/dist/esm/models/EndpointCreate.js +63 -0
- package/dist/esm/models/EndpointList.d.ts +33 -0
- package/dist/esm/models/EndpointList.js +44 -0
- package/dist/esm/models/EndpointMachine.d.ts +90 -0
- package/dist/esm/models/EndpointMachine.js +84 -0
- package/dist/esm/models/EndpointReplicaCounts.d.ts +38 -0
- package/dist/esm/models/EndpointReplicaCounts.js +47 -0
- package/dist/esm/models/Job.d.ts +352 -0
- package/dist/esm/models/Job.js +254 -0
- package/dist/esm/models/JobAttempt.d.ts +176 -0
- package/dist/esm/models/JobAttempt.js +147 -0
- package/dist/esm/models/JobCreate.d.ts +153 -0
- package/dist/esm/models/JobCreate.js +84 -0
- package/dist/esm/models/JobGpuTypes.d.ts +39 -0
- package/dist/esm/models/JobGpuTypes.js +48 -0
- package/dist/esm/models/JobGpuTypesDataInner.d.ts +58 -0
- package/dist/esm/models/JobGpuTypesDataInner.js +59 -0
- package/dist/esm/models/JobLogChunk.d.ts +50 -0
- package/dist/esm/models/JobLogChunk.js +55 -0
- package/dist/esm/models/JobLogs.d.ts +39 -0
- package/dist/esm/models/JobLogs.js +48 -0
- package/dist/esm/models/JobPage.d.ts +39 -0
- package/dist/esm/models/JobPage.js +48 -0
- package/dist/esm/models/JobSharingHint.d.ts +46 -0
- package/dist/esm/models/JobSharingHint.js +51 -0
- package/dist/esm/models/JobTelemetry.d.ts +51 -0
- package/dist/esm/models/JobTelemetry.js +56 -0
- package/dist/esm/models/JobTelemetryPoint.d.ts +56 -0
- package/dist/esm/models/JobTelemetryPoint.js +59 -0
- package/dist/esm/models/JobTrial.d.ts +79 -0
- package/dist/esm/models/JobTrial.js +73 -0
- package/dist/esm/models/Secret.d.ts +62 -0
- package/dist/esm/models/Secret.js +63 -0
- package/dist/esm/models/SecretCreate.d.ts +44 -0
- package/dist/esm/models/SecretCreate.js +49 -0
- package/dist/esm/models/SecretImportItem.d.ts +38 -0
- package/dist/esm/models/SecretImportItem.js +47 -0
- package/dist/esm/models/SecretImportRequest.d.ts +39 -0
- package/dist/esm/models/SecretImportRequest.js +46 -0
- package/dist/esm/models/SecretImportResult.d.ts +44 -0
- package/dist/esm/models/SecretImportResult.js +51 -0
- package/dist/esm/models/SecretList.d.ts +33 -0
- package/dist/esm/models/SecretList.js +44 -0
- package/dist/esm/models/SecretPut.d.ts +38 -0
- package/dist/esm/models/SecretPut.js +45 -0
- package/dist/esm/models/index.d.ts +25 -0
- package/dist/esm/models/index.js +25 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/DedicatedIPOffer.d.ts +98 -0
- package/dist/models/DedicatedIPOffer.js +94 -0
- package/dist/models/Endpoint.d.ts +147 -0
- package/dist/models/Endpoint.js +129 -0
- package/dist/models/EndpointCreate.d.ts +80 -0
- package/dist/models/EndpointCreate.js +70 -0
- package/dist/models/EndpointList.d.ts +33 -0
- package/dist/models/EndpointList.js +51 -0
- package/dist/models/EndpointMachine.d.ts +90 -0
- package/dist/models/EndpointMachine.js +92 -0
- package/dist/models/EndpointReplicaCounts.d.ts +38 -0
- package/dist/models/EndpointReplicaCounts.js +54 -0
- package/dist/models/Job.d.ts +352 -0
- package/dist/models/Job.js +262 -0
- package/dist/models/JobAttempt.d.ts +176 -0
- package/dist/models/JobAttempt.js +155 -0
- package/dist/models/JobCreate.d.ts +153 -0
- package/dist/models/JobCreate.js +92 -0
- package/dist/models/JobGpuTypes.d.ts +39 -0
- package/dist/models/JobGpuTypes.js +55 -0
- package/dist/models/JobGpuTypesDataInner.d.ts +58 -0
- package/dist/models/JobGpuTypesDataInner.js +66 -0
- package/dist/models/JobLogChunk.d.ts +50 -0
- package/dist/models/JobLogChunk.js +62 -0
- package/dist/models/JobLogs.d.ts +39 -0
- package/dist/models/JobLogs.js +55 -0
- package/dist/models/JobPage.d.ts +39 -0
- package/dist/models/JobPage.js +55 -0
- package/dist/models/JobSharingHint.d.ts +46 -0
- package/dist/models/JobSharingHint.js +58 -0
- package/dist/models/JobTelemetry.d.ts +51 -0
- package/dist/models/JobTelemetry.js +63 -0
- package/dist/models/JobTelemetryPoint.d.ts +56 -0
- package/dist/models/JobTelemetryPoint.js +66 -0
- package/dist/models/JobTrial.d.ts +79 -0
- package/dist/models/JobTrial.js +81 -0
- package/dist/models/Secret.d.ts +62 -0
- package/dist/models/Secret.js +70 -0
- package/dist/models/SecretCreate.d.ts +44 -0
- package/dist/models/SecretCreate.js +56 -0
- package/dist/models/SecretImportItem.d.ts +38 -0
- package/dist/models/SecretImportItem.js +54 -0
- package/dist/models/SecretImportRequest.d.ts +39 -0
- package/dist/models/SecretImportRequest.js +53 -0
- package/dist/models/SecretImportResult.d.ts +44 -0
- package/dist/models/SecretImportResult.js +58 -0
- package/dist/models/SecretList.d.ts +33 -0
- package/dist/models/SecretList.js +51 -0
- package/dist/models/SecretPut.d.ts +38 -0
- package/dist/models/SecretPut.js +52 -0
- package/dist/models/index.d.ts +25 -0
- package/dist/models/index.js +25 -0
- package/dist/runtime.js +1 -1
- package/docs/DedicatedIPOffer.md +56 -0
- package/docs/Endpoint.md +68 -0
- package/docs/EndpointCreate.md +50 -0
- package/docs/EndpointList.md +34 -0
- package/docs/EndpointMachine.md +50 -0
- package/docs/EndpointReplicaCounts.md +36 -0
- package/docs/EndpointsApi.md +544 -0
- package/docs/InstancesApi.md +67 -0
- package/docs/Job.md +125 -0
- package/docs/JobAttempt.md +69 -0
- package/docs/JobCreate.md +66 -0
- package/docs/JobGpuTypes.md +36 -0
- package/docs/JobGpuTypesDataInner.md +42 -0
- package/docs/JobLogChunk.md +40 -0
- package/docs/JobLogs.md +36 -0
- package/docs/JobPage.md +36 -0
- package/docs/JobSharingHint.md +39 -0
- package/docs/JobTelemetry.md +40 -0
- package/docs/JobTelemetryPoint.md +42 -0
- package/docs/JobTrial.md +46 -0
- package/docs/JobsApi.md +609 -0
- package/docs/OperationsApi.md +76 -0
- package/docs/Secret.md +45 -0
- package/docs/SecretCreate.md +38 -0
- package/docs/SecretImportItem.md +36 -0
- package/docs/SecretImportRequest.md +36 -0
- package/docs/SecretImportResult.md +38 -0
- package/docs/SecretList.md +34 -0
- package/docs/SecretPut.md +36 -0
- package/docs/SecretsApi.md +450 -0
- package/package.json +1 -1
- package/src/apis/EndpointsApi.ts +481 -0
- package/src/apis/InstancesApi.ts +52 -0
- package/src/apis/JobsApi.ts +551 -0
- package/src/apis/OperationsApi.ts +59 -0
- package/src/apis/SecretsApi.ts +413 -0
- package/src/apis/index.ts +3 -0
- package/src/models/DedicatedIPOffer.ts +165 -0
- package/src/models/Endpoint.ts +247 -0
- package/src/models/EndpointCreate.ts +132 -0
- package/src/models/EndpointList.ts +74 -0
- package/src/models/EndpointMachine.ts +151 -0
- package/src/models/EndpointReplicaCounts.ts +75 -0
- package/src/models/Job.ts +538 -0
- package/src/models/JobAttempt.ts +267 -0
- package/src/models/JobCreate.ts +221 -0
- package/src/models/JobGpuTypes.ts +83 -0
- package/src/models/JobGpuTypesDataInner.ts +104 -0
- package/src/models/JobLogChunk.ts +93 -0
- package/src/models/JobLogs.ts +83 -0
- package/src/models/JobPage.ts +83 -0
- package/src/models/JobSharingHint.ts +86 -0
- package/src/models/JobTelemetry.ts +101 -0
- package/src/models/JobTelemetryPoint.ts +102 -0
- package/src/models/JobTrial.ts +132 -0
- package/src/models/Secret.ts +111 -0
- package/src/models/SecretCreate.ts +83 -0
- package/src/models/SecretImportItem.ts +75 -0
- package/src/models/SecretImportRequest.ts +82 -0
- package/src/models/SecretImportResult.ts +84 -0
- package/src/models/SecretList.ts +74 -0
- package/src/models/SecretPut.ts +74 -0
- package/src/models/index.ts +25 -0
- package/src/runtime.ts +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
# EndpointMachine
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`id` | string
|
|
10
|
+
`status` | string
|
|
11
|
+
`instanceId` | string
|
|
12
|
+
`gpuType` | string
|
|
13
|
+
`pricePerHour` | number
|
|
14
|
+
`readyAt` | Date
|
|
15
|
+
`terminatedAt` | Date
|
|
16
|
+
`terminateReason` | string
|
|
17
|
+
`createdAt` | Date
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import type { EndpointMachine } from '@gpuai/sdk'
|
|
23
|
+
|
|
24
|
+
// TODO: Update the object below with actual values
|
|
25
|
+
const example = {
|
|
26
|
+
"id": null,
|
|
27
|
+
"status": null,
|
|
28
|
+
"instanceId": null,
|
|
29
|
+
"gpuType": null,
|
|
30
|
+
"pricePerHour": null,
|
|
31
|
+
"readyAt": null,
|
|
32
|
+
"terminatedAt": null,
|
|
33
|
+
"terminateReason": null,
|
|
34
|
+
"createdAt": null,
|
|
35
|
+
} satisfies EndpointMachine
|
|
36
|
+
|
|
37
|
+
console.log(example)
|
|
38
|
+
|
|
39
|
+
// Convert the instance to a JSON string
|
|
40
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
41
|
+
console.log(exampleJSON)
|
|
42
|
+
|
|
43
|
+
// Parse the JSON string back to an object
|
|
44
|
+
const exampleParsed = JSON.parse(exampleJSON) as EndpointMachine
|
|
45
|
+
console.log(exampleParsed)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
49
|
+
|
|
50
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# EndpointReplicaCounts
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`starting` | number
|
|
10
|
+
`ready` | number
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { EndpointReplicaCounts } from '@gpuai/sdk'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"starting": null,
|
|
20
|
+
"ready": null,
|
|
21
|
+
} satisfies EndpointReplicaCounts
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as EndpointReplicaCounts
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
# EndpointsApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.gpu.ai/v1*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
|------------- | ------------- | -------------|
|
|
7
|
+
| [**createEndpoint**](EndpointsApi.md#createendpoint) | **POST** /endpoints | Create a model endpoint |
|
|
8
|
+
| [**createEndpointChatCompletion**](EndpointsApi.md#createendpointchatcompletion) | **POST** /endpoints/{id}/openai/v1/chat/completions | Chat completion on a model endpoint (OpenAI-compatible) |
|
|
9
|
+
| [**createEndpointCompletion**](EndpointsApi.md#createendpointcompletion) | **POST** /endpoints/{id}/openai/v1/completions | Text completion on a model endpoint (OpenAI-compatible) |
|
|
10
|
+
| [**deleteEndpoint**](EndpointsApi.md#deleteendpoint) | **DELETE** /endpoints/{id} | Delete a model endpoint |
|
|
11
|
+
| [**getEndpoint**](EndpointsApi.md#getendpoint) | **GET** /endpoints/{id} | Get a model endpoint |
|
|
12
|
+
| [**listEndpointModels**](EndpointsApi.md#listendpointmodels) | **GET** /endpoints/{id}/openai/v1/models | List the model an endpoint serves (OpenAI-compatible) |
|
|
13
|
+
| [**listEndpoints**](EndpointsApi.md#listendpoints) | **GET** /endpoints | List model endpoints |
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## createEndpoint
|
|
18
|
+
|
|
19
|
+
> Endpoint createEndpoint(endpointCreate)
|
|
20
|
+
|
|
21
|
+
Create a model endpoint
|
|
22
|
+
|
|
23
|
+
Creates an OpenAI-compatible endpoint serving a Hugging Face model with vLLM on the chosen GPU type. Nothing starts until the first request arrives, unless `min_replicas` keeps machines warm. Each machine is billed for the time it exists, like an instance, through the same balance. For a gated model, store a Hugging Face token as a secret and name it in `hf_token_secret`; it reaches the machines as HF_TOKEN. Returns 422 `validation_failed` for a bad field, 409 `name_taken` for a duplicate name, and 409 `limit_reached` at the per-organization cap. Requires the `functions:write` scope.
|
|
24
|
+
|
|
25
|
+
### Example
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import {
|
|
29
|
+
Configuration,
|
|
30
|
+
EndpointsApi,
|
|
31
|
+
} from '@gpuai/sdk';
|
|
32
|
+
import type { CreateEndpointRequest } from '@gpuai/sdk';
|
|
33
|
+
|
|
34
|
+
async function example() {
|
|
35
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
36
|
+
const config = new Configuration({
|
|
37
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
38
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
39
|
+
});
|
|
40
|
+
const api = new EndpointsApi(config);
|
|
41
|
+
|
|
42
|
+
const body = {
|
|
43
|
+
// EndpointCreate
|
|
44
|
+
endpointCreate: ...,
|
|
45
|
+
} satisfies CreateEndpointRequest;
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const data = await api.createEndpoint(body);
|
|
49
|
+
console.log(data);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error(error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Run the test
|
|
56
|
+
example().catch(console.error);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Parameters
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
| Name | Type | Description | Notes |
|
|
63
|
+
|------------- | ------------- | ------------- | -------------|
|
|
64
|
+
| **endpointCreate** | [EndpointCreate](EndpointCreate.md) | | |
|
|
65
|
+
|
|
66
|
+
### Return type
|
|
67
|
+
|
|
68
|
+
[**Endpoint**](Endpoint.md)
|
|
69
|
+
|
|
70
|
+
### Authorization
|
|
71
|
+
|
|
72
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
73
|
+
|
|
74
|
+
### HTTP request headers
|
|
75
|
+
|
|
76
|
+
- **Content-Type**: `application/json`
|
|
77
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### HTTP response details
|
|
81
|
+
| Status code | Description | Response headers |
|
|
82
|
+
|-------------|-------------|------------------|
|
|
83
|
+
| **201** | Created. | - |
|
|
84
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
85
|
+
| **0** | Error response (RFC 7807) | - |
|
|
86
|
+
|
|
87
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## createEndpointChatCompletion
|
|
91
|
+
|
|
92
|
+
> ChatCompletionResponse createEndpointChatCompletion(id, chatCompletionRequest)
|
|
93
|
+
|
|
94
|
+
Chat completion on a model endpoint (OpenAI-compatible)
|
|
95
|
+
|
|
96
|
+
The OpenAI chat completions route of one endpoint: point an OpenAI client\'s base_url at the endpoint\'s `url` and use a GPU.ai API key with the `functions:write` scope. The request\'s `model` is replaced with the endpoint\'s model, so any value works. Set `\"stream\": true` for Server-Sent Events, passed through as vLLM produces them. When no machine is ready the request waits while one starts (a cold start takes minutes: machine, image and model download); if none is ready in time the answer is 503 `endpoint_starting` with Retry-After. 402 `insufficient_quota` when the balance is empty. Errors use the OpenAI error envelope.
|
|
97
|
+
|
|
98
|
+
### Example
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import {
|
|
102
|
+
Configuration,
|
|
103
|
+
EndpointsApi,
|
|
104
|
+
} from '@gpuai/sdk';
|
|
105
|
+
import type { CreateEndpointChatCompletionRequest } from '@gpuai/sdk';
|
|
106
|
+
|
|
107
|
+
async function example() {
|
|
108
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
109
|
+
const config = new Configuration({
|
|
110
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
111
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
112
|
+
});
|
|
113
|
+
const api = new EndpointsApi(config);
|
|
114
|
+
|
|
115
|
+
const body = {
|
|
116
|
+
// string | The endpoint\'s id.
|
|
117
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
118
|
+
// ChatCompletionRequest
|
|
119
|
+
chatCompletionRequest: ...,
|
|
120
|
+
} satisfies CreateEndpointChatCompletionRequest;
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
const data = await api.createEndpointChatCompletion(body);
|
|
124
|
+
console.log(data);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Run the test
|
|
131
|
+
example().catch(console.error);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Parameters
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
| Name | Type | Description | Notes |
|
|
138
|
+
|------------- | ------------- | ------------- | -------------|
|
|
139
|
+
| **id** | `string` | The endpoint\'s id. | [Defaults to `undefined`] |
|
|
140
|
+
| **chatCompletionRequest** | [ChatCompletionRequest](ChatCompletionRequest.md) | | |
|
|
141
|
+
|
|
142
|
+
### Return type
|
|
143
|
+
|
|
144
|
+
[**ChatCompletionResponse**](ChatCompletionResponse.md)
|
|
145
|
+
|
|
146
|
+
### Authorization
|
|
147
|
+
|
|
148
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
149
|
+
|
|
150
|
+
### HTTP request headers
|
|
151
|
+
|
|
152
|
+
- **Content-Type**: `application/json`
|
|
153
|
+
- **Accept**: `application/json`, `text/event-stream`
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### HTTP response details
|
|
157
|
+
| Status code | Description | Response headers |
|
|
158
|
+
|-------------|-------------|------------------|
|
|
159
|
+
| **200** | application/json for non-streaming requests; text/event-stream when stream=true. | - |
|
|
160
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
161
|
+
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
162
|
+
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
163
|
+
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
164
|
+
| **404** | Model or resource not found (OpenAI error envelope). | - |
|
|
165
|
+
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
166
|
+
| **502** | Internal server error (OpenAI error envelope). | - |
|
|
167
|
+
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. Code `data_retention_check_failed` means the org zero data retention setting could not be read, so the request was not sent; retry shortly. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
168
|
+
|
|
169
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## createEndpointCompletion
|
|
173
|
+
|
|
174
|
+
> { [key: string]: any; } createEndpointCompletion(id, requestBody)
|
|
175
|
+
|
|
176
|
+
Text completion on a model endpoint (OpenAI-compatible)
|
|
177
|
+
|
|
178
|
+
The OpenAI completions route of one endpoint, with the same auth, model rewrite, streaming, cold start and error behavior as chat completions.
|
|
179
|
+
|
|
180
|
+
### Example
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
import {
|
|
184
|
+
Configuration,
|
|
185
|
+
EndpointsApi,
|
|
186
|
+
} from '@gpuai/sdk';
|
|
187
|
+
import type { CreateEndpointCompletionRequest } from '@gpuai/sdk';
|
|
188
|
+
|
|
189
|
+
async function example() {
|
|
190
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
191
|
+
const config = new Configuration({
|
|
192
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
193
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
194
|
+
});
|
|
195
|
+
const api = new EndpointsApi(config);
|
|
196
|
+
|
|
197
|
+
const body = {
|
|
198
|
+
// string | The endpoint\'s id.
|
|
199
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
200
|
+
// { [key: string]: any | null; }
|
|
201
|
+
requestBody: Object,
|
|
202
|
+
} satisfies CreateEndpointCompletionRequest;
|
|
203
|
+
|
|
204
|
+
try {
|
|
205
|
+
const data = await api.createEndpointCompletion(body);
|
|
206
|
+
console.log(data);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
console.error(error);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Run the test
|
|
213
|
+
example().catch(console.error);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Parameters
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
| Name | Type | Description | Notes |
|
|
220
|
+
|------------- | ------------- | ------------- | -------------|
|
|
221
|
+
| **id** | `string` | The endpoint\'s id. | [Defaults to `undefined`] |
|
|
222
|
+
| **requestBody** | `{ [key: string]: any | null; }` | | |
|
|
223
|
+
|
|
224
|
+
### Return type
|
|
225
|
+
|
|
226
|
+
**{ [key: string]: any; }**
|
|
227
|
+
|
|
228
|
+
### Authorization
|
|
229
|
+
|
|
230
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
231
|
+
|
|
232
|
+
### HTTP request headers
|
|
233
|
+
|
|
234
|
+
- **Content-Type**: `application/json`
|
|
235
|
+
- **Accept**: `application/json`, `text/event-stream`
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
### HTTP response details
|
|
239
|
+
| Status code | Description | Response headers |
|
|
240
|
+
|-------------|-------------|------------------|
|
|
241
|
+
| **200** | application/json for non-streaming requests; text/event-stream when stream=true. | - |
|
|
242
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
243
|
+
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
244
|
+
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
245
|
+
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
246
|
+
| **404** | Model or resource not found (OpenAI error envelope). | - |
|
|
247
|
+
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
248
|
+
| **502** | Internal server error (OpenAI error envelope). | - |
|
|
249
|
+
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. Code `data_retention_check_failed` means the org zero data retention setting could not be read, so the request was not sent; retry shortly. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
250
|
+
|
|
251
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## deleteEndpoint
|
|
255
|
+
|
|
256
|
+
> deleteEndpoint(id)
|
|
257
|
+
|
|
258
|
+
Delete a model endpoint
|
|
259
|
+
|
|
260
|
+
Deletes the endpoint. Its machines are released within seconds and stop billing when terminated. Requires the `functions:write` scope.
|
|
261
|
+
|
|
262
|
+
### Example
|
|
263
|
+
|
|
264
|
+
```ts
|
|
265
|
+
import {
|
|
266
|
+
Configuration,
|
|
267
|
+
EndpointsApi,
|
|
268
|
+
} from '@gpuai/sdk';
|
|
269
|
+
import type { DeleteEndpointRequest } from '@gpuai/sdk';
|
|
270
|
+
|
|
271
|
+
async function example() {
|
|
272
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
273
|
+
const config = new Configuration({
|
|
274
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
275
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
276
|
+
});
|
|
277
|
+
const api = new EndpointsApi(config);
|
|
278
|
+
|
|
279
|
+
const body = {
|
|
280
|
+
// string | The endpoint\'s id.
|
|
281
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
282
|
+
} satisfies DeleteEndpointRequest;
|
|
283
|
+
|
|
284
|
+
try {
|
|
285
|
+
const data = await api.deleteEndpoint(body);
|
|
286
|
+
console.log(data);
|
|
287
|
+
} catch (error) {
|
|
288
|
+
console.error(error);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Run the test
|
|
293
|
+
example().catch(console.error);
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Parameters
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
| Name | Type | Description | Notes |
|
|
300
|
+
|------------- | ------------- | ------------- | -------------|
|
|
301
|
+
| **id** | `string` | The endpoint\'s id. | [Defaults to `undefined`] |
|
|
302
|
+
|
|
303
|
+
### Return type
|
|
304
|
+
|
|
305
|
+
`void` (Empty response body)
|
|
306
|
+
|
|
307
|
+
### Authorization
|
|
308
|
+
|
|
309
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
310
|
+
|
|
311
|
+
### HTTP request headers
|
|
312
|
+
|
|
313
|
+
- **Content-Type**: Not defined
|
|
314
|
+
- **Accept**: `application/problem+json`
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
### HTTP response details
|
|
318
|
+
| Status code | Description | Response headers |
|
|
319
|
+
|-------------|-------------|------------------|
|
|
320
|
+
| **204** | Deleted. | - |
|
|
321
|
+
| **404** | Error response (RFC 7807) | - |
|
|
322
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
323
|
+
| **0** | Error response (RFC 7807) | - |
|
|
324
|
+
|
|
325
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
## getEndpoint
|
|
329
|
+
|
|
330
|
+
> Endpoint getEndpoint(id)
|
|
331
|
+
|
|
332
|
+
Get a model endpoint
|
|
333
|
+
|
|
334
|
+
Returns one endpoint with its recent machines (newest first), each with its price, ready and terminated times, and why it was released. Requires the `functions:read` scope.
|
|
335
|
+
|
|
336
|
+
### Example
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
import {
|
|
340
|
+
Configuration,
|
|
341
|
+
EndpointsApi,
|
|
342
|
+
} from '@gpuai/sdk';
|
|
343
|
+
import type { GetEndpointRequest } from '@gpuai/sdk';
|
|
344
|
+
|
|
345
|
+
async function example() {
|
|
346
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
347
|
+
const config = new Configuration({
|
|
348
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
349
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
350
|
+
});
|
|
351
|
+
const api = new EndpointsApi(config);
|
|
352
|
+
|
|
353
|
+
const body = {
|
|
354
|
+
// string | The endpoint\'s id.
|
|
355
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
356
|
+
} satisfies GetEndpointRequest;
|
|
357
|
+
|
|
358
|
+
try {
|
|
359
|
+
const data = await api.getEndpoint(body);
|
|
360
|
+
console.log(data);
|
|
361
|
+
} catch (error) {
|
|
362
|
+
console.error(error);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Run the test
|
|
367
|
+
example().catch(console.error);
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Parameters
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
| Name | Type | Description | Notes |
|
|
374
|
+
|------------- | ------------- | ------------- | -------------|
|
|
375
|
+
| **id** | `string` | The endpoint\'s id. | [Defaults to `undefined`] |
|
|
376
|
+
|
|
377
|
+
### Return type
|
|
378
|
+
|
|
379
|
+
[**Endpoint**](Endpoint.md)
|
|
380
|
+
|
|
381
|
+
### Authorization
|
|
382
|
+
|
|
383
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
384
|
+
|
|
385
|
+
### HTTP request headers
|
|
386
|
+
|
|
387
|
+
- **Content-Type**: Not defined
|
|
388
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
### HTTP response details
|
|
392
|
+
| Status code | Description | Response headers |
|
|
393
|
+
|-------------|-------------|------------------|
|
|
394
|
+
| **200** | The endpoint. | - |
|
|
395
|
+
| **404** | Error response (RFC 7807) | - |
|
|
396
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
397
|
+
| **0** | Error response (RFC 7807) | - |
|
|
398
|
+
|
|
399
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
## listEndpointModels
|
|
403
|
+
|
|
404
|
+
> { [key: string]: any; } listEndpointModels(id)
|
|
405
|
+
|
|
406
|
+
List the model an endpoint serves (OpenAI-compatible)
|
|
407
|
+
|
|
408
|
+
The OpenAI models route of one endpoint: the one model it serves. Can trigger a cold start like any other request.
|
|
409
|
+
|
|
410
|
+
### Example
|
|
411
|
+
|
|
412
|
+
```ts
|
|
413
|
+
import {
|
|
414
|
+
Configuration,
|
|
415
|
+
EndpointsApi,
|
|
416
|
+
} from '@gpuai/sdk';
|
|
417
|
+
import type { ListEndpointModelsRequest } from '@gpuai/sdk';
|
|
418
|
+
|
|
419
|
+
async function example() {
|
|
420
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
421
|
+
const config = new Configuration({
|
|
422
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
423
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
424
|
+
});
|
|
425
|
+
const api = new EndpointsApi(config);
|
|
426
|
+
|
|
427
|
+
const body = {
|
|
428
|
+
// string | The endpoint\'s id.
|
|
429
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
430
|
+
} satisfies ListEndpointModelsRequest;
|
|
431
|
+
|
|
432
|
+
try {
|
|
433
|
+
const data = await api.listEndpointModels(body);
|
|
434
|
+
console.log(data);
|
|
435
|
+
} catch (error) {
|
|
436
|
+
console.error(error);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Run the test
|
|
441
|
+
example().catch(console.error);
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Parameters
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
| Name | Type | Description | Notes |
|
|
448
|
+
|------------- | ------------- | ------------- | -------------|
|
|
449
|
+
| **id** | `string` | The endpoint\'s id. | [Defaults to `undefined`] |
|
|
450
|
+
|
|
451
|
+
### Return type
|
|
452
|
+
|
|
453
|
+
**{ [key: string]: any; }**
|
|
454
|
+
|
|
455
|
+
### Authorization
|
|
456
|
+
|
|
457
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
458
|
+
|
|
459
|
+
### HTTP request headers
|
|
460
|
+
|
|
461
|
+
- **Content-Type**: Not defined
|
|
462
|
+
- **Accept**: `application/json`
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
### HTTP response details
|
|
466
|
+
| Status code | Description | Response headers |
|
|
467
|
+
|-------------|-------------|------------------|
|
|
468
|
+
| **200** | An OpenAI model list. | - |
|
|
469
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
470
|
+
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
471
|
+
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
472
|
+
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
473
|
+
| **404** | Model or resource not found (OpenAI error envelope). | - |
|
|
474
|
+
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
475
|
+
| **502** | Internal server error (OpenAI error envelope). | - |
|
|
476
|
+
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. Code `data_retention_check_failed` means the org zero data retention setting could not be read, so the request was not sent; retry shortly. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
477
|
+
|
|
478
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
## listEndpoints
|
|
482
|
+
|
|
483
|
+
> EndpointList listEndpoints()
|
|
484
|
+
|
|
485
|
+
List model endpoints
|
|
486
|
+
|
|
487
|
+
Lists the organization\'s live model endpoints with their status, URL and machine counts. Requires the `functions:read` scope.
|
|
488
|
+
|
|
489
|
+
### Example
|
|
490
|
+
|
|
491
|
+
```ts
|
|
492
|
+
import {
|
|
493
|
+
Configuration,
|
|
494
|
+
EndpointsApi,
|
|
495
|
+
} from '@gpuai/sdk';
|
|
496
|
+
import type { ListEndpointsRequest } from '@gpuai/sdk';
|
|
497
|
+
|
|
498
|
+
async function example() {
|
|
499
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
500
|
+
const config = new Configuration({
|
|
501
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
502
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
503
|
+
});
|
|
504
|
+
const api = new EndpointsApi(config);
|
|
505
|
+
|
|
506
|
+
try {
|
|
507
|
+
const data = await api.listEndpoints();
|
|
508
|
+
console.log(data);
|
|
509
|
+
} catch (error) {
|
|
510
|
+
console.error(error);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// Run the test
|
|
515
|
+
example().catch(console.error);
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Parameters
|
|
519
|
+
|
|
520
|
+
This endpoint does not need any parameter.
|
|
521
|
+
|
|
522
|
+
### Return type
|
|
523
|
+
|
|
524
|
+
[**EndpointList**](EndpointList.md)
|
|
525
|
+
|
|
526
|
+
### Authorization
|
|
527
|
+
|
|
528
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
529
|
+
|
|
530
|
+
### HTTP request headers
|
|
531
|
+
|
|
532
|
+
- **Content-Type**: Not defined
|
|
533
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
### HTTP response details
|
|
537
|
+
| Status code | Description | Response headers |
|
|
538
|
+
|-------------|-------------|------------------|
|
|
539
|
+
| **200** | The organization\'s endpoints. | - |
|
|
540
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
541
|
+
| **0** | Error response (RFC 7807) | - |
|
|
542
|
+
|
|
543
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
544
|
+
|