Random Seed
Use the seed parameter to control randomness in Segmind model output. Pass -1 for a random seed, or any positive integer for reproducible results.
The seed parameter controls the randomness of model outputs. Here is how it works across the Segmind platform:
Seed Behavior
| Seed Value | Behavior |
|---|---|
-1 | The system picks a seed at random. On v1 it tells you which one in the x-seed-value response header, so the run can be repeated later; on v2 it does not — see below. |
Any positive integer (e.g., 42, 12345) | Deterministic output. Using the same seed with identical parameters will produce the same result. |
| Omitted / not provided | Behaviour is model-dependent — most treat it as random. x-seed-value comes back as None, so you are not told what was used and the result cannot be reproduced. |
Important: Some model documentation pages may show a default seed value (e.g., 12345) in the API parameter list. This is a placeholder example, not the actual default used when the parameter is omitted. To guarantee random results every time, explicitly set seed: -1 in your request.
Random, but reproducible later
These two are not the same thing, and the difference only shows up once you want a result back:
- Omit the seed and the response reports no seed at all. The output is random and gone — nothing tells you how to get it again.
- Send
seed: -1and the output is equally random, but the seed that produced it comes back inx-seed-value. Store that alongside the result and you can reproduce it whenever you like.
Reusing a reported seed with the same prompt and parameters returns the same image:
# 1. random run — note the seed the gateway reports
curl -D - -o first.jpg -X POST "https://api.segmind.com/v1/fast-flux-schnell" \
-H "x-api-key: $SEGMIND_API_KEY" -H "Content-Type: application/json" \
-d '{"prompt":"a red apple on a wooden table","steps":4,"seed":-1}' \
| grep -i x-seed-value
# x-seed-value: 42873396
# 2. replay it
curl -o again.jpg -X POST "https://api.segmind.com/v1/fast-flux-schnell" \
-H "x-api-key: $SEGMIND_API_KEY" -H "Content-Type: application/json" \
-d '{"prompt":"a red apple on a wooden table","steps":4,"seed":42873396}'This round trip only works on v1. The v2 result payload has a seed field,
but it echoes what you sent rather than reporting what was used — send
seed: -1 and it comes back as "-1", which tells you nothing. Only the
x-seed-value header on a synchronous response resolves -1 to the seed the
model actually used.
So if you want a random generation you can reproduce later, either run it on v1, or choose the seed yourself and send it explicitly.
If you keep generations you might want to revisit — variations on a good result, a reproducible test set — store the seed with the output. It is the only thing that makes a generation repeatable, and it costs nothing to record.
When to Use
- For consistent, reproducible outputs: Provide a specific seed value (e.g.,
seed: 42). The same prompt + seed + parameters will produce the same output. - For varied results each time: Set
seed: -1to explicitly request random generation — and keep the reported seed if you might want the output back. - For A/B testing or debugging: Use a fixed seed to isolate the effect of other parameter changes.
This approach works across model APIs, model playground (UI), PixelFlow UI, and PixelFlow APIs.