Generate, review, and refine SVG graphics with AI β directly inside Inkscape
An Inkscape extension that turns text descriptions into vector graphics using OpenAI, Anthropic Claude, Google Gemini, Azure OpenAI, local Ollama models, or any custom OpenAI-compatible server β with a review-first gallery so nothing lands on your canvas until you approve it.
-
π€ Seven AI providers
Provider Auth Notes OpenAI API key GPT-5.x, GPT-4.1, o3/o4 reasoning models Anthropic Claude API key Claude Opus 4.8, Sonnet 5, Haiku 4.5 Google Gemini API key Gemini 2.5 Pro / Flash Azure OpenAI API key + endpoint Your own deployments Ollama none (local) Any locally installed model Custom (OpenAI-compatible) optional key + endpoint LM Studio, vLLM, Groq, Together, DeepSeek⦠-
πΌοΈ Review-first workflow β after generation, a gallery shows every variation rendered. Check what you want, Refine with a follow-up instruction ("make the roof red"), Regenerate, Preview/Copy/Save β and only then Insert Selected. Discard All leaves your document untouched.
-
β‘ Fast & responsive β variations generate in parallel; streaming providers show live character counts; Cancel returns immediately.
-
π‘οΈ Safe by default β generated SVG is sanitized (scripts, event handlers,
foreignObject,javascript:URIs stripped) before it is previewed or inserted. -
π¨ Rich style controls β style presets, color schemes, complexity, stroke styles, negative prompts, custom system prompt β all editable as markdown files under
prompts/. -
π Flexible output β preset/custom sizes, aspect ratios, target layer, grouping, positioning, multiple variations, save-to-disk, link-or-embed.
-
π§° Workflow tools β prompt history with search & replay, named templates, live model-list refresh per provider, API key test button, selection-as-context and selection-refine modes.
| Component | Version | Purpose |
|---|---|---|
| Inkscape | 1.0+ | Runs the extension (GTK3 + its bundled Python) |
| Python | 3.8+ | Ships with Inkscape β nothing to install |
| Internet | β | API access (not needed for Ollama) |
No pip packages required β the extension uses only the Python standard
library. librsvg (bundled with Inkscape) enables thumbnail previews.
-
Find your extensions directory (Edit β Preferences β System β User extensions):
OS Path Windows %APPDATA%\inkscape\extensions\macOS ~/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions/Linux ~/.config/inkscape/extensions/ -
Copy (or clone) this whole folder there as
svg_maker/:git clone https://github.com/YouvenZ/svg_maker_ink.git [extensions-dir]/svg_maker
-
Restart Inkscape. The extension appears under Extensions β Generate β AI SVG Generator.
- Extensions β Generate β AI SVG Generator
- Pick a provider and paste an API key (or use local Ollama β no key)
- Type a prompt:
A simple house icon with a chimney - Click Generate
- In the review gallery: refine if needed, check the variations you like, click Insert Selected
| Tab | Purpose |
|---|---|
| Prompt | Provider + key, preset, prompt text, negative prompt, selection context/refine |
| Model | Model picker with live β³ Refresh, temperature, max tokens, timeout, retries, seed |
| Size | Presets (200β800 px), aspect ratios, custom dimensions |
| Style | Visual style, complexity, color scheme, stroke style, gradients |
| Output | Position, grouping, variations (1β4), animations, accessibility, target layer, page auto-fit |
| Save | Save-to-disk directory, filename prefix, embed vs. link |
| Advanced | Custom system prompt, named prompt templates |
| History | Searchable prompt history β double-click to replay |
| Help | In-dialog quick reference |
After generation you get a gallery β nothing has touched your document yet:
- Each variation card: rendered thumbnail, byte size, Insert checkbox, Preview / Copy / Save buttons
- Refine β pick a variation, type a follow-up instruction; the current SVG is sent back to the model and replaced in place. Iterate as often as you like.
- Regenerate β re-run the original prompt for one variation
- Insert Selected β inserts only the checked variations
- Discard All β closes with zero changes to your document
To restore the old auto-insert behaviour (e.g. for scripted use), set
"review_before_insert": false in config.json.
- Direct input in the Provider tab (check Save entered key to persist)
- Environment variable β
OPENAI_API_KEY,ANTHROPIC_API_KEY,GOOGLE_API_KEY,AZURE_OPENAI_API_KEY,CUSTOM_OPENAI_API_KEY - config.json in the extension folder (flat keys):
{
"openai_api_key": "sk-β¦",
"anthropic_api_key": "sk-ant-β¦",
"google_api_key": "β¦",
"default_provider": "anthropic",
"default_model": "claude-opus-4-8",
"default_save_directory": "C:/Users/you/Pictures/AI_Images",
"review_before_insert": true
}
β οΈ config.jsonstores keys as plain text. Prefer environment variables on shared machines.config.jsonis gitignored.
| File | Purpose |
|---|---|
config.json |
Saved keys and defaults |
svg_llm_history.json |
Prompt history (last 50) |
svg_llm_templates.json |
Named prompt templates |
All are gitignored and stay on your machine.
Key from platform.openai.com/api-keys.
Reasoning models (o3, o4-mini, gpt-5*) are handled automatically
(correct token parameter, no temperature).
Key from console.anthropic.com.
Recommended: claude-opus-4-8 (best quality) or claude-haiku-4-5 (fast/cheap).
Newest models ignore the temperature setting (API restriction).
Key from aistudio.google.com/apikey.
Recommended: gemini-2.5-flash.
Enter your resource endpoint (https://your-resource.openai.azure.com) and
key; the model field is your deployment name.
ollama pull llama3.1 # once
ollama serveSelect provider Ollama β installed models are auto-discovered. No key.
Point the Endpoint field at any /v1-style base URL:
http://localhost:1234/v1 (LM Studio), https://api.groq.com/openai/v1, etc.
Type the model name in the Custom model name field.
Everything sent to the model lives under prompts/ β edit without touching code:
prompts/
βββ system_prompt.md # the system prompt
βββ presets/ # icon, logo, diagram, flowchart, β¦
βββ styles/ # minimal, flat, isometric, cartoon, β¦
βββ colors/ # warm, pastel, neon, β¦
βββ complexity/ # simple, medium, complex
βββ strokes/ # thin, thick, none, variable
Add a new file (e.g. styles/blueprint.md) and reference it, or edit
existing ones. Missing files fall back to built-in defaults.
Save any prompt + settings combination as a named template in the Advanced tab, and reload it with one click.
Everything except the Inkscape insertion can be tested outside Inkscape:
# Offline unit checks (sanitizer, cleaner, dimension fixer, registry)
python test_svg_generation.py --self-test
# Live end-to-end call using your config.json / env keys
python test_svg_generation.py --provider anthropic --stream
python test_svg_generation.py --provider ollama --model llama3.1Extension not in the menu
- Confirm the folder layout:
[extensions]/svg_maker/svg_llm.inx+svg_llm.py - Restart Inkscape fully
- Check Edit β Preferences β System β Open Error Log
API error (401 / 403)
- Use the Test button next to the key field
- Check for stray spaces, expiry, or org restrictions on the key
Model error (400)
- Click β³ Refresh in the Model tab to load the provider's current list β hardcoded model names go stale
- For Azure, the model must be your deployment name
No thumbnails in the review gallery
- Thumbnails need librsvg (bundled with Inkscape on all platforms); when missing, a source-code preview is shown instead β everything else works
Ollama not reachable
- Start it:
ollama serve, then verifycurl http://localhost:11434/api/tags - Check the endpoint field if you run it on another port/host
svg_maker/
βββ svg_llm.inx # Inkscape extension registration
βββ svg_llm.py # Main extension (effect flow, document insertion)
βββ svg_llm_common.py # Provider registry, sanitizer, HTTP/SSE helpers
βββ svg_llm_dialog.py # GTK3 main dialog + progress dialog
βββ svg_llm_review.py # Review-first result gallery
βββ svg_llm_prompts.py # Markdown prompt loader
βββ svg_llm_openai.py # ββ provider modules ββ
βββ svg_llm_anthropic.py
βββ svg_llm_google.py
βββ svg_llm_azure.py
βββ svg_llm_ollama.py
βββ svg_llm_custom.py
βββ prompts/ # Editable prompt fragments (markdown)
βββ test_svg_generation.py # Self-tests + live smoke test
βββ example_config.json # Config template
- Be specific: "A red apple with a leaf" beats "an apple"
- Use presets β they add tuned instructions for icons, logos, diagramsβ¦
- Refine instead of retrying β the review gallery's Refine keeps what works and changes only what you ask
- Use the negative prompt for things to avoid ("text, shadows, 3D")
- Select elements first and enable selection context to match a style
- Fork, branch (
git checkout -b feature/x), commit, PR - Run
python test_svg_generation.py --self-testbefore submitting - Provider modules are self-contained β adding a provider means one new
svg_llm_<name>.py(withgenerate()/fetch_models()) plus a registry entry insvg_llm_common.py
MIT β see the license file.
- Issues: GitHub Issues
- Email: youvenz.pro@gmail.com
- β¨ Review-first workflow: gallery with thumbnails, per-variation insert, iterative Refine, Regenerate β nothing auto-inserts
- β¨ Parallel variation generation + streaming progress + instant Cancel
- β¨ SVG sanitization (scripts/handlers/foreignObject stripped)
- β¨ Current model support: Claude Opus 4.8/Sonnet 5, GPT-5.x/o-series (correct parameters per model), Gemini 2.5
- π§ Single shared provider registry; root-tag-only dimension fixing; UTF-8 file output; offline self-test suite
- Initial release: OpenAI/Anthropic/Google/Ollama, styles, sizing, variations, history, GTK dialog
