Skip to content

चित्र बनाना और संपादित करना

Images API text-to-image और मौजूदा file editing देता है। Model, size, quality और input format कीमत बदलते हैं; editing multipart/form-data उपयोग करती है।

  • निर्माण के लिए /v1/images/generations, editing के लिए /v1/images/edits।
  • हर model के size, quality, count और file limits देखें।
  • अंतिम charge completed result और लौटे usage पर आधारित है।

पूरे उदाहरण

मूल गाइड के सभी चलने योग्य उदाहरण नीचे सुरक्षित रखे गए हैं। केवल अपने टूल और ऑपरेटिंग सिस्टम से संबंधित ब्लॉक चलाएँ।

bash
curl https://nordrouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-nr-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.1-flash-image-preview",
    "modalities": ["image", "text"],
    "messages": [{ "role": "user", "content": "A cozy cabin in the woods, watercolor" }]
  }'
python
from openai import OpenAI

client = OpenAI(base_url="https://nordrouter.com/v1", api_key="sk-nr-YOUR-KEY")

resp = client.chat.completions.create(
    model="google/gemini-3.1-flash-image-preview",
    modalities=["image", "text"],
    messages=[{"role": "user", "content": "A cozy cabin in the woods, watercolor"}],
)
img_b64 = resp.choices[0].message.images[0]["image_url"]["url"]  # data:image/png;base64,...
python
resp = client.chat.completions.create(
    model="google/gemini-3.1-flash-image-preview",
    modalities=["image", "text"],
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Repaint the car blue and remove the background"},
            {"type": "image_url", "image_url": {"url": "data:image/png;base64,<YOUR-PHOTO>"}},
        ],
    }],
)
bash
curl https://nordrouter.com/v1/images/generations \
  -H "Authorization: Bearer sk-nr-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-image-2",
    "prompt": "Coffee shop logo, minimalist, emerald on white",
    "size": "1024x1024",
    "n": 1
  }'
python
resp = client.images.generate(
    model="openai/gpt-image-2",
    prompt="Coffee shop logo, minimalist, emerald on white",
    size="1024x1024",
)
img_b64 = resp.data[0].b64_json

आधिकारिक दस्तावेज़ और लिंक

Model≈ per imageHow to call
google/gemini-3.1-flash-image-preview (Nano Banana)~$0.012chat + modalities
google/gemini-3-pro-image (Nano Banana Pro)~$0.028chat + modalities
openai/gpt-image-2~$0.001–0.10 (varies by size & quality)/v1/images/generations
Size · qualityOutput tokensPrice
1024×1024 · low~200~$0.0014
1024×1024 · high~7,000~$0.05
1536×1024 · high~10,500~$0.076
2048×2048 · high~14,300~$0.10

संबंधित गाइड

पहले न्यूनतम text request से कनेक्शन जाँचें, फिर streaming, tool calls, images और दूसरी advanced सुविधाएँ जोड़ें। API key को public code या browser frontend में कभी न रखें।

समस्या निवारण