This quickstart walks you through generating an image using Runpod Public Endpoints. You’ll use the Flux Schnell model, which is optimized for fast generation.
Requirements
Step 1: Generate an image in the playground
The fastest way to test Public Endpoints is through the browser-based playground.
- Go to the Flux Schnell endpoint in the Runpod console.
- Under Input, enter a prompt:
A golden retriever playing fetch on a sunny beach (or any other prompt you like).
- Click Run.
- Wait a few seconds for the image to generate. The result appears under Result.
You’ve just generated your first image. The playground shows the estimated cost (~$0.0025 for a 1024x1024 image).
Step 2: Generate an image with the API
Now let’s generate an image programmatically using the REST API.
- Open a terminal on your local machine.
- Copy the following command, replacing
YOUR_API_KEY with your Runpod API key:
- Paste the command into your terminal and press Enter.
- Wait for the response (this takes about 10-20 seconds).
- Create a new file called
generate_image.py and paste the following code:
- Replace
YOUR_API_KEY with your Runpod API key.
- Open a terminal, navigate to the directory containing the file, and run:
- Wait for the script to print the image URL (this takes about 10-20 seconds).
Response
Both methods return a JSON response with your generated image:
Open the image_url in your browser to view the generated image.
Image URLs expire after 7 days. Download images immediately if you need to keep them.
Next steps