ask-my-tti
v0.0.1
Published
Zero-dependency AI image generation module
Maintainers
Readme
ask-my-tti
Zero-dependency AI image generation module. Works with any OpenAI-compatible image API (DALL-E, etc.).
Install
npm install ask-my-ttiConfigure
npx ask-my-tti configReuses the same ~/.askttirc config. Prompts for Base API URL, API Key, and Model (default: dall-e-3).
CLI usage
npx ask-my-tti draw "Cow" cow.jpgLibrary usage
const amtti = require("ask-my-tti");
// Sync
amtti.drawSync("Cow", "cow.jpg");
// Async
await amtti.draw("Cow with a calf", "cows.jpg");
// With options
amtti.drawSync("Cow", "widecow.jpg", { size: "1792x1024" });
amtti.drawSync("Cow", "lowcow.jpg", { quality: "low" });
// Get current model
console.log(amtti.getCurrentModel());Options
All options are optional:
| Option | Default | Description |
|--------|---------|-------------|
| size | 1024x1024 | Image size (e.g., 1792x1024, 1024x1792) |
| quality | auto | Generation quality (auto, hd, standard, low) |
| style | vivid | Image style (vivid, natural, auto) |
| model | from config | Override model name |
The output format is inferred from the file extension (.jpg → jpeg, .png → png, .webp → webp).
API
amtti.drawSync(prompt, outputPath, options?): { outputPath, revisedPrompt }
Generates an image synchronously and saves to outputPath. Returns metadata including revisedPrompt if the API rewrote the prompt.
amtti.draw(prompt, outputPath, options?): Promise<{ outputPath, revisedPrompt }>
Async version.
amtti.getCurrentModel(): string
Returns the model from the active config.
License
Unlicense — see LICENSE.
