Text to Image instant generation (Stable Diffusion)

August 8, 2024

Table of contents

  1. Request Headers
  2. Query Parameters
  3. Responses
  4. Model
  5. Examples
  6. Try It

Runway AI Tools » Video tools » Gen-2 Text/Image to Video page, button.

This endpoint provides free & unlimited Stable Diffusion text-to-image generations. It works with free accounts without any limitations as well. It takes on average between 10 to 60 seconds to complete. You can make multiple requests in parallel.

Please be aware that Runway’s moderation system analyzes your prompt and may respond with 403 if the prompt is determined to be offensive. Runway monitors the rate and the number of moderated prompts, which may result in your account being suspended when the internal threshold is exceeded.

https://api.useapi.net/v1/runwayml/text_to_image_preview/?…

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Query Parameters
  • email is optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required.
  • text_prompt is required. Specify text prompt.
  • prompt_weight is optional. Specify weight of the prompt.
    Valid range 1…30.
  • negative_prompt is optional. Specify negative prompt.
  • seed is optional.
    Valid range 1…4294967294.
  • style is optional. If not provided cinematic will be used by default.
    Supported values: cinematic, abandoned, abstract_sculpture, advertising, anime, architectural, cartoon, cine_lens, claymation, concept_art, digital_art, duotone_artistic_photo, forestpunk, frost, graphic_novel, graphite, impressionist_painting, isometric_3d, low_poly_3d, macro_photography, marker_drawing, moody_film, pixel_art, retro_photography, sci-fi_art, stickers, storyboard, actor_casting, thriller, 35mm, 3d_cartoon, 3d_render, 80s_vaporwave.
  • aspect_ratio is optional. If not provided 16:9 will be used by default.
    Supported values: 21:9,1:1, 9:16, 16:9, 4:3, 3:4
Responses
  • 200 OK

    {
        "url": "<image url>",
        "seed": 1234567
    }
    
  • 400 Bad Request

    {
        "error": "<Error message>",
        "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
  • 403 Forbidden
    Runway moderation message. Runway monitors the rate and the number of moderated prompts, which may result in your account being suspended when the internal threshold is exceeded.

    {
      "message": "Text did not pass content moderation.",
      "moderation_category": "SEXUALLY_EXPLICIT",
      "reason": "SAFETY.INPUT.TEXT",
      "tally_asimov": true
    }
    
Model
{ // TypeScript, all fields are optional
    url: string,
    seed: number,
    error: string,
    message: string,
    moderation_category: string,
    reason: string,
    tally_asimov: boolean,
    code: number
}
Examples
  • curl "https://api.useapi.net/v1/runwayml/text_to_image_preview/?text_prompt=happy cat" \
       -H "Accept: application/json" \
       -H "Authorization: Bearer …" 
    
  • const token = "API token";
    const text_prompt="happy cat";
    const apiUrl = `https://api.useapi.net/v1/runwayml/text_to_image_preview/?text_prompt=${text_prompt}`; 
    const response = await fetch(apiUrl, {
      headers: {
        "Authorization": `Bearer ${token}`,
      },
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    text_prompt = "happy cat"
    apiUrl = f"https://api.useapi.net/v1/runwayml/text_to_image_preview/?text_prompt={text_prompt}"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    response = requests.get(apiUrl, headers=headers)
    print(response, response.json())
    
Try It