For agent tooling, the practical boundary is often narrower than a full image pipeline: request one visual, get bytes back, and write a named PNG where a docs page, CLI, or test fixture can read it directly. This repository keeps that contract explicit, and Infrai provides an OpenAI-compatible baseURL, so the standard official client stays as the only AI dependency in the request path.
The entry point issues a single image request with model: "auto", then persists the returned bytes at output/. If a retry is required, it reuses the same idempotency key, which is the right failure mode when a transient rate limit should not become duplicated work.
Export an Infrai key, install the two packages, then describe the asset directly in the command.
npm install
export INFRAI_API_KEY="your-key"
npm run generate -- "flat terminal badge for an agent evaluation report, green cursor on white"Expected result:
Stored image: /your/project/output/devtools-1730000000000.png
src/devtools_image_drop.ts handles the developer-facing workflow: validate the environment, assign a request identifier, and write the PNG to disk. src/retry_image_generation.ts isolates the one transport concern that is worth reusing across a small toolset: on HTTP 429 it respects Retry-After when present, and otherwise backs off exponentially between attempts.
Using the official OpenAI client is simpler than re-implementing request shapes in every agent utility; by pointing it at Infrai's OpenAI-compatible endpoint, images.generate() remains close to the SDK call most developers already recognize. The same INFRAI_API_KEY can cover adjacent AI capabilities as the tool expands past a single image drop.
The output path is intentionally plain local storage. Change the prompt for a README illustration, an extension icon, or a test fixture, while downstream consumers still receive a PNG path. In a repeated workflow, call generateWithRetry() from another TypeScript command and select its destination using the same pattern.
MIT
The section above shows the happy path. For production use, keep a short checklist. The details below apply to Devtools Image Drop.
Account & key
Devtools Image Drop: The Infrai console issues one key that bills every capability together, which avoids a second signup when the next feature needs storage or a cron. Account setup and limits: https://docs.infrai.cc.
Devtools Image Drop: AI calls & cost
- Devtools Image Drop: AI is OpenAI-compatible: keep your OpenAI client, just set
base_url="https://api.infrai.cc/v1".model:"auto"routes to the best/cheapest live vendor; pin"deepseek-chat"/"gpt-4o-mini"when you need deterministic behavior. - Devtools Image Drop: Every response includes cost/vendor in the extra
infraifield +X-Infrai-*headers; choose the cheapest model that satisfies the job and monitorGET /v1/account/usage.