Plus plan

Text to Image

Create a brand-new picture from a text description
POST
/v1/ai/generation/generate

About this tool

You describe the picture you want in words, and the tool creates it for you. You can choose the shape (square, wide, tall), the size, the style such as watercolour or photo, and things to leave out. You can also add one picture as a starting point, and the tool will create something based on it. It uses AI (a computer program that creates images), so results differ each time.
For example, you type a cosy coffee shop on a rainy day in watercolour style, and you get a new picture that matches.

How to use it

  1. Choose this tool.
  2. Type your description in Describe the picture.
  3. Optionally add one picture as a starting point, and choose the shape, size and style.
  4. Choose how many results you want and the format to save as.
  5. Press Generate, then download the picture you like.

What you get back

You get one or more new pictures that you can look at, download and save. If you do not like them, change your description and press Generate again.
TEST IT LIVE

Try Text to Image in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Plus
Method
POST
Endpoint
/v1/ai/generation/generate
Tool ID
ai.generation.generate
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/generation/generate" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'on_unsupported=error' \
  -F 'instructions=example' \
  -F 'n=1'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.generation.generate({
    "on_unsupported": "error",
    "instructions": "example",
    "n": 1
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->generation()->generate([
    'on_unsupported' => 'error',
    'instructions' => 'example',
    'n' => 1,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Generate images from a prompt; also image-to-image when a reference image is supplied. Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.generate).

Classification: ai. Deterministic stages: upload content sniffing, input image normalisation (Sharp), generated image validation and re-encoding (Sharp), signed-URL output.

Text to Image works from text and settings, so no file is needed. The required inputs are instructions.

Not on the Free plan: Text to Image is available on the Plus plan and above. Free accounts can upgrade any time to use it. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/generation/generate with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.