# Ai Image Generation Deepinfra

> A Claude skill from marketintellabs/agent-skills.

- **Type:** Skill
- **Install:** `agentstack add skill-marketintellabs-agent-skills-ai-image-generation-deepinfra`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [marketintellabs](https://agentstack.voostack.com/s/marketintellabs)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [marketintellabs](https://github.com/marketintellabs)
- **Source:** https://github.com/marketintellabs/agent-skills/tree/main/ai-image-generation-deepinfra

## Install

```sh
agentstack add skill-marketintellabs-agent-skills-ai-image-generation-deepinfra
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# AI Image Generation (DeepInfra FLUX-2)

Generate high-quality images using DeepInfra's FLUX-2 model family via an OpenAI-compatible API. No additional subscriptions required — uses your existing DeepInfra API key.

## Requirements

- A DeepInfra API key (set as `DEEPINFRA_API_KEY` environment variable)
- Any HTTP client or OpenAI SDK

## Model Tiers

| Model | Quality | Cost | Best For |
|-------|---------|------|----------|
| `black-forest-labs/FLUX-2-max` | Best | ~$0.07/image | Final published images, hero art |
| `black-forest-labs/FLUX-2-dev` | Good | ~$0.01/image | Drafts, iterations, social cards |
| `black-forest-labs/FLUX-2-klein-9b` | Fast | ~$0.015/image | Thumbnails, quick previews |

Default to `FLUX-2-dev` for drafts. Upgrade to `FLUX-2-max` only for final/published images.

## API Reference

**Endpoint:** `https://api.deepinfra.com/v1/openai/images/generations`
**Auth:** `Authorization: Bearer $DEEPINFRA_API_KEY`

### Request

```json
{
  "prompt": "Detailed image description",
  "model": "black-forest-labs/FLUX-2-dev",
  "size": "1024x1024",
  "n": 1
}
```

### Response

```json
{
  "created": 1707000000,
  "data": [
    {
      "revised_prompt": "...",
      "b64_json": "/9j/4AAQ..."
    }
  ]
}
```

### Supported Sizes

- `1024x1024` — Square (social media, thumbnails)
- `1536x1024` — Landscape 3:2 (article covers, headers)
- `1024x1536` — Portrait 2:3 (mobile, stories)
- `1920x1080` — Widescreen 16:9 (video thumbnails, banners)

## Prompt Engineering

Structure prompts as: `{subject}, {style}, {composition}, {lighting}, {color_palette}`

```
Example:
"Close-up of polished gold bars stacked in a vault with soft warm lighting,
professional photography style, shallow depth of field, dark background
with golden amber highlights, 4K quality"
```

Tips:
- Be specific about style and lighting
- Include negative constraints ("no text", "no watermarks") when needed
- Specify aspect-appropriate composition for the chosen size
- Iterate with `FLUX-2-dev` before committing to `FLUX-2-max`

## Workflow

1. Craft a detailed prompt for the desired image
2. Generate a draft with `FLUX-2-dev` (~$0.01)
3. Review and refine the prompt if needed
4. For final use, regenerate with `FLUX-2-max` (~$0.07)
5. Decode the base64 response and save to your storage backend

## Example (Python)

```python
import requests, base64, os

resp = requests.post(
    "https://api.deepinfra.com/v1/openai/images/generations",
    headers={"Authorization": f"Bearer {os.environ['DEEPINFRA_API_KEY']}"},
    json={
        "prompt": "Abstract data visualization with flowing blue particle streams, dark background, modern minimalist style",
        "model": "black-forest-labs/FLUX-2-dev",
        "size": "1536x1024",
        "n": 1,
    },
)

image_data = base64.b64decode(resp.json()["data"][0]["b64_json"])
with open("output.jpg", "wb") as f:
    f.write(image_data)
```

## Example (curl)

```bash
curl -X POST https://api.deepinfra.com/v1/openai/images/generations \
  -H "Authorization: Bearer $DEEPINFRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Professional corporate abstract background",
    "model": "black-forest-labs/FLUX-2-dev",
    "size": "1024x1024",
    "n": 1
  }'
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [marketintellabs](https://github.com/marketintellabs)
- **Source:** [marketintellabs/agent-skills](https://github.com/marketintellabs/agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-marketintellabs-agent-skills-ai-image-generation-deepinfra
- Seller: https://agentstack.voostack.com/s/marketintellabs
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
