Claude Opus 5.5을(를) SeedRouter에서 사용할 수 있습니다

Image

Grok Imagine Image 2.0

View Markdown

SeedRouter의 비동기 이미지 작업 API를 통해 Grok Imagine Image 2.0으로 텍스트-이미지 생성 및 다중 이미지 편집을 수행할 수 있습니다. 1K, 1.5K 및 2K 해상도, low 및 medium 품질 등급, 16가지 화면 비율, 요청당 최대 10장의 이미지 및 최대 5개의 참조 URL을 지원합니다.

SeedRouter의 비동기 작업 API를 통해 Grok Imagine Image 2.0(grok-imagine-image-2.0)으로 이미지를 생성하고 편집할 수 있습니다. 텍스트-이미지 생성과 단일 또는 다중 이미지 편집 모두 POST /v1/images/generations를 사용하고 GET /v1/tasks/{id}로 폴링합니다.

빠른 예제

cURL

curl -X POST https://api.seedrouter.ai/v1/images/generations \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-image-2.0",
    "prompt": "An architectural photography poster for a coastal glasshouse at blue hour, crisp serif title text \"GLASS PAVILION\"",
    "n": 1,
    "aspect_ratio": "3:2",
    "resolution": "1k",
    "quality": "auto"
  }'

Python

import os
import time
import requests

