@runwayml/sdk 1.4.3 → 2.0.0

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/LICENSE +1 -1
  3. package/README.md +10 -10
  4. package/_shims/index.d.ts +2 -0
  5. package/_shims/index.js +5 -1
  6. package/_shims/index.mjs +5 -1
  7. package/core.d.ts +12 -1
  8. package/core.d.ts.map +1 -1
  9. package/core.js +30 -12
  10. package/core.js.map +1 -1
  11. package/core.mjs +31 -13
  12. package/core.mjs.map +1 -1
  13. package/index.d.mts +8 -5
  14. package/index.d.ts +8 -5
  15. package/index.d.ts.map +1 -1
  16. package/index.js +3 -0
  17. package/index.js.map +1 -1
  18. package/index.mjs +3 -0
  19. package/index.mjs.map +1 -1
  20. package/package.json +1 -1
  21. package/resources/image-to-video.d.ts +4 -7
  22. package/resources/image-to-video.d.ts.map +1 -1
  23. package/resources/index.d.ts +1 -0
  24. package/resources/index.d.ts.map +1 -1
  25. package/resources/index.js +3 -1
  26. package/resources/index.js.map +1 -1
  27. package/resources/index.mjs +1 -0
  28. package/resources/index.mjs.map +1 -1
  29. package/resources/organization.d.ts +129 -0
  30. package/resources/organization.d.ts.map +1 -0
  31. package/resources/organization.js +16 -0
  32. package/resources/organization.js.map +1 -0
  33. package/resources/organization.mjs +12 -0
  34. package/resources/organization.mjs.map +1 -0
  35. package/resources.d.ts +2 -0
  36. package/resources.d.ts.map +1 -0
  37. package/resources.js +18 -0
  38. package/resources.js.map +1 -0
  39. package/resources.mjs +2 -0
  40. package/resources.mjs.map +1 -0
  41. package/src/_shims/index.d.ts +2 -0
  42. package/src/_shims/index.js +5 -1
  43. package/src/_shims/index.mjs +5 -1
  44. package/src/core.ts +51 -14
  45. package/src/index.ts +10 -5
  46. package/src/resources/image-to-video.ts +12 -8
  47. package/src/resources/index.ts +1 -0
  48. package/src/resources/organization.ts +150 -0
  49. package/src/resources.ts +1 -0
  50. package/src/version.ts +1 -1
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/version.mjs +1 -1
@@ -0,0 +1,129 @@
1
+ import { APIResource } from "../resource.js";
2
+ import * as Core from "../core.js";
3
+ export declare class Organization extends APIResource {
4
+ /**
5
+ * Get usage tier and credit balance information about the organization associated
6
+ * with the API key used to make the request.
7
+ */
8
+ retrieve(options?: Core.RequestOptions): Core.APIPromise<OrganizationRetrieveResponse>;
9
+ }
10
+ export interface OrganizationRetrieveResponse {
11
+ /**
12
+ * The number of credits remaining in the organization account.
13
+ */
14
+ creditBalance: number;
15
+ /**
16
+ * Limits associated with the organization's tier.
17
+ */
18
+ tier: OrganizationRetrieveResponse.Tier;
19
+ /**
20
+ * Usage data for the organization.
21
+ */
22
+ usage: OrganizationRetrieveResponse.Usage;
23
+ }
24
+ export declare namespace OrganizationRetrieveResponse {
25
+ /**
26
+ * Limits associated with the organization's tier.
27
+ */
28
+ interface Tier {
29
+ /**
30
+ * The maximum number of credits that can be purchased in a month.
31
+ */
32
+ maxMonthlyCreditSpend: number;
33
+ /**
34
+ * An object containing model-specific limits. Each key represents a model.
35
+ */
36
+ models: Tier.Models;
37
+ }
38
+ namespace Tier {
39
+ /**
40
+ * An object containing model-specific limits. Each key represents a model.
41
+ */
42
+ interface Models {
43
+ /**
44
+ * Limits associated with the gen3a_turbo model.
45
+ */
46
+ gen3a_turbo?: Models.Gen3aTurbo;
47
+ /**
48
+ * Limits associated with the gen4_turbo model.
49
+ */
50
+ gen4_turbo?: Models.Gen4Turbo;
51
+ }
52
+ namespace Models {
53
+ /**
54
+ * Limits associated with the gen3a_turbo model.
55
+ */
56
+ interface Gen3aTurbo {
57
+ /**
58
+ * The maximum number of generations that can be run concurrently for this model.
59
+ */
60
+ maxConcurrentGenerations: number;
61
+ /**
62
+ * The maximum number of generations that can be created each day for this model.
63
+ */
64
+ maxDailyGenerations: number;
65
+ }
66
+ /**
67
+ * Limits associated with the gen4_turbo model.
68
+ */
69
+ interface Gen4Turbo {
70
+ /**
71
+ * The maximum number of generations that can be run concurrently for this model.
72
+ */
73
+ maxConcurrentGenerations: number;
74
+ /**
75
+ * The maximum number of generations that can be created each day for this model.
76
+ */
77
+ maxDailyGenerations: number;
78
+ }
79
+ }
80
+ }
81
+ /**
82
+ * Usage data for the organization.
83
+ */
84
+ interface Usage {
85
+ /**
86
+ * Usage data for each model.
87
+ */
88
+ models: Usage.Models;
89
+ }
90
+ namespace Usage {
91
+ /**
92
+ * Usage data for each model.
93
+ */
94
+ interface Models {
95
+ /**
96
+ * Usage data for the gen3a_turbo model.
97
+ */
98
+ gen3a_turbo?: Models.Gen3aTurbo;
99
+ /**
100
+ * Usage data for the gen4_turbo model.
101
+ */
102
+ gen4_turbo?: Models.Gen4Turbo;
103
+ }
104
+ namespace Models {
105
+ /**
106
+ * Usage data for the gen3a_turbo model.
107
+ */
108
+ interface Gen3aTurbo {
109
+ /**
110
+ * The number of generations that have been run for this model in the past day.
111
+ */
112
+ dailyGenerations: number;
113
+ }
114
+ /**
115
+ * Usage data for the gen4_turbo model.
116
+ */
117
+ interface Gen4Turbo {
118
+ /**
119
+ * The number of generations that have been run for this model in the past day.
120
+ */
121
+ dailyGenerations: number;
122
+ }
123
+ }
124
+ }
125
+ }
126
+ export declare namespace Organization {
127
+ export { type OrganizationRetrieveResponse as OrganizationRetrieveResponse };
128
+ }
129
+ //# sourceMappingURL=organization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../src/resources/organization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC;CAGvF;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,IAAI,EAAE,4BAA4B,CAAC,IAAI,CAAC;IAExC;;OAEG;IACH,KAAK,EAAE,4BAA4B,CAAC,KAAK,CAAC;CAC3C;AAED,yBAAiB,4BAA4B,CAAC;IAC5C;;OAEG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,qBAAqB,EAAE,MAAM,CAAC;QAE9B;;WAEG;QACH,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;KACrB;IAED,UAAiB,IAAI,CAAC;QACpB;;WAEG;QACH,UAAiB,MAAM;YACrB;;eAEG;YACH,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;YAEhC;;eAEG;YACH,UAAU,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;SAC/B;QAED,UAAiB,MAAM,CAAC;YACtB;;eAEG;YACH,UAAiB,UAAU;gBACzB;;mBAEG;gBACH,wBAAwB,EAAE,MAAM,CAAC;gBAEjC;;mBAEG;gBACH,mBAAmB,EAAE,MAAM,CAAC;aAC7B;YAED;;eAEG;YACH,UAAiB,SAAS;gBACxB;;mBAEG;gBACH,wBAAwB,EAAE,MAAM,CAAC;gBAEjC;;mBAEG;gBACH,mBAAmB,EAAE,MAAM,CAAC;aAC7B;SACF;KACF;IAED;;OAEG;IACH,UAAiB,KAAK;QACpB;;WAEG;QACH,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;KACtB;IAED,UAAiB,KAAK,CAAC;QACrB;;WAEG;QACH,UAAiB,MAAM;YACrB;;eAEG;YACH,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;YAEhC;;eAEG;YACH,UAAU,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;SAC/B;QAED,UAAiB,MAAM,CAAC;YACtB;;eAEG;YACH,UAAiB,UAAU;gBACzB;;mBAEG;gBACH,gBAAgB,EAAE,MAAM,CAAC;aAC1B;YAED;;eAEG;YACH,UAAiB,SAAS;gBACxB;;mBAEG;gBACH,gBAAgB,EAAE,MAAM,CAAC;aAC1B;SACF;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EAAE,KAAK,4BAA4B,IAAI,4BAA4B,EAAE,CAAC;CAC9E"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Organization = void 0;
5
+ const resource_1 = require("../resource.js");
6
+ class Organization extends resource_1.APIResource {
7
+ /**
8
+ * Get usage tier and credit balance information about the organization associated
9
+ * with the API key used to make the request.
10
+ */
11
+ retrieve(options) {
12
+ return this._client.get('/v1/organization', options);
13
+ }
14
+ }
15
+ exports.Organization = Organization;
16
+ //# sourceMappingURL=organization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.js","sourceRoot":"","sources":["../src/resources/organization.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AARD,oCAQC"}
@@ -0,0 +1,12 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../resource.mjs";
3
+ export class Organization extends APIResource {
4
+ /**
5
+ * Get usage tier and credit balance information about the organization associated
6
+ * with the API key used to make the request.
7
+ */
8
+ retrieve(options) {
9
+ return this._client.get('/v1/organization', options);
10
+ }
11
+ }
12
+ //# sourceMappingURL=organization.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.mjs","sourceRoot":"","sources":["../src/resources/organization.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF"}
package/resources.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./resources/index.js";
2
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
package/resources.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./resources/index.js"), exports);
18
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAkC"}
package/resources.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./resources/index.mjs";
2
+ //# sourceMappingURL=resources.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
79
79
  export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
80
80
 
81
81
  export function isFsReadStream(value: any): value is FsReadStream;
82
+
83
+ export const init: () => void;
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const shims = require('./registry');
5
5
  const auto = require('@runwayml/sdk/_shims/auto/runtime');
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ exports.init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  for (const property of Object.keys(shims)) {
8
10
  Object.defineProperty(exports, property, {
9
11
  get() {
@@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) {
11
13
  },
12
14
  });
13
15
  }
16
+
17
+ exports.init();
@@ -3,5 +3,9 @@
3
3
  */
4
4
  import * as shims from './registry.mjs';
5
5
  import * as auto from "./auto/runtime";
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ export const init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  export * from './registry.mjs';
10
+
11
+ init();
package/src/core.ts CHANGED
@@ -16,7 +16,12 @@ import {
16
16
  type RequestInit,
17
17
  type Response,
18
18
  type HeadersInit,
19
+ init,
19
20
  } from './_shims/index';
21
+
22
+ // try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
23
+ init();
24
+
20
25
  export { type Response };
21
26
  import { BlobLike, isBlobLike, isMultipartBody } from './uploads';
22
27
  export {
@@ -28,6 +33,20 @@ export {
28
33
 
29
34
  export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
30
35
 
36
+ /**
37
+ * An alias to the builtin `Array` type so we can
38
+ * easily alias it in import statements if there are name clashes.
39
+ */
40
+ type _Array<T> = Array<T>;
41
+
42
+ /**
43
+ * An alias to the builtin `Record` type so we can
44
+ * easily alias it in import statements if there are name clashes.
45
+ */
46
+ type _Record<K extends keyof any, T> = Record<K, T>;
47
+
48
+ export type { _Array as Array, _Record as Record };
49
+
31
50
  type PromiseOrValue<T> = T | Promise<T>;
32
51
 
33
52
  type APIResponseProps = {
@@ -48,8 +67,8 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
48
67
  }
49
68
 
50
69
  const contentType = response.headers.get('content-type');
51
- const isJSON =
52
- contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
70
+ const mediaType = contentType?.split(';')[0]?.trim();
71
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
53
72
  if (isJSON) {
54
73
  const json = await response.json();
55
74
 
@@ -163,7 +182,7 @@ export abstract class APIClient {
163
182
  maxRetries = 2,
164
183
  timeout = 60000, // 1 minute
165
184
  httpAgent,
166
- fetch: overridenFetch,
185
+ fetch: overriddenFetch,
167
186
  }: {
168
187
  baseURL: string;
169
188
  maxRetries?: number | undefined;
@@ -176,7 +195,7 @@ export abstract class APIClient {
176
195
  this.timeout = validatePositiveInteger('timeout', timeout);
177
196
  this.httpAgent = httpAgent;
178
197
 
179
- this.fetch = overridenFetch ?? fetch;
198
+ this.fetch = overriddenFetch ?? fetch;
180
199
  }
181
200
 
182
201
  protected authHeaders(opts: FinalRequestOptions): Headers {
@@ -280,6 +299,7 @@ export abstract class APIClient {
280
299
  options: FinalRequestOptions<Req>,
281
300
  { retryCount = 0 }: { retryCount?: number } = {},
282
301
  ): { req: RequestInit; url: string; timeout: number } {
302
+ options = { ...options };
283
303
  const { method, path, query, headers: headers = {} } = options;
284
304
 
285
305
  const body =
@@ -292,9 +312,9 @@ export abstract class APIClient {
292
312
 
293
313
  const url = this.buildURL(path!, query);
294
314
  if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
295
- const timeout = options.timeout ?? this.timeout;
315
+ options.timeout = options.timeout ?? this.timeout;
296
316
  const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
297
- const minAgentTimeout = timeout + 1000;
317
+ const minAgentTimeout = options.timeout + 1000;
298
318
  if (
299
319
  typeof (httpAgent as any)?.options?.timeout === 'number' &&
300
320
  minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)
@@ -323,7 +343,7 @@ export abstract class APIClient {
323
343
  signal: options.signal ?? null,
324
344
  };
325
345
 
326
- return { req, url, timeout };
346
+ return { req, url, timeout: options.timeout };
327
347
  }
328
348
 
329
349
  private buildHeaders({
@@ -351,15 +371,22 @@ export abstract class APIClient {
351
371
  delete reqHeaders['content-type'];
352
372
  }
353
373
 
354
- // Don't set the retry count header if it was already set or removed through default headers or by the
355
- // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
356
- // account for the removal case.
374
+ // Don't set theses headers if they were already set or removed through default headers or by the caller.
375
+ // We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
376
+ // for the removal case.
357
377
  if (
358
378
  getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
359
379
  getHeader(headers, 'x-stainless-retry-count') === undefined
360
380
  ) {
361
381
  reqHeaders['x-stainless-retry-count'] = String(retryCount);
362
382
  }
383
+ if (
384
+ getHeader(defaultHeaders, 'x-stainless-timeout') === undefined &&
385
+ getHeader(headers, 'x-stainless-timeout') === undefined &&
386
+ options.timeout
387
+ ) {
388
+ reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
389
+ }
363
390
 
364
391
  this.validateHeaders(reqHeaders, headers);
365
392
 
@@ -387,7 +414,7 @@ export abstract class APIClient {
387
414
  !headers ? {}
388
415
  : Symbol.iterator in headers ?
389
416
  Object.fromEntries(Array.from(headers as Iterable<string[]>).map((header) => [...header]))
390
- : { ...headers }
417
+ : { ...(headers as any as Record<string, string>) }
391
418
  );
392
419
  }
393
420
 
@@ -522,9 +549,19 @@ export abstract class APIClient {
522
549
 
523
550
  const timeout = setTimeout(() => controller.abort(), ms);
524
551
 
552
+ const fetchOptions = {
553
+ signal: controller.signal as any,
554
+ ...options,
555
+ };
556
+ if (fetchOptions.method) {
557
+ // Custom methods like 'patch' need to be uppercased
558
+ // See https://github.com/nodejs/undici/issues/2294
559
+ fetchOptions.method = fetchOptions.method.toUpperCase();
560
+ }
561
+
525
562
  return (
526
563
  // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
527
- this.fetch.call(undefined, url, { signal: controller.signal as any, ...options }).finally(() => {
564
+ this.fetch.call(undefined, url, fetchOptions).finally(() => {
528
565
  clearTimeout(timeout);
529
566
  })
530
567
  );
@@ -970,8 +1007,8 @@ export const safeJSON = (text: string) => {
970
1007
  }
971
1008
  };
972
1009
 
973
- // https://stackoverflow.com/a/19709846
974
- const startsWithSchemeRegexp = new RegExp('^(?:[a-z]+:)?//', 'i');
1010
+ // https://url.spec.whatwg.org/#url-scheme-string
1011
+ const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
975
1012
  const isAbsoluteURL = (url: string): boolean => {
976
1013
  return startsWithSchemeRegexp.test(url);
977
1014
  };
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  ImageToVideoCreateParams,
11
11
  ImageToVideoCreateResponse,
12
12
  } from './resources/image-to-video';
13
+ import { Organization, OrganizationRetrieveResponse } from './resources/organization';
13
14
  import { TaskRetrieveResponse, Tasks } from './resources/tasks';
14
15
 
15
16
  export interface ClientOptions {
@@ -34,7 +35,7 @@ export interface ClientOptions {
34
35
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
35
36
  * much longer than this timeout before the promise succeeds or fails.
36
37
  */
37
- timeout?: number;
38
+ timeout?: number | undefined;
38
39
 
39
40
  /**
40
41
  * An HTTP agent used to manage HTTP(S) connections.
@@ -42,7 +43,7 @@ export interface ClientOptions {
42
43
  * If not provided, an agent will be constructed by default in the Node.js environment,
43
44
  * otherwise no agent is used.
44
45
  */
45
- httpAgent?: Agent;
46
+ httpAgent?: Agent | undefined;
46
47
 
47
48
  /**
48
49
  * Specify a custom `fetch` function implementation.
@@ -58,7 +59,7 @@ export interface ClientOptions {
58
59
  *
59
60
  * @default 2
60
61
  */
61
- maxRetries?: number;
62
+ maxRetries?: number | undefined;
62
63
 
63
64
  /**
64
65
  * Default headers to include with every request to the API.
@@ -66,7 +67,7 @@ export interface ClientOptions {
66
67
  * These can be removed in individual requests by explicitly setting the
67
68
  * header to `undefined` or `null` in request options.
68
69
  */
69
- defaultHeaders?: Core.Headers;
70
+ defaultHeaders?: Core.Headers | undefined;
70
71
 
71
72
  /**
72
73
  * Default query parameters to include with every request to the API.
@@ -74,7 +75,7 @@ export interface ClientOptions {
74
75
  * These can be removed in individual requests by explicitly setting the
75
76
  * param to `undefined` in request options.
76
77
  */
77
- defaultQuery?: Core.DefaultQuery;
78
+ defaultQuery?: Core.DefaultQuery | undefined;
78
79
  }
79
80
 
80
81
  /**
@@ -140,6 +141,7 @@ export class RunwayML extends Core.APIClient {
140
141
 
141
142
  tasks: API.Tasks = new API.Tasks(this);
142
143
  imageToVideo: API.ImageToVideo = new API.ImageToVideo(this);
144
+ organization: API.Organization = new API.Organization(this);
143
145
 
144
146
  protected override defaultQuery(): Core.DefaultQuery | undefined {
145
147
  return this._options.defaultQuery;
@@ -180,6 +182,7 @@ export class RunwayML extends Core.APIClient {
180
182
 
181
183
  RunwayML.Tasks = Tasks;
182
184
  RunwayML.ImageToVideo = ImageToVideo;
185
+ RunwayML.Organization = Organization;
183
186
  export declare namespace RunwayML {
184
187
  export type RequestOptions = Core.RequestOptions;
185
188
 
@@ -190,6 +193,8 @@ export declare namespace RunwayML {
190
193
  type ImageToVideoCreateResponse as ImageToVideoCreateResponse,
191
194
  type ImageToVideoCreateParams as ImageToVideoCreateParams,
192
195
  };
196
+
197
+ export { Organization as Organization, type OrganizationRetrieveResponse as OrganizationRetrieveResponse };
193
198
  }
194
199
 
195
200
  export { toFile, fileFromPath } from './uploads';
@@ -27,7 +27,7 @@ export interface ImageToVideoCreateParams {
27
27
  /**
28
28
  * The model variant to use.
29
29
  */
30
- model: 'gen3a_turbo';
30
+ model: 'gen4_turbo' | 'gen3a_turbo';
31
31
 
32
32
  /**
33
33
  * A HTTPS URL or data URI containing an encoded image to be used as the first
@@ -43,7 +43,15 @@ export interface ImageToVideoCreateParams {
43
43
 
44
44
  promptText?: string;
45
45
 
46
- ratio?: '1280:768' | '768:1280';
46
+ ratio?:
47
+ | '1280:720'
48
+ | '720:1280'
49
+ | '1104:832'
50
+ | '832:1104'
51
+ | '960:960'
52
+ | '1584:672'
53
+ | '1280:768'
54
+ | '768:1280';
47
55
 
48
56
  /**
49
57
  * If unspecified, a random number is chosen. Varying the seed integer is a way to
@@ -51,12 +59,6 @@ export interface ImageToVideoCreateParams {
51
59
  * integer for an identical request will produce similar results.
52
60
  */
53
61
  seed?: number;
54
-
55
- /**
56
- * A boolean indicating whether or not the output video will contain a Runway
57
- * watermark.
58
- */
59
- watermark?: boolean;
60
62
  }
61
63
 
62
64
  export namespace ImageToVideoCreateParams {
@@ -65,6 +67,8 @@ export namespace ImageToVideoCreateParams {
65
67
  * The position of the image in the output video. "first" will use the image as the
66
68
  * first frame of the video, "last" will use the image as the last frame of the
67
69
  * video.
70
+ *
71
+ * "last" is currently supported for `gen3a_turbo` only.
68
72
  */
69
73
  position: 'first' | 'last';
70
74
 
@@ -5,4 +5,5 @@ export {
5
5
  type ImageToVideoCreateResponse,
6
6
  type ImageToVideoCreateParams,
7
7
  } from './image-to-video';
8
+ export { Organization, type OrganizationRetrieveResponse } from './organization';
8
9
  export { Tasks, type TaskRetrieveResponse } from './tasks';
@@ -0,0 +1,150 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class Organization extends APIResource {
7
+ /**
8
+ * Get usage tier and credit balance information about the organization associated
9
+ * with the API key used to make the request.
10
+ */
11
+ retrieve(options?: Core.RequestOptions): Core.APIPromise<OrganizationRetrieveResponse> {
12
+ return this._client.get('/v1/organization', options);
13
+ }
14
+ }
15
+
16
+ export interface OrganizationRetrieveResponse {
17
+ /**
18
+ * The number of credits remaining in the organization account.
19
+ */
20
+ creditBalance: number;
21
+
22
+ /**
23
+ * Limits associated with the organization's tier.
24
+ */
25
+ tier: OrganizationRetrieveResponse.Tier;
26
+
27
+ /**
28
+ * Usage data for the organization.
29
+ */
30
+ usage: OrganizationRetrieveResponse.Usage;
31
+ }
32
+
33
+ export namespace OrganizationRetrieveResponse {
34
+ /**
35
+ * Limits associated with the organization's tier.
36
+ */
37
+ export interface Tier {
38
+ /**
39
+ * The maximum number of credits that can be purchased in a month.
40
+ */
41
+ maxMonthlyCreditSpend: number;
42
+
43
+ /**
44
+ * An object containing model-specific limits. Each key represents a model.
45
+ */
46
+ models: Tier.Models;
47
+ }
48
+
49
+ export namespace Tier {
50
+ /**
51
+ * An object containing model-specific limits. Each key represents a model.
52
+ */
53
+ export interface Models {
54
+ /**
55
+ * Limits associated with the gen3a_turbo model.
56
+ */
57
+ gen3a_turbo?: Models.Gen3aTurbo;
58
+
59
+ /**
60
+ * Limits associated with the gen4_turbo model.
61
+ */
62
+ gen4_turbo?: Models.Gen4Turbo;
63
+ }
64
+
65
+ export namespace Models {
66
+ /**
67
+ * Limits associated with the gen3a_turbo model.
68
+ */
69
+ export interface Gen3aTurbo {
70
+ /**
71
+ * The maximum number of generations that can be run concurrently for this model.
72
+ */
73
+ maxConcurrentGenerations: number;
74
+
75
+ /**
76
+ * The maximum number of generations that can be created each day for this model.
77
+ */
78
+ maxDailyGenerations: number;
79
+ }
80
+
81
+ /**
82
+ * Limits associated with the gen4_turbo model.
83
+ */
84
+ export interface Gen4Turbo {
85
+ /**
86
+ * The maximum number of generations that can be run concurrently for this model.
87
+ */
88
+ maxConcurrentGenerations: number;
89
+
90
+ /**
91
+ * The maximum number of generations that can be created each day for this model.
92
+ */
93
+ maxDailyGenerations: number;
94
+ }
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Usage data for the organization.
100
+ */
101
+ export interface Usage {
102
+ /**
103
+ * Usage data for each model.
104
+ */
105
+ models: Usage.Models;
106
+ }
107
+
108
+ export namespace Usage {
109
+ /**
110
+ * Usage data for each model.
111
+ */
112
+ export interface Models {
113
+ /**
114
+ * Usage data for the gen3a_turbo model.
115
+ */
116
+ gen3a_turbo?: Models.Gen3aTurbo;
117
+
118
+ /**
119
+ * Usage data for the gen4_turbo model.
120
+ */
121
+ gen4_turbo?: Models.Gen4Turbo;
122
+ }
123
+
124
+ export namespace Models {
125
+ /**
126
+ * Usage data for the gen3a_turbo model.
127
+ */
128
+ export interface Gen3aTurbo {
129
+ /**
130
+ * The number of generations that have been run for this model in the past day.
131
+ */
132
+ dailyGenerations: number;
133
+ }
134
+
135
+ /**
136
+ * Usage data for the gen4_turbo model.
137
+ */
138
+ export interface Gen4Turbo {
139
+ /**
140
+ * The number of generations that have been run for this model in the past day.
141
+ */
142
+ dailyGenerations: number;
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ export declare namespace Organization {
149
+ export { type OrganizationRetrieveResponse as OrganizationRetrieveResponse };
150
+ }