New to Claude Skills? Learn how to install them →

davila7 on GitHub

PatentFig AI API

Free

Generate patent-compliant figures from text or images.

Get this skill

Free · Opens the source repo

What PatentFig AI API does

The PatentFig AI API provides a robust solution for generating and converting patent figures, tailored specifically for compliance with patent office standards. Users can create patent line art from textual descriptions, vectorize existing drawings, and enhance images for filing purposes. This API is particularly useful for inventors, patent attorneys, and designers who need to prepare high-quality figures for patent applications efficiently.

To generate a patent figure, users simply send a prompt describing the desired figure along with the output format (PNG or SVG). The API supports detailed prompts, allowing for the inclusion of labeled reference callouts, which are essential for patent documentation. Additionally, the API can handle multiple views of a design by making separate calls for each perspective, ensuring comprehensive coverage of the invention.

The vectorization feature allows users to convert raster images into CAD-friendly formats like SVG and DXF, which is crucial for engineers and designers looking to integrate patent figures into their workflows. The API also includes an enhancement feature that uses AI to upscale images, ensuring that the final output meets the high-resolution requirements often needed for patent filings.

Overall, the PatentFig AI API streamlines the process of creating and preparing patent figures, making it an essential tool for anyone involved in the patent application process.

When to use it

Use this tool when you need to generate patent drawings from text descriptions, vectorize existing images, or prepare figures for patent filings.

When not to use it

This skill is not suitable for generating non-patent-related graphics or for users who require real-time rendering of complex images, as processing can take several seconds to minutes.

What you can build with it

Generating Patent Drawings

Use the API to create detailed patent figures directly from text prompts, ensuring compliance with patent office standards.

Vectorizing Existing Designs

Convert raster images into SVG or DXF formats for CAD applications, making it easier to integrate patent figures into engineering workflows.

Enhancing Image Quality

Utilize the AI enhancement feature to upscale images for high-resolution patent filings, meeting the necessary quality requirements.

How to install PatentFig AI API

View source

1. Install with the skills CLI

npx skills add davila7/claude-code-templates/patentfig --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by davila7

PatentFig AI API

Generate and convert patent figures through the PatentFig AI REST API.

  • Base URL: https://patentfig.ai/api/v1
  • Auth: Authorization: Bearer $PATENTFIG_API_KEY
  • All endpoints are synchronous and return JSON: { "success": true, "data": {...} } on success, { "success": false, "error": { "code", "message" } } on failure.
  • Generated files are returned as URLs on https://cdn.patentfig.ai — pass them to the user or feed them into follow-up calls.

Setup

The key comes from the PATENTFIG_API_KEY environment variable. Never hardcode it, print it, or write it into files or logs.

If the variable is not set, tell the user to create a key at https://patentfig.ai/settings/api-keys (requires a PatentFig AI account; keys start with pfig_) and export it:

export PATENTFIG_API_KEY="pfig_..."

Verify connectivity and credit balance (free call):

curl -s https://patentfig.ai/api/v1/credits \
  -H "Authorization: Bearer $PATENTFIG_API_KEY"
# → { "success": true, "data": { "balance": 500 } }

Generate a patent figure (10 credits)

POST /figures — the core endpoint. One prompt → one figure. Views, diagram type, and composition are all controlled through the prompt; for a multi-view set (front/side/top), make one call per view.

curl -s -X POST https://patentfig.ai/api/v1/figures \
  -H "Authorization: Bearer $PATENTFIG_API_KEY" \
  -H "Content-Type: application/json" \
  --max-time 300 \
  -d '{
    "prompt": "Exploded view of a wireless earbud charging case showing lid, hinge, charging coil, and battery",
    "output": "svg",
    "labeled": true
  }'
  • output: "png" (raster figure) or "svg" (stroke-based line art, CAD-friendly). Default "png".
  • labeled: true adds patent-style numeric reference callouts (100, 102, …).
  • referenceImageUrls: up to 4 public image URLs (sketch/photo/prior figure) used as the structural baseline.
  • Response data.url is the figure; with output: "svg" the full SVG source is also in data.svg.

Prompting tips: name the parts to draw (names tell the model WHAT to draw, not what to label); for flowcharts/block diagrams, name every node explicitly.

Convert an existing image

All three endpoints accept either JSON with imageUrl (public URL) or multipart/form-data with a file field (PNG/JPEG/WebP/TIFF, ≤10 MB).

Vectorize (20 credits) — raster → SVG / DXF / vector PDF:

curl -s -X POST https://patentfig.ai/api/v1/vectorize \
  -H "Authorization: Bearer $PATENTFIG_API_KEY" \
  -H "Content-Type: application/json" \
  --max-time 300 \
  -d '{ "imageUrl": "https://example.com/drawing.png", "format": "dxf", "engine": "lineart" }'

engine: "lineart" (default) redraws as clean single-stroke patent line art — use for CAD/DXF. engine: "trace" reproduces the input pixels faithfully, preserving fills — use when output must match the original.

Enhance (20 credits) — AI super-resolution: POST /enhance with scale (2 or 4, controls pixels) and dpi (300 or 600, metadata stamp only).

Convert (20 credits) — filing-ready raster: POST /convert with format (png/tiff/pdf) and dpi (300 or 600).

Full parameter tables for every endpoint: see references/endpoints.md. Machine-readable spec: https://patentfig.ai/api/openapi.yaml

Operational rules

  • Set a client timeout of at least 300 seconds — generation and vectorization take from ~20s up to a few minutes.
  • Credits are charged only on success; retrying a failed call never double-bills.
  • Rate limit: 60 requests/minute per key. On 429 back off (start at 5s) and retry.
  • On 402 INSUFFICIENT_CREDITS, stop and tell the user to top up at https://patentfig.ai/pricing.
  • On 500 GENERATION_FAILED, one retry is reasonable; persistent failures usually mean the input doesn't suit the pipeline (e.g., a photo sent for line-art vectorization — suggest POST /figures with the photo as referenceImageUrls instead).
  • Before a batch of billable calls, check GET /credits and confirm the balance covers it.

Frequently asked questions about PatentFig AI API

Similar skills