DeepAI
Log In Sign Up

Text To Image - AI Image Generator API

Create an image from text prompt

Choose a style

The selected style is only available to PRO users. Please upgrade or try a different style
See what AI Art other users are creating!

This is an AI Image Generator. It creates an image from scratch from a text description.

Yes, this is the one you've been waiting for. Text-to-image uses AI to understand your words and convert them to a unique image each time. Like magic.

This can be used to generate AI art, or for general silliness.

Don't expect the quality to be photorealistic, however. You would need a really really big AI to do that, and have you priced those lately?

If you can't think of something, try "Balloon in the shape of X" where X is something you wouldn't find in balloon form.



API Docs
Recently generated images:
QUICK START API REQUEST
curl \
    -F 'text=YOUR_TEXT_URL' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/text2img 

Text To Image - AI Image Generator API Documentation

Pricing: $5 per 100 API calls

API Options


grid_size
Pass a string, either "1" or "2"
Pass “1” to only receive 1 image in response.
With the default, 4 will be returned

width, height
Pass a string, eg "256" or "768" (default 512)
Use values between 128 and 1536.
Note: values above approximately 700 or below 256 may produce strange outputs.

Frequently Asked Questions

Is commercial use allowed?
Yes, all commercial use is allowed for the generated images.

You can use these images in general for any legal purpose you wish.

Please see our full terms of service here: Terms of Service

Can I use the generated images for NFT?
Yes.

Who owns the output?
The images are considered public domain, that is, they have no owner.

Copyright on output?
The images generated by the AI have no copyright.

Can I get higher resolution or higher quality images?
At this time we don't offer higher quality or higher resolution. What you see is what we have available, which will improve over time.

Is the quality of the images good enough for printing?
In general the quality is good enough for printing smaller images. Larger prints might become very blurry.

Text To Image - AI Image Generator cURL Examples

# Example posting a text URL:

curl \
    -F 'text=YOUR_TEXT_URL' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/text2img 


# Example posting a local text file:

curl \
    -F 'text=@/path/to/your/file.txt' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/text2img 


# Example directly sending a text string:

curl \
    -F 'text=YOUR_TEXT_HERE' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/text2img 

Text To Image - AI Image Generator Javascript Examples

// Get the 'deepai' package here (Compatible with browser & nodejs):
//     https://www.npmjs.com/package/deepai
// All examples use JS async-await syntax, be sure to call the API inside an async function.
//     Learn more about async-await here: https://javascript.info/async-await

// Example posting a text URL:

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("text2img", {
            text: "YOUR_TEXT_URL",
    });
    console.log(resp);
})()


// Example posting file picker input text (Browser only):

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("text2img", {
            text: document.getElementById('yourFileInputId'),
    });
    console.log(resp);
})()


// Example posting a local text file (Node.js only):
const fs = require('fs');

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("text2img", {
            text: fs.createReadStream("/path/to/your/file.txt"),
    });
    console.log(resp);
})()


// Example directly sending a text string:

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("text2img", {
            text: "YOUR_TEXT_HERE",
    });
    console.log(resp);
})()

Text To Image - AI Image Generator Python Examples

# Example posting a text URL:

import requests
r = requests.post(
    "https://api.deepai.org/api/text2img",
    data={
        'text': 'YOUR_TEXT_URL',
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())


# Example posting a local text file:

import requests
r = requests.post(
    "https://api.deepai.org/api/text2img",
    files={
        'text': open('/path/to/your/file.txt', 'rb'),
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())


# Example directly sending a text string:

import requests
r = requests.post(
    "https://api.deepai.org/api/text2img",
    data={
        'text': 'YOUR_TEXT_HERE',
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())

Text To Image - AI Image Generator Ruby Examples

# Example posting a text URL:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/text2img', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'text' => 'YOUR_TEXT_URL',
    }
)
puts r


# Example posting a local text file:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/text2img', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'text' => File.new('/path/to/your/file.txt'),
    }
)
puts r


# Example directly sending a text string:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/text2img', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'text' => 'YOUR_TEXT_HERE',
    }
)
puts r

Text To Image - AI Image Generator Csharp Examples

// Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client
// Example posting a text URL:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("text2img", new {
        text = "YOUR_TEXT_URL",
});
Console.Write(api.objectAsJsonString(resp));


// Example posting a local text file:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("text2img", new {
        text = File.OpenRead("C:\\path\\to\\your\\file.txt"),
});
Console.Write(api.objectAsJsonString(resp));


// Example directly sending a text string:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("text2img", new {
        text = "YOUR_TEXT_HERE",
});
Console.Write(api.objectAsJsonString(resp));