@omelhorsite/sdk 0.16.0 → 0.18.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.
- package/README.md +1 -1
- package/dist/index.js +540 -19
- package/dist/types/auth/tokens.d.ts +1 -1
- package/dist/types/client.d.ts +3 -0
- package/dist/types/resources/admin/llm.d.ts +34 -0
- package/dist/types/resources/bots.d.ts +394 -0
- package/dist/types/resources/content/news/feeds.d.ts +9 -2
- package/dist/types/resources/content/news/index.d.ts +23 -0
- package/dist/types/resources/content/news/items.d.ts +40 -0
- package/dist/types/resources/content/news/sources.d.ts +61 -5
- package/dist/types/resources/content/notifications.d.ts +1 -1
- package/dist/types/resources/cron.d.ts +319 -26
- package/dist/types/resources/index.d.ts +1 -0
- package/dist/types/resources/search.d.ts +5 -0
- package/dist/types/resources/tools/imageGeneration.d.ts +156 -0
- package/dist/types/resources/tools/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image generation: a prompt in, a PNG out.
|
|
3
|
+
*
|
|
4
|
+
* Same shape as the other async tools - `POST /image_generations` enqueues a
|
|
5
|
+
* job and answers with a row plus a `job_id` and, when anonymous, a
|
|
6
|
+
* `watch_token`.
|
|
7
|
+
*
|
|
8
|
+
* What is different here is that the work can run in two places, and the
|
|
9
|
+
* caller picks: a model on the server itself, which is free, or a model at a
|
|
10
|
+
* paid provider, which is not. {@link ImageGenerationNamespace.models} lists
|
|
11
|
+
* the ones the CURRENT caller may actually use, so an anonymous caller never
|
|
12
|
+
* sees a model they would be refused for.
|
|
13
|
+
*
|
|
14
|
+
* Two daily quotas apply, not one: a count of images, which every model
|
|
15
|
+
* consumes, and a spend ceiling in USD, which only the paid ones touch.
|
|
16
|
+
*/
|
|
17
|
+
import { Resource } from "../../http";
|
|
18
|
+
import type { Id, RequestOptions } from "../../types";
|
|
19
|
+
import { type ToolCaptcha, type ToolJobHandle, type ToolRecord, type ToolRunOptions } from "./index";
|
|
20
|
+
/** Where a model runs. `"local"` is the server itself and always free. */
|
|
21
|
+
export type ImageProvider = "local" | "fal";
|
|
22
|
+
/** One model the caller may pick, as `GET /image_generations/models` lists it. */
|
|
23
|
+
export interface ImageModel {
|
|
24
|
+
readonly key: string;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly description: string;
|
|
27
|
+
readonly provider: ImageProvider;
|
|
28
|
+
/** True when a run costs money and counts against the spend ceiling. */
|
|
29
|
+
readonly billable: boolean;
|
|
30
|
+
/** True on models kept behind an account flag. */
|
|
31
|
+
readonly adult: boolean;
|
|
32
|
+
/** `width * height` may not exceed this. */
|
|
33
|
+
readonly max_pixels: number;
|
|
34
|
+
readonly default_width: number;
|
|
35
|
+
readonly default_height: number;
|
|
36
|
+
readonly default_steps: number;
|
|
37
|
+
readonly max_steps: number;
|
|
38
|
+
/** False on models that ignore `negative_prompt` entirely, such as FLUX. */
|
|
39
|
+
readonly supports_negative_prompt: boolean;
|
|
40
|
+
/** Millionths of a USD per megapixel, rounded up. Zero on local models. */
|
|
41
|
+
readonly cost_per_megapixel_microusd: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One generation.
|
|
45
|
+
*
|
|
46
|
+
* Both routes that answer with one - `POST /image_generations` and
|
|
47
|
+
* `GET /image_generations/:id` - answer the same shape, so `result_url` is
|
|
48
|
+
* always PRESENT and simply `null` until the run completes.
|
|
49
|
+
*/
|
|
50
|
+
export interface ImageGeneration extends ToolRecord {
|
|
51
|
+
readonly model_key: string;
|
|
52
|
+
readonly provider: ImageProvider;
|
|
53
|
+
readonly prompt: string;
|
|
54
|
+
readonly negative_prompt: string | null;
|
|
55
|
+
readonly width: number;
|
|
56
|
+
readonly height: number;
|
|
57
|
+
readonly steps: number;
|
|
58
|
+
/**
|
|
59
|
+
* The seed the image was made with. Null only while the run is still
|
|
60
|
+
* pending: a caller that sent none gets the one the server picked, which is
|
|
61
|
+
* what makes the image reproducible.
|
|
62
|
+
*/
|
|
63
|
+
readonly seed: number | null;
|
|
64
|
+
readonly guidance: string | null;
|
|
65
|
+
/** What this run costs, in millionths of a USD. Zero on local models. */
|
|
66
|
+
readonly cost_microusd: number;
|
|
67
|
+
/**
|
|
68
|
+
* Signed URL of the PNG, or `null`. `null` covers three different
|
|
69
|
+
* situations - the run has not finished, it failed, or the 24-hour sweep
|
|
70
|
+
* took the attachment - which is why {@link ImageGenerationNamespace.resultUrl}
|
|
71
|
+
* exists rather than a bare read of this field.
|
|
72
|
+
*/
|
|
73
|
+
readonly result_url: string | null;
|
|
74
|
+
}
|
|
75
|
+
/** What `POST /image_generations` answers with. */
|
|
76
|
+
export type ImageGenerationCreated = ImageGeneration & ToolJobHandle;
|
|
77
|
+
/** Arguments for starting a run. */
|
|
78
|
+
export interface CreateImageGenerationInput extends ToolCaptcha {
|
|
79
|
+
/** What to draw. Cap: 2000 characters. */
|
|
80
|
+
readonly prompt: string;
|
|
81
|
+
/** Defaults to the server's own default model when omitted. */
|
|
82
|
+
readonly model?: string;
|
|
83
|
+
/** Ignored by models whose `supports_negative_prompt` is false. */
|
|
84
|
+
readonly negativePrompt?: string;
|
|
85
|
+
/** Must be a multiple of 8, at least 256. Defaults to the model's own. */
|
|
86
|
+
readonly width?: number;
|
|
87
|
+
/** Must be a multiple of 8, at least 256. Defaults to the model's own. */
|
|
88
|
+
readonly height?: number;
|
|
89
|
+
readonly steps?: number;
|
|
90
|
+
/** Pass the seed of an earlier run to reproduce its image. */
|
|
91
|
+
readonly seed?: number;
|
|
92
|
+
readonly guidance?: number;
|
|
93
|
+
}
|
|
94
|
+
/** The `imageGeneration` tool, reachable as `oms.tools.imageGeneration`. */
|
|
95
|
+
export declare class ImageGenerationNamespace extends Resource {
|
|
96
|
+
private readonly jobs;
|
|
97
|
+
/**
|
|
98
|
+
* `GET /image_generations/models` - the models THIS caller may use.
|
|
99
|
+
*
|
|
100
|
+
* The list is already filtered by session and by account flags, so it is
|
|
101
|
+
* safe to render straight into a picker: everything in it is something
|
|
102
|
+
* {@link create} would accept.
|
|
103
|
+
*/
|
|
104
|
+
models(options?: RequestOptions): Promise<ImageModel[]>;
|
|
105
|
+
/**
|
|
106
|
+
* `POST /image_generations` - enqueues a run and returns straight away.
|
|
107
|
+
*
|
|
108
|
+
* Every optional field is omitted from the body when the caller did not set
|
|
109
|
+
* it, so the server applies the chosen model's own defaults rather than the
|
|
110
|
+
* SDK guessing at them.
|
|
111
|
+
*
|
|
112
|
+
* NOT retried by default: replaying this `POST` after a 502 starts a second
|
|
113
|
+
* run, and on a paid model bills for it. Pass `retry: {}` to opt back in.
|
|
114
|
+
*
|
|
115
|
+
* @throws {OmsApiError} 400 for an unknown model, a blank prompt, or
|
|
116
|
+
* dimensions outside the model's limits; 403 for a model this caller may
|
|
117
|
+
* not use; 429 once either daily quota is spent.
|
|
118
|
+
* @throws {OmsAuthError} 401 when anonymous and the captcha is missing or bad.
|
|
119
|
+
*/
|
|
120
|
+
create(input: CreateImageGenerationInput, options?: RequestOptions): Promise<ImageGenerationCreated>;
|
|
121
|
+
/**
|
|
122
|
+
* `GET /image_generations/:id` - one poll.
|
|
123
|
+
*
|
|
124
|
+
* @throws {OmsApiError} 404 once the 24-hour retention sweep has taken it.
|
|
125
|
+
* @throws {OmsAuthError} 401 when the run belongs to someone else, which
|
|
126
|
+
* includes an anonymous run being read from a different address.
|
|
127
|
+
*/
|
|
128
|
+
get(id: Id, options?: RequestOptions): Promise<ImageGeneration>;
|
|
129
|
+
/**
|
|
130
|
+
* Creates a run and waits for it, through `oms.jobs.wait`.
|
|
131
|
+
*
|
|
132
|
+
* Resolves with a `"failed"` row rather than throwing when the work failed.
|
|
133
|
+
* Pass `waitTimeoutMs` (or a `signal`) to bound the wait; there is no default
|
|
134
|
+
* deadline.
|
|
135
|
+
*
|
|
136
|
+
* @throws {OmsTimeoutError} `code: "timeout"` when `waitTimeoutMs` elapses,
|
|
137
|
+
* `code: "aborted"` when the signal fires. Neither cancels the run: pick it
|
|
138
|
+
* up later with {@link get}.
|
|
139
|
+
*/
|
|
140
|
+
run(input: CreateImageGenerationInput, options?: ToolRunOptions): Promise<ImageGeneration>;
|
|
141
|
+
/**
|
|
142
|
+
* Downloads the PNG of a finished run.
|
|
143
|
+
*
|
|
144
|
+
* @throws {OmsError} `conflict` when the run has not finished,
|
|
145
|
+
* `invalid_request` when it failed, `not_found` when the artefact is gone.
|
|
146
|
+
*/
|
|
147
|
+
download(id: Id, options?: RequestOptions): Promise<Blob>;
|
|
148
|
+
/**
|
|
149
|
+
* The signed URL of a finished run's image, from a row you already hold.
|
|
150
|
+
*
|
|
151
|
+
* It is a credential: anyone holding it can read the image.
|
|
152
|
+
*
|
|
153
|
+
* @throws {OmsError} explaining which of the three reasons there is no URL.
|
|
154
|
+
*/
|
|
155
|
+
resultUrl(record: ImageGeneration): string;
|
|
156
|
+
}
|
|
@@ -37,6 +37,7 @@ import { type JobsNamespace } from "../jobs";
|
|
|
37
37
|
import { BackgroundRemovalNamespace } from "./backgroundRemoval";
|
|
38
38
|
import { CaptionsNamespace } from "./captions";
|
|
39
39
|
import { DownloaderNamespace } from "./downloader";
|
|
40
|
+
import { ImageGenerationNamespace } from "./imageGeneration";
|
|
40
41
|
import { JumpstyleNamespace } from "./jumpstyle";
|
|
41
42
|
import { TranscriptionNamespace } from "./transcription";
|
|
42
43
|
import { UpscaleNamespace } from "./upscale";
|
|
@@ -45,6 +46,7 @@ import { VocalSeparationNamespace } from "./vocalSeparation";
|
|
|
45
46
|
export * from "./backgroundRemoval";
|
|
46
47
|
export * from "./captions";
|
|
47
48
|
export * from "./downloader";
|
|
49
|
+
export * from "./imageGeneration";
|
|
48
50
|
export * from "./jumpstyle";
|
|
49
51
|
export * from "./transcription";
|
|
50
52
|
export * from "./upscale";
|
|
@@ -247,6 +249,8 @@ export declare class ToolsNamespace extends Resource {
|
|
|
247
249
|
readonly backgroundRemoval: BackgroundRemovalNamespace;
|
|
248
250
|
/** Enlarges an image without the mush. */
|
|
249
251
|
readonly upscale: UpscaleNamespace;
|
|
252
|
+
/** A prompt in, a PNG out. Runs on the server or at a paid provider. */
|
|
253
|
+
readonly imageGeneration: ImageGenerationNamespace;
|
|
250
254
|
/** Speech to text, with SRT and VTT output. */
|
|
251
255
|
readonly transcription: TranscriptionNamespace;
|
|
252
256
|
/** Splits a track into vocals and instrumental. */
|
package/package.json
CHANGED