patentfig-ai-patent-drawinglisted
Install: claude install-skill TopLocalAI/patentfig-skill
# 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:
```bash
export PATENTFIG_API_KEY="pfig_..."
```
Verify connectivity and credit balance (free call):
```bash
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.
```bash
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":