Images
Generate images from text and edit existing images with a multipart upload. Both endpoints mirror the OpenAI Images API surface — your existing SDK code works against our base URL.
Generations
/v1/images/generationsauth · sk-echoText-to-image. Returns a JSON envelope with one or more signed asset URLs.
from openai import OpenAI
client = OpenAI(
base_url="https://api.echotokens.me/v1",
api_key="sk-echo-...",
)
response = client.images.generate(
model="nano-banana-2",
prompt="A pelican wearing a tweed jacket, oil painting, dramatic lighting.",
n=1,
aspect_ratio="1:1",
)
print(response.data[0].url)
print(f"Cost: {response.cost_usd_cents} cents")Parameters
- parameter
modeltypestringrequiredrequiredImage model id. See the catalog below + the live list on /pricing. - parameter
prompttypestringrequiredrequiredText description of the image you want. - parameter
ntypeintegerrequiredoptionalNumber of images to return.default:1 - parameter
image_urltypestring (URL)requiredoptionalSource image URL to use for editing / variation (where the model supports it). - parameter
aspect_ratiotypestringrequiredoptional1:1, 16:9, 9:16, 4:3, 3:4. Pass either aspect_ratio OR size — not both.default:1:1 - parameter
sizetypestringrequiredoptionalPixel dimensions, e.g. 1024x1024. - parameter
resolutiontypestringrequiredoptional1K, 2K, or 4K — supported by some models. - parameter
qualitytypestringrequiredoptionallow | medium | high — supported by some models. - parameter
negative_prompttypestringrequiredoptionalText describing what to avoid in the image. - parameter
output_formattypestringrequiredoptionalpng | jpeg | webp. Controls the format of the returned signed URL's payload.default:png
Response
{
"created": 1779537000,
"data": [
{
"url": "https://api.echotokens.me/v1/assets/eyJ1Ij..."
}
],
"cost_usd_cents": 4
}Image edits
/v1/images/editsauth · sk-echoImage-in, image-out — multipart upload. Use this when you want to modify an existing image rather than generate from text alone.
from openai import OpenAI
client = OpenAI(
base_url="https://api.echotokens.me/v1",
api_key="sk-echo-...",
)
with open("input.png", "rb") as image:
result = client.images.edit(
model="nano-banana-2",
image=image,
prompt="Replace the sky with a starlit night.",
n=1,
)
print(result.data[0].url)Parameters
- parameter
modeltypestringrequiredrequiredImage model id supporting edits. - parameter
prompttypestringrequiredrequiredEdit instructions in plain English. - parameter
imagetypefile (multipart)requiredrequiredSource image. PNG, JPEG, or WebP. - parameter
ntypeintegerrequiredoptionalNumber of variations.default:1 - parameter
sizetypestringrequiredoptionalOutput dimensions (model-dependent). - parameter
qualitytypestringrequiredoptionallow | medium | high (model-dependent). - parameter
output_formattypestringrequiredoptionalpng | jpeg | webp.default:png
The edits endpoint is OpenAI-compatible — clients like OpenWebUI and LibreChat work out of the box. The OpenAI SDK's mask parameter (transparent pixels are regenerated) is passed through verbatim where the model supports it.
Picking a model
The catalog below auto-syncs from the upstream every six hours, so it always reflects what's available right now. The pricing page is the canonical source for per-model rates.
catalog auto-syncs from the upstream every 6h · canonical pricing at /pricing
nano-banana-2 (Google) is a solid default — start with that if you're not sure. Switch the model string to try a different provider; the request shape stays identical.
Image generations bill per output. Watch the cost_usd_cents field while you iterate — the usage page shows per-request cost so you can ballpark a batch run before launching it.
Generate or edit images in the portal — no code required. Useful for iterating on a prompt before wiring it into your app.