@omnichar/contracts 0.0.0-01d940d

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 (113) hide show
  1. package/dist/errors.d.ts +39 -0
  2. package/dist/errors.d.ts.map +1 -0
  3. package/dist/errors.js +42 -0
  4. package/dist/errors.js.map +1 -0
  5. package/dist/index.d.ts +5 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +5 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/manifest/index.d.ts +18 -0
  10. package/dist/manifest/index.d.ts.map +1 -0
  11. package/dist/manifest/index.js +13 -0
  12. package/dist/manifest/index.js.map +1 -0
  13. package/dist/result.d.ts +12 -0
  14. package/dist/result.d.ts.map +1 -0
  15. package/dist/result.js +7 -0
  16. package/dist/result.js.map +1 -0
  17. package/dist/v1/accessRequests.d.ts +11 -0
  18. package/dist/v1/accessRequests.d.ts.map +1 -0
  19. package/dist/v1/accessRequests.js +12 -0
  20. package/dist/v1/accessRequests.js.map +1 -0
  21. package/dist/v1/apiKeys.d.ts +38 -0
  22. package/dist/v1/apiKeys.d.ts.map +1 -0
  23. package/dist/v1/apiKeys.js +28 -0
  24. package/dist/v1/apiKeys.js.map +1 -0
  25. package/dist/v1/assets.d.ts +47 -0
  26. package/dist/v1/assets.d.ts.map +1 -0
  27. package/dist/v1/assets.js +24 -0
  28. package/dist/v1/assets.js.map +1 -0
  29. package/dist/v1/capacity.d.ts +48 -0
  30. package/dist/v1/capacity.d.ts.map +1 -0
  31. package/dist/v1/capacity.js +18 -0
  32. package/dist/v1/capacity.js.map +1 -0
  33. package/dist/v1/characterListings.d.ts +75 -0
  34. package/dist/v1/characterListings.d.ts.map +1 -0
  35. package/dist/v1/characterListings.js +68 -0
  36. package/dist/v1/characterListings.js.map +1 -0
  37. package/dist/v1/characters.d.ts +171 -0
  38. package/dist/v1/characters.d.ts.map +1 -0
  39. package/dist/v1/characters.js +111 -0
  40. package/dist/v1/characters.js.map +1 -0
  41. package/dist/v1/common.d.ts +13 -0
  42. package/dist/v1/common.d.ts.map +1 -0
  43. package/dist/v1/common.js +12 -0
  44. package/dist/v1/common.js.map +1 -0
  45. package/dist/v1/credits.d.ts +124 -0
  46. package/dist/v1/credits.d.ts.map +1 -0
  47. package/dist/v1/credits.js +82 -0
  48. package/dist/v1/credits.js.map +1 -0
  49. package/dist/v1/datasets.d.ts +153 -0
  50. package/dist/v1/datasets.d.ts.map +1 -0
  51. package/dist/v1/datasets.js +93 -0
  52. package/dist/v1/datasets.js.map +1 -0
  53. package/dist/v1/featureRequests.d.ts +29 -0
  54. package/dist/v1/featureRequests.d.ts.map +1 -0
  55. package/dist/v1/featureRequests.js +36 -0
  56. package/dist/v1/featureRequests.js.map +1 -0
  57. package/dist/v1/guest.d.ts +154 -0
  58. package/dist/v1/guest.d.ts.map +1 -0
  59. package/dist/v1/guest.js +91 -0
  60. package/dist/v1/guest.js.map +1 -0
  61. package/dist/v1/health.d.ts +13 -0
  62. package/dist/v1/health.d.ts.map +1 -0
  63. package/dist/v1/health.js +10 -0
  64. package/dist/v1/health.js.map +1 -0
  65. package/dist/v1/index.d.ts +24 -0
  66. package/dist/v1/index.d.ts.map +1 -0
  67. package/dist/v1/index.js +24 -0
  68. package/dist/v1/index.js.map +1 -0
  69. package/dist/v1/me.d.ts +30 -0
  70. package/dist/v1/me.d.ts.map +1 -0
  71. package/dist/v1/me.js +22 -0
  72. package/dist/v1/me.js.map +1 -0
  73. package/dist/v1/plans.d.ts +30 -0
  74. package/dist/v1/plans.d.ts.map +1 -0
  75. package/dist/v1/plans.js +19 -0
  76. package/dist/v1/plans.js.map +1 -0
  77. package/dist/v1/purchases.d.ts +40 -0
  78. package/dist/v1/purchases.d.ts.map +1 -0
  79. package/dist/v1/purchases.js +56 -0
  80. package/dist/v1/purchases.js.map +1 -0
  81. package/dist/v1/runs.d.ts +791 -0
  82. package/dist/v1/runs.d.ts.map +1 -0
  83. package/dist/v1/runs.js +257 -0
  84. package/dist/v1/runs.js.map +1 -0
  85. package/dist/v1/sessions.d.ts +486 -0
  86. package/dist/v1/sessions.d.ts.map +1 -0
  87. package/dist/v1/sessions.js +89 -0
  88. package/dist/v1/sessions.js.map +1 -0
  89. package/dist/v1/studio.d.ts +279 -0
  90. package/dist/v1/studio.d.ts.map +1 -0
  91. package/dist/v1/studio.js +309 -0
  92. package/dist/v1/studio.js.map +1 -0
  93. package/dist/v1/terms.d.ts +8 -0
  94. package/dist/v1/terms.d.ts.map +1 -0
  95. package/dist/v1/terms.js +15 -0
  96. package/dist/v1/terms.js.map +1 -0
  97. package/dist/v1/uploads.d.ts +60 -0
  98. package/dist/v1/uploads.d.ts.map +1 -0
  99. package/dist/v1/uploads.js +77 -0
  100. package/dist/v1/uploads.js.map +1 -0
  101. package/dist/v1/usernames.d.ts +35 -0
  102. package/dist/v1/usernames.d.ts.map +1 -0
  103. package/dist/v1/usernames.js +67 -0
  104. package/dist/v1/usernames.js.map +1 -0
  105. package/dist/v1/videoPricing.d.ts +70 -0
  106. package/dist/v1/videoPricing.d.ts.map +1 -0
  107. package/dist/v1/videoPricing.js +131 -0
  108. package/dist/v1/videoPricing.js.map +1 -0
  109. package/dist/v1/workflows.d.ts +201 -0
  110. package/dist/v1/workflows.d.ts.map +1 -0
  111. package/dist/v1/workflows.js +104 -0
  112. package/dist/v1/workflows.js.map +1 -0
  113. package/package.json +34 -0
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ export declare const MAX_UPLOAD_BYTES: number;
3
+ export declare const MAX_THUMBNAIL_BYTES: number;
4
+ /**
5
+ * The long edge of every stored derivative, wherever it is made.
6
+ *
7
+ * Shared because three places make one - the control plane for a pod's takes, the worker for a
8
+ * serverless run's, and the browser for an upload - and a grid that gets a different size depending
9
+ * on which produced it is a grid that looks wrong for reasons nobody can see.
10
+ */
11
+ export declare const THUMBNAIL_EDGE = 512;
12
+ export declare const THUMBNAIL_CONTENT_TYPE = "image/webp";
13
+ export declare const THUMBNAIL_QUALITY = 82;
14
+ export declare const MAX_AUDIO_UPLOAD_BYTES: number;
15
+ export declare const UPLOAD_KINDS: readonly ["image", "video", "character", "audio"];
16
+ export declare const uploadKindSchema: z.ZodEnum<{
17
+ image: "image";
18
+ video: "video";
19
+ character: "character";
20
+ audio: "audio";
21
+ }>;
22
+ export declare const UPLOAD_CONTENT_TYPES: {
23
+ readonly image: readonly ["image/png", "image/jpeg", "image/webp"];
24
+ readonly video: readonly ["video/mp4", "video/webm"];
25
+ readonly character: readonly ["application/octet-stream"];
26
+ readonly audio: readonly ["audio/mpeg", "audio/wav", "audio/x-wav", "audio/wave", "audio/mp4", "audio/x-m4a", "audio/aac", "audio/flac", "audio/x-flac", "audio/ogg"];
27
+ };
28
+ export declare const createUploadBodySchema: z.ZodObject<{
29
+ kind: z.ZodEnum<{
30
+ image: "image";
31
+ video: "video";
32
+ character: "character";
33
+ audio: "audio";
34
+ }>;
35
+ contentType: z.ZodString;
36
+ bytes: z.ZodNumber;
37
+ name: z.ZodOptional<z.ZodString>;
38
+ thumbBytes: z.ZodOptional<z.ZodNumber>;
39
+ }, z.core.$strip>;
40
+ export declare const uploadThumbnailSchema: z.ZodObject<{
41
+ r2Key: z.ZodString;
42
+ uploadUrl: z.ZodURL;
43
+ contentType: z.ZodLiteral<"image/webp">;
44
+ }, z.core.$strip>;
45
+ export declare const createUploadResponseSchema: z.ZodObject<{
46
+ r2Key: z.ZodString;
47
+ uploadUrl: z.ZodURL;
48
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
49
+ expiresAt: z.ZodISODateTime;
50
+ thumb: z.ZodNullable<z.ZodObject<{
51
+ r2Key: z.ZodString;
52
+ uploadUrl: z.ZodURL;
53
+ contentType: z.ZodLiteral<"image/webp">;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>;
56
+ export type UploadKind = z.infer<typeof uploadKindSchema>;
57
+ export type CreateUploadBody = z.infer<typeof createUploadBodySchema>;
58
+ export type CreateUploadResponse = z.infer<typeof createUploadResponseSchema>;
59
+ export type UploadThumbnail = z.infer<typeof uploadThumbnailSchema>;
60
+ //# sourceMappingURL=uploads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../src/v1/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,gBAAgB,QAAqB,CAAA;AAGlD,eAAO,MAAM,mBAAmB,QAAkB,CAAA;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAElD,eAAO,MAAM,iBAAiB,KAAK,CAAA;AAGnC,eAAO,MAAM,sBAAsB,QAAmB,CAAA;AAEtD,eAAO,MAAM,YAAY,mDAAoD,CAAA;AAC7E,eAAO,MAAM,gBAAgB;;;;;EAAuB,CAAA;AAEpD,eAAO,MAAM,oBAAoB;;;;;CAiB4C,CAAA;AAE7E,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAqB/B,CAAA;AAKJ,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAA;AAGF,eAAO,MAAM,0BAA0B;;;;;;;;;;iBAMrC,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAC7E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -0,0 +1,77 @@
1
+ import { z } from 'zod';
2
+ // One gigabyte. A character carrying a trained LoRA is already 164 MB, so the old 64 MB refused
3
+ // files this platform had itself produced. The pod dispatcher still reads an input into memory on
4
+ // its way to the pod, but it stages them one at a time, so the peak is one file rather than all.
5
+ export const MAX_UPLOAD_BYTES = 1024 * 1024 * 1024;
6
+ // A 512px WebP is a few tens of KB. The cap only stops the second grant being useful for anything
7
+ // but the derivative it was asked for.
8
+ export const MAX_THUMBNAIL_BYTES = 2 * 1024 * 1024;
9
+ /**
10
+ * The long edge of every stored derivative, wherever it is made.
11
+ *
12
+ * Shared because three places make one - the control plane for a pod's takes, the worker for a
13
+ * serverless run's, and the browser for an upload - and a grid that gets a different size depending
14
+ * on which produced it is a grid that looks wrong for reasons nobody can see.
15
+ */
16
+ export const THUMBNAIL_EDGE = 512;
17
+ export const THUMBNAIL_CONTENT_TYPE = 'image/webp';
18
+ // Held here for the same reason as the edge: three encoders, one answer.
19
+ export const THUMBNAIL_QUALITY = 82;
20
+ // Core refuses a voice sample over 50 MB, so a bigger one would upload and then fail the build.
21
+ export const MAX_AUDIO_UPLOAD_BYTES = 50 * 1024 * 1024;
22
+ export const UPLOAD_KINDS = ['image', 'video', 'character', 'audio'];
23
+ export const uploadKindSchema = z.enum(UPLOAD_KINDS);
24
+ export const UPLOAD_CONTENT_TYPES = {
25
+ image: ['image/png', 'image/jpeg', 'image/webp'],
26
+ video: ['video/mp4', 'video/webm'],
27
+ character: ['application/octet-stream'],
28
+ // Browsers disagree on the names for wav and m4a, so each spelling they send is listed.
29
+ audio: [
30
+ 'audio/mpeg',
31
+ 'audio/wav',
32
+ 'audio/x-wav',
33
+ 'audio/wave',
34
+ 'audio/mp4',
35
+ 'audio/x-m4a',
36
+ 'audio/aac',
37
+ 'audio/flac',
38
+ 'audio/x-flac',
39
+ 'audio/ogg',
40
+ ],
41
+ };
42
+ export const createUploadBodySchema = z
43
+ .object({
44
+ kind: uploadKindSchema,
45
+ contentType: z.string().max(100),
46
+ bytes: z.number().int().positive().max(MAX_UPLOAD_BYTES),
47
+ // The file's own name, kept so the Imported list can show it. Cleaned before it reaches a key.
48
+ name: z.string().max(200).optional(),
49
+ // The exact size of the derivative the caller has already made. Sent up front because a signed
50
+ // PUT binds the length exactly, so the grant cannot be issued before the bytes exist.
51
+ thumbBytes: z.number().int().positive().max(MAX_THUMBNAIL_BYTES).optional(),
52
+ })
53
+ .refine((body) => UPLOAD_CONTENT_TYPES[body.kind].includes(body.contentType), {
54
+ message: 'That content type is not accepted for this kind of upload.',
55
+ path: ['contentType'],
56
+ })
57
+ .refine((body) => body.kind !== 'audio' || body.bytes <= MAX_AUDIO_UPLOAD_BYTES, {
58
+ message: 'A voice sample can be at most 50 MB. About 30 seconds of speech is all it needs.',
59
+ path: ['bytes'],
60
+ });
61
+ // A second link for a small WebP of the same image, at a key derived from the first. Null for
62
+ // anything that is not an image. The browser has the file decoded already, so making the derivative
63
+ // there costs nothing per byte; the key is still ours, so a caller cannot choose where it lands.
64
+ export const uploadThumbnailSchema = z.object({
65
+ r2Key: z.string(),
66
+ uploadUrl: z.url(),
67
+ contentType: z.literal('image/webp'),
68
+ });
69
+ // The signed URL binds the key, content type and length, so the PUT must send exactly `headers`.
70
+ export const createUploadResponseSchema = z.object({
71
+ r2Key: z.string(),
72
+ uploadUrl: z.url(),
73
+ headers: z.record(z.string(), z.string()),
74
+ expiresAt: z.iso.datetime(),
75
+ thumb: uploadThumbnailSchema.nullable(),
76
+ });
77
+ //# sourceMappingURL=uploads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/v1/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gGAAgG;AAChG,kGAAkG;AAClG,iGAAiG;AACjG,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAClD,kGAAkG;AAClG,uCAAuC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA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ERNAME_PATTERN: RegExp;
5
+ export declare const RESERVED_USERNAMES: readonly ["about", "admin", "api", "auth", "characters", "help", "login", "logout", "omnichar", "pricing", "privacy", "projects", "root", "settings", "signup", "staff", "support", "team", "terms", "welcome", "workflows"];
6
+ /** Lowercasing is the client's job before it sends, so the API can refuse what it did not mean. */
7
+ export declare function normaliseUsername(raw: string): string;
8
+ export declare function isReservedUsername(name: string): boolean;
9
+ export declare const usernameShapeSchema: z.ZodString;
10
+ export declare const usernameSchema: z.ZodString;
11
+ export declare const usernameAvailableQuerySchema: z.ZodObject<{
12
+ name: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export declare const usernameAvailableSchema: z.ZodObject<{
15
+ available: z.ZodBoolean;
16
+ reason: z.ZodNullable<z.ZodEnum<{
17
+ shape: "shape";
18
+ reserved: "reserved";
19
+ taken: "taken";
20
+ }>>;
21
+ }, z.core.$strip>;
22
+ export declare const claimUsernameBodySchema: z.ZodObject<{
23
+ username: z.ZodString;
24
+ }, z.core.$strip>;
25
+ export declare const claimUsernameResponseSchema: z.ZodObject<{
26
+ username: z.ZodString;
27
+ }, z.core.$strip>;
28
+ export type UsernameAvailable = z.infer<typeof usernameAvailableSchema>;
29
+ export type ClaimUsernameBody = z.infer<typeof claimUsernameBodySchema>;
30
+ export type ClaimUsernameResponse = z.infer<typeof claimUsernameResponseSchema>;
31
+ export declare const myUsernameSchema: z.ZodObject<{
32
+ username: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ export type MyUsername = z.infer<typeof myUsernameSchema>;
35
+ //# sourceMappingURL=usernames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usernames.d.ts","sourceRoot":"","sources":["../../src/v1/usernames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,gBAAgB,QAAiB,CAAA;AAK9C,eAAO,MAAM,kBAAkB,8NAsBrB,CAAA;AAEV,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAID,eAAO,MAAM,mBAAmB,aAIN,CAAA;AAE1B,eAAO,MAAM,cAAc,aAEzB,CAAA;AAIF,eAAO,MAAM,4BAA4B;;iBAEvC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;iBAIlC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;iBAAyC,CAAA;AAE7E,eAAO,MAAM,2BAA2B;;iBAAyC,CAAA;AAEjF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACvE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAI/E,eAAO,MAAM,gBAAgB;;iBAE3B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod';
2
+ // A handle is public, so the character set is deliberately narrow. Uppercase is refused rather than
3
+ // folded, which is what lets a plain unique index behave case-insensitively with no citext extension.
4
+ export const USERNAME_MIN = 3;
5
+ export const USERNAME_MAX = 30;
6
+ export const USERNAME_PATTERN = /^[a-z0-9_]+$/;
7
+ // Out of circulation so a handle can never read as though it belongs to us, or collide with a path
8
+ // if a profile route is ever added. Only words that could actually be claimed are listed: anything
9
+ // with a hyphen, or shorter than the minimum, is already unreachable.
10
+ export const RESERVED_USERNAMES = [
11
+ 'about',
12
+ 'admin',
13
+ 'api',
14
+ 'auth',
15
+ 'characters',
16
+ 'help',
17
+ 'login',
18
+ 'logout',
19
+ 'omnichar',
20
+ 'pricing',
21
+ 'privacy',
22
+ 'projects',
23
+ 'root',
24
+ 'settings',
25
+ 'signup',
26
+ 'staff',
27
+ 'support',
28
+ 'team',
29
+ 'terms',
30
+ 'welcome',
31
+ 'workflows',
32
+ ];
33
+ /** Lowercasing is the client's job before it sends, so the API can refuse what it did not mean. */
34
+ export function normaliseUsername(raw) {
35
+ return raw.trim().toLowerCase();
36
+ }
37
+ export function isReservedUsername(name) {
38
+ return RESERVED_USERNAMES.includes(name);
39
+ }
40
+ // Shape alone, with no opinion on whether the word is spoken for. Separate so a caller can be told
41
+ // which of the two it failed: "too short" and "already ours" are different answers.
42
+ export const usernameShapeSchema = z
43
+ .string()
44
+ .min(USERNAME_MIN)
45
+ .max(USERNAME_MAX)
46
+ .regex(USERNAME_PATTERN);
47
+ export const usernameSchema = usernameShapeSchema.refine((name) => !isReservedUsername(name), {
48
+ message: 'That one is reserved.',
49
+ });
50
+ // Loosely typed on purpose: a live checker wants to be told why a candidate is wrong, so the route
51
+ // answers rather than rejecting the request. The shape is judged in the response, not the schema.
52
+ export const usernameAvailableQuerySchema = z.object({
53
+ name: z.string().min(1).max(64),
54
+ });
55
+ export const usernameAvailableSchema = z.object({
56
+ available: z.boolean(),
57
+ // Why not, when it is not, so the form states a reason instead of guessing at one.
58
+ reason: z.enum(['shape', 'reserved', 'taken']).nullable(),
59
+ });
60
+ export const claimUsernameBodySchema = z.object({ username: usernameSchema });
61
+ export const claimUsernameResponseSchema = z.object({ username: usernameSchema });
62
+ // The caller's own username, or null when they have not set one. Its own response rather than a
63
+ // field on /v1/me, because that route is behind the alpha gate and this is not.
64
+ export const myUsernameSchema = z.object({
65
+ username: z.string().nullable(),
66
+ });
67
+ //# sourceMappingURL=usernames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usernames.js","sourceRoot":"","sources":["../../src/v1/usernames.ts"],"names":[],"mappings":"AAAA,OAAO,E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;IACnD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;CAChC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,mFAAmF;IACnF,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC1D,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAA;AAE7E,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAA;AAMjF,gGAAgG;AAChG,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAA"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * What a reference-to-video run costs, in credits, before it is run.
3
+ *
4
+ * Unlike a GPU run there is nothing to meter: the price follows from the duration, the resolution
5
+ * and the number of references, all of which the caller picks. So the form shows the exact number,
6
+ * the charge equals the quote, and a run that cannot be afforded is refused with the settings that
7
+ * would fit rather than a bare "not enough credits".
8
+ *
9
+ * The rates below are what a caller pays. What the run costs us is server-side
10
+ * (`services/pricing/videoCost.ts`), and a test there recomputes this table so the two cannot drift.
11
+ */
12
+ export declare const VIDEO_RESOLUTIONS: readonly ["480p", "768p", "2K", "4K"];
13
+ export type VideoResolution = (typeof VIDEO_RESOLUTIONS)[number];
14
+ /** Whole seconds, as the model accepts them. */
15
+ export declare const MIN_VIDEO_SECONDS = 5;
16
+ export declare const MAX_VIDEO_SECONDS = 15;
17
+ export declare const VIDEO_MICRO_PER_SECOND: Record<VideoResolution, number>;
18
+ export declare const FREE_VIDEO_REFERENCES = 5;
19
+ export declare const VIDEO_MICRO_PER_EXTRA_REFERENCE = 16000000;
20
+ export declare const VIDEO_ASPECT_RATIOS: readonly ["adaptive", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
21
+ export type VideoAspectRatio = (typeof VIDEO_ASPECT_RATIOS)[number];
22
+ export declare const VIDEO_SHORT_EDGE: Record<VideoResolution, number>;
23
+ export type VideoQuoteInput = {
24
+ resolution: VideoResolution;
25
+ seconds: number;
26
+ aspectRatio?: VideoAspectRatio;
27
+ /** Every reference the run sends, a character's own included. */
28
+ referenceImages?: number;
29
+ };
30
+ export declare class VideoQuoteError extends Error {
31
+ }
32
+ /**
33
+ * The price of one run, in micro-credits.
34
+ *
35
+ * Throws on anything it cannot price. A quote that fell back to the cheapest tier for an unknown
36
+ * resolution would undercharge silently, which is the one failure nobody would report.
37
+ */
38
+ export declare function videoRunMicro(input: VideoQuoteInput, card?: Partial<Record<VideoResolution, number>>): number;
39
+ /** The same price in whole credits, which is the only form a caller ever sees. */
40
+ export declare function videoRunCredits(input: VideoQuoteInput, card?: Partial<Record<VideoResolution, number>>): number;
41
+ export type VideoAlternative = {
42
+ resolution: VideoResolution;
43
+ seconds: number;
44
+ credits: number;
45
+ };
46
+ /**
47
+ * Settings close to the ones asked for that this balance can afford, dearest first.
48
+ *
49
+ * Offered because the two things that move the price are the two things the caller chose, so a
50
+ * refusal can name a way forward instead of only a number. Same resolution at a shorter duration
51
+ * comes first, since length is usually easier to give up than sharpness.
52
+ */
53
+ export declare function affordableVideoOptions(balanceMicro: number, input: VideoQuoteInput, limit?: number): VideoAlternative[];
54
+ /** What the model accepts, and so the most a run can be billed for. */
55
+ export declare const MAX_VIDEO_REFERENCES = 9;
56
+ /**
57
+ * How many references a run is billed for.
58
+ *
59
+ * A character carries its own references inside the `.char`, so they never appear among the
60
+ * uploads - and the renderer charges for every one it is sent. Billing only the uploads would hand
61
+ * those over free, so a run with a character is billed at the model's cap: the most it can send.
62
+ *
63
+ * Shared rather than restated in a browser: the figure a form shows and the figure a run is charged
64
+ * have to be the same arithmetic, or the price moves between pressing Run and being billed.
65
+ */
66
+ export declare function billedVideoReferences(opts: {
67
+ uploads: number;
68
+ hasCharacter: boolean;
69
+ }): number;
70
+ //# sourceMappingURL=videoPricing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"videoPricing.d.ts","sourceRoot":"","sources":["../../src/v1/videoPricing.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,iBAAiB,uCAAwC,CAAA;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEhE,gDAAgD;AAChD,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAClC,eAAO,MAAM,iBAAiB,KAAK,CAAA;AAInC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAKlE,CAAA;AAID,eAAO,MAAM,qBAAqB,IAAI,CAAA;AACtC,eAAO,MAAM,+BAA+B,WAAa,CAAA;AAGzD,eAAO,MAAM,mBAAmB,oEAQtB,CAAA;AACV,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAGnE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAK5D,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IAEf,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAE7C;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,eAAe,EAGtB,IAAI,GAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAA0B,GACtE,MAAM,CAmBR;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,eAAe,EACtB,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,GAC9C,MAAM,CAER;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,eAAe,EACtB,KAAK,SAAI,GACR,gBAAgB,EAAE,CA6BpB;AAED,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAG9F"}
@@ -0,0 +1,131 @@
1
+ import { MICRO_PER_CREDIT } from './credits.js';
2
+ /**
3
+ * What a reference-to-video run costs, in credits, before it is run.
4
+ *
5
+ * Unlike a GPU run there is nothing to meter: the price follows from the duration, the resolution
6
+ * and the number of references, all of which the caller picks. So the form shows the exact number,
7
+ * the charge equals the quote, and a run that cannot be afforded is refused with the settings that
8
+ * would fit rather than a bare "not enough credits".
9
+ *
10
+ * The rates below are what a caller pays. What the run costs us is server-side
11
+ * (`services/pricing/videoCost.ts`), and a test there recomputes this table so the two cannot drift.
12
+ */
13
+ export const VIDEO_RESOLUTIONS = ['480p', '768p', '2K', '4K'];
14
+ /** Whole seconds, as the model accepts them. */
15
+ export const MIN_VIDEO_SECONDS = 5;
16
+ export const MAX_VIDEO_SECONDS = 15;
17
+ // Micro-credits per second of output. Integers so nothing rounds until the total, and a 15-second
18
+ // 4K clip is the same arithmetic as a 5-second draft.
19
+ export const VIDEO_MICRO_PER_SECOND = {
20
+ '480p': 10_000_000,
21
+ '768p': 12_000_000,
22
+ '2K': 26_000_000,
23
+ '4K': 32_000_000,
24
+ };
25
+ // References are how a character reaches the model, so the ones a character needs are not a
26
+ // surcharge. Past that the supplier charges per image and so do we.
27
+ export const FREE_VIDEO_REFERENCES = 5;
28
+ export const VIDEO_MICRO_PER_EXTRA_REFERENCE = 16_000_000;
29
+ // `adaptive` lets the model choose, which is what it does when nothing is asked for.
30
+ export const VIDEO_ASPECT_RATIOS = [
31
+ 'adaptive',
32
+ '21:9',
33
+ '16:9',
34
+ '4:3',
35
+ '1:1',
36
+ '3:4',
37
+ '9:16',
38
+ ];
39
+ // Lines on the short edge, which is what a resolution names. The long edge follows from the ratio.
40
+ export const VIDEO_SHORT_EDGE = {
41
+ '480p': 480,
42
+ '768p': 768,
43
+ '2K': 1440,
44
+ '4K': 2160,
45
+ };
46
+ export class VideoQuoteError extends Error {
47
+ }
48
+ /**
49
+ * The price of one run, in micro-credits.
50
+ *
51
+ * Throws on anything it cannot price. A quote that fell back to the cheapest tier for an unknown
52
+ * resolution would undercharge silently, which is the one failure nobody would report.
53
+ */
54
+ export function videoRunMicro(input,
55
+ // Which renderer's rates to quote at. Defaulted, so every caller that predates a choice of
56
+ // renderer still quotes the one it was written against.
57
+ card = VIDEO_MICRO_PER_SECOND) {
58
+ const perSecond = card[input.resolution];
59
+ if (perSecond === undefined) {
60
+ throw new VideoQuoteError(`Unknown resolution ${String(input.resolution)}.`);
61
+ }
62
+ if (!Number.isInteger(input.seconds)) {
63
+ throw new VideoQuoteError('Duration must be a whole number of seconds.');
64
+ }
65
+ if (input.seconds < MIN_VIDEO_SECONDS || input.seconds > MAX_VIDEO_SECONDS) {
66
+ throw new VideoQuoteError(`Duration must be ${MIN_VIDEO_SECONDS} to ${MAX_VIDEO_SECONDS} seconds.`);
67
+ }
68
+ const references = input.referenceImages ?? 0;
69
+ if (!Number.isInteger(references) || references < 0) {
70
+ throw new VideoQuoteError('Reference count must be zero or more.');
71
+ }
72
+ const extra = Math.max(0, references - FREE_VIDEO_REFERENCES);
73
+ return input.seconds * perSecond + extra * VIDEO_MICRO_PER_EXTRA_REFERENCE;
74
+ }
75
+ /** The same price in whole credits, which is the only form a caller ever sees. */
76
+ export function videoRunCredits(input, card) {
77
+ return Math.ceil(videoRunMicro(input, card) / MICRO_PER_CREDIT);
78
+ }
79
+ /**
80
+ * Settings close to the ones asked for that this balance can afford, dearest first.
81
+ *
82
+ * Offered because the two things that move the price are the two things the caller chose, so a
83
+ * refusal can name a way forward instead of only a number. Same resolution at a shorter duration
84
+ * comes first, since length is usually easier to give up than sharpness.
85
+ */
86
+ export function affordableVideoOptions(balanceMicro, input, limit = 2) {
87
+ const references = input.referenceImages ?? 0;
88
+ const fits = (resolution, seconds) => {
89
+ const micro = videoRunMicro({ resolution, seconds, referenceImages: references });
90
+ if (micro > balanceMicro)
91
+ return null;
92
+ return { resolution, seconds, credits: Math.ceil(micro / MICRO_PER_CREDIT) };
93
+ };
94
+ const shorterSame = [];
95
+ for (let seconds = input.seconds - 1; seconds >= MIN_VIDEO_SECONDS; seconds -= 1) {
96
+ const option = fits(input.resolution, seconds);
97
+ if (option) {
98
+ shorterSame.push(option);
99
+ break;
100
+ }
101
+ }
102
+ // Cheaper tiers at the duration originally asked for, dearest of them first.
103
+ const cheaperTiers = [];
104
+ const rank = VIDEO_RESOLUTIONS.indexOf(input.resolution);
105
+ for (let i = rank - 1; i >= 0; i -= 1) {
106
+ const option = fits(VIDEO_RESOLUTIONS[i], input.seconds);
107
+ if (option) {
108
+ cheaperTiers.push(option);
109
+ break;
110
+ }
111
+ }
112
+ return [...shorterSame, ...cheaperTiers].slice(0, limit);
113
+ }
114
+ /** What the model accepts, and so the most a run can be billed for. */
115
+ export const MAX_VIDEO_REFERENCES = 9;
116
+ /**
117
+ * How many references a run is billed for.
118
+ *
119
+ * A character carries its own references inside the `.char`, so they never appear among the
120
+ * uploads - and the renderer charges for every one it is sent. Billing only the uploads would hand
121
+ * those over free, so a run with a character is billed at the model's cap: the most it can send.
122
+ *
123
+ * Shared rather than restated in a browser: the figure a form shows and the figure a run is charged
124
+ * have to be the same arithmetic, or the price moves between pressing Run and being billed.
125
+ */
126
+ export function billedVideoReferences(opts) {
127
+ if (opts.hasCharacter)
128
+ return MAX_VIDEO_REFERENCES;
129
+ return Math.min(MAX_VIDEO_REFERENCES, Math.max(0, opts.uploads));
130
+ }
131
+ //# sourceMappingURL=videoPricing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"videoPricing.js","sourceRoot":"","sources":["../../src/v1/videoPricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAGtE,gDAAgD;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAClC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAEnC,kGAAkG;AAClG,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAoC;IACrE,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAA;AAED,4FAA4F;AAC5F,oEAAoE;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AACtC,MAAM,CAAC,MAAM,+BAA+B,GAAG,UAAU,CAAA;AAEzD,qFAAqF;AACrF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU;IACV,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;CACE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