@runwayml/sdk 4.30.0 → 4.31.1
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/CHANGELOG.md +18 -0
- package/client.d.mts +15 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +15 -0
- package/client.d.ts.map +1 -1
- package/client.js +15 -0
- package/client.js.map +1 -1
- package/client.mjs +15 -0
- package/client.mjs.map +1 -1
- package/lib/polling.d.mts.map +1 -1
- package/lib/polling.d.ts.map +1 -1
- package/lib/polling.js +6 -8
- package/lib/polling.js.map +1 -1
- package/lib/polling.mjs +6 -8
- package/lib/polling.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/generate/generate.d.mts +4 -0
- package/resources/generate/generate.d.mts.map +1 -1
- package/resources/generate/generate.d.ts +4 -0
- package/resources/generate/generate.d.ts.map +1 -1
- package/resources/generate/generate.js +4 -0
- package/resources/generate/generate.js.map +1 -1
- package/resources/generate/generate.mjs +4 -0
- package/resources/generate/generate.mjs.map +1 -1
- package/resources/generate/index.d.mts +1 -0
- package/resources/generate/index.d.mts.map +1 -1
- package/resources/generate/index.d.ts +1 -0
- package/resources/generate/index.d.ts.map +1 -1
- package/resources/generate/index.js +3 -1
- package/resources/generate/index.js.map +1 -1
- package/resources/generate/index.mjs +1 -0
- package/resources/generate/index.mjs.map +1 -1
- package/resources/generate/mesh.d.mts +162 -0
- package/resources/generate/mesh.d.mts.map +1 -0
- package/resources/generate/mesh.d.ts +162 -0
- package/resources/generate/mesh.d.ts.map +1 -0
- package/resources/generate/mesh.js +16 -0
- package/resources/generate/mesh.js.map +1 -0
- package/resources/generate/mesh.mjs +12 -0
- package/resources/generate/mesh.mjs.map +1 -0
- package/resources/image-to-mesh.d.mts +128 -0
- package/resources/image-to-mesh.d.mts.map +1 -0
- package/resources/image-to-mesh.d.ts +128 -0
- package/resources/image-to-mesh.d.ts.map +1 -0
- package/resources/image-to-mesh.js +27 -0
- package/resources/image-to-mesh.js.map +1 -0
- package/resources/image-to-mesh.mjs +23 -0
- package/resources/image-to-mesh.mjs.map +1 -0
- package/resources/index.d.mts +3 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -1
- package/resources/model-catalog.d.mts +139 -0
- package/resources/model-catalog.d.mts.map +1 -0
- package/resources/model-catalog.d.ts +139 -0
- package/resources/model-catalog.d.ts.map +1 -0
- package/resources/model-catalog.js +28 -0
- package/resources/model-catalog.js.map +1 -0
- package/resources/model-catalog.mjs +24 -0
- package/resources/model-catalog.mjs.map +1 -0
- package/resources/text-to-mesh.d.mts +83 -0
- package/resources/text-to-mesh.d.mts.map +1 -0
- package/resources/text-to-mesh.d.ts +83 -0
- package/resources/text-to-mesh.d.ts.map +1 -0
- package/resources/text-to-mesh.js +19 -0
- package/resources/text-to-mesh.js.map +1 -0
- package/resources/text-to-mesh.mjs +15 -0
- package/resources/text-to-mesh.mjs.map +1 -0
- package/src/client.ts +29 -0
- package/src/lib/polling.ts +6 -8
- package/src/resources/generate/generate.ts +10 -0
- package/src/resources/generate/index.ts +1 -0
- package/src/resources/generate/mesh.ts +214 -0
- package/src/resources/image-to-mesh.ts +176 -0
- package/src/resources/index.ts +3 -0
- package/src/resources/model-catalog.ts +161 -0
- package/src/resources/text-to-mesh.ts +118 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/client.ts
CHANGED
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
DocumentUpdateParams,
|
|
56
56
|
Documents,
|
|
57
57
|
} from './resources/documents';
|
|
58
|
+
import { ImageToMesh, ImageToMeshCreateParams, ImageToMeshCreateResponse } from './resources/image-to-mesh';
|
|
58
59
|
import {
|
|
59
60
|
ImageToVector,
|
|
60
61
|
ImageToVectorCreateParams,
|
|
@@ -70,6 +71,7 @@ import {
|
|
|
70
71
|
ImageUpscaleCreateParams,
|
|
71
72
|
ImageUpscaleCreateResponse,
|
|
72
73
|
} from './resources/image-upscale';
|
|
74
|
+
import { ModelCatalog, ModelCatalogListResponse } from './resources/model-catalog';
|
|
73
75
|
import {
|
|
74
76
|
DeprecatedLivekit,
|
|
75
77
|
RealtimeSessionCreateParams,
|
|
@@ -116,6 +118,7 @@ import {
|
|
|
116
118
|
} from './resources/speech-to-speech';
|
|
117
119
|
import { TaskRetrieveResponse, Tasks } from './resources/tasks';
|
|
118
120
|
import { TextToImage, TextToImageCreateParams, TextToImageCreateResponse } from './resources/text-to-image';
|
|
121
|
+
import { TextToMesh, TextToMeshCreateParams, TextToMeshCreateResponse } from './resources/text-to-mesh';
|
|
119
122
|
import { TextToMusic, TextToMusicCreateParams, TextToMusicCreateResponse } from './resources/text-to-music';
|
|
120
123
|
import {
|
|
121
124
|
TextToSpeech,
|
|
@@ -974,6 +977,14 @@ export class RunwayML {
|
|
|
974
977
|
* These endpoints all kick off tasks to create generations.
|
|
975
978
|
*/
|
|
976
979
|
textToMusic: API.TextToMusic = new API.TextToMusic(this);
|
|
980
|
+
/**
|
|
981
|
+
* These endpoints all kick off tasks to create generations.
|
|
982
|
+
*/
|
|
983
|
+
textToMesh: API.TextToMesh = new API.TextToMesh(this);
|
|
984
|
+
/**
|
|
985
|
+
* These endpoints all kick off tasks to create generations.
|
|
986
|
+
*/
|
|
987
|
+
imageToMesh: API.ImageToMesh = new API.ImageToMesh(this);
|
|
977
988
|
/**
|
|
978
989
|
* These endpoints all kick off tasks to create generations.
|
|
979
990
|
*/
|
|
@@ -1018,6 +1029,7 @@ export class RunwayML {
|
|
|
1018
1029
|
voices: API.Voices = new API.Voices(this);
|
|
1019
1030
|
uploads: API.Uploads = new API.Uploads(this);
|
|
1020
1031
|
workflows: API.Workflows = new API.Workflows(this);
|
|
1032
|
+
modelCatalog: API.ModelCatalog = new API.ModelCatalog(this);
|
|
1021
1033
|
workflowInvocations: API.WorkflowInvocations = new API.WorkflowInvocations(this);
|
|
1022
1034
|
}
|
|
1023
1035
|
|
|
@@ -1030,6 +1042,8 @@ RunwayML.TextToVideo = TextToVideo;
|
|
|
1030
1042
|
RunwayML.TextToImage = TextToImage;
|
|
1031
1043
|
RunwayML.ImageToVector = ImageToVector;
|
|
1032
1044
|
RunwayML.TextToMusic = TextToMusic;
|
|
1045
|
+
RunwayML.TextToMesh = TextToMesh;
|
|
1046
|
+
RunwayML.ImageToMesh = ImageToMesh;
|
|
1033
1047
|
RunwayML.CharacterPerformance = CharacterPerformance;
|
|
1034
1048
|
RunwayML.TextToSpeech = TextToSpeech;
|
|
1035
1049
|
RunwayML.SoundEffect = SoundEffect;
|
|
@@ -1050,6 +1064,7 @@ RunwayML.Recipes = Recipes;
|
|
|
1050
1064
|
RunwayML.Voices = Voices;
|
|
1051
1065
|
RunwayML.Uploads = Uploads;
|
|
1052
1066
|
RunwayML.Workflows = Workflows;
|
|
1067
|
+
RunwayML.ModelCatalog = ModelCatalog;
|
|
1053
1068
|
RunwayML.WorkflowInvocations = WorkflowInvocations;
|
|
1054
1069
|
|
|
1055
1070
|
export declare namespace RunwayML {
|
|
@@ -1108,6 +1123,18 @@ export declare namespace RunwayML {
|
|
|
1108
1123
|
type TextToMusicCreateParams as TextToMusicCreateParams,
|
|
1109
1124
|
};
|
|
1110
1125
|
|
|
1126
|
+
export {
|
|
1127
|
+
TextToMesh as TextToMesh,
|
|
1128
|
+
type TextToMeshCreateResponse as TextToMeshCreateResponse,
|
|
1129
|
+
type TextToMeshCreateParams as TextToMeshCreateParams,
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
export {
|
|
1133
|
+
ImageToMesh as ImageToMesh,
|
|
1134
|
+
type ImageToMeshCreateResponse as ImageToMeshCreateResponse,
|
|
1135
|
+
type ImageToMeshCreateParams as ImageToMeshCreateParams,
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1111
1138
|
export {
|
|
1112
1139
|
CharacterPerformance as CharacterPerformance,
|
|
1113
1140
|
type CharacterPerformanceCreateResponse as CharacterPerformanceCreateResponse,
|
|
@@ -1273,6 +1300,8 @@ export declare namespace RunwayML {
|
|
|
1273
1300
|
type WorkflowRunParams as WorkflowRunParams,
|
|
1274
1301
|
};
|
|
1275
1302
|
|
|
1303
|
+
export { ModelCatalog as ModelCatalog, type ModelCatalogListResponse as ModelCatalogListResponse };
|
|
1304
|
+
|
|
1276
1305
|
export {
|
|
1277
1306
|
WorkflowInvocations as WorkflowInvocations,
|
|
1278
1307
|
type WorkflowInvocationRetrieveResponse as WorkflowInvocationRetrieveResponse,
|
package/src/lib/polling.ts
CHANGED
|
@@ -96,12 +96,11 @@ export function wrapAsWaitableResource<T extends { id: string }>(client: RunwayM
|
|
|
96
96
|
setTimeout(resolve, POLL_TIME + Math.random() * POLL_JITTER - POLL_JITTER / 2),
|
|
97
97
|
);
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
// Observe the create request right away so an immediate failure rejects here
|
|
100
|
+
// instead of surfacing as an unhandled rejection during the initial wait.
|
|
101
|
+
const [output] = await Promise.all([responsePromise, skipInitialWait ? undefined : wait()]);
|
|
102
102
|
|
|
103
103
|
const { timeout = 60 * 10 * 1000 } = options ?? {};
|
|
104
|
-
const output = await responsePromise;
|
|
105
104
|
const startTime = Date.now();
|
|
106
105
|
let taskDetails: TaskRetrieveResponse;
|
|
107
106
|
do {
|
|
@@ -154,12 +153,11 @@ export function wrapAsWaitableWorkflowInvocation<T extends { id: string }>(clien
|
|
|
154
153
|
setTimeout(resolve, POLL_TIME + Math.random() * POLL_JITTER - POLL_JITTER / 2),
|
|
155
154
|
);
|
|
156
155
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
// Observe the create request right away so an immediate failure rejects here
|
|
157
|
+
// instead of surfacing as an unhandled rejection during the initial wait.
|
|
158
|
+
const [output] = await Promise.all([responsePromise, skipInitialWait ? undefined : wait()]);
|
|
160
159
|
|
|
161
160
|
const { timeout = 60 * 10 * 1000 } = options ?? {};
|
|
162
|
-
const output = await responsePromise;
|
|
163
161
|
const startTime = Date.now();
|
|
164
162
|
let details: WorkflowInvocationRetrieveResponse;
|
|
165
163
|
do {
|
|
@@ -5,6 +5,8 @@ import * as AudioAPI from './audio';
|
|
|
5
5
|
import { Audio, AudioCreateParams, AudioCreateResponse, ReferenceAudio, ReferenceVoice } from './audio';
|
|
6
6
|
import * as ImageAPI from './image';
|
|
7
7
|
import { Image, ImageCreateParams, ImageCreateResponse } from './image';
|
|
8
|
+
import * as MeshAPI from './mesh';
|
|
9
|
+
import { Mesh, MeshCreateParams, MeshCreateResponse } from './mesh';
|
|
8
10
|
import * as VideoAPI from './video';
|
|
9
11
|
import { Video, VideoCreateParams, VideoCreateResponse } from './video';
|
|
10
12
|
|
|
@@ -12,11 +14,13 @@ export class Generate extends APIResource {
|
|
|
12
14
|
video: VideoAPI.Video = new VideoAPI.Video(this._client);
|
|
13
15
|
image: ImageAPI.Image = new ImageAPI.Image(this._client);
|
|
14
16
|
audio: AudioAPI.Audio = new AudioAPI.Audio(this._client);
|
|
17
|
+
mesh: MeshAPI.Mesh = new MeshAPI.Mesh(this._client);
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
Generate.Video = Video;
|
|
18
21
|
Generate.Image = Image;
|
|
19
22
|
Generate.Audio = Audio;
|
|
23
|
+
Generate.Mesh = Mesh;
|
|
20
24
|
|
|
21
25
|
export declare namespace Generate {
|
|
22
26
|
export {
|
|
@@ -38,4 +42,10 @@ export declare namespace Generate {
|
|
|
38
42
|
type AudioCreateResponse as AudioCreateResponse,
|
|
39
43
|
type AudioCreateParams as AudioCreateParams,
|
|
40
44
|
};
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
Mesh as Mesh,
|
|
48
|
+
type MeshCreateResponse as MeshCreateResponse,
|
|
49
|
+
type MeshCreateParams as MeshCreateParams,
|
|
50
|
+
};
|
|
41
51
|
}
|
|
@@ -9,4 +9,5 @@ export {
|
|
|
9
9
|
} from './audio';
|
|
10
10
|
export { Generate } from './generate';
|
|
11
11
|
export { Image, type ImageCreateResponse, type ImageCreateParams } from './image';
|
|
12
|
+
export { Mesh, type MeshCreateResponse, type MeshCreateParams } from './mesh';
|
|
12
13
|
export { Video, type VideoCreateResponse, type VideoCreateParams } from './video';
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
5
|
+
import { APIPromiseWithAwaitableTask, wrapAsWaitableResource } from '../../lib/polling';
|
|
6
|
+
|
|
7
|
+
export class Mesh extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Generate a GLB mesh using a saved Model Router config.
|
|
10
|
+
*/
|
|
11
|
+
create(body: MeshCreateParams, options?: RequestOptions): APIPromiseWithAwaitableTask<MeshCreateResponse> {
|
|
12
|
+
return wrapAsWaitableResource<MeshCreateResponse>(this._client)(
|
|
13
|
+
this._client.post('/v1/generate/mesh', { body, ...options }),
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MeshCreateResponse {
|
|
19
|
+
/**
|
|
20
|
+
* The ID of the created task. Poll GET /v1/tasks/:id for the result.
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Metadata describing which model the router selected and why.
|
|
26
|
+
*/
|
|
27
|
+
routing: MeshCreateResponse.Routing;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export namespace MeshCreateResponse {
|
|
31
|
+
/**
|
|
32
|
+
* Metadata describing which model the router selected and why.
|
|
33
|
+
*/
|
|
34
|
+
export interface Routing {
|
|
35
|
+
/**
|
|
36
|
+
* The slug of the router config that was applied to this request.
|
|
37
|
+
*/
|
|
38
|
+
configId: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Estimated cost, computed against current pricing.
|
|
42
|
+
*/
|
|
43
|
+
estimatedCost: Routing.EstimatedCost;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The public name of the model the router selected.
|
|
47
|
+
*/
|
|
48
|
+
model: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The provider of the selected model.
|
|
52
|
+
*/
|
|
53
|
+
provider: string;
|
|
54
|
+
|
|
55
|
+
resolvedInput: Routing.ResolvedInput;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The resolved config settings the router used for this request.
|
|
59
|
+
*/
|
|
60
|
+
resolvedSettings: Routing.ResolvedSettings;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Present only when the config enables fallback.onCapacity and capacity affected
|
|
64
|
+
* this request.
|
|
65
|
+
*/
|
|
66
|
+
capacityFallback?: Routing.CapacityFallback;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export namespace Routing {
|
|
70
|
+
/**
|
|
71
|
+
* Estimated cost, computed against current pricing.
|
|
72
|
+
*/
|
|
73
|
+
export interface EstimatedCost {
|
|
74
|
+
/**
|
|
75
|
+
* Estimated cost of the generation in credits.
|
|
76
|
+
*/
|
|
77
|
+
credits: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ResolvedInput {
|
|
81
|
+
outputFormat: 'glb';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The resolved config settings the router used for this request.
|
|
86
|
+
*/
|
|
87
|
+
export interface ResolvedSettings {
|
|
88
|
+
/**
|
|
89
|
+
* The single optimization preference the config selected, used as the soft
|
|
90
|
+
* weighting when scoring eligible models.
|
|
91
|
+
*/
|
|
92
|
+
optimizeFor: 'cost' | 'latency' | 'quality';
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The applied maximum credits per generation for this request's modality, or null
|
|
96
|
+
* if the config sets no ceiling.
|
|
97
|
+
*/
|
|
98
|
+
priceCeiling: number | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Present only when the config enables fallback.onCapacity and capacity affected
|
|
103
|
+
* this request.
|
|
104
|
+
*/
|
|
105
|
+
export interface CapacityFallback {
|
|
106
|
+
/**
|
|
107
|
+
* True when every eligible model was at its concurrency limit, so the best-ranked
|
|
108
|
+
* model was used and the task will queue.
|
|
109
|
+
*/
|
|
110
|
+
allExhausted: boolean;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Eligible models that were considered for this request but not selected because
|
|
114
|
+
* this account is at its concurrency limit for them.
|
|
115
|
+
*/
|
|
116
|
+
skipped: Array<string>;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface MeshCreateParams {
|
|
122
|
+
/**
|
|
123
|
+
* The slug of a saved Model Router config to route this request with.
|
|
124
|
+
*/
|
|
125
|
+
configId: string;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Generate a GLB mesh from either text or views of the same object, not both.
|
|
129
|
+
*/
|
|
130
|
+
input: MeshCreateParams.FromText | MeshCreateParams.FromReferenceImages;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export namespace MeshCreateParams {
|
|
134
|
+
export interface FromText {
|
|
135
|
+
promptText: string;
|
|
136
|
+
|
|
137
|
+
autoSize?: boolean;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Maximum face count: 1,500,000 with standard geometry or 2,000,000 with detailed
|
|
141
|
+
* geometry.
|
|
142
|
+
*/
|
|
143
|
+
faceLimit?: number;
|
|
144
|
+
|
|
145
|
+
geometryQuality?: 'standard' | 'detailed';
|
|
146
|
+
|
|
147
|
+
imageSeed?: number;
|
|
148
|
+
|
|
149
|
+
modelSeed?: number;
|
|
150
|
+
|
|
151
|
+
orientation?: 'default' | 'align_image';
|
|
152
|
+
|
|
153
|
+
pbr?: boolean;
|
|
154
|
+
|
|
155
|
+
referenceImages?: unknown;
|
|
156
|
+
|
|
157
|
+
texture?: boolean;
|
|
158
|
+
|
|
159
|
+
textureAlignment?: 'original_image' | 'geometry';
|
|
160
|
+
|
|
161
|
+
textureQuality?: 'standard' | 'detailed';
|
|
162
|
+
|
|
163
|
+
textureSeed?: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface FromReferenceImages {
|
|
167
|
+
referenceImages: Array<FromReferenceImages.ReferenceImage>;
|
|
168
|
+
|
|
169
|
+
autoSize?: boolean;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Maximum face count: 1,500,000 with standard geometry or 2,000,000 with detailed
|
|
173
|
+
* geometry.
|
|
174
|
+
*/
|
|
175
|
+
faceLimit?: number;
|
|
176
|
+
|
|
177
|
+
geometryQuality?: 'standard' | 'detailed';
|
|
178
|
+
|
|
179
|
+
imageSeed?: number;
|
|
180
|
+
|
|
181
|
+
modelSeed?: number;
|
|
182
|
+
|
|
183
|
+
orientation?: 'default' | 'align_image';
|
|
184
|
+
|
|
185
|
+
pbr?: boolean;
|
|
186
|
+
|
|
187
|
+
promptText?: unknown;
|
|
188
|
+
|
|
189
|
+
texture?: boolean;
|
|
190
|
+
|
|
191
|
+
textureAlignment?: 'original_image' | 'geometry';
|
|
192
|
+
|
|
193
|
+
textureQuality?: 'standard' | 'detailed';
|
|
194
|
+
|
|
195
|
+
textureSeed?: number;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export namespace FromReferenceImages {
|
|
199
|
+
export interface ReferenceImage {
|
|
200
|
+
/**
|
|
201
|
+
* A HTTPS URL, Runway upload URI, or base64 data URI (e.g.
|
|
202
|
+
* `data:image/png;base64,...`, up to 5MB) containing an encoded image. See
|
|
203
|
+
* [our docs](/assets/inputs#images) on image inputs for more information.
|
|
204
|
+
*/
|
|
205
|
+
uri: string;
|
|
206
|
+
|
|
207
|
+
type?: 'front' | 'left' | 'back' | 'right';
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export declare namespace Mesh {
|
|
213
|
+
export { type MeshCreateResponse as MeshCreateResponse, type MeshCreateParams as MeshCreateParams };
|
|
214
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { RequestOptions } from '../internal/request-options';
|
|
5
|
+
import { APIPromiseWithAwaitableTask, wrapAsWaitableResource } from '../lib/polling';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* These endpoints all kick off tasks to create generations.
|
|
9
|
+
*/
|
|
10
|
+
export class ImageToMesh extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Generate a GLB mesh from one image or ordered views of the same object.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const imageToMesh = await client.imageToMesh.create({
|
|
17
|
+
* imageUri: 'https://example.com/image.jpg',
|
|
18
|
+
* model: 'trellis_2',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
create(
|
|
23
|
+
body: ImageToMeshCreateParams,
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): APIPromiseWithAwaitableTask<ImageToMeshCreateResponse> {
|
|
26
|
+
return wrapAsWaitableResource<ImageToMeshCreateResponse>(this._client)(
|
|
27
|
+
this._client.post('/v1/image_to_mesh', { body, ...options }),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ImageToMeshCreateResponse {
|
|
33
|
+
/**
|
|
34
|
+
* The ID of the task that was created. Use this to retrieve the task later.
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The maximum credits this task may charge. The final amount may be lower after
|
|
40
|
+
* the task completes.
|
|
41
|
+
*/
|
|
42
|
+
estimatedCost: ImageToMeshCreateResponse.EstimatedCost;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export namespace ImageToMeshCreateResponse {
|
|
46
|
+
/**
|
|
47
|
+
* The maximum credits this task may charge. The final amount may be lower after
|
|
48
|
+
* the task completes.
|
|
49
|
+
*/
|
|
50
|
+
export interface EstimatedCost {
|
|
51
|
+
/**
|
|
52
|
+
* Estimated cost of the generation in credits.
|
|
53
|
+
*/
|
|
54
|
+
credits: number;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type ImageToMeshCreateParams =
|
|
59
|
+
| ImageToMeshCreateParams.Tripo3dH3_1
|
|
60
|
+
| ImageToMeshCreateParams.Hunyuan3d3_1Pro
|
|
61
|
+
| ImageToMeshCreateParams.Trellis2;
|
|
62
|
+
|
|
63
|
+
export declare namespace ImageToMeshCreateParams {
|
|
64
|
+
export interface Tripo3dH3_1 {
|
|
65
|
+
model: 'tripo3d_h3_1';
|
|
66
|
+
|
|
67
|
+
referenceImages: Array<Tripo3dH3_1.ReferenceImage>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Estimate the physical size of the object.
|
|
71
|
+
*/
|
|
72
|
+
autoSize?: boolean;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The maximum number of faces in the generated mesh.
|
|
76
|
+
*/
|
|
77
|
+
faceLimit?: number;
|
|
78
|
+
|
|
79
|
+
geometryQuality?: 'standard' | 'detailed';
|
|
80
|
+
|
|
81
|
+
modelSeed?: number;
|
|
82
|
+
|
|
83
|
+
orientation?: 'default' | 'align_image';
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Generate physically based materials for the mesh.
|
|
87
|
+
*/
|
|
88
|
+
pbr?: boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Generate textures for the mesh. PBR also enables textures.
|
|
92
|
+
*/
|
|
93
|
+
texture?: boolean;
|
|
94
|
+
|
|
95
|
+
textureAlignment?: 'original_image' | 'geometry';
|
|
96
|
+
|
|
97
|
+
textureQuality?: 'standard' | 'detailed';
|
|
98
|
+
|
|
99
|
+
textureSeed?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export namespace Tripo3dH3_1 {
|
|
103
|
+
export interface ReferenceImage {
|
|
104
|
+
/**
|
|
105
|
+
* A HTTPS URL, Runway upload URI, or base64 data URI (e.g.
|
|
106
|
+
* `data:image/png;base64,...`, up to 5MB) containing an encoded image. See
|
|
107
|
+
* [our docs](/assets/inputs#images) on image inputs for more information.
|
|
108
|
+
*/
|
|
109
|
+
uri: string;
|
|
110
|
+
|
|
111
|
+
type?: 'front' | 'left' | 'back' | 'right';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface Hunyuan3d3_1Pro {
|
|
116
|
+
model: 'hunyuan_3d_3_1_pro';
|
|
117
|
+
|
|
118
|
+
referenceImages: Array<Hunyuan3d3_1Pro.ReferenceImage>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Generate physically based materials for a textured model.
|
|
122
|
+
*/
|
|
123
|
+
enablePbr?: boolean;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The target number of faces in the generated mesh.
|
|
127
|
+
*/
|
|
128
|
+
faceCount?: number;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Generate a textured model or geometry without textures.
|
|
132
|
+
*/
|
|
133
|
+
generateType?: 'Normal' | 'Geometry';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export namespace Hunyuan3d3_1Pro {
|
|
137
|
+
export interface ReferenceImage {
|
|
138
|
+
/**
|
|
139
|
+
* A HTTPS URL, Runway upload URI, or base64 data URI (e.g.
|
|
140
|
+
* `data:image/png;base64,...`, up to 5MB) containing an encoded image. See
|
|
141
|
+
* [our docs](/assets/inputs#images) on image inputs for more information.
|
|
142
|
+
*/
|
|
143
|
+
uri: string;
|
|
144
|
+
|
|
145
|
+
type?: 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom' | 'left_front' | 'right_front';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface Trellis2 {
|
|
150
|
+
/**
|
|
151
|
+
* A HTTPS URL, Runway upload URI, or base64 data URI (e.g.
|
|
152
|
+
* `data:image/png;base64,...`, up to 5MB) containing an encoded image. See
|
|
153
|
+
* [our docs](/assets/inputs#images) on image inputs for more information.
|
|
154
|
+
*/
|
|
155
|
+
imageUri: string;
|
|
156
|
+
|
|
157
|
+
model: 'trellis_2';
|
|
158
|
+
|
|
159
|
+
decimationTarget?: number;
|
|
160
|
+
|
|
161
|
+
remesh?: boolean;
|
|
162
|
+
|
|
163
|
+
resolution?: 512 | 1024 | 1536;
|
|
164
|
+
|
|
165
|
+
seed?: number;
|
|
166
|
+
|
|
167
|
+
textureSize?: 1024 | 2048 | 4096;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export declare namespace ImageToMesh {
|
|
172
|
+
export {
|
|
173
|
+
type ImageToMeshCreateResponse as ImageToMeshCreateResponse,
|
|
174
|
+
type ImageToMeshCreateParams as ImageToMeshCreateParams,
|
|
175
|
+
};
|
|
176
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export {
|
|
|
37
37
|
type DocumentListResponsesCursorPage,
|
|
38
38
|
} from './documents';
|
|
39
39
|
export { Generate } from './generate/generate';
|
|
40
|
+
export { ImageToMesh, type ImageToMeshCreateResponse, type ImageToMeshCreateParams } from './image-to-mesh';
|
|
40
41
|
export {
|
|
41
42
|
ImageToVector,
|
|
42
43
|
type ImageToVectorCreateResponse,
|
|
@@ -52,6 +53,7 @@ export {
|
|
|
52
53
|
type ImageUpscaleCreateResponse,
|
|
53
54
|
type ImageUpscaleCreateParams,
|
|
54
55
|
} from './image-upscale';
|
|
56
|
+
export { ModelCatalog, type ModelCatalogListResponse } from './model-catalog';
|
|
55
57
|
export {
|
|
56
58
|
Organization,
|
|
57
59
|
type OrganizationRetrieveResponse,
|
|
@@ -104,6 +106,7 @@ export {
|
|
|
104
106
|
} from './speech-to-speech';
|
|
105
107
|
export { Tasks, type TaskRetrieveResponse } from './tasks';
|
|
106
108
|
export { TextToImage, type TextToImageCreateResponse, type TextToImageCreateParams } from './text-to-image';
|
|
109
|
+
export { TextToMesh, type TextToMeshCreateResponse, type TextToMeshCreateParams } from './text-to-mesh';
|
|
107
110
|
export { TextToMusic, type TextToMusicCreateResponse, type TextToMusicCreateParams } from './text-to-music';
|
|
108
111
|
export {
|
|
109
112
|
TextToSpeech,
|