AI Agent Hub
Back to skills
New API Image Generation icon

New API Image Generation

Design & Media Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow the guide at https://skillhub.cn/install/skillhub.md to install @user_a0de7824/tupian.

About this skill

The Problem It Solves

In the field of AI image generation, developers and creators often need to integrate powerful generation capabilities into their own tools or workflows. Directly interfacing with the official OpenAI API can present challenges like access restrictions, cost, or compatibility issues. This skill provides a localized solution based on New API that is fully compatible with the OpenAI interface specification, enabling you to easily invoke functions like text-to-image generation and image editing without worrying about the underlying complex API adaptation and networking problems.

How the Skill Works

The skill encapsulates a command-line tool that performs image generation tasks by parsing parameters, sending standardized API requests, and processing the results.

Core Capabilities
- Text-to-Image (T2I): Generates new images from text prompts using models like gpt-image-1 or dall-e-3.
- Image-to-Image (I2I): Modifies or re-creates an original image based on one or more reference images combined with a new prompt.
- Multi-Image Fusion: Blends visual features from multiple reference images to generate a novel image.
- Batch Generation: Produces multiple related images in a single request.

Key Workflow Steps
1. Parameter Parsing: Reads command-line arguments such as the prompt (--prompt), model (--model), and size (--size).
2. API Request Construction: Encapsulates parameters into a JSON request body conforming to the OpenAI /v1/images/generations endpoint format, using the environment variable NEWAPI_API_KEY for authentication.
3. Result Retrieval and Saving: Receives the image URL or Base64 data from the API response, automatically downloads it, and saves it as a local file (e.g., PNG), with the path configurable via --output.

Applicability and Considerations

  • Dependencies and Configuration: Requires a Node.js 16+ environment to run. You must set the NEWAPI_API_KEY environment variable before use, which should contain your key from the New API platform.
  • Model Selection Differences: Capabilities vary by model. gpt-image-1 is recommended as it supports advanced parameters like background transparency (--background) and moderation level (--moderation). In contrast, dall-e-3 currently only supports generating one image per request (n=1).
  • Error Handling: A 401 error typically indicates an invalid API key, while 429 means you've hit a rate limit. Adjust requests or check key status based on the error code.
  • Parameter Limitations: Some parameters (like --background) are only supported by specific models, so model compatibility must be considered. Image size and quality are also subject to API-level constraints.

Use Cases

  • When designing an app UI prototype, need to quickly generate multiple visual drafts with different compositions based on a text description like 'minimalist login page' for team review.
  • An e-commerce operator needs to batch generate multiple consistent main images for new clothing product listings by uploading a base image and modifying the prompt to 'beach background'.
  • A content creator has a building sketch and wants to 'render it into a cyberpunk night scene illustration' to be used as an image for a social media article.
  • A game artist needs to blend features from three different character reference images to 'generate a new character concept with elven ears and mechanical armor' for exploring new design directions.

Best For

  • A **marketing specialist** who needs to quickly generate promotional graphics or visual drafts, often seeking inspiration and assets for social media posts or event posters.
  • A **e-commerce graphic designer** responsible for product detail page visuals, who needs to batch produce and optimize numerous product display images, especially for background replacement or style unification.
  • A **freelance illustrator/artist** working on concept design or sketch rendering, needing to quickly transform hand-drawn drafts or text ideas into digital images in various styles.
  • A **designer** engaged in architectural visualization or interior rendering, needing to quickly render wireframe sketches into different styles of effect diagrams for scheme comparison.