14 Text-to-Image AI APIs Posted in Platforms Kristopher Sandoval April 2, 2024 AI has become a ubiquitous tool in relatively short order, with APIs across the spectrum offering video, image, text, and even audio generation. Below, we’ll look at 14 of the best text-to-image APIs leveraging AI and LLMs. These tools are cutting edge, offering the latest in text-to-image and a variety of other input and output formats, and promise to accelerate your product in extremely short order! 1. DALL·E 3 DALL·E 3 and OpenAI Image Generation is considered by many to be the first of the new movement in AI image generators of the last decade. The results feel both near-human and highly customizable. DALL·E has become near ubiquitous in conversations around AI, with “ChatGPT” often being used as a catch-all term encompassing both the actual ChatGPT framework as well as the DALL·E-specific implementation. This has continued with the recent build-in of DALL·E into ChatGPT as a core function. And within the OpenAI API family, this merging of functionality into the mega-API has continued. Sample API Request curl https://api.openai.com/v1/images/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "dall-e-3", "prompt": "a white siamese cat", "n": 1, "size": "1024x1024" }' 2. Generative AI by Getty One of the biggest open questions around AI-generated images and models that provide text-to-image generation is the question of copyright. While these models can generate very good images, they are often trained on copyright-covered materials that open up a conversation about the ethics and legality of using such images in a commercial application. This issue has yet to be fully resolved, but Getty has gotten a jump by providing a powerful API that offers commercially safe images. The ability to generate these images today without worrying about future legislation or current ethical issues makes this offering uniquely suited for commercial applications. Sample API Request curl -X 'POST' \ 'https://api.gettyimages.com/v3/ai/image-generations' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{"prompt": "an image of a person coding an API", "negative_prompt": "string", "aspect_ratio": "string", "media_type": "photography", "mood": "black_and_white", "product_id": 0, "project_code": "string", "notes": "string"}' 3. Imagen 2 by Google Imagen 2 is a compelling solution backed by one of the largest data players in the world — Google. That in and of itself is a strong selling point — Google trades in data in such a way that no other AI or LLM provider could possibly recreate. This data allows Imagen 2 to create incredibly lifelike and high-quality images, and this is delivered to developers through the Imagen API in Google Cloud Vertex AI. Although Google is an always-shifting company with a reputation for shuttering its product lines, it has signaled that AI is a major focus for the firm, which may mitigate some of those concerns. 4. Stability AI Developer Platform Best known for its stable diffusion model which set the standard by which AI image generation is largely judged, Stability AI has done a lot of work to package its AI offerings into a business suite that is compelling and useful. The end result of that effort is the Stability AI Developer Platform. While the platform uses cutting-edge technology to offer some of the highest quality image generation results in the market, much of their other solutions — including AI-driven upscaling and even image-to-image iteration using machine learning — has catapulted Stability AI into a workhorse tool for many flows, including design, animation, and video editing. Sample API Request import base64 import requests import os url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image" body = { "steps": 40, "width": 1024, "height": 1024, "seed": 0, "cfg_scale": 5, "samples": 1, "text_prompts": [ { "text": "an image of a person coding an API", "weight": 1 }, { "text": "blurry, dark", "weight": -1 } ], } headers = { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY", } response = requests.post( url, headers=headers, json=body, ) if response.status_code != 200: raise Exception("Non-200 response: " + str(response.text)) data = response.json() # make sure the out directory exists if not os.path.exists("./out"): os.makedirs("./out") for i, image in enumerate(data["artifacts"]): with open(f'./out/txt2img_{image["seed"]}.png', "wb") as f: f.write(base64.b64decode(image["base64"])) 5. ModelsLab API The main value proposition of ModelsLab is the sheer depth and variety of their LLM models. Not only does ModelsLab offer its own native LLM models for image generation, but it also allows the community to upload their own models, allowing for a remixing and expansion of capability that is not common in more controlled and centralized distributions. While this could, in theory, impact long-term quality, these models are generally isolated, allowing for much more customized and directive-driven LLM AI text-to-image generation than other offerings on this list. Sample API Request OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\n \"key\": \"\",\n \"prompt\": \"a person coding an API))\",\n \"negative_prompt\": null,\n \"width\": \"512\",\n \"height\": \"512\",\n \"samples\": \"1\",\n \"num_inference_steps\": \"20\",\n \"seed\": null,\n \"guidance_scale\": 7.5,\n\"safety_checker\":\"yes\",\n \"multi_lingual\":\"no\",\n \"panorama\":\"no\",\n \"self_attention\":\"no\",\n \"upscale\":\"no\",\n \"embeddings_model\":\"no\",\n \"webhook\": null,\n \"track_id\": null\n}"); Request request = new Request.Builder() .url("https://modelslab.com/api/v3/text2img") .method("POST", body) .addHeader("Content-Type", "application/json") .build(); Response response = client.newCall(request).execute(); 6. Monster API Monster API is a unique solution due to the relatively monster (pun intended) network driving their API. This stable diffusion solution utilizes decentralized computing via worldwide crypto-mining rigs to offer a stable, scalable, globally localized image generation solution. This ultimately means Monster’s image generation is more resource efficient with access that is often democratized more fairly, opening up worldwide developers to the power of AI generation in a way that has, until now, mainly been isolated in a handful of countries. Sample API Request curl --request POST \ --url https://api.monsterapi.ai/v1/generate/txt2img \ --header 'accept: application/json' \ --header 'content-type: application/json' 7. Replicate API Replicate is a powerful implementation due largely to the breadth of materials it can produce. While Replicate can create text-to-image results with incredible accuracy and quality, it has used this model to branch out into video, speech, and even music generation. This multifaceted system also allows you to fine-tune the output, resulting in an API that can adapt to your specific needs and generate images within your particular parameters. For this reason, Replicate is a powerful and customizable solution worthy of consideration in any workflow. Sample API Request import Replicate from 'replicate'; const replicate = new Replicate(); const input = { prompt: "an astronaut riding a horse on mars, hd, dramatic lighting", scheduler: "K_EULER" }; const output = await replicate.run("stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4", { input }); console.log(output) //=> ["https://replicate.delivery/pbxt/sWeZFZou6v3CPKuoJbqX46u... 8. AI Image Generator by DeepAI DeepAI’s Image Generation API is simple to use and simple in design. In many ways, that is both its attraction and its detriment. The tool is easy to use, fast, and offers a robust free license for commercial use of its generated images. That said, it’s a simple solution that doesn’t offer much more than what’s on the tin — image generation. If that’s what you need, this can do it, but don’t expect it to do anything more than that. Sample API Request curl \ -F 'text=YOUR_TEXT_HERE' \ -H 'api-key:YOUR_API_KEY' \ https://api.deepai.org/api/text2img 9. Image Generation API by Hive Hive positions itself as an AI solutions operator, offering a wide range of implementations via its API. While the core image generation solution has continued to be highly valuable for developers and adoptees, the inclusion of additional tools based on this technology, such as moderation tools, text recognition, insight generation, document OCR systems, and more, has made it a cornerstone of many large-scale image AI implementations. Sample API Request curl --location --request POST 'https://api.thehive.ai/api/v2/task/async' \ --header 'authorization: Token <YOUR_TOKEN>' \ --header 'Content-Type: application/json' \ --data-raw '{ "options": { "neg_text": "grass, pool", "num_images": 3 }, "text_data": "modern architecture house", "callback_url": "example_url" }' 10. Cloudlayer.io Cloudlayer is a business-specific implementation of AI image generation that focuses on creating image-driven marketing and business materials. These materials include things like images, sure, but they also offer the creation of PDFs from text input, pre-built templates for structured creation, and much more. Perhaps the best part of this tool is that it can take a URL and generate an image from it — this allows for a wide range of workflow efficiency improvements and direct image generation from pre-built structures. This is an excellent solution for businesses looking for something more robust than meme-ish art generation that is nonetheless built within the same concept as those other offerings. Sample API Request curl --request POST \ --url https://api.cloudlayer.io/v2/html/image \ --header 'Content-Type: application/json' \ --header 'x-api-key: <YOUR-API-KEY>' \ --data '{ "html": "PGh0bWw+PGJvZHk+PGgxPkhlbGxvIHdvcmxkITwvaDE+PC9ib2R5PjwvaHRtbD4=" }' \ --output "response.json" Also read: 7 Large Language Model (LLM) APIs 11. Améthyste API One of the most significant shifts in recent years has been the movement away from platform solutions toward more decentralized and democratized systems. Améthyste API continues this trend by offering an AI image generation solution with a very specific form and function: memes and images related to Discord and its culture. While this focus limits its use, it is nonetheless a perfect example of a purpose-built, hyper-specific generative model solution that has been the new focus of many AI providers, including OpenAI. Sample API Request https://v1.api.amethyste.moe/generate/challenger 12. Synthesia Generation API While Synthesia’s core offering has traditionally been in video generation, it is notable that the output is often highly dynamic and can be split into individual frames. For this reason, while it’s not truly a text-to-image AI generator, it nonetheless can function as one, creating workable options for keyframe art, image effects, and more through a relatively robust API. It’s also notable that Synthesia has a large amount of integrations that gives it an edge over other individual offerings. Sample API Request curl https://api.synthesia.io/v2/videos \ -H "Authorization: ${API_KEY}" \ -H "Content-Type: application/json" \ -X POST \ -d '{"test": true, "input": [{"scriptText": "Hello, World! This is my first synthetic video, made with the Synthesia API!", "avatar": "anna_costume1_cameraA", "background": "green_screen"}] }' 13. Image Generation API by Bannerbear Bannerbear is a niche solution that has targeted its consumer base well. It’s built specifically for e-commerce and marketing functions, and its integration with marketing workflows and processes makes it a standout choice in this domain. Notably, Bannerbear makes it incredibly easy to generate images as well as manipulate and change those images post-generation — this is a functionality that is not as commonly seen in other robust solutions such as DALL·E 3, which can often change images from iteration to iteration substantially enough to warrant it being considered a new design from a marketing point of view. Sample API Request var data = { "template" : "jJWBKNELpQPvbX5R93Gk", "modifications": [ { "name": "layer1", "text": "This is my text" }, { "name": "photo", "image_url" : "https://www.pathtomyphoto.com/1.jpg" } ] } fetch('https://api.bannerbear.com/v2/images', { method: 'POST', body: JSON.stringify(data), headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` } }) 14. Eden AI Eden AI is dissimilar from others on this list in that it’s not really a singular AI image generator. It’s more of a frontend to both a proprietary and open collection of image generators utilizing machine learning and artificial intelligence. The upside to all of this is that Eden has a complete feature set, and it offers both image generation and a variety of OCR, facial recognition, object identification, and general-purpose detection solutions, making it widely applicable for various use cases beyond just generating images. Sample API Request curl --request POST \ --url https://api.edenai.run/v2/image/generation \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data' { "response_as_dict": true, "attributes_as_list": false, "show_original_response": false, "resolution": "512x512", "num_images": 2, "providers": "stabilityai,amazon,deepai,replicate,openai", "text": "A huge red balloon flying outside the city." } Conclusion Text-to-image AI generation models are the cutting edge of LLM-driven creation, and the systems on this list are only going to get better. These highly powerful APIs offer complex engines for creative and professional material development, and should be considered a valuable source for media creation for years to come. Did we miss any models or solutions? Please let us know in the comments below! The latest API insights straight to your inbox