Install
openclaw skills install mediaio-imagen4-image-generatorGenerate high-quality AI images using Google Imagen 4 via Media.io OpenAPI. Produces photorealistic, detailed images from text prompts with advanced text rendering accuracy.
openclaw skills install mediaio-imagen4-image-generatorThis skill provides access to Google Imagen 4 through the Media.io OpenAPI. Imagen 4 sets a new standard for photorealism and text rendering accuracy, handling the most complex prompts with ease.
Use this skill when you hear:
| Variable | Required | Description |
|---|---|---|
API_KEY | Yes | Media.io OpenAPI key, sent as X-API-KEY header. Apply at https://developer.media.io/. |
Imagen 4t2i-imagen-4POST https://openapi.media.io/generation/imagen/t2i-imagen-4| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text description for image generation |
ratio | string | No | Image aspect ratio (e.g., "1:1", "16:9", "9:16") |
counts | string | No | Number of images to generate (default: "1") |
{
"code": 0,
"msg": "",
"data": {
"task_id": "..."
},
"trace_id": "..."
}
pip install requests
import os
from scripts.skill_router import Skill
skill = Skill('scripts/c_api_doc_detail.json')
api_key = os.getenv('API_KEY', '')
if not api_key:
raise RuntimeError('API_KEY is not set')
Windows PowerShell:
$env:API_KEY="your-api-key"
macOS / Linux (bash/zsh):
export API_KEY="your-api-key"
import os
from scripts.skill_router import Skill
skill = Skill('scripts/c_api_doc_detail.json')
api_key = os.getenv('API_KEY', '')
if not api_key:
raise RuntimeError('API_KEY is not set')
result = skill.invoke(
'Imagen 4',
{
'prompt': 'a cute puppy, photorealistic, soft natural light, high detail',
'ratio': '1:1',
'counts': '1'
},
api_key=api_key
)
print(result) # Returns task_id when code=0
import os
import time
from scripts.skill_router import Skill
skill = Skill('scripts/c_api_doc_detail.json')
api_key = os.getenv('API_KEY', '')
if not api_key:
raise RuntimeError('API_KEY is not set')
task_id = 'your-task-id'
for _ in range(24):
r = skill.invoke('Task Result', {'task_id': task_id}, api_key=api_key)
print(r)
status = (r.get('data') or {}).get('status')
if status in ('completed', 'failed', 'succeeded'):
break
time.sleep(5)
waiting: queuedprocessing: runningcompleted: completed successfullyfailed: failedtimeout: timed out| Error Code | Description |
|---|---|
374004 | Not authenticated. Apply for an APP KEY at https://developer.media.io/ |
490505 | Insufficient credits. Recharge before invoking generation APIs |