1. Select an image group

In the console, create a site API key in 渠道1 / image图片生成 for this example. image-2 also appears in a separate stable group, with a different price. Keep the selected group explicit instead of assuming all keys have the same rate.

  • Check image-2 in the model catalog before submitting.
  • Start with n: 1. Add size or other image options only when the selected model documents support for them.
  • The endpoint shown here is the synchronous Images API. It is separate from the asynchronous video-task workflow.

2. Submit the image request

Run this command from your backend environment or terminal. It saves the JSON response to image-response.json so you can inspect the returned output.

Terminal · cURL
export OHGROK_API_KEY='YOUR_API_KEY'

curl --fail-with-body --silent --show-error \
  'https://api.ohgrok.com/v1/images/generations' \
  -H "Authorization: Bearer $OHGROK_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "image-2",
    "prompt": "A blue inflatable puppy on a peach studio set, soft natural shadows",
    "n": 1
  }' \
  -o image-response.json

3. Read and save the output

Inspect the JSON before using it. A successful image response may provide a URL in data[0].url or base64 image data in data[0].b64_json. Handle the format actually returned by your chosen model.

For a URL result, download from that returned URL. For base64, decode the value into an image file and preserve the actual image format. Do not assume every model returns the same file type.

If the request times out, check its recorded outcome before resubmitting. A client timeout alone does not establish that generation was never started.

4. Keep usage and price together

The listed image models are billed per generated image, with the effective rate determined by the selected group. Recheck the current model details when changing a model or group.

The blue puppy artwork on this website is an illustrative design asset. It is not a receipt from this image-2 request or a claim about the output of a particular model.

Keep your next step small.

Review the result and current usage before scaling your workflow.

Explore models