SuperAPI AI Directory

xiaobao-flow2api

Coding & development

View repository

Updated 10-16 10:22

About this skill

Flow2API

This skill must use the bundled CLI instead of calling the HTTP API directly.

CLI path:

scripts/flow2api-cli

Update Mode

Only enter update mode when the user explicitly asks to "update", "update", "sync", or "refresh" this skill.

In that case:

  • Read UPDATE.md
  • Inspect the upstream flow2api/ source and documentation
  • Update the CLI first when API behavior or calling conventions change
  • Update the skill text only when the entry workflow or routing rules change

If the user does not explicitly ask for an update, do not run the update workflow.

Step 0: Read the CLI Help First

Before invoking the skill, read the CLI help:

scripts/flow2api-cli --help

The help output is the canonical place for:

  • Single JSON input mode
  • JSON parameter format
  • Supported subcommands
  • Supported model groups
  • Default config keys
  • .env lookup order

Do not duplicate CLI usage instructions anywhere else in this skill.

Step 1: Load Default Config from .env

This skill uses .env-based configuration through flow2api-cli.

Default lookup order:

  1. env_file in the command input JSON
  2. Current working directory .env
  3. .env

Preferred .env keys:

  • FLOW2API_BASE_URL
  • FLOW2API_API_KEY
  • FLOW2API_DEFAULT_IMAGE_MODEL
  • FLOW2API_DEFAULT_VIDEO_MODEL
  • FLOW2API_DEFAULT_FIRST_LAST_FRAME_MODEL
  • FLOW2API_DEFAULT_MULTI_IMAGE_VIDEO_MODEL
  • FLOW2API_DEFAULT_VIDEO_UPSAMPLE_MODEL

Rules:

  • Prefer .env
  • Keep base_url as origin only, without /v1, /models, or /api
  • If the user provides another base URL or API key for the current task, pass it through the command input JSON
  • All request values should be passed through one JSON input source
  • The JSON input source may come from --input, a JSON file path passed to --input, or stdin

Step 2: Choose the Correct CLI Command

Use these CLI commands:

  • Health check: health
  • OpenAI model list: list-openai-models
  • Alias list: list-aliases
  • Gemini model list: list-gemini-models
  • Gemini model lookup: get-model
  • OpenAI-compatible image generation: openai-image
  • Gemini-native image generation: gemini-image
  • Text-to-video: text-to-video
  • First-last-frame video: first-last-frame-video
  • Multi-image video: multi-image-video
  • Video upsample: video-upsample

Step 3: Check API Semantics from Upstream Sources

If you need to verify request semantics, supported models, streaming behavior, or protocol differences, inspect the upstream Flow2API materials directly instead of reading local reference notes.

Preferred source order:

  1. flow2api/src/api/routes.py
  2. flow2api/README.md
  3. flow2api/tests/test_api_routes.py
  4. flow2api/tests/test_gemini_generate_content.py
  5. Other relevant files under flow2api/src/ when needed

Rules:

  • Treat upstream code and tests as the source of truth
  • Prefer code and tests over README when they disagree
  • Do not call the HTTP endpoint directly when the CLI can do it
  • If a capability is missing in the CLI, extend the CLI first, then use it

Step 4: Result Handling

The CLI is responsible for output normalization.

Rules:

  • If the interface produces URL links, the CLI should print the URL links
  • If output_path is provided, the CLI should download URL resources to that path
  • If the response contains inline binary data instead of a URL, the CLI may save it to output_path
  • Prefer the CLI output over raw API JSON when reporting generation results

Step 5: Command Construction Rules

  • Pass all request values through CLI arguments
  • Use one JSON input source per command
  • Prefer the category-specific command over manually composing raw request bodies
  • Use --request only when a full custom payload is necessary
  • Use default models from config when the user does not specify a model
  • For Gemini-native image generation, use gemini-image
  • For OpenAI-compatible generation and all video generation flows, use the corresponding OpenAI-style command

Notes

  • flow2api-cli --help is the source of truth for CLI usage
  • Upstream flow2api code, README, and tests are the source of truth for API semantics
  • Keep this skill focused on routing through the CLI, not on re-documenting every API shape locally