api_key = os.environ["SEEDROUTER_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}

submitted = requests.post(
    "https://api.seedrouter.ai/v1/images/generations",
    headers=headers,
    json={
        "model": "grok-imagine-image-2.0",
        "prompt": "Render <IMAGE_0> in a detailed architectural pencil sketch style",
        "image_urls": ["https://file.deepytb.com/example.png"],
        "resolution": "2k",
        "quality": "medium",
    },
    timeout=30,
)
submitted.raise_for_status()
task_id = submitted.json()["id"]

while True:
    poll = requests.get(
        f"https://api.seedrouter.ai/v1/tasks/{task_id}",
        headers={"Authorization": f"Bearer {api_key}"},
        timeout=30,
    )
    poll.raise_for_status()
    data = poll.json()
    if data["status"] == "completed":
        print([item["url"] for item in data["output"]["data"]])
        break
    if data["status"] == "failed":
        raise RuntimeError(data["error"])
    time.sleep(2)

JavaScript / TypeScript

const apiKey = process.env.SEEDROUTER_API_KEY!;
const headers = {
  Authorization: `Bearer ${apiKey}`,
  'Content-Type': 'application/json',
};

const submitRes = await fetch('https://api.seedrouter.ai/v1/images/generations', {
  method: 'POST',
  headers,
  body: JSON.stringify({
    model: 'grok-imagine-image-2.0',
    prompt: 'A minimalist ceramic pour-over kettle on limestone, soft morning light',
    n: 2,
    aspect_ratio: '16:9',
    resolution: '1.5k',
    quality: 'low',
  }),
});
const { id } = await submitRes.json();

while (true) {
  const pollRes = await fetch(`https://api.seedrouter.ai/v1/tasks/${id}`, {
    headers: { Authorization: `Bearer ${apiKey}` },
  });
  const task = await pollRes.json();
  if (task.status === 'completed') {
    console.log(task.output.data.map((item: { url: string }) => item.url));
    break;
  }
  if (task.status === 'failed') {
    throw new Error(task.error?.message ?? 'Task failed');
  }
  await new Promise((r) => setTimeout(r, 2000));
}

Go

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"model":        "grok-imagine-image-2.0",
		"prompt":       "A coastal glasshouse glowing at dusk, crisp photography",
		"aspect_ratio": "16:9",
		"resolution":   "1k",
		"quality":      "auto",
	})
	req, _ := http.NewRequest(http.MethodPost, "https://api.seedrouter.ai/v1/images/generations", bytes.NewReader(body))
	req.Header.Set("Authorization", "Bearer "+os.Getenv("SEEDROUTER_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	fmt.Println("HTTP", resp.StatusCode)
}

엔드포인트 및 인증

  • 작업 제출: POST https://api.seedrouter.ai/v1/images/generations
  • 작업 폴링: GET https://api.seedrouter.ai/v1/tasks/{id}
  • 헤더: Authorization: Bearer <YOUR_API_KEY> 및 Content-Type: application/json
  • 통합 경로: Grok Imagine Image 2.0 편집 요청을 /v1/images/edits로 보내면 안 됩니다. 대신 POST /v1/images/generations에 image_urls를 전달해야 합니다.

요청 매개변수

매개변수유형필수기본값제약 사항 및 참고
modelstring예—"grok-imagine-image-2.0"이어야 합니다(명시적 등급을 선택하는 경우 grok-imagine-image-2.0:<tier>).
promptstring예—앞뒤 공백 제거 후 1–10,000자(유니코드 문자)입니다. 다중 이미지 편집 시 입력 이미지를 <IMAGE_0>, <IMAGE_1>부터 최대 <IMAGE_4>까지 참조합니다.
image_urlsstring[]아니오—공개 HTTP(S) 이미지 URL 1–5개(JPEG, PNG 또는 WebP, 각 최대 20 MiB)입니다. Base64 문자열과 data: URI는 거부됩니다.
ninteger아니오1생성할 출력 이미지 수(1–10)입니다.
aspect_ratiostring아니오"auto"auto, 1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1, 21:9 및 5:2 중 하나입니다.
resolutionstring아니오"1k"출력 해상도 등급입니다: "1k", "1.5k" 또는 "2k".
qualitystring아니오"auto""auto", "low" 또는 "medium"입니다. "auto"는 텍스트-이미지 생성 시 "low", 이미지 편집 시 "medium"으로 동작합니다.
userstring아니오—선택적 최종 사용자 식별자(최대 256자)입니다. API에서만 사용할 수 있으며 웹 Playground에는 노출되지 않습니다.

의도적으로 제외된 매개변수

  • response_format 및 deferred: SeedRouter는 항상 비동기 작업 폴링을 실행하고 호스팅된 출력 URL을 반환합니다.
  • output (upload_urls) 및 storage_options / file_id: SeedRouter가 결과 호스팅을 관리하며 공개 HTTP(S) 참조 URL을 수신합니다.

모드 및 미디어 제약 사항

  • 텍스트-이미지 생성: image_urls를 생략합니다. 기본값인 aspect_ratio: "auto"를 사용하면 모델이 프롬프트에 맞는 구도를 선택합니다.
  • 단일 이미지 편집: image_urls에 URL 1개를 제공합니다. aspect_ratio: "auto"를 지정하거나 생략하면 출력물이 입력 이미지의 구도를 유지합니다.
  • 다중 이미지 편집: image_urls에 URL 2–5개를 제공하고 prompt에서 0부터 시작하는 인덱스(<IMAGE_0>, <IMAGE_1>, ...)로 참조합니다.
  • 입력 제한: 공개 HTTP(S) URL만 허용되며(포함된 자격 증명 또는 사설 호스트 불가), JPEG/PNG/WebP 형식 및 참조 이미지당 최대 20 MiB까지 지원합니다.

과금 기준

Grok Imagine Image 2.0은 유효 품질(low 또는 medium)과 해상도(1k, 1.5k 또는 2k)에 따라 전달된 출력 이미지당 과금되며, 여기에 image_urls의 첫 번째 참조 이미지부터 각 입력 참조 이미지당 요금이 추가됩니다.

  • quality가 "auto"이거나 생략된 경우 텍스트-이미지 생성 요청은 low 등급으로, 이미지 편집 요청은 medium 등급으로 과금됩니다.
  • n개보다 적은 수의 이미지가 전달된 경우 실제로 전달된 이미지와 입력 참조 이미지에 대해서만 정산됩니다.
  • 실패한 요청에는 요금이 부과되지 않습니다.
  • 실시간 등급별 USD 요금은 Grok Imagine Image 2.0 페이지와 GET https://api.seedrouter.ai/v1/pricing에서 확인할 수 있습니다.

작업 응답 및 폴링

제출 시 HTTP 200이 반환됩니다:

{
  "id": "task_0123456789abcdef0123456789abcdef",
  "model": "grok-imagine-image-2.0",
  "status": "processing",
  "created_at": 1795600000
}

GET /v1/tasks/{id}를 폴링하면 processing, completed 또는 failed가 반환됩니다:

{
  "id": "task_0123456789abcdef0123456789abcdef",
  "model": "grok-imagine-image-2.0",
  "status": "completed",
  "output": {
    "data": [
      { "url": "https://file.deepytb.com/media/tasks/task_.../0.jpg" }
    ]
  }
}

오류

모든 요청 및 작업 실패에는 SeedRouter의 통합 오류 응답 형식({"error": {"code": <integer>, "message": "..."}})이 사용됩니다. 전체 코드 정의 및 재시도 가이드는 오류 참조에서 확인할 수 있습니다.

팁

  • 편집 작업에서 "auto" 기본값(편집 시 medium) 대신 이미지당 비용을 낮추려면 quality: "low"로 고정하는 것이 좋습니다.
  • 포스터 레이아웃이나 타이포그래피 작업에서는 prompt에 따옴표로 묶은 정확한 텍스트와 배치를 지정하고, 세밀한 글자 표현을 위해 1.5k 또는 2k를 사용하는 것이 좋습니다.
  • 여러 사진을 합성할 때는 구도와 정체성이 일관되게 유지되도록 각 이미지를 명시적으로 참조합니다(<IMAGE_0>, <IMAGE_1>).

관련 문서