@ai-sdk/prodia 0.0.0-01d6317c-20260129172110

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 ADDED
@@ -0,0 +1,75 @@
1
+ # @ai-sdk/prodia
2
+
3
+ ## 0.0.0-01d6317c-20260129172110
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ac4b7cb]
8
+ - @ai-sdk/provider-utils@0.0.0-01d6317c-20260129172110
9
+ - @ai-sdk/provider@0.0.0-01d6317c-20260129172110
10
+
11
+ ## 1.0.8
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [462ad00]
16
+ - @ai-sdk/provider-utils@4.0.10
17
+
18
+ ## 1.0.7
19
+
20
+ ### Patch Changes
21
+
22
+ - 4de5a1d: chore: excluded tests from src folder in npm package
23
+ - Updated dependencies [4de5a1d]
24
+ - @ai-sdk/provider@3.0.5
25
+ - @ai-sdk/provider-utils@4.0.9
26
+
27
+ ## 1.0.6
28
+
29
+ ### Patch Changes
30
+
31
+ - 8dc54db: chore: add src folders to package bundle
32
+
33
+ ## 1.0.5
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [5c090e7]
38
+ - @ai-sdk/provider@3.0.4
39
+ - @ai-sdk/provider-utils@4.0.8
40
+
41
+ ## 1.0.4
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [46f46e4]
46
+ - @ai-sdk/provider-utils@4.0.7
47
+
48
+ ## 1.0.3
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [1b11dcb]
53
+ - @ai-sdk/provider-utils@4.0.6
54
+ - @ai-sdk/provider@3.0.3
55
+
56
+ ## 1.0.2
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependencies [34d1c8a]
61
+ - @ai-sdk/provider-utils@4.0.5
62
+
63
+ ## 1.0.1
64
+
65
+ ### Patch Changes
66
+
67
+ - Updated dependencies [d937c8f]
68
+ - @ai-sdk/provider@3.0.2
69
+ - @ai-sdk/provider-utils@4.0.4
70
+
71
+ ## 1.0.0
72
+
73
+ ### Major Changes
74
+
75
+ - bb3d30e: feat(provider/prodia): Create Prodia provider package
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Vercel, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # AI SDK - Prodia Provider
2
+
3
+ The **[Prodia provider](https://ai-sdk.dev/providers/ai-sdk-providers/prodia)** for the [AI SDK](https://ai-sdk.dev/docs) adds image model support for the [Prodia API](https://docs.prodia.com/).
4
+
5
+ ## Setup
6
+
7
+ The Prodia provider is available in the `@ai-sdk/prodia` module. You can install it with
8
+
9
+ ```bash
10
+ pnpm add @ai-sdk/prodia
11
+ ```
12
+
13
+ ## Provider Instance
14
+
15
+ You can import the default provider instance `prodia` from `@ai-sdk/prodia`:
16
+
17
+ ```ts
18
+ import { prodia } from '@ai-sdk/prodia';
19
+ ```
20
+
21
+ ## Image Generation Example
22
+
23
+ ```ts
24
+ import fs from 'node:fs';
25
+ import { prodia } from '@ai-sdk/prodia';
26
+ import { generateImage } from 'ai';
27
+
28
+ const { image } = await generateImage({
29
+ model: prodia.image('inference.flux-fast.schnell.txt2img.v2'),
30
+ prompt: 'A cat wearing a intricate robe',
31
+ });
32
+
33
+ const filename = `image-${Date.now()}.png`;
34
+ fs.writeFileSync(filename, image.uint8Array);
35
+ console.log(`Image saved to ${filename}`);
36
+ ```
37
+
38
+ ## Additional Options
39
+
40
+ If you want to pass additional inputs to the model besides the prompt, use the `providerOptions.prodia` property:
41
+
42
+ ```ts
43
+ import { prodia, type ProdiaImageProviderOptions } from '@ai-sdk/prodia';
44
+ import { generateImage } from 'ai';
45
+
46
+ const { image } = await generateImage({
47
+ model: prodia.image('inference.flux-fast.schnell.txt2img.v2'),
48
+ prompt: 'A cat wearing an intricate robe',
49
+ providerOptions: {
50
+ prodia: {
51
+ width: 1024,
52
+ height: 1024,
53
+ steps: 4,
54
+ } satisfies ProdiaImageProviderOptions,
55
+ },
56
+ });
57
+ ```
58
+
59
+ ## Configuring Base URL
60
+
61
+ By default, the provider uses `https://inference.prodia.com/v2`. You can override this if needed:
62
+
63
+ ```ts
64
+ import { createProdia } from '@ai-sdk/prodia';
65
+
66
+ const prodia = createProdia({
67
+ baseURL: 'https://inference.prodia.com/v2',
68
+ apiKey: process.env.PRODIA_TOKEN,
69
+ });
70
+ ```
71
+
72
+ ## Documentation
73
+
74
+ See the [Prodia provider](https://ai-sdk.dev/providers/ai-sdk-providers/prodia) for more information.
@@ -0,0 +1,58 @@
1
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
+ import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { ProviderV3, ImageModelV3 } from '@ai-sdk/provider';
4
+
5
+ /**
6
+ * Prodia job types for image generation.
7
+ */
8
+ type ProdiaImageModelId = 'inference.flux-fast.schnell.txt2img.v2' | 'inference.flux.schnell.txt2img.v2' | (string & {});
9
+
10
+ declare const prodiaImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
11
+ steps?: number | undefined;
12
+ width?: number | undefined;
13
+ height?: number | undefined;
14
+ stylePreset?: "3d-model" | "analog-film" | "anime" | "cinematic" | "comic-book" | "digital-art" | "enhance" | "fantasy-art" | "isometric" | "line-art" | "low-poly" | "neon-punk" | "origami" | "photographic" | "pixel-art" | "texture" | "craft-clay" | undefined;
15
+ loras?: string[] | undefined;
16
+ progressive?: boolean | undefined;
17
+ }>;
18
+ type ProdiaImageProviderOptions = InferSchema<typeof prodiaImageProviderOptionsSchema>;
19
+
20
+ interface ProdiaProviderSettings {
21
+ /**
22
+ * Prodia API key. Default value is taken from the `PRODIA_TOKEN` environment variable.
23
+ */
24
+ apiKey?: string;
25
+ /**
26
+ * Base URL for the API calls. Defaults to `https://inference.prodia.com/v2`.
27
+ */
28
+ baseURL?: string;
29
+ /**
30
+ * Custom headers to include in the requests.
31
+ */
32
+ headers?: Record<string, string>;
33
+ /**
34
+ * Custom fetch implementation. You can use it as a middleware to intercept
35
+ * requests, or to provide a custom fetch implementation for e.g. testing.
36
+ */
37
+ fetch?: FetchFunction;
38
+ }
39
+ interface ProdiaProvider extends ProviderV3 {
40
+ /**
41
+ * Creates a model for image generation.
42
+ */
43
+ image(modelId: ProdiaImageModelId): ImageModelV3;
44
+ /**
45
+ * Creates a model for image generation.
46
+ */
47
+ imageModel(modelId: ProdiaImageModelId): ImageModelV3;
48
+ /**
49
+ * @deprecated Use `embeddingModel` instead.
50
+ */
51
+ textEmbeddingModel(modelId: string): never;
52
+ }
53
+ declare function createProdia(options?: ProdiaProviderSettings): ProdiaProvider;
54
+ declare const prodia: ProdiaProvider;
55
+
56
+ declare const VERSION: string;
57
+
58
+ export { type ProdiaImageModelId, type ProdiaImageProviderOptions, type ProdiaProvider, type ProdiaProviderSettings, VERSION, createProdia, prodia };
@@ -0,0 +1,58 @@
1
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
+ import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { ProviderV3, ImageModelV3 } from '@ai-sdk/provider';
4
+
5
+ /**
6
+ * Prodia job types for image generation.
7
+ */
8
+ type ProdiaImageModelId = 'inference.flux-fast.schnell.txt2img.v2' | 'inference.flux.schnell.txt2img.v2' | (string & {});
9
+
10
+ declare const prodiaImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
11
+ steps?: number | undefined;
12
+ width?: number | undefined;
13
+ height?: number | undefined;
14
+ stylePreset?: "3d-model" | "analog-film" | "anime" | "cinematic" | "comic-book" | "digital-art" | "enhance" | "fantasy-art" | "isometric" | "line-art" | "low-poly" | "neon-punk" | "origami" | "photographic" | "pixel-art" | "texture" | "craft-clay" | undefined;
15
+ loras?: string[] | undefined;
16
+ progressive?: boolean | undefined;
17
+ }>;
18
+ type ProdiaImageProviderOptions = InferSchema<typeof prodiaImageProviderOptionsSchema>;
19
+
20
+ interface ProdiaProviderSettings {
21
+ /**
22
+ * Prodia API key. Default value is taken from the `PRODIA_TOKEN` environment variable.
23
+ */
24
+ apiKey?: string;
25
+ /**
26
+ * Base URL for the API calls. Defaults to `https://inference.prodia.com/v2`.
27
+ */
28
+ baseURL?: string;
29
+ /**
30
+ * Custom headers to include in the requests.
31
+ */
32
+ headers?: Record<string, string>;
33
+ /**
34
+ * Custom fetch implementation. You can use it as a middleware to intercept
35
+ * requests, or to provide a custom fetch implementation for e.g. testing.
36
+ */
37
+ fetch?: FetchFunction;
38
+ }
39
+ interface ProdiaProvider extends ProviderV3 {
40
+ /**
41
+ * Creates a model for image generation.
42
+ */
43
+ image(modelId: ProdiaImageModelId): ImageModelV3;
44
+ /**
45
+ * Creates a model for image generation.
46
+ */
47
+ imageModel(modelId: ProdiaImageModelId): ImageModelV3;
48
+ /**
49
+ * @deprecated Use `embeddingModel` instead.
50
+ */
51
+ textEmbeddingModel(modelId: string): never;
52
+ }
53
+ declare function createProdia(options?: ProdiaProviderSettings): ProdiaProvider;
54
+ declare const prodia: ProdiaProvider;
55
+
56
+ declare const VERSION: string;
57
+
58
+ export { type ProdiaImageModelId, type ProdiaImageProviderOptions, type ProdiaProvider, type ProdiaProviderSettings, VERSION, createProdia, prodia };