@todoforai/image-api 2.1.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @todoforai/image-api
2
2
 
3
- Generate and edit images through the TODOforAI backend (gpt-image).
3
+ Generate and edit images through the TODOforAI backend (gpt-image, nano-banana, nano-banana-pro).
4
4
 
5
5
  ## Install
6
6
 
@@ -11,8 +11,8 @@ npm install -g @todoforai/image-api
11
11
  ## Usage
12
12
 
13
13
  ```bash
14
- image-api generate "An orange rocket on a white background" -o rocket.png
15
- image-api edit "Change only the background to black" --image rocket.png -o edited.png
14
+ tfa-imagegen generate "An orange rocket on a white background" -o rocket.png
15
+ tfa-imagegen edit "Change only the background to black" --image rocket.png -o edited.png
16
16
  ```
17
17
 
18
18
  Authenticate with `todoforai login`, `TODOFORAI_API_KEY`, or `--api-key`.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@todoforai/image-api",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "AI image generation and editing through TODOforAI (gpt-image)",
5
5
  "type": "module",
6
6
  "bin": {
7
- "image-api": "src/index.ts"
7
+ "tfa-imagegen": "src/index.ts"
8
8
  },
9
9
  "dependencies": {
10
10
  "commander": "^14.0.3"
package/src/api.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * Mount routing: a bridge-injected `dst_` device-session token is only accepted
5
5
  * on the `/dst/v1` mount; long-lived API keys go through `/api/v1`.
6
6
  *
7
- * Auth precedence (matches todoforai-subagent):
7
+ * Auth precedence (matches the tfa-* CLIs):
8
8
  * 1. --api-key flag
9
9
  * 2. TODOFORAI_API_TOKEN env (bridge-injected short-lived token)
10
10
  * 3. stored creds for explicit --api-url
@@ -19,7 +19,7 @@ import { homedir } from "os";
19
19
  import { join } from "path";
20
20
 
21
21
  // Mirrors @shared/fbe CodexImageGen{Input,Output,Content}; kept inline so this
22
- // CLI stays a zero-dep package (like todoforai-subagent).
22
+ // CLI stays a zero-dep package.
23
23
  export type CodexImageGenContent =
24
24
  | { type: "input_text"; text: string }
25
25
  | { type: "input_image"; imageUrl: string };
@@ -15,7 +15,7 @@ export const editCommand = new Command("edit")
15
15
  [],
16
16
  )
17
17
  .option("-o, --output <file>", "Output PNG file", "edited.png")
18
- .option("--model <model>", "Model (default: gpt-image-2)")
18
+ .option("--model <model>", "nano-banana | gpt-image-2 | nano-banana-pro; also: nano-banana-lite", "nano-banana")
19
19
  .option("--size <size>", "1024x1024 | 1536x1024 | 1024x1536 | 2048x2048 | 4096x4096", "1024x1024")
20
20
  .option("--quality <quality>", "low | medium | high")
21
21
  .option("--background <bg>", "auto | transparent | opaque")
@@ -3,19 +3,18 @@ import { runImageGen } from "../imagegen";
3
3
 
4
4
  export const generateCommand = new Command("generate")
5
5
  .description(
6
- "Generate an image via TODOFORAI's image generation endpoint.\n\n" +
7
- "Auth: TODOFORAI_API_TOKEN (bridge-injected) or TODOFORAI_API_KEY env (or --api-key)."
6
+ "Generate an image via TODOFORAI's image generation endpoint."
8
7
  )
9
8
  .argument("<prompt>", "Image prompt")
10
9
  .option("-o, --output <file>", "Output PNG file", "out.png")
11
- .option("--model <model>", "Model (default: gpt-image-2)")
10
+ .option("--model <model>", "nano-banana | gpt-image-2 | nano-banana-pro; also: nano-banana-lite", "nano-banana")
12
11
  .option("--size <size>", "1024x1024 | 1536x1024 | 1024x1536 | 2048x2048 | 4096x4096", "1024x1024")
13
12
  .option("--quality <quality>", "low | medium | high")
14
13
  .option("--background <bg>", "auto | transparent | opaque")
15
14
  .option("--output_format <fmt>", "png | webp | jpeg", "png")
16
15
  .option("--instructions <text>", "System instructions")
17
16
  .option("--api-url <url>", "TODOFORAI API URL (default: $TODOFORAI_API_URL or https://api.todofor.ai)")
18
- .option("--api-key <key>", "TODOFORAI API key (default: $TODOFORAI_API_TOKEN or $TODOFORAI_API_KEY)")
17
+ .option("--api-key <key>", "TODOFORAI API key")
19
18
  .action(async (prompt: string, opts) => {
20
19
  await runImageGen([{ type: "input_text", text: prompt }], opts);
21
20
  });
package/src/index.ts CHANGED
@@ -4,13 +4,12 @@ import { generateCommand } from "./commands/generate";
4
4
  import { editCommand } from "./commands/edit";
5
5
 
6
6
  program
7
- .name("image-api")
7
+ .name("tfa-imagegen")
8
8
  .description(
9
- "Image generation & editing CLI via TODOFORAI backend (gpt-image).\n\n" +
10
- "Auth: TODOFORAI_API_TOKEN (bridge-injected) or TODOFORAI_API_KEY env (or --api-key).\n" +
11
- "Run `todoforai login` to store credentials."
9
+ "Image generation & editing CLI via TODOFORAI backend.\n" +
10
+ "Models (--model): nano-banana (default, $0.02, general), gpt-image-2 (best for infographics/text-heavy), nano-banana-pro ($0.15, complex composition). Also: nano-banana-lite ($0.04, fastest, 1K only)."
12
11
  )
13
- .version("2.1.0");
12
+ .version("2.2.0");
14
13
 
15
14
  program.addCommand(generateCommand);
16
15
  program.addCommand(editCommand);