Text to image
A blank canvas and a sentence become a finished image without a human ever opening an editor. This endpoint takes a text prompt and returns a generated image, built for products that need visuals on demand rather than pulled from a stock library.
Run it online
Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.
What problem this actually solves
Plenty of applications need an image that doesn't exist yet and never will exist as stock: a hero illustration matching a specific brand mood, a placeholder that reflects a user's own input, an icon for a category nobody photographed. Sourcing or commissioning that image the traditional way takes days; describing it in a sentence and generating it takes seconds, which changes what's even worth building into a product.
What you send and what comes back
You submit a text prompt describing the image you want, along with optional parameters for size, style and number of variations, and the task returns one or more generated images once processing finishes. Because the endpoint is asynchronous, you get a task_id immediately and the actual image arrives later by webhook or a signed link, which keeps your request path fast even though generation itself takes real compute time.
Why prompt wording changes the result
Text-to-image generation works by mapping language into a visual space the model has learned from enormous amounts of image-text pairs, which means specificity matters: a vague prompt produces a generic result, while one that names subject, style, lighting and composition produces something closer to intent. This is the same reason two people typing different words for the same idea in their heads get visibly different pictures back — the model has no access to what's inside your head, only to what you actually typed.
Fitting generation into a pipeline
Because results arrive asynchronously, this endpoint composes naturally with the rest of an image pipeline: generate a base image, then run it through a resize, background removal, or watermark step before it's ever shown to a user. Teams building content tools, mockup generators or dynamic marketing assets tend to call this endpoint as the first stage, with everything downstream operating on whatever comes back.
What to expect, honestly
Generated images are original compositions inferred from your prompt, not retrieved from a database of existing photos, so results vary between runs even with an identical prompt, and highly specific requests, exact text rendering or precise counts of objects, are the areas where any generation model is still weakest. Treat the first result as a strong starting point rather than a guaranteed exact match, and iterate on the prompt the way you would iterate on a brief with a designer.
What you can do with it
Dynamic blog and article headers
A publishing platform generates a unique header image from each article's title and summary instead of licensing stock photography for every post.
User-personalized visuals
An app lets users describe a scene in their own words and generates a matching image for a greeting card, avatar background or gift design.
Placeholder and concept art
A product team generates quick concept visuals from a written brief to test a design direction before commissioning final artwork.
On-brand illustration at scale
A marketing team generates a consistent set of illustrations for a campaign by reusing a style-locked prompt template across many subjects.
FAQ
How do I generate an image from text with the api?
Send a POST to /image/generate with your text prompt and any size or style parameters; you get a task_id back and the image arrives by webhook or a signed link.
Can I control the image size and style?
Yes, you set target size and optional style parameters in the request, and the generated image is returned matching those settings.
Will the same prompt always produce the same image?
No. Generation is not deterministic, so identical prompts produce different but related images on each run, which is expected behavior, not a bug.
Is there a free trial for the text to image api?
There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.
How much does generating one image cost?
$0.002 per request plus $0.0065 per image, billed only for tasks that complete successfully.
Can it render exact text or logos inside the image?
Precise text rendering and exact logo reproduction are the weakest areas for any generation model; treat those results as approximate rather than production-ready.
What happens if generation fails?
The task retries automatically up to three times; if it still fails, you receive a clear error and are never charged for the failed attempt.
Can I generate multiple images from one prompt in bulk?
Submit multiple asynchronous requests in parallel for volume, or request several variations in a single call where supported, and collect each result as its webhook fires.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/image/generate \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"image":"https://ejemplo.com/imagen.jpg"}'const res = await fetch("https://api.kit.forhosting.com/image/generate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"image": "https://ejemplo.com/imagen.jpg"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/image/generate",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"image": "https://ejemplo.com/imagen.jpg"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/image/generate", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"image":"https://ejemplo.com/imagen.jpg"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"image":"https://ejemplo.com/imagen.jpg"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/image/generate", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"image": "https://ejemplo.com/imagen.jpg"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "image.generate",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 15 |
max_megapixels | 12 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
422 | task_failed | The task failed after 3 retries. You are never charged for it. |