SenseNova U1 Image Generation
Call SenseNova's U1 model API via curl to generate images from text prompts.
First-Time Setup
- Check existing token: Look in MEMORY.md for
sensenova-u1-image token. If found, use it directly. - If no token: Ask the user to provide their SenseNova API token (
Authorization: Bearer <token>). - Store it: Write the token to MEMORY.md :
### sensenova-u1-image - token: <the-token-value> - Confirm to the user that the token has been saved.
Usage Workflow
- Understand the user's image description and desired parameters (prompt, size, image count).
- Construct the curl command using the stored token.
- Execute the command and capture the response.
- Parse the response to extract image URL(s).
- Download the generated image(s) to a local path using
browser_useorcurl. - Show the image(s) to the user via
view_imageorsend_file_to_user.
API Reference
Endpoint
POST https://token.sensenova.cn/v1/images/generations
Headers
Authorization: Bearer {token}
Content-Type: application/json
Request Body
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| model | string | yes | sensenova-u1-fast |
| prompt | string | yes | Text prompt, max-token=4096 |
| size | string | no | Image size with aspect ratio. Options:<br>1664x2496 | 2:3<br>2496x1664 | 3:2<br>1760x2368 | 3:4<br>2368x1760 | 4:3<br>1824x2272 | 4:5<br>2272x1824 | 5:4<br>2048x2048 | 1:1<br>2752x1536 | 16:9<br>1536x2752 | 9:16<br>3072x1376 | 21:9<br>1344x3136 | 9:21 |
| n | integer | no | Number of images to generate (default 1) |
Example curl Command
curl -s https://token.sensenova.cn/v1/images/generations \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "sensenova-u1-fast",
"prompt": "A cute cat wearing a hat, digital art style",
"size": "2752x1536",
"n": 1
}'
Response Format
The API returns JSON. Extract the image URL(s) from the response (typically under data[].url or similar path — parse dynamically).
Download Image
curl -s -o output.png "<image_url>"
Notes
- The token is reused once saved — the user only provides it once.
- If the API returns an error, show the full error message to the user for debugging.
- Respect the user's prompt language — use their language for the
promptfield.
微信扫一扫