1. Text-To-Image (GET)

GET https://teekgenai.com/tgapi/image/

Generates an image based on a text description.

Parameters:

Parameter Required Description Default
prompt Yes Text description of the image. Should be URL-encoded.
model Yes Model for generation. See Available Image Models. flux
key Yes Authentication key for API access.
seed No Seed for reproducible results.
height No Height of the generated image in pixels. 1024
width No Width of the generated image in pixels. 1024
image No URL of input image for image-to-image generation/editing (kontext model only). false
enhance No Set to true to enhance the prompt using an LLM for more detail. false
safe No Set to true for strict NSFW filtering (throws error if detected). true
transparent No Set to true to generate images with transparent backgrounds (gptimage model only). false

Return: Image file (typically JPEG)️

Code Examples: Generate Image (GET)

cURL Examples

Basic Prompt, Save to File:

curl -o boy.jpg "https://teekgenai.com/tgapi/image/?prompt=boy&model=flux&key=ADD_YOUR_KEY"
        

With Many Parameters:

curl -o boy.jpg "https://teekgenai.com/tgapi/image/?prompt=boy&model=flux&width=1280&height=720&seed=42&key=ADD_YOUR_KEY"
        

With Transparent Background (gptimage model only):

curl -o logo_transparent.png "https://teekgenai.com/tgapi/image/?prompt=A%20company%20logo%20on%20transparent%20background&model=gptimage&transparent=true&key=ADD_YOUR_KEY"
        

Image-to-Image Generation with Kontext Model:

curl -o logo_teekgenai.png "https://teekgenai.com/tgapi/image/?prompt=change%20color%20to%20pink&model=kontext&image=https://i.ibb.co/d4rp9W2g/5986db9f87ea.jpg&key=ADD_YOUR_KEY"
        
Python (requests) Text-to-Image
import requests
url = "https://teekgenai.com/tgapi/image/"
params = {
    "prompt": "boy",
    "model": "flux",
    "key": "ADD_YOUR_KEY",
}
try:
    response = requests.get(url, params=params)
    response.raise_for_status()
    with open("image.jpeg", "wb") as f:
        f.write(response.content)
    print("Image saved as image.jpeg")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")
        
Python (requests) Image-to-Image
import requests
url = "https://teekgenai.com/tgapi/image/"
params = {
    "prompt": "change color to pink",
    "model": "kontext",
    "image": "https://i.ibb.co/d4rp9W2g/5986db9f87ea.jpg",
    "key": "ADD_YOUR_KEY",
}
try:
    response = requests.get(url, params=params)
    response.raise_for_status()
    with open("image.jpeg", "wb") as f:
        f.write(response.content)
    print("Image saved as image.jpeg")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")
        
Scroll to Top

Get Free AI Updates Instantly!

Join our WhatsApp group and unlock:

✔️ Free prompt guides to boost your creativity
✔️ The latest AI trends and updates
✔️ Instant access to powerful free AI tools

👉 Be part of our creative community — join now and never miss out!