(dedicated.image)
- generate - Image generations
Given a description, the model generates image(s).
import os
from friendli import SyncFriendli
with SyncFriendli(
token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
res = friendli.dedicated.image.generate(
model="(endpoint-id)",
num_inference_steps=10,
prompt="An orange Lamborghini driving down a hill road at night with a beautiful ocean view in the background.",
response_format="url",
)
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
model |
str | ✔️ | ID of target endpoint. If you want to send request to specific adapter, use the format "YOUR_ENDPOINT_ID:YOUR_ADAPTER_ROUTE". Otherwise, you can just use "YOUR_ENDPOINT_ID" alone. | (endpoint-id) |
num_inference_steps |
int | ✔️ | The number of inference steps to use during image generation. Supported range: [1, 50]. | |
prompt |
str | ✔️ | A text description of the desired image(s). | |
x_friendli_team |
OptionalNullable[str] | ➖ | ID of team to run requests as (optional parameter). | |
guidance_scale |
OptionalNullable[float] | ➖ | Adjusts the alignment of the generated image with the input prompt. Higher values (e.g., 8-10) make the output more faithful to the prompt, while lower values (e.g., 1-5) encourage more creative freedom. This parameter may be irrelevant for certain models, such as FLUX.Schnell. |
|
response_format |
OptionalNullable[models.DedicatedImageGenerationBodyResponseFormat] | ➖ | The format in which the generated image(s) will be returned. One of url(default), raw, png, jpeg, and jpg. |
|
seed |
OptionalNullable[int] | ➖ | The seed to use for image generation. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.DedicatedImageGenerateSuccess
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |