generate-image

generate-image is a skill for Claude Code, Codex from synthetic-sciences/openscience. It costs 67 tokens per session (808 once invoked), scanned A, original, Apache-2.0.

A library for extracting structured data from AI responses and checking it against Pydantic schemas, which define the required fields and types. It can retry failed extractions and stream partial results.

In plain words
What is it for?
Use it to turn model responses into validated Python objects, parse complex JSON, and support several AI providers.
Why use it?
It reduces the manual work of checking whether an AI response has the expected shape and values.

Skill for Claude CodeCodex

About the project

synthetic-sciences/openscience is an AI workbench that carries out scientific research by reading papers, forming hypotheses, writing and running code, conducting experiments, analyzing results, and preparing reports. Researchers use it for work in machine learning, biology, physics, and chemistry with remote or local models. Catalogue add-ons extend its scientific workflows through skills and instructions.

synthetic-sciences/openscience · 3,473 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/synthetic-sciences/openscience/generate-image
Any agent
npx skills add synthetic-sciences/openscience --skill generate-image
Clone the repo
git clone --depth 1 https://github.com/synthetic-sciences/openscience

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for generate-image

README.md
[![agentmods](https://agentmods.dev/badge/skills/synthetic-sciences/openscience/generate-image.svg)](https://agentmods.dev/skills/synthetic-sciences/openscience/generate-image)
Your own site
<a href="https://agentmods.dev/skills/synthetic-sciences/openscience/generate-image"><img src="https://agentmods.dev/badge/skills/synthetic-sciences/openscience/generate-image.svg" alt="Measured on agentmods" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 808 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00067 $0.00808
Opus 5 $0.00034 $0.00404
Sonnet 5 $0.00013 $0.00162
Haiku 4.5 $0.00007 $0.00081

Measured yesterday against content hash 55ec6967055e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

generate-image 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 yesterday.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/generate_image.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

backend/cli/skills/llm-tools/generate-image/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generate Image

Generate or edit a high-quality image with OpenScience's native generate_image tool. The tool keeps credentials in the trusted host and saves the returned image directly into the connected workspace.

Required route

Inside OpenScience, always call the native generate_image tool. Do not invoke scripts/generate_image.py through Bash: the native tool uses a connected Gemini or OpenRouter account and saves the result into the workspace.

Credential routing is automatic:

  1. A connected Gemini account is used when available.
  2. Otherwise, a connected user-owned OpenRouter key is used.
  3. Stop when neither account is connected or the selected provider rejects the request.

Never ask the user to paste a secret into chat. Direct them to Customize → Models to connect an account.

Tool contract

Call generate_image with:

  • prompt (required): detailed generation or editing instructions.
  • output_path: destination in the connected workspace; default generated-image.png.
  • input_path: existing image for an edit. Omit it entirely for a new image; never create or pass a blank canvas, directory, . or /dev/null.
  • model: OpenRouter image model; default google/gemini-3-pro-image (Nano Banana Pro).
  • aspect_ratio: optional 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, or 9:16.

Example generation:

{
  "prompt": "Editorial scientific illustration of a DNA double helix with one mutation site highlighted, restrained blue and amber palette, no decorative text",
  "output_path": "figures/dna-mutation.png",
  "aspect_ratio": "3:2"
}

Example edit:

{
  "prompt": "Preserve every plotted value and label; improve spacing and contrast for a two-column conference paper",
  "input_path": "figures/ablation-draft.png",
  "output_path": "figures/ablation-refined.png",
  "aspect_ratio": "4:3"
}

Model selection

  • google/gemini-3-pro-image: Nano Banana Pro; recommended for generation and editing.
  • black-forest-labs/flux.2-pro: fast, high-quality generation and editing.
  • black-forest-labs/flux.2-flex: cheaper generation-only alternative.

Read the full file on GitHub · 78 lines

Files

What ships with it

1 file 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.

Changes

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.

  1. yesterday First seen · 78 lines · 67 tokens per session scan A 55ec6967055e

Subscribe to this mod's changes

generate-image is a skill published in the GitHub repository synthetic-sciences/openscience (3,473 stars, last pushed today), licensed Apache-2.0. It adds 67 tokens to every session and 808 once invoked, about $0.0003 per session on Opus 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-09-03.