Plus plan

Generate Image

Create a new picture from your description
POST
/v1/ai/generate

About this tool

You describe the picture you want and the AI draws it. You can choose its shape, its size, the picture format, the style and how many pictures to make, and you can list things to leave out. You can also add a picture to start from. The AI can make mistakes or surprise you, so try again if needed.
For example, you type a red fox in a snowy forest at dawn and get a few pictures to choose from.

How to use it

  1. Choose this tool.
  2. Describe the picture you want in the box.
  3. Choose the shape and size, the format, and how many pictures you want.
  4. Optionally add a style, things to leave out, or a picture to start from.
  5. Press Generate, then download the pictures you like.

What you get back

You get one or more new pictures. You can download them.
TEST IT LIVE

Try Generate 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/generate
Tool ID
ai.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/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.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()->generate([
    'on_unsupported' => 'error',
    'instructions' => 'example',
    'n' => 1,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Generic prompt-to-image (or image-to-image) generation with automatic or explicit model. Readiness: unbenchmarked (see GET /v1/ai/capabilities/core.generate).

Classification: ai. Deterministic stages: generated image validation and re-encoding (Sharp).

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

Not on the Free plan: Generate 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/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.