caozhiyuan/copilot-api is a local AI gateway that exposes OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages interfaces for multiple providers. It lets clients such as Claude Code, OpenCode, and Codex connect through one endpoint to GitHub Copilot, the built-in Codex provider, and other configured services.
Borrowing it
Nothing to install: this file belongs to caozhiyuan/copilot-api. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/caozhiyuan/copilot-api/dev/.agents/skills/copilot-api-imagegen/SKILL.mdgit clone --depth 1 https://github.com/caozhiyuan/copilot-apiWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/caozhiyuan/copilot-api/copilot-api-imagegen)<a href="https://agentmods.dev/skills/caozhiyuan/copilot-api/copilot-api-imagegen"><img src="https://agentmods.dev/badge/skills/caozhiyuan/copilot-api/copilot-api-imagegen/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/caozhiyuan/copilot-api/copilot-api-imagegen"><img src="https://agentmods.dev/badge/skills/caozhiyuan/copilot-api/copilot-api-imagegen.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00155 | $0.02529 |
| Opus 5.5 | $0.00062 | $0.01012 |
| Sonnet 5.5 | $0.00031 | $0.00506 |
| Haiku 4.5 | $0.00015 | $0.00253 |
Grade A, and why
copilot-api-imagegen scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 150 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Copilot API Image Generation & Editing Skill
Generate and edit raster images through a running copilot-api gateway using the bundled zero-dependency Node.js/Bun CLI (scripts/image_gen.mjs).
No Python environment or openai SDK installation is required; the script runs directly on Node.js 20+ or Bun and works across all image providers supported by copilot-api (Codex, GitHub Copilot, xAI, and configured custom providers).
When to use
- Generate a new raster image (concept art, product photo, hero banner, illustration, infographic, sprite, mockup)
- Generate an animated GIF (
--output-format gif) via Codexgpt-image-2 - Edit an existing local image or image URL (inpainting, lighting/weather shifts, background replacement, object removal, compositing, style transfer, mask-guided edits)
- Produce multiple variants (
--n) or many distinct assets concurrently (generate-batchJSONL)
When not to use
- Extending or editing an existing SVG/vector icon set, logo system, or code-native asset inside the repo
- Creating simple diagrams, charts, or UI elements better authored in SVG, Mermaid, or HTML/CSS
- Pure image inspection/analysis without creating or modifying an image file
Quick start
Resolve <SKILL_DIR> relative to this SKILL.md (in this repository: .agents/skills/copilot-api-imagegen):
export IMAGE_GEN=".agents/skills/copilot-api-imagegen/scripts/image_gen.mjs"
Dry-run first to inspect the resolved gateway URL, redacted auth status, default temp output path, and payload:
node "$IMAGE_GEN" generate \
--prompt "A minimal hero image of a matte ceramic coffee mug on warm stone" \
--size 1536x1024 \
--dry-run
Decision tree
Evaluate three questions before running:
- Intent (
generatevsedit):- Modifying an existing image while preserving parts of it ->
edit - Creating a brand-new image (no input image) ->
generate - Note: If the user supplies reference images for style/subject guidance, pass them via
edit(--image, repeatable) and describe each image's role by index in the prompt.
- Modifying an existing image while preserving parts of it ->
- Execution strategy (single vs variants vs batch):
- One prompt, one output ->
generate(oredit) - One prompt, multiple variations ->
--n 2..4 - Many distinct assets/prompts ->
generate-batch --input <temp-dir>/prompts.jsonl(omit--out-dirto write to a unique directory under<os.tmpdir()>/copilot-api-imagegen/, or pass--out-dir <path>when saving into a target workspace directory; do not misuse--nfor unrelated assets)
- One prompt, one output ->
- Provider & model selection:
- Default (
--model gpt-image-2or--auto-model):copilot-apiappliesmodelMappingsfirst, then automatically picks the first available provider in order:- Codex (
gpt-image-2) - GitHub Copilot (
gpt-image-2.5-flare) - xAI (
grok-imagine-image-2.0)
- Codex (
- Explicit provider/model pinning: pass
--model codex/gpt-image-2,--model codex/gpt-image-1.5,--model github-copilot/gpt-image-2.5-flare,--model xai/grok-imagine-image-2.0, or--provider <name>.
- Default (
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 150 lines · 155 tokens per session scan A 3785841094bb
copilot-api-imagegen is a skill published in the GitHub repository caozhiyuan/copilot-api (1,136 stars, last pushed yesterday), licensed MIT. It adds 155 tokens to every session and 2,529 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-27.
copilot-api-imagegen compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| copilot-api-imagegencaozhiyuan/copilot-api | Skill | 1.1k | yesterday | MIT | A | 155 | Claude Code, Codex |
| zenrouter-videoZenRouter/ZenRouter | Skill | 5 | 1mo ago | MIT | A | 73 | Claude Code, Codex |
| zenrouter-web-searchZenRouter/ZenRouter | Skill | 5 | 1mo ago | MIT | A | 73 | Claude Code, Codex |
| zenrouter-imageZenRouter/ZenRouter | Skill | 5 | 1mo ago | MIT | A | 73 | Claude Code, Codex |
| zenrouterZenRouter/ZenRouter | Skill | 5 | 1mo ago | MIT | A | 82 | Claude Code, Codex |
| zenrouter-embeddingsZenRouter/ZenRouter | Skill | 5 | 1mo ago | MIT | A | 65 | Claude Code, Codex |
| zenrouter-web-fetchZenRouter/ZenRouter | Skill | 5 | 1mo ago | MIT | A | 62 | Claude Code, Codex |