@fias/create-fias-plugin 1.15.0 → 1.16.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/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- fias-sdk-guide-version: 2.
|
|
1
|
+
<!-- fias-sdk-guide-version: 2.24.0 -->
|
|
2
2
|
|
|
3
3
|
# FIAS Plugin Development Guide
|
|
4
4
|
|
|
@@ -551,6 +551,8 @@ function ModelPicker({ value, onChange }: { value: string; onChange: (id: string
|
|
|
551
551
|
|
|
552
552
|
Generate images using platform image models. Images are saved to the user's Fias file system and a display URL is returned.
|
|
553
553
|
|
|
554
|
+
Most images take 10–60 seconds; high quality at large sizes (the GPT Image models especially) can take several minutes, so `generate` waits up to 320 seconds before rejecting. Show progress for the whole wait (`estimatedDurationMs` from `useImageEntities` sizes it), and do not race `generate` against a shorter timeout of your own — the platform is still rendering, and bills, an image your plugin stopped waiting for.
|
|
555
|
+
|
|
554
556
|
#### Choosing an image model
|
|
555
557
|
|
|
556
558
|
The `entityId` parameter accepts three forms. **Prefer the selector forms** (`platformRecommended` / `providerRecommended`) over hardcoded entity IDs: the platform's recommendations evolve, models get retired, and a selector lets your plugin pick up the current best automatically without a code edit. Hardcoded IDs are still supported for back-compat and for cases where you want a specific model — but if the platform retires that exact entity, your plugin breaks unless the platform has registered a successor.
|
|
@@ -583,7 +585,7 @@ generate({
|
|
|
583
585
|
|
|
584
586
|
Mode values: `'text-to-image'` (baseline), `'image-to-image'` (requires `referenceImage`), `'vector'` (SVG output). Style values: `'illustration'` (stylized / digital-art) or `'photoreal'`.
|
|
585
587
|
|
|
586
|
-
**Several reference images, and output resolution.** A model whose `maxReferenceImages` (from `useImageEntities`) is more than one takes them together in `referenceImages` — Nano Banana 2 (`ent_modeldef_nano_banana_2`) takes up to 14. There is no role per image: the model reads them in order, so the prompt says which is which. `resolution` picks one of the model's `supportedResolutions`; higher costs more (`creditsPerImageByResolution`):
|
|
588
|
+
**Several reference images, and output resolution.** A model whose `maxReferenceImages` (from `useImageEntities`) is more than one takes them together in `referenceImages` — Nano Banana 2 (`ent_modeldef_nano_banana_2`) takes up to 14, the GPT Image models up to 16. There is no role per image: the model reads them in order, so the prompt says which is which. `resolution` picks one of the model's `supportedResolutions`; higher costs more (`creditsPerImageByResolution`):
|
|
587
589
|
|
|
588
590
|
```tsx
|
|
589
591
|
generate({
|
|
@@ -670,13 +672,14 @@ const { entities, isLoading } = useImageEntities({
|
|
|
670
672
|
// entities[i]: { entityId, displayName, provider, modes, supportedSizes,
|
|
671
673
|
// supportsReferenceImage, maxReferenceImages,
|
|
672
674
|
// supportedResolutions, defaultResolution, isPlatformRecommended,
|
|
673
|
-
//
|
|
675
|
+
// pricedBy, pixelSizes, defaultQuality,
|
|
676
|
+
// creditsPerImage, creditsPerImageByResolution, creditsPerImageByTier,
|
|
674
677
|
// estimatedDurationMs, company, strengths, providerParams, ... }
|
|
675
678
|
```
|
|
676
679
|
|
|
677
680
|
Each entry is scrubbed — only fields a UI legitimately needs (no provider model strings, no endpoints, no execution config).
|
|
678
681
|
|
|
679
|
-
`creditsPerImage` is what one image costs the user in credits, markup already included — it matches what the ledger deducts, so it is the figure to show. For a model priced by resolution it is the price at `defaultResolution`, and `creditsPerImageByResolution` has each resolution's; Nano Banana 2 also bills reference images and thinking as tokens on top (a fraction of a credit to a few credits). `estimatedDurationMs` sizes a progress indicator; `company` and `strengths` are model-info copy. All optional: absent means the model has nothing to declare, not that the data is missing.
|
|
682
|
+
`creditsPerImage` is what one image costs the user in credits, markup already included — it matches what the ledger deducts, so it is the figure to show. For a model priced by resolution it is the price at `defaultResolution`, and `creditsPerImageByResolution` has each resolution's; Nano Banana 2 also bills reference images and thinking as tokens on top (a fraction of a credit to a few credits). The GPT Image models are `pricedBy: 'quality-and-size'`: `creditsPerImage` is the price at `defaultQuality`, the first `supportedSizes` entry and `defaultResolution`, and `creditsPerImageByTier` has every other, keyed `'<quality>@<WIDTHxHEIGHT>'` — find the pixel size in `pixelSizes` (`'16:9/2K'` → `'2048x1152'`), so a request's price is `creditsPerImageByTier[quality + '@' + pixelSizes[size + '/' + resolution]]`. Their prompt and reference images are billed as tokens on top. `estimatedDurationMs` sizes a progress indicator; `company` and `strengths` are model-info copy. All optional: absent means the model has nothing to declare, not that the data is missing.
|
|
680
683
|
|
|
681
684
|
**Tunable engine parameters.** `providerParams` describes what a model exposes for tuning — enough to render a settings panel without hardcoding a thing:
|
|
682
685
|
|
|
@@ -688,7 +691,7 @@ const seed = entity.providerParams?.find((p) => p.key === 'seed');
|
|
|
688
691
|
await generate({ entityId, prompt, providerParams: { seed: 42 } });
|
|
689
692
|
```
|
|
690
693
|
|
|
691
|
-
Nano Banana 2 exposes `seed`, `temperature` (0–2) and `thinking_level` (`'minimal'` default, or `'high'` — the model plans the picture first: better at layouts and directions like "seen from above", slower, and its thinking tokens are billed).
|
|
694
|
+
Nano Banana 2 exposes `seed`, `temperature` (0–2) and `thinking_level` (`'minimal'` default, or `'high'` — the model plans the picture first: better at layouts and directions like "seen from above", slower, and its thinking tokens are billed). The GPT Image models expose `output_format` (`'png'` default, `'jpeg'`, `'webp'`) and `output_compression` (0–100, JPEG and WebP only); GPT Image 1.5 and the GPT Image 2.5 models also take `background` (`'auto'`, `'opaque'`, `'transparent'` — transparent needs PNG or WebP).
|
|
692
695
|
|
|
693
696
|
**The `category` trap.** A param carrying `category: 'quality'` or `'style'` does NOT belong in `providerParams` — send it on the matching top-level field. Providers read those two from the top level only, and an unrecognized `providerParams` key is dropped without an error, so the image generates at the model's default **and you are billed for it anyway**:
|
|
694
697
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- fias-sdk-guide-version: 2.
|
|
1
|
+
<!-- fias-sdk-guide-version: 2.24.0 -->
|
|
2
2
|
|
|
3
3
|
# FIAS Plugin Development Guide
|
|
4
4
|
|
|
@@ -551,6 +551,8 @@ function ModelPicker({ value, onChange }: { value: string; onChange: (id: string
|
|
|
551
551
|
|
|
552
552
|
Generate images using platform image models. Images are saved to the user's Fias file system and a display URL is returned.
|
|
553
553
|
|
|
554
|
+
Most images take 10–60 seconds; high quality at large sizes (the GPT Image models especially) can take several minutes, so `generate` waits up to 320 seconds before rejecting. Show progress for the whole wait (`estimatedDurationMs` from `useImageEntities` sizes it), and do not race `generate` against a shorter timeout of your own — the platform is still rendering, and bills, an image your plugin stopped waiting for.
|
|
555
|
+
|
|
554
556
|
#### Choosing an image model
|
|
555
557
|
|
|
556
558
|
The `entityId` parameter accepts three forms. **Prefer the selector forms** (`platformRecommended` / `providerRecommended`) over hardcoded entity IDs: the platform's recommendations evolve, models get retired, and a selector lets your plugin pick up the current best automatically without a code edit. Hardcoded IDs are still supported for back-compat and for cases where you want a specific model — but if the platform retires that exact entity, your plugin breaks unless the platform has registered a successor.
|
|
@@ -583,7 +585,7 @@ generate({
|
|
|
583
585
|
|
|
584
586
|
Mode values: `'text-to-image'` (baseline), `'image-to-image'` (requires `referenceImage`), `'vector'` (SVG output). Style values: `'illustration'` (stylized / digital-art) or `'photoreal'`.
|
|
585
587
|
|
|
586
|
-
**Several reference images, and output resolution.** A model whose `maxReferenceImages` (from `useImageEntities`) is more than one takes them together in `referenceImages` — Nano Banana 2 (`ent_modeldef_nano_banana_2`) takes up to 14. There is no role per image: the model reads them in order, so the prompt says which is which. `resolution` picks one of the model's `supportedResolutions`; higher costs more (`creditsPerImageByResolution`):
|
|
588
|
+
**Several reference images, and output resolution.** A model whose `maxReferenceImages` (from `useImageEntities`) is more than one takes them together in `referenceImages` — Nano Banana 2 (`ent_modeldef_nano_banana_2`) takes up to 14, the GPT Image models up to 16. There is no role per image: the model reads them in order, so the prompt says which is which. `resolution` picks one of the model's `supportedResolutions`; higher costs more (`creditsPerImageByResolution`):
|
|
587
589
|
|
|
588
590
|
```tsx
|
|
589
591
|
generate({
|
|
@@ -670,13 +672,14 @@ const { entities, isLoading } = useImageEntities({
|
|
|
670
672
|
// entities[i]: { entityId, displayName, provider, modes, supportedSizes,
|
|
671
673
|
// supportsReferenceImage, maxReferenceImages,
|
|
672
674
|
// supportedResolutions, defaultResolution, isPlatformRecommended,
|
|
673
|
-
//
|
|
675
|
+
// pricedBy, pixelSizes, defaultQuality,
|
|
676
|
+
// creditsPerImage, creditsPerImageByResolution, creditsPerImageByTier,
|
|
674
677
|
// estimatedDurationMs, company, strengths, providerParams, ... }
|
|
675
678
|
```
|
|
676
679
|
|
|
677
680
|
Each entry is scrubbed — only fields a UI legitimately needs (no provider model strings, no endpoints, no execution config).
|
|
678
681
|
|
|
679
|
-
`creditsPerImage` is what one image costs the user in credits, markup already included — it matches what the ledger deducts, so it is the figure to show. For a model priced by resolution it is the price at `defaultResolution`, and `creditsPerImageByResolution` has each resolution's; Nano Banana 2 also bills reference images and thinking as tokens on top (a fraction of a credit to a few credits). `estimatedDurationMs` sizes a progress indicator; `company` and `strengths` are model-info copy. All optional: absent means the model has nothing to declare, not that the data is missing.
|
|
682
|
+
`creditsPerImage` is what one image costs the user in credits, markup already included — it matches what the ledger deducts, so it is the figure to show. For a model priced by resolution it is the price at `defaultResolution`, and `creditsPerImageByResolution` has each resolution's; Nano Banana 2 also bills reference images and thinking as tokens on top (a fraction of a credit to a few credits). The GPT Image models are `pricedBy: 'quality-and-size'`: `creditsPerImage` is the price at `defaultQuality`, the first `supportedSizes` entry and `defaultResolution`, and `creditsPerImageByTier` has every other, keyed `'<quality>@<WIDTHxHEIGHT>'` — find the pixel size in `pixelSizes` (`'16:9/2K'` → `'2048x1152'`), so a request's price is `creditsPerImageByTier[quality + '@' + pixelSizes[size + '/' + resolution]]`. Their prompt and reference images are billed as tokens on top. `estimatedDurationMs` sizes a progress indicator; `company` and `strengths` are model-info copy. All optional: absent means the model has nothing to declare, not that the data is missing.
|
|
680
683
|
|
|
681
684
|
**Tunable engine parameters.** `providerParams` describes what a model exposes for tuning — enough to render a settings panel without hardcoding a thing:
|
|
682
685
|
|
|
@@ -688,7 +691,7 @@ const seed = entity.providerParams?.find((p) => p.key === 'seed');
|
|
|
688
691
|
await generate({ entityId, prompt, providerParams: { seed: 42 } });
|
|
689
692
|
```
|
|
690
693
|
|
|
691
|
-
Nano Banana 2 exposes `seed`, `temperature` (0–2) and `thinking_level` (`'minimal'` default, or `'high'` — the model plans the picture first: better at layouts and directions like "seen from above", slower, and its thinking tokens are billed).
|
|
694
|
+
Nano Banana 2 exposes `seed`, `temperature` (0–2) and `thinking_level` (`'minimal'` default, or `'high'` — the model plans the picture first: better at layouts and directions like "seen from above", slower, and its thinking tokens are billed). The GPT Image models expose `output_format` (`'png'` default, `'jpeg'`, `'webp'`) and `output_compression` (0–100, JPEG and WebP only); GPT Image 1.5 and the GPT Image 2.5 models also take `background` (`'auto'`, `'opaque'`, `'transparent'` — transparent needs PNG or WebP).
|
|
692
695
|
|
|
693
696
|
**The `category` trap.** A param carrying `category: 'quality'` or `'style'` does NOT belong in `providerParams` — send it on the matching top-level field. Providers read those two from the top level only, and an unrecognized `providerParams` key is dropped without an error, so the image generates at the model's default **and you are billed for it anyway**:
|
|
694
697
|
|