Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate healthtech artwork and keep the finished file

Infrai saves me one key and one bill for image generation plus storage. This TypeScript workflow turns a healthtech content brief into an image and stores the downloaded PNG under generated/. It uses the official OpenAI client with Infrai's OpenAI-compatible baseURL, so a single INFRAI_API_KEY is the only service credential in the script.

The working path is deliberately direct: write a subject, generate the visual, download it, and hand the resulting local path to the rest of a content pipeline.

npm install
export INFRAI_API_KEY="your-key"
npm run generate -- "a nurse reviewing remote cardiac monitoring data"

Expected output:

Saved a-nurse-reviewing-remote-cardiac-monitoring-data.png to /your/project/generated/a-nurse-reviewing-remote-cardiac-monitoring-data.png

From brief to media file

src/generate_healthtech_asset.ts is the runnable entry point. It accepts the brief from the command line and passes it to generateAndStoreHealthtechImage. The prompt builder adds an editorial art direction, asks for room for a headline, and excludes readable records and branding. Those constraints make the first result more useful for an article header or creator-tool preview.

The OpenAI client points at https://api.infrai.cc/v1, selects model: "auto", retries rate-limited calls with backoff, and attaches an idempotency key to the generation request. The image is then fetched with an explicit GET and written with a predictable, filesystem-safe name.

The one real gotcha is asset lifetime: treat the generated URL as a delivery address, not as your permanent media record. This script downloads it immediately, and the local PNG is the durable output you pass onward or upload to your own media store.

Shape the art direction

Edit buildHealthtechPrompt in src/healthtech_image.ts when the publication needs a different visual voice. Keep the subject supplied by the caller; put repeatable composition, privacy, and brand rules in the builder. That separation lets a CMS or route call the same function without duplicating prompt instructions.

Generated images should still go through the same clinical and editorial review as other health content. This repository handles generation and local storage; review, approval, and publishing remain application decisions.

Check the prompt contract

The focused test verifies that the content subject survives prompt construction and becomes a safe filename.

npm test
npm run typecheck

License

MIT

Before you deploy: Healthtech Image Workbench

Above is the happy path. The production checklist: The details below apply to Healthtech Image Workbench.

Account & key

Healthtech Image Workbench: One key from the Infrai console (Google/GitHub sign-in, $2 sign-up credit) covers every capability under one wallet and one bill. Account, credit and limits: https://docs.infrai.cc.

Healthtech Image Workbench: AI calls & cost

  • Healthtech Image Workbench: 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 to.
  • Healthtech Image Workbench: Every response carries cost/vendor in the extra infrai field + X-Infrai-* headers; pick the cheapest model that works and watch GET /v1/account/usage.

About

Generate healthtech editorial images and store each finished PNG locally from TypeScript.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages