
Image Create
Create images from an agent turn via sc-proxy while tagging paid calls and writing per-turn cost ledger rows for accurate SSE cost summaries.
Overview
Image-create is an agent skill for the Build phase that generates images via sc-proxy and records credit usage into a Starchild cost ledger for per-turn billing summaries.
Install
npx skills add https://github.com/starchild-ai-agent/official-skills --skill image-createWhat is this skill?
- Stdlib-only cost_tracking helper drop-in for any skill folder calling sc-proxy
- SC-CALLER-ID and STARCHILD_USER_TURN_ID tie paid calls to the correct user turn cost card
- Parses sc-proxy response headers X-Credits-Used and X-Credits-Api-Type into the cost ledger
- Graceful degradation when Starchild env vars are missing so calls still work with synthetic caller ids
- Default cost ledger directory: /data/.starchild/cost_ledger
- Response headers parsed: X-Credits-Used and X-Credits-Api-Type
Adoption & trust: 1 installs on skills.sh; 13 GitHub stars; trending (+100% hot-view momentum).
What problem does it solve?
Your agent triggers paid image API calls but costs disappear from the user-facing turn summary because subprocess skills never tag caller ids or persist credit headers.
Who is it for?
Starchild or sc-proxy users building credit-metered agents that must attribute generative image spend to the triggering conversation turn.
Skip if: Offline-only image pipelines with no sc-proxy billing, or tasks unrelated to paid remote image generation and cost attribution.
When should I use this skill?
When the agent dispatches a skill subprocess that creates images through sc-proxy and must attribute credits to STARCHILD_USER_TURN_ID for cost_summary events.
What do I get? / Deliverables
Each image-create call carries the right SC-CALLER-ID, logs X-Credits-Used to the ledger, and lets the agent surface accurate cost_summary data for that user turn.
- Generated image output from the sc-proxy image create flow
- Cost ledger JSON rows keyed to the triggering user turn
- Caller-id tagged requests suitable for per-turn cost cards
Recommended Skills
Journey fit
Image creation here is agent infrastructure that runs during product build when you wire Starchild-style paid media calls into your assistant. Agent-tooling is the right shelf because the skill couples generation with caller-id tagging, credit headers, and ledger files the orchestrator reads back.
How it compares
Agent-integrated billed image skill with ledger hooks, not a standalone DALL·E prompt cheat sheet.
Common Questions / FAQ
Who is image-create for?
Indie builders running Starchild-class agents who need image generation plus honest per-turn cost tracking for sc-proxy credit charges.
When should I use image-create?
During Build agent-tooling when wiring image generation into your assistant subprocess and you need SC-CALLER-ID tagging and ledger rows before shipping a credit-aware product demo.
Is image-create safe to install?
Review the Security Audits panel on this page; the skill performs networked paid API calls and may handle billing-related env configuration, so scope secrets and ledger directories deliberately.
SKILL.md
READMESKILL.md - Image Create
"""Cost tracking helper for skill subprocesses. Skills that call sc-proxy via plain `requests` need to: 1. Tag every paid call with a SC-CALLER-ID that ties it back to the user turn that triggered the skill (so the agent's per-turn cost summary shows the cost in the right cost card). 2. After each call, parse the sc-proxy response headers (`X-Credits-Used`, `X-Credits-Api-Type`) and write a row to the cost ledger that the agent reads back when it builds the SSE `cost_summary` event. This file is intentionally zero-dependency (stdlib only) so it can be dropped into any skill folder without coupling to starchild-clawd internals. Env vars consumed (set by the agent before dispatching the bash subprocess): - STARCHILD_TOOL_CALLER_ID — opaque tag for the current tool call - STARCHILD_USER_TURN_ID — uuid of the current user turn - STARCHILD_COST_LEDGER_DIR — optional override for ledger directory When env vars are absent (e.g. running the script outside an agent), the helpers degrade gracefully: caller-id falls back to a synthetic string so the call still goes through, and ledger writes still happen for audit but the user-turn reader will skip them. """ from __future__ import annotations import fcntl import json import os import time from datetime import datetime, timezone from pathlib import Path from typing import Any, Dict, Optional from urllib.parse import urlparse _DEFAULT_LEDGER_DIR = "/data/.starchild/cost_ledger" # Allowlisted request payload keys we forward into the ledger row's # `details` field. MUST stay in sync with starchild-clawd's # core/http_client._record_cost_to_ledger allowlist — anything not in # that allowlist won't be picked up by the agent and won't render in # the frontend cost card. _PAYLOAD_ALLOWLIST = ( # Identity "model", "provider", # Image geometry "aspect_ratio", "quality", "resolution", "image_size", "size", # Video / motion "duration", "duration_s", "fps", "motion_strength", # Quantity "n", "count", # Generation knobs "seed", "steps", "guidance_scale", "cfg_scale", "strength", "scheduler", "sampler", # Reference / mode hints "image_to_image", "image_to_video", "use_reference", "reference_count", ) def caller_headers(extra: Optional[Dict[str, str]] = None, tool_default: str = "skill") -> Dict[str, str]: """Return an HTTP-headers dict with SC-CALLER-ID filled in. Resolution order: 1. `extra["SC-CALLER-ID"]` (case-insensitive) — caller wins. 2. STARCHILD_TOOL_CALLER_ID env (set by the agent) 3. Synthetic `f"{tool_default}:{int(time.time())}"` — tags the call so charges are attributable to *some* identifier even when the agent didn't inject one (standalone CLI runs, tests, cron). """ merged: Dict[str, str] = dict(extra or {}) has_caller = any(k.lower() == "sc-caller-id" for k in merged) if not has_caller: cid = os.environ.get("STARCHILD_TOOL_CALLER_ID") \ or f"{tool_default}:{int(time.time())}" merged["SC-CALLER-ID"] = cid return merged def record_response(response, request_url: str, request_payload: Optional[Dict[str, Any]] = None, api_type_hint: Optional[str] = None) -> None: """Inspect a sc-proxy response and append a ledger row when paid. Best-effort. Silently no-ops when: - response carries no X-Credits-Used / X-Credits-Api-Type - cost is 0 or unparseable - file write fails Never raises — must not break a real request flow. """ try: headers = getattr(response, "headers", None) or {} used = headers.get("X-Credits-Used") or headers.get("x-credits-used") api_type = (headers.get("X-Credits-Api-Type") or headers.get("x-credits-api-type") or api_type_hint) if not used or not api_type: return try: