SuperAPI AI Directory

linkfox-aigc-textgen

Writing & research

View repository

Updated 10-16 00:00

About this skill

AI Text Generation

Uses a large language model to generate text content based on prompts, and supports passing in images, videos, etc. for combined image-text understanding, and video-text understanding and analysis.

Core Features

  • Dual-model selection: fast response (GEM_3_FLASH) and high-quality complex analysis (GEM_3_1_PRO).
  • Image-text/video content combination:imageUrls Supports both image and video URLs; up to 10 images, and usually 1 video.
  • Controllable thinking depth: 4-level thinkingLevel controls reasoning depth.
  • Asynchronous two-step invocation: after creating a task, taskId is returned immediately, and the client polls for the result, avoiding long-running synchronous timeouts.

Model Description

Model (model) Description Applicable Scenarios
GEM_3_FLASH Fast response (default) General copywriting, simple analysis, translation
GEM_3_1_PRO High-quality complex analysis In-depth analysis, long-form writing, complex reasoning

Thinking Level

thinkingLevel Description
minimal Close to no thinking (not supported by GEM_3_1_PRO)
low Low thinking
medium Balanced
high Maximum reasoning depth

Parameter Overview

  • Required fields:prompt、imageUrls(pass an empty array when there are no images and no videos [])、thinkingLevel(must be passed explicitly, recommended default minimal)
  • Media URL convention: image and video URLs are both passed through imageUrls passing(for example, for video analysis pass ["https://example.com/ref.mp4"]); do not use undocumented fields (such as videoUrl、videoUrls)

For the complete parameter table, response field structure, and error codes, see references/api.md。

Invocation Method

Uses an asynchronous two-step mode (consistent with imagegen):

  1. Create task:POST /aigc/textGenAsync → returns taskId
  2. Polling query:POST /aigc/textTaskQuery → returns PROCESSING / SUCCESS / FAILED
  • Python script(internally already encapsulates creation + polling, and the parameter passing method remains unchanged):
    • python scripts/aigc_textgen.py --stdin — Recommended, read JSON parameters from stdin to avoid shell escaping issues (such as python scripts/aigc_textgen.py --stdin < params.json)
    • python scripts/aigc_textgen.py --stdin --content-only — outputs only the content text (also already single-line)
    • python scripts/aigc_textgen.py '<JSON 参数>' [--inline] — direct passing for simple scenarios (disabled when prompt contains newline characters)

Polling strategy: single HTTP timeout is 150 seconds; polling interval decreases from 10 seconds to 5 seconds; total polling duration is up to 600 seconds. For complete parameters/response/error codes, see references/api.md。

Newline flattening is enabled by default (no flag needed): in all output modes, newlines in content are automatically replaced with the single character ⏎(U+23CE), and the entire content becomes a single line;--content-only only changes "output content text vs complete JSON" and does not affect this flattening behavior.

Output Contract (other agents parse according to this)

  • stdout contains only machine data, and can always be json.loads(--content-only exception, whose stdout is plain text content):
    • Default (small result) / --inline: stdout = full response JSON
    • Large result: stdout = JSON envelope {"ok":bool, "truncated":true, "savedPath":"<路径>", "bytes":int, "content":"<单行文本>"}
  • All hints/summaries/diagnostics (CHAIN-HINT, Saved full response, summarize) always go to stderr, without polluting stdout.
  • Exit code: success 0; failure (network error / errcode non-200 / status==FAILED) non- 0 — the agent should prioritize using the exit code to determine errors.

Data reading recommendations: for small results directly json.loads(stdout) take content; for large results read the stdout envelope's content(or according to savedPath use jq to extract the complete field), avoiding the entire JSON entering the context.

Resolve authentication and compute power issues

When the following abnormal situations occur, use references/onboarding.md to guide resolution of the problem:

Abnormal situations

  • API Key not configured: environment variable not configured LINKFOX_AGENT_API_KEY, and also not configured LINKFOXAGENT_API_KEY。
  • Response 401 or 402 status code
  • Response indicates insufficient compute power or balance: message contains "insufficient compute balance/insufficient billing/insufficient balance/quota exceeded/insufficient balance/package expired/recharge required/please recharge", or content with similar meaning.

Automatic chained call decision rules

The Agent must follow the decision tree below, and execute automatically upon reading the rules, without the user needing step-by-step instructions.

用户需求后续是否涉及 作图 / 生图 / 换模特 / 视频 / imagegen / videogen?
│
├─ YES ──→ 使用 --content-only 模式(换行符已压平为单字符 ⏎,可安全内联拼接)
│           捕获 stdout → 内联拼进下游参数 JSON → 调用下游 Skill
│
└─ NO  ──→ 使用默认模式
            小结果 → json.loads(stdout) 取 content
            大结果 → 读 stdout JSON 信封的 content,或按 savedPath 用 jq 提取

Newline placeholder convention (core mechanism)

