Image Generate & Edit — ewo open skill
A drop-in, multi-model media API. This skill calls ewo's public OpenAI-compatible
endpoint; you pay only for what you generate, from a prepaid ewo wallet. Free to
start — a new ewo account comes with a small trial credit, enough to try it out
before you ever recharge.
- Endpoint:
POST https://api.ewo.so/v1/images/generations
- Default
model: gpt-image-2. Pick a model by setting the model field.
Step 1 — resolve ORIGIN and KEY (first hit wins)
ORIGIN=https://api.ewo.so. For the key:
- Environment:
KEY=$EWO_API_KEY.
- Config file:
~/.ewo/credentials (or %USERPROFILE%\.ewo\credentials on
Windows) — a line api_key=sk-ewo-... or a JSON { "api_key": "sk-ewo-..." }.
- If the ewo desktop app is running, its managed key also works — set
EWO_API_KEY from it.
If you find no key, STOP — do not call the API. Tell the user, in their
language:
This skill uses ewo's image/video API. It's free to start:
- Sign up at https://api.ewo.so/sign-up — new accounts get a free trial credit.
- Create an API key at https://api.ewo.so/keys (it starts with
sk-ewo-).
- Save it:
export EWO_API_KEY=sk-ewo-... (or put api_key=sk-ewo-... in
~/.ewo/credentials), then ask me again.
Step 2 — call the endpoint
Write the JSON body to a temp file — never inline user text into shell quoting.
cat > /tmp/ewo-req.json <<'EOF'
{
"model": "gpt-image-2",
"prompt": "a fluffy orange cat, watercolor style",
"size": "1024x1024"
}
EOF
curl -sS --max-time 180 "$ORIGIN/v1/images/generations" \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d @/tmp/ewo-req.json -o /tmp/ewo-resp.json
Fields
prompt (string, required) — The image prompt. When editing (image_url provided), describe the desired edit.
model (string, optional) (one of: gpt-image-2) — Optional image model. Defaults to gpt-image-2.
image_url (string, optional) — Optional. URL or data URL of a source image to edit; when provided the invocation runs in edit mode against an edit-capable model.
mask_url (string, optional) — Optional mask URL or data URL. Only valid together with image_url.
size (string, optional) (one of: 1024x1024, 1024x1536, 1536x1024, auto) — Output pixel size (WIDTHxHEIGHT). Portrait 2:3 is 1024x1536; landscape 3:2 is 1536x1024. Do not send aspect ratios like 1:1 or 2:3 — the live gpt-image lane rejects them.
resolution (string, optional) (one of: 1K, 2K, 4K) — Optional output resolution tier. Defaults to 1K. Square output is roughly 1024px, 2048px and 2880px. gpt-image-2 is one flat per-image price; 2K/4K do not cost more. The live Images lane may ignore this field and still render at the default size.
quality (string, optional) (one of: standard, medium, high, auto) — Requested quality tier (OpenAI-image models only). Non-OpenAI image models (Nano Banana, Doubao Seedream) ignore this and render at their native quality; it is dropped before upstream so it never causes a 4xx.
background (string, optional) (one of: opaque, transparent, auto)
output_format (string, optional) (one of: png, jpeg, webp)
Step 3 — save the image
The synchronous response is the OpenAI images shape: .data[0] holds either
b64_json (a multi-megabyte base64 payload — NEVER print it into the chat, it
destroys your context) or url (a short-lived link — download it immediately).
B64=$(jq -r '.data[0].b64_json // empty' /tmp/ewo-resp.json)
URL=$(jq -r '.data[0].url // empty' /tmp/ewo-resp.json)
OUT="ewo-image-$(date +%s).png" # or the path the user asked for
if [ -n "$B64" ]; then printf %s "$B64" | base64 -d > "$OUT"; else curl -sS "$URL" -o "$OUT"; fi
echo "saved: $OUT"
Finish by telling the user the saved file path.
Editing an existing image
To edit instead of generate, POST the same body plus image (a data: URL of
the source picture) to $ORIGIN/v1/images/edits. gpt-image-2 supports editing.
Failures (JSON { error: { code, message } }) — do NOT blind-retry 4xx
401 (missing / invalid / expired key) → the user has no working ewo key.
Walk them through Step 1 signup (sign up at https://api.ewo.so/sign-up, create a key
at https://api.ewo.so/keys), then stop.
402 HABITAT_INSUFFICIENT_BALANCE → the ewo wallet is empty. Tell the user,
in their language, to recharge at https://api.ewo.so/console/topup, then stop. Do not
retry — 402 is terminal.
400 invalid_request_error → fix the request body against the Fields list.
429 → real rate limit; honor Retry-After and retry once.
503 → temporary ewo-side capacity issue; wait a few seconds, retry once.
1---2name: ewo-image-generate3description: Generate or edit images. Use whenever the user asks to draw, create, or modify any picture, illustration, logo, poster, icon, or photo — 画图/画一张/生成图片/改图/做个logo/海报/插画/头像. Free to start — new ewo accounts get a trial credit; then pay-as-you-go with your own ewo key (sk-ewo-…), no subscription.4---56# Image Generate & Edit — ewo open skill78A drop-in, multi-model media API. This skill calls ewo's public OpenAI-compatible9endpoint; you pay only for what you generate, from a prepaid ewo wallet. **Free to10start** — a new ewo account comes with a small trial credit, enough to try it out11before you ever recharge.1213- Endpoint: `POST https://api.ewo.so/v1/images/generations`14- Default `model`: `gpt-image-2`. Pick a model by setting the `model` field.1516## Step 1 — resolve ORIGIN and KEY (first hit wins)1718`ORIGIN=https://api.ewo.so`. For the key:19201. Environment: `KEY=$EWO_API_KEY`.212. Config file: `~/.ewo/credentials` (or `%USERPROFILE%\.ewo\credentials` on22 Windows) — a line `api_key=sk-ewo-...` or a JSON `{ "api_key": "sk-ewo-..." }`.233. If the ewo desktop app is running, its managed key also works — set24 `EWO_API_KEY` from it.2526**If you find no key, STOP — do not call the API.** Tell the user, in their27language:2829> This skill uses ewo's image/video API. It's free to start:30> 1. Sign up at https://api.ewo.so/sign-up — new accounts get a free trial credit.31> 2. Create an API key at https://api.ewo.so/keys (it starts with `sk-ewo-`).32> 3. Save it: `export EWO_API_KEY=sk-ewo-...` (or put `api_key=sk-ewo-...` in33> `~/.ewo/credentials`), then ask me again.3435## Step 2 — call the endpoint3637Write the JSON body to a temp file — never inline user text into shell quoting.3839```bash40cat > /tmp/ewo-req.json <<'EOF'41{42 "model": "gpt-image-2",43 "prompt": "a fluffy orange cat, watercolor style",44 "size": "1024x1024"45}46EOF47curl -sS --max-time 180 "$ORIGIN/v1/images/generations" \48 -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \49 -d @/tmp/ewo-req.json -o /tmp/ewo-resp.json50```5152### Fields5354- `prompt` (string, required) — The image prompt. When editing (image_url provided), describe the desired edit.55- `model` (string, optional) (one of: gpt-image-2) — Optional image model. Defaults to `gpt-image-2`.56- `image_url` (string, optional) — Optional. URL or data URL of a source image to edit; when provided the invocation runs in edit mode against an edit-capable model.57- `mask_url` (string, optional) — Optional mask URL or data URL. Only valid together with image_url.58- `size` (string, optional) (one of: 1024x1024, 1024x1536, 1536x1024, auto) — Output pixel size (WIDTHxHEIGHT). Portrait 2:3 is 1024x1536; landscape 3:2 is 1536x1024. Do not send aspect ratios like 1:1 or 2:3 — the live gpt-image lane rejects them.59- `resolution` (string, optional) (one of: 1K, 2K, 4K) — Optional output resolution tier. Defaults to 1K. Square output is roughly 1024px, 2048px and 2880px. gpt-image-2 is one flat per-image price; 2K/4K do not cost more. The live Images lane may ignore this field and still render at the default size.60- `quality` (string, optional) (one of: standard, medium, high, auto) — Requested quality tier (OpenAI-image models only). Non-OpenAI image models (Nano Banana, Doubao Seedream) ignore this and render at their native quality; it is dropped before upstream so it never causes a 4xx.61- `background` (string, optional) (one of: opaque, transparent, auto)62- `output_format` (string, optional) (one of: png, jpeg, webp)6364## Step 3 — save the image6566The synchronous response is the OpenAI images shape: `.data[0]` holds either67`b64_json` (a multi-megabyte base64 payload — **NEVER print it into the chat, it68destroys your context**) or `url` (a short-lived link — download it immediately).6970```bash71B64=$(jq -r '.data[0].b64_json // empty' /tmp/ewo-resp.json)72URL=$(jq -r '.data[0].url // empty' /tmp/ewo-resp.json)73OUT="ewo-image-$(date +%s).png" # or the path the user asked for74if [ -n "$B64" ]; then printf %s "$B64" | base64 -d > "$OUT"; else curl -sS "$URL" -o "$OUT"; fi75echo "saved: $OUT"76```7778Finish by telling the user the saved file path.7980### Editing an existing image8182To edit instead of generate, POST the same body plus `image` (a `data:` URL of83the source picture) to `$ORIGIN/v1/images/edits`. `gpt-image-2` supports editing.8485## Failures (JSON `{ error: { code, message } }`) — do NOT blind-retry 4xx8687- `401` (missing / invalid / expired key) → the user has no working ewo key.88 Walk them through **Step 1** signup (sign up at https://api.ewo.so/sign-up, create a key89 at https://api.ewo.so/keys), then stop.90- `402` `HABITAT_INSUFFICIENT_BALANCE` → the ewo wallet is empty. Tell the user,91 in their language, to recharge at https://api.ewo.so/console/topup, then stop. Do **not**92 retry — `402` is terminal.93- `400` `invalid_request_error` → fix the request body against the Fields list.94- `429` → real rate limit; honor `Retry-After` and retry once.95- `503` → temporary ewo-side capacity issue; wait a few seconds, retry once.