API Documentation

Generate beautiful SVG illustrations and PNG images from text prompts using our REST API.

Base URL
https://api.oomf.in

Authentication

All authenticated endpoints require an API key passed in the X-API-Key header.

bash
curl -H "X-API-Key: your-api-key-here" \
  https://api.oomf.in/generate

Endpoints

POST /generate

Generate an SVG or PNG illustration from a text prompt.

Request Body

promptrequired

Text description of the image (1-500 characters)

formatoptional

Output format: svg (default) or png

styleoptional

Style name (e.g., minimalist_line)

filenameoptional

Custom filename without extension (max 100 chars)

Response

json
{
  "task_id": "550e8400-...",
  "status": "queued",
  "message": "Generation task started..."
}

Example Request

bash
curl -X POST https://api.oomf.in/generate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key-here" \
  -d '{
    "prompt": "A cute cat playing with yarn",
    "format": "svg",
    "style": "minimalist_line"
  }'

POST /generate-with-images

Generate with optional input images for editing or composition (max 4 images).

Form Data Parameters

promptrequired

Text description

images[]optional

Input images (JPEG, PNG, WebP) - max 4

formatoptional

svg or png (default: svg)

styleoptional

Style name

Example Request

bash
curl -X POST https://api.oomf.in/generate-with-images \
  -H "X-API-Key: your-api-key-here" \
  -F "prompt=Change background to beach sunset" \
  -F "format=png" \
  -F "style=golden_hour_portrait" \
  -F "[email protected]"

GET /status/{task_id}

Check the status of a generation task.

Response (Completed)

json
{
  "task_id": "550e8400-...",
  "status": "completed",
  "message": "SVG generated successfully",
  "file_path": "/path/to/file.svg",
  "download_url": "https://api.oomf.in/download/..."
}

Status values: queued, processing, completed, failed

Example Request

bash
curl -H "X-API-Key: your-api-key-here" \
  https://api.oomf.in/status/550e8400-e29b-41d4-a716-446655440000

GET /download/{task_id}

Download the generated file. No authentication required.

Public endpoint: No API key required. Rate limited by IP address.

Example Request

bash
curl -O https://api.oomf.in/download/550e8400-e29b-41d4-a716-446655440000

GET /styles

List all available styles. No authentication required.

Query Parameters

formatoptional

Filter by svg or png

Response

json
{
  "total_styles": 48,
  "description": "SVG styles...",
  "default_svg_style": "minimalist_line",
  "default_png_style": "studio_professional",
  "styles": {
    "minimalist_line": "Clean lines...",
    ...
  }
}

Example Request

bash
curl https://api.oomf.in/styles?format=svg

GET /styles/categories

List styles organized by category. No authentication required.

Response Structure

json
{
  "svg_categories": {
    "icon_symbol": {
      "description": "Icon & Symbol Styles",
      "styles": ["minimalist_line", ...]
    },
    ...
  },
  "png_categories": {
    "photorealistic": { ... },
    ...
  }
}

Example Request

bash
curl https://api.oomf.in/styles/categories

MCP Server

Use our API through the Model Context Protocol (MCP) server for seamless integration with Claude Desktop and other MCP-compatible clients.

Installation

bash
npx -y @modelcontextprotocol/create-server oomf-mcp-server

Configuration

Add the following to your Claude Desktop configuration file:

json
{
  "mcpServers": {
    "oomf": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/oomf-mcp-server"],
      "env": {
        "OOMF_API_KEY": "your-api-key-here"
      }
    }
  }
}

Config file locations:

  • • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • • Windows: %APPDATA%\Claude\claude_desktop_config.json

Available Tools

generate_image

Generate SVG or PNG images from text prompts with optional style selection.

promptrequired

Text description of the image to generate

formatoptional

Output format: svg or png

styleoptional

Style name from available styles list

list_styles

List all available image styles, optionally filtered by format.

formatoptional

Optional filter: svg or png

get_task_status

Check the status of a generation task and get the download URL when complete.

task_idrequired

The UUID of the generation task

Usage Example

Once configured, you can ask Claude to generate images directly:

"Generate a minimalist line art SVG of a mountain landscape"

Tip: The MCP server automatically handles task polling and returns the final download URL when the image is ready.

Complete Examples

JavaScript/Node.js

javascript
const API_KEY = 'your-api-key-here';
const BASE_URL = 'https://api.oomf.in';

// Generate an image
async function generateImage() {
  const response = await fetch(`${BASE_URL}/generate`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': API_KEY
    },
    body: JSON.stringify({
      prompt: 'A mountain landscape at sunset',
      format: 'svg',
      style: 'minimalist_line'
    })
  });
  
  const data = await response.json();
  console.log('Task ID:', data.task_id);
  
  // Poll for completion
  return await pollStatus(data.task_id);
}

// Check status
async function pollStatus(taskId) {
  while (true) {
    const response = await fetch(`${BASE_URL}/status/${taskId}`, {
      headers: { 'X-API-Key': API_KEY }
    });
    
    const data = await response.json();
    console.log('Status:', data.status);
    
    if (data.status === 'completed') {
      console.log('Download URL:', data.download_url);
      return data;
    } else if (data.status === 'failed') {
      throw new Error(data.message);
    }
    
    await new Promise(resolve => setTimeout(resolve, 2000));
  }
}

generateImage().catch(console.error);

Python

python
import requests
import time

API_KEY = 'your-api-key-here'
BASE_URL = 'https://api.oomf.in'

def generate_image(prompt, style='minimalist_line', format='svg'):
    headers = {
        'X-API-Key': API_KEY,
        'Content-Type': 'application/json'
    }
    
    data = {
        'prompt': prompt,
        'style': style,
        'format': format
    }
    
    # Start generation
    response = requests.post(f'{BASE_URL}/generate', 
                           headers=headers, 
                           json=data)
    task_id = response.json()['task_id']
    
    # Poll for completion
    while True:
        status_response = requests.get(
            f'{BASE_URL}/status/{task_id}',
            headers=headers
        )
        status_data = status_response.json()
        
        if status_data['status'] == 'completed':
            return status_data['download_url']
        elif status_data['status'] == 'failed':
            raise Exception(status_data['message'])
        
        time.sleep(2)

# Usage
url = generate_image('A serene forest path', style='watercolor_soft')
print(f'Download: {url}')

Error Handling

400 Bad Request

Invalid parameters or request format

403 Forbidden

Invalid or missing API key

404 Not Found

Task ID not found

429 Too Many Requests

Rate limit exceeded

Error Response Format

json
{
  "detail": "Invalid API key"
}