agentleFS
stardustaistardustai/stardust-skills/skills/ai-services/SKILL.md

ai-services

Skill0 starsChanged 2 months agoMITView on GitHub

Use when the user asks to OCR an image or PDF (including tables, forms and complex layouts), transcribe an audio file, or turn text into speech, through the shared Stardust AI Services endpoint, or asks to connect an agent to the ai-services MCP server. One service covers OCR (RapidOCR or Qwen vision), ASR (Qwen3-ASR) and TTS (Qwen3-TTS).

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the ai-services MCP server is connected in this agent, call its tools directly (health, ocr_document, transcribe_audio, …

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AI Services

One Access-protected service for three jobs:

JobBackendTool / command
OCR, plain textRapidOCR (zh + en)ocr_document / ai_services.py ocr
OCR, tables and complex layoutsQwen vision, returns Markdownocr_document with engine="qwen"
Speech to textQwen3-ASRtranscribe_audio / ai_services.py asr
Text to speechQwen3-TTS CustomVoicesynthesize_speech / ai_services.py tts
  • Base URL: https://ai-services.preseen.ai
  • MCP endpoint: https://ai-services.preseen.ai/mcp
  • REST: GET /health, POST /ocr, POST /asr, POST /tts

Pick the path

  1. If the ai-services MCP server is connected in this agent, call its tools directly (health, ocr_document, transcribe_audio, synthesize_speech). Binary inputs and outputs are base64, so for large files prefer the script.
  2. Otherwise use the bundled client, which uploads local files directly and writes results to disk:
python3 "$HOME/.agents/skills/ai-services/scripts/ai_services.py" health

To connect an agent to the MCP server, use the endpoint above, for example in Codex config.toml:

[mcp_servers.ai_services]
enabled = true
url = "https://ai-services.preseen.ai/mcp"

For ChatGPT, add a custom MCP plugin with the same URL and OAuth. Never put a credential in the URL.

OCR

Choose the engine from the document, not by habit:

  • rapidocr (default): screenshots, receipts, scans and ordinary text. Fast, returns plain text with a confidence score.
  • qwen: tables, forms, multi-column or otherwise complex layouts. A vision model reads each page and returns Markdown, with tables as Markdown or HTML. Slower; it ignores --languages and reads at most 20 pages per call, so pass --pages for longer PDFs.
S="$HOME/.agents/skills/ai-services/scripts/ai_services.py"
python3 "$S" ocr /abs/path/receipt.png                       # rapidocr, markdown report
python3 "$S" ocr /abs/path/report.pdf --engine qwen --pages 1-3 --format text
python3 "$S" ocr /abs/path/scan.png --format json --output /abs/path/ocr.json

Formats: text (text only), markdown (headings, engine, confidence, warnings; the default), json (the service response). Treat low confidence and warnings as uncertainty: never silently correct names, amounts, dates or identifiers. If a table matters and rapidocr flattened it, rerun with --engine qwen.

ASR

python3 "$S" asr /abs/path/meeting.mp3 --language zh --format text
python3 "$S" asr /abs/path/call.m4a --format json --output /abs/path/call.json

--language is optional (auto-detected). json includes timestamped segments. Long audio can take minutes; the service re-encodes files over 24 MB itself.

TTS

Output is always MP3 and each request is limited to 3000 characters.

python3 "$S" tts "欢迎使用星尘智能服务。" --voice Vivian \
  --instructions "温暖、自然、语速稍慢" --output /abs/path/welcome.mp3
python3 "$S" tts --input-file /abs/path/script.txt --voice Serena --output /abs/path/narration.mp3

Voices: Vivian (default), Serena, Uncle_Fu, Dylan, Eric, Ryan, Aiden, Ono_Anna, Sohee. --instructions steers tone, emotion and pacing in plain language. For text over 3000 characters, split it at sentence boundaries yourself, with the user's agreement, and synthesize in pieces.

The Qwen3-TTS model unloads after about five idle minutes. The first call after that can take 2-3 minutes; the client retries once on Cloudflare's 524, so if it still fails, wait a minute and run it again.

Authentication

The service sits behind Cloudflare Access. The bundled client uses the shared Stardust Access client: the first request opens a browser for company login (an authorized @stardust.ai identity). The refresh token is kept in the local owner-only store, isolated by service origin.

python3 "$S" --auth-status     # check without starting a job
python3 "$S" --logout          # remove only this service's session

Approved headless workloads set both CF_ACCESS_CLIENT_ID and CF_ACCESS_CLIENT_SECRET from their secret manager. Never set only one, and never paste either value into chat, source, logs or reports.

Data handling

Files and text are sent to the Stardust service and its GPU backends. Do not send material the user has not agreed to share. The service itself writes nothing to disk beyond a temporary file that is deleted after the request (audio re-encoding); it does not control logging on the shared GPU gateway.

Troubleshooting

  • HTTP 401 / login loop: run --auth-status; sign in again if required.
  • HTTP 403 ... 1010: Cloudflare's browser-integrity check, not a login failure. See lib/stardust_access/README.md.
  • HTTP 502 ... backend: the GPU backend is busy or cold. Retry shortly; qwen OCR and TTS share GPUs with other models.
  • Wrong or empty OCR: try the other engine; check warnings in --format json.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.