{"skill":{"slug":"hidream-api-gen","displayName":"Hidream Aigc","summary":"OpenClaw AIGC models (video + image) client. **REQUIRES CREDENTIALS**: You must set `HIDREAM_AUTHORIZATION` environment variable or use `scripts/configure.py...","description":"---\nname: hidream-aigc-skills\ndescription: >-\n  OpenClaw AIGC models (video + image) client. \n  **REQUIRES CREDENTIALS**: You must set `HIDREAM_AUTHORIZATION` environment variable or use `scripts/configure.py` to save a token. \n  **FILE ACCESS**: Reads local image/video files provided as arguments for base64 encoding.\n  **NETWORK**: Sends requests to `https://vivago.ai`.\ndependencies:\n  - requests\nrequires:\n  env:\n    - HIDREAM_AUTHORIZATION\n---\n\n# HD AIGC Skills\n\nThis skill provides per-model scripts that validate parameters and call shared request runners.\n\n## Security Disclosure (AI Agents)\n\n- **Credential Access**: This skill reads `HIDREAM_AUTHORIZATION` from environment variables or a secure local config file (`~/.config/openclaw/hidream_config.json`, permission 0600).\n- **File System Access**: Scripts read local image/video files provided in arguments to base64 encode them for API transmission. No other file system access occurs.\n- **Network Activity**: Requests are sent exclusively to the configured `HIDREAM_ENDPOINT` (default: `https://vivago.ai`).\n\n## Configuration & Usage (AI Agent Instructions)\n\nWhen a user wants to use this skill, follow these steps:\n\n1.  **Check for Token**: The system automatically checks for the API key in the following order:\n    *   Local Env File (Primary): `~/.openclaw/.env` (reads `HIDREAM_AUTHORIZATION=sk-...`)\n    *   Environment Variable: `HIDREAM_AUTHORIZATION`\n    *   Config File: `~/.config/openclaw/hidream_config.json`\n\n2.  **Request Token (If Missing or 401)**: Instruct the user to update their credentials:\n    *   **Recommended**: Provide their API Key (starts with `sk-`) and ask the agent to save it: `echo \"HIDREAM_AUTHORIZATION=sk-...\" > ~/.openclaw/.env`\n    *   **Interactive**: Run `python3 scripts/configure.py` to interactively save the token.\n3.  **Handle Missing Prompts**: If the user asks to generate an image or video but does not provide a specific prompt, **DO NOT generate a random test image**. Instead, politely ask the user what they would like to generate.\n4.  **Generate**: Use the Python interface to generate content based on user requests.\n5.  **Save Output**: When generation is complete and returns a media URL (image or video), **ALWAYS download and save the file to the `assets/` directory within this skill's folder (e.g., `assets/generated_image.png`)**. Do NOT use `~/.openclaw/workspace/output/` as it may have permission issues. Create the `assets/` directory if it does not exist.\n6.  **Present Results**: When showing generated images or videos to the user, **ALWAYS** use the following Markdown formats to ensure proper rendering in the Claw interface. Use the local path if downloaded, or the remote URL:\n\n### Error Handling & Troubleshooting\n\n- **Resolution too small (ValueError)**: Seedream M2 requires high resolution (at least `2560*1440` or `2048*2048`). If you get this error, increase the `resolution` parameter.\n- **401 Unauthorized (invalid token)**: The token is invalid or expired. Update it by writing the new token to `~/.openclaw/.env`:\n    ```bash\n    echo \"HIDREAM_AUTHORIZATION=sk-...\" > ~/.openclaw/.env\n    ```\n- **Insufficient Credits (Code 2007)**: Instruct the user to go to `https://vivago.ai/platform/info` to recharge credits.\n\n\n## Python Interface (Recommended)\n\nYou can call the scripts directly from Python code. This is the preferred way for AI agents to interact.\n\n### Image Generation (Seedream)\n\n```python\nfrom scripts.seedream import run as run_seedream\n\n# Example: Generate an image\ntry:\n    result = run_seedream(\n        version=\"M2\",\n        prompt=\"A cyberpunk cat on the moon\",\n        resolution=\"2048*2048\",\n        authorization=\"sk-...\" # Optional if env var is set\n    )\n    print(result)\nexcept Exception as e:\n    print(f\"Error: {e}\")\n```\n\n### Video Generation (Kling)\n\n```python\nfrom scripts.kling import run as run_kling\n\n# Example: Generate a video\ntry:\n    result = run_kling(\n        version=\"Q2.5T-std\",\n        prompt=\"A cyberpunk cat running on neon streets\",\n        duration=5,\n        authorization=\"sk-...\" # Optional if env var is set\n    )\n    print(result)\nexcept Exception as e:\n    print(f\"Error: {e}\")\n```\n\n## Structure\n\n- `scripts/commom/base_image.py`: shared OpenClaw image request runner\n- `scripts/common/base_video.py`: shared OpenClaw video request runner\n- `scripts/common/task_client.py`: http request runner\n- `scripts/*.py`: per-model scripts (parameter parsing + payload only)\n\n## Auth and Endpoints\n\nSet one of the following environment variables, or use `scripts/configure.py`:\n\n- `HIDREAM_AUTHORIZATION`: Bearer token value only\n- `HIDREAM_ENDPOINT`: API Endpoint (default: `https://vivago.ai`)\n- `OPENCLAW_AUTHORIZATION` (Legacy): Alternative for `HIDREAM_AUTHORIZATION`\n- `OPENCLAW_ENDPOINT` (Legacy): Alternative for `HIDREAM_ENDPOINT`\n\n## Dependencies\n\n- `requests` (Python library) - see `requirements.txt`\n\n## Video Model Scripts\n\n- `scripts/sora_2_pro.py`\n- `scripts/seedance_1_0_pro.py`\n- `scripts/seedance_1_5_pro.py`\n- `scripts/minimax_hailuo_02.py`\n- `scripts/kling.py` (Refactored for Python access)\n\n## Image Model Scripts\n\n- `scripts/seedream.py` (Refactored for Python access)\n- `scripts/nano_banana.py`\n\n## Notes\n\n- Per-model scripts only handle parameter parsing and payload building.\n- Base scripts handle request submission, polling, and auth.\n","tags":{"latest":"0.1.9"},"stats":{"comments":0,"downloads":651,"installsAllTime":24,"installsCurrent":1,"stars":0,"versions":10},"createdAt":1773371063692,"updatedAt":1778491872769},"latestVersion":{"version":"0.1.9","createdAt":1773907769426,"changelog":"- Added support for automatic API key detection from `~/.openclaw/.env`, environment variable, or config file.\n- Now always downloads and saves generated media (images/videos) to the local `assets/` directory within the skill folder, improving output handling and avoiding permission issues.\n- Improved prompt requirements: the skill will now ask the user to specify a prompt, rather than generating random content if missing.\n- Expanded troubleshooting guidance: updated error handling steps for invalid tokens, missing prompts, and low resolution errors.\n- Updated documentation to clarify updated credential management, output, and Markdown usage for displaying results.","license":"MIT-0"},"metadata":{"setup":[{"key":"HIDREAM_AUTHORIZATION","required":true}],"os":null,"systems":null},"owner":{"handle":"zhy2015","userId":"s176q7vm0cykajnw10akpbfpq183hjjf","displayName":"harry zhu","image":"https://avatars.githubusercontent.com/u/51319424?v=4"},"moderation":null}