content usually contains real newline characters, and directly entering a shell variable or concatenating JSON will break lines. The scriptby default(any mode, no flag needed) replaces the newline characters in content uniformly with the single character ⏎(U+23CE), while covering both the real newline control character and the literal \n forms:

  • ⏎ in shell single quotes and JSON stringsneither requires escaping, the entire content becomes a single line, which can be safely captured by variables and inline-concatenated;
  • after downstream AIGC scripts (imagegen / videogen / videogen-multi) parse the parameters, they willautomatically convert ⏎ back to newline characters (the decode_nl_in_objinlined in each AIGC script), so the text is passed losslessly;
  • after the entire content becomes a single line, it can be directly captured into a shell variable and inline-concatenated into the downstream parameter JSON, without the need for an intermediate file.

Standard two-step chained call (imagegen / videogen / any AIGC Skill)

# ── Step 1:生文,--content-only 直接拿到单行 content(换行已是 ⏎),捕获进变量 ──────
PROMPT=$(python scripts/aigc_textgen.py --stdin --content-only < textgen_params.json)

# ── Step 2:内联拼接进下游参数并调用下游 Skill(jq 负责正确的 JSON 转义) ───────────
PARAMS=$(jq -nc --arg p "$PROMPT" \
  '{prompt:$p, imageUrls:["https://example.com/ref.jpg"], provider:"BANANA_PRO", outputNum:1, resolution:"1K", aspectRatio:"1:1"}')
python ../linkfox-aigc-imagegen/scripts/aigc_imagegen.py "$PARAMS"
# 下游脚本接收后自动把 ⏎ 还原为换行符

When there is no jq , you can directly inline $PROMPT into the single-quoted JSON: since ⏎ requires no escaping and has no real newlines, it can also be safely concatenated (provided the content does not contain double quotes; when double quotes are present, prefer using jq)。

Key parameter reference for each downstream Skill

Downstream Skill Key fields (adjust as needed, prompt is injected by upstream)
linkfox-aigc-imagegen {"imageUrls":[...],"provider":"BANANA_PRO","outputNum":1,"resolution":"1K","aspectRatio":"1:1"}
linkfox-aigc-videogen {"imageUrls":[...],"model":"WAN2_1","outputNum":1,"resolution":"720P","duration":5}
linkfox-aigc-imagegen-cloth {"imageUrls":[...],"outputNum":1,"aspectRatio":"1:1"}
linkfox-aigc-imagegen-product {"imageUrls":[...],"outputNum":1,"aspectRatio":"1:1"}

Usage guide

  1. Model selection: for simple tasks use GEM_3_FLASH(default, fast response); for complex analysis and long-form writing use GEM_3_1_PRO。
  2. Prompt: maximum 100,000 characters, the more specific the description the better the effect.
  3. Image/video input: pass in the media URL via imageUrls . For plain text use []; for image understanding, pass 1–10 images; for video understanding, usually pass 1 video URL (e.g., .mp4). For complex video shot segmentation/content analysis, it is recommended to use GEM_3_1_PRO + thinkingLevel: low。
  4. Thinking level: choose minimal/lowfor deep reasoning; choose high。
  5. Video failure fallback: if the returned video is unreadable, media access fails,10005 or the content is empty, frames should be extracted as images and then passed to imageUrls(see the frame extraction process in the downstream business skill).

Example

1. Basic text generation

{"prompt": "Write a compelling product description for a wireless bluetooth speaker, highlighting portability and sound quality", "imageUrls": [], "thinkingLevel": "minimal"}

2. Combined image + text analysis

{"prompt": "分析这张商品主图的构图和卖点表达", "imageUrls": ["https://example.com/product-main.jpg"], "model": "GEM_3_1_PRO", "thinkingLevel": "high"}

3. Combined video + text analysis

{"prompt": "分析该参考视频的镜头节奏、卖点表达与可复刻的分镜结构", "imageUrls": ["https://example.com/reference.mp4"], "model": "GEM_3_1_PRO", "thinkingLevel": "low"}

4. Quick translation

{"prompt": "Translate to German: 'Wireless Bluetooth Speaker with LED Light'", "imageUrls": [], "model": "GEM_3_FLASH", "thinkingLevel": "low"}

Display rules

  • Directly display the generated text content.

Limitations

  • The prompt can be up to 100,000 characters.
  • imageUrls Up to 10 URLs; video analysis usually passes only 1 video URL, and mixing it with image URLs is not recommended.
  • GEM_3_1_PRO Does not support minimal thinking level.
  • On failure, retry up to 3 times.

Applicable and not applicable

Applicable:

  • Product copy/title/five-point description generation
  • Image content analysis and description
  • Text translation
  • Data analysis summary
  • Video analysis

Not applicable:

  • Image generation → linkfox-aigc-imagegen
  • Video generation → linkfox-aigc-videogen
  • Report format output → linkfox-report-generator

Feedback

See references/api.md。