Contents

convert_video_mp4.phpConvert an uploaded browser video to iPhone-compatible MP4
video_studio_job.phpCreate Shortform Studio MP4 jobs with optional uploaded starting photos
email.phpSend plain-text email via SMTP / PHPMailer
ffmpeg_helper.phpInspect, convert, and thumbnail uploaded media with safe FFmpeg presets
html_gen.phpGenerate HTML apps or PHP REST API endpoints from a plain-English prompt
image_gen.phpRecommended image generation API for text-to-image PNG output
image_gen_gemini.phpUse only when an input image is needed for Gemini image editing
image_gen_seedream.phpUse only when one or more input images are needed for Seedream editing
kgraph.phpCreate, update, delete, and query local knowledge graphs with llm.php
llm.phpRecommended LLM API for text answers
photo_score.phpScore a person photo against the 15-point composition checklist
llm_gemini.phpUse only when Gemini attachment/image/audio content is needed
llm_grok.phpUse only when image attachments or Grok-specific behavior are needed
lyrics.phpTranscribe an uploaded MP3 into cleaned lyric lines via AIMLAPI
memory.phpCreate and manage structured long-term memory files with llm.php
notes.phpCreate, read, edit, list, complete, restore, and delete durable note files
music_gen.phpCreate and check MiniMax Music 2.0 generation jobs via AIMLAPI
music_video_studio.phpPlan Music Video Studio lyrics and image prompts via REST
pdf_creator.phpCreate a PDF from finished document text and layout options
rag.phpAsk a Gemini File Search store and get a brief JSON answer
rate-limit.phpPer-program rate-limit API and admin dashboard
steam.phpFetch Steam game reviews or community discussion search results
stock.phpFetch stock quotes, company profiles, and financial metrics via Finnhub
transfer.phpUpload temporary files and retrieve them with transfer.promptbox.cn receipts
transcribe.phpTranscribe uploaded or base64 audio to plain text using Gemini
transcript.phpRetrieve plain-text transcripts for public YouTube videos
tts_inworld.phpConvert text to speech and stream audio via AIML / Inworld TTS
twitter.phpSearch Twitter/X, Facebook, and Reddit posts and comments
web.phpLive web search proxy returning a number or plain-text answer
web_read.phpFetch one exact public webpage and return cleaned readable text
youtube.phpSearch YouTube and get AI-synthesized answers from video transcripts

convert_video_mp4.php

Browser video to MP4 fallback converter

Converts an uploaded browser-generated video file to MP4 with H.264 video and AAC audio. Shortform Studio normally uses its primary server-side assembler directly, so this endpoint is a fallback.

POST https://promptbox.cn/api/convert_video_mp4.php
NameTypeDescription
videofilerequiredUploaded WebM or other ffmpeg-readable video, up to 600 MB.

Returns video/mp4 on success. Errors are plain text and logged to api/convert_video_mp4.log. The helper is rate limited as video_studio_convert_mp4.

video_studio_job.php

Shortform Studio server-rendered MP4 jobs

Creates a server-side Shortform Studio job, generates narration or music, generates missing scene images, renders subtitles onto portrait slides, and assembles an MP4. Use JSON for ordinary jobs or multipart form data when uploading starting photos.

POST https://promptbox.cn/api/video_studio_job.php
NameTypeDescription
actionstringrequiredUse start, then call step with the returned job_id until phase is complete.
narrationstringrequiredSpoken script or music-only subtitle script.
topicstringoptionalTopic context for image prompts and outro generation.
voicestringoptionalNarrator voice. Default: Ashley.
music_onlybooleanoptionalWhen true, creates instrumental music and subtitles without spoken narration.
starting_photos[]file[]optionalMultipart-only image uploads, up to 12 files and 10 MB each. They become the first scene slides, cropped to portrait and rendered with subtitles; generated images begin after them.
{ "success": true, "job": { "id": "...", "phase": "images", "progress": 24, "video_url": "" } }

The helper is rate limited as video_studio_server_job, logs debug details only when debug mode is enabled, and keeps temporary job files under api/video_studio_jobs/.

email.php

Send plain-text email via SMTP / PHPMailer

Sends a plain-text email through Hostinger's SMTP server using PHPMailer. The From address is always adam@promptbox.cn (PromptBox); an optional custom sender is set as the Reply-To header instead. All three of recipient, subject, and body are required.

https://promptbox.cn/api/email.php  GET POST
NameTypeDescription
recipientstringrequiredDestination email address. Must be a valid email format.
subjectstringrequiredEmail subject line.
bodystringrequiredPlain-text body of the email.
senderstringoptionalPreferred From address (used as Reply-To if it differs from the server's SMTP address). Default: adam@promptbox.cn.
{ "sent": true } // or on failure: { "sent": false, "error": "Mailer error: ..." }
# Send via GET GET email.php?recipient=user@example.com&subject=Hello&body=This+is+a+test+message. # Send via POST JSON POST email.php Content-Type: application/json { "recipient": "user@example.com", "subject": "Meeting reminder", "body": "Don't forget our call at 3 PM today." }

ffmpeg_helper.php

Safe REST access to Hostinger FFmpeg

Runs common FFmpeg tasks for external HTML apps without exposing arbitrary command execution. Supports media inspection, format conversion, and video thumbnail extraction from an uploaded file.

GET POST https://promptbox.cn/api/ffmpeg_helper.php
ActionMethodReturnsDescription
infoGET or POSTJSONReturns helper version, FFmpeg version, limits, and supported presets.
probePOSTJSONReturns FFprobe stream and format metadata for the uploaded media.
convertPOSTFile bytesConverts uploaded media with a safe preset: mp4, webm, mp3, m4a, wav, or gif.
thumbnailPOSTJPEGExtracts one video frame as a JPEG thumbnail.
NameTypeDescription
actionstringrequired*info, probe, convert, or thumbnail. Defaults to info for GET.
mediafilerequiredUploaded audio or video file, up to 300 MB. Aliases file, video, and audio are also accepted.
presetstringoptionalFor convert; one of mp4, webm, mp3, m4a, wav, or gif. Default: mp4.
startnumberoptionalStart time in seconds for conversion. Range: 0-600.
durationnumberoptionalMaximum converted duration in seconds. Range: 0-600.
widthnumberoptionalOutput width for video, GIF, or thumbnail. Keeps aspect ratio. Range: 64-3840.
qualitynumberoptionalVideo CRF quality for mp4 and webm. Lower is better/larger. Range: 18-35, default 23.
audio_bitratenumberoptionalAudio bitrate in kbps for compressed outputs. Range: 64-320, default 128.
timenumberoptionalFor thumbnail; frame time in seconds. Default: 1.
const form = new FormData();
form.append('action', 'convert');
form.append('preset', 'mp4');
form.append('width', '720');
form.append('media', fileInput.files[0]);

const response = await fetch('https://promptbox.cn/api/ffmpeg_helper.php', {
  method: 'POST',
  body: form
});
if (!response.ok) throw new Error(await response.text());
const mp4Blob = await response.blob();

info and probe return JSON like { "success": true, ... }. convert returns the requested media bytes with the matching content type, and thumbnail returns image/jpeg. Errors return JSON { "success": false, "error": "...", "code": 400 } with an appropriate HTTP status. The helper sends permissive CORS headers, logs errors to api/ffmpeg_helper.log, and is rate limited as ffmpeg_helper.

html_gen.php

AI-powered HTML app and REST API generator

Takes a plain-English description and uses Gemini to generate a complete working program. By default it preserves the original HTML generator behavior: a self-contained mobile-friendly HTML/CSS/JavaScript app is saved in public_html/logi/logi_code/ as the next numbered codeN.html file, and the public URL is returned.

Pass api=1, rest=1, or mode=api to generate a PHP REST API endpoint instead of a user interface. API mode saves a unique descriptive PHP filename in public_html/api/, such as recipe-nutrition-calculator-api.php, then appends usage documentation for that generated endpoint to this api.html reference page. It does not create a separate .txt documentation file.

Every generated REST API uses the shared rate-limit.php helper, returns JSON 429 responses when the helper denies a request, and writes server-side failures to an endpoint-specific .log file in public_html/api/.

Generated HTML apps can call web.php for live web data, llm.php for lightweight AI tasks, and image_gen.php for runtime image generation. A pre-generation image manifest (<!-- APP_GEN_PREGENERATE_IMAGES [...] -->) can also be embedded in HTML output to generate up to 30 static images at save time. Generated REST APIs are PHP endpoints that accept HTTP inputs and return JSON.

https://promptbox.cn/api/html_gen.php  GET POST
NameTypeDescription
promptstringrequiredDescription of the HTML app or REST API to generate. Also accepted as q.
apibooloptionalPass 1, true, or yes to generate a PHP REST API endpoint instead of an HTML user interface. Aliases: rest, rest_api, api_mode; mode=api, mode=rest, or type=api also works.
task_idstringoptionalStable ID to use for completion tracking. If omitted, html_gen.php creates one. Completion or failure is posted to ve-asked-html-gen-inform-api.php so Sentience background/chain turns can notice finished jobs.

Default HTML mode returns the created codeN.html file under logi/logi_code/:

{ "success": true, "filename": "code42.html", "filepath": "/path/to/code42.html", "url": "https://logi.promptbox.cn/logi_code/code42.html", "task_id": "htmlgen_app_abc123", "generated_images": [...], "image_errors": [] }

API mode returns the created descriptive .php endpoint under api/ and reports whether this page was updated with generated endpoint documentation:

{ "success": true, "filename": "recipe-nutrition-calculator-api.php", "filepath": "/path/to/api/recipe-nutrition-calculator-api.php", "mode": "rest_api", "docs_updated": true, "docs_url": "https://promptbox.cn/api.html#recipe-nutrition-calculator-api", "url": "https://promptbox.cn/api/recipe-nutrition-calculator-api.php", "task_id": "htmlgen_api_def456" }

On completion or failure, html_gen.php also posts a notification with task_id, status, result URL, filename, docs URL, and a prompt preview to ve-asked-html-gen-inform-api.php.

# Generate a tip calculator app GET html_gen.php?prompt=A+tip+calculator+with+split+bill+support # POST with JSON body POST html_gen.php Content-Type: application/json { "prompt": "A flashcard quiz app with spaced repetition for learning vocabulary" } # Generate a PHP REST API endpoint instead of an HTML UI POST html_gen.php Content-Type: application/json { "prompt": "A recipe nutrition calculator API", "api": true }

image_gen.php

AI image generation via AIML / z-image-turbo

Recommended image generation API. Use image_gen.php for normal text-to-image requests; use the Gemini or Seedream image helpers only when an existing image input is needed for editing, style transfer, or image-conditioned generation. Generates a PNG image from a text prompt using AIML's alibaba/z-image-turbo model. Returns the raw image bytes directly as image/png — use response.blob() and URL.createObjectURL() in browser apps. Portrait (3:4) by default; set landscape=1 for landscape (4:3) output. AIML acceleration is off by default; pass acceleration=high to enable it for faster generation. AIML's safety checker is off by default; opt in with safety_checker=1. To have the server rewrite and sanitize the image prompt with llm.php before generation, pass optimize_prompt=1.

When called as a library function (require_once 'image_gen.php'), use generateImage($prompt, $isLandscape, $enableSafetyChecker, $acceleration, $optimizePrompt) which returns the raw binary string, or run_image_gen($inputs) which saves the image to logi_image.png and returns a public URL.

On sites that block external fetch() but allow external images, such as newer free Neocities sites, set the helper URL directly as an image source instead of fetching a blob.

https://promptbox.cn/api/image_gen.php  GET POST
NameTypeDescription
promptstringrequiredText description of the image to generate. Also accepted as q.
landscapebooloptionalPass 1, true, or landscape to generate landscape (4:3). Default is portrait (3:4).
accelerationstringoptionalDefault is off, which omits AIML's acceleration field. Pass high for faster generation. Alias: speed.
safety_checkerbooloptionalPass 1, true, yes, or on to enable AIML's safety checker. Default is off. Aliases: safetyChecker, enable_safety_checker, enableSafetyChecker.
optimize_promptbooloptionalPass 1, true, yes, or on to call llm.php first and rewrite/sanitize the prompt for image generation. Default is off. Aliases: optimizePrompt, sanitize_prompt, sanitizePrompt, refine_prompt, refinePrompt, prompt_optimize, promptOptimize.
copyToDeletedbooloptionalIf true, also copies the image to a storage/deleted/ archive directory on the server.

HTTP 200 with Content-Type: image/png and raw PNG bytes on success. On error: plain text error message with an appropriate HTTP error code.

# Portrait image (default) GET image_gen.php?prompt=A+serene+Japanese+garden+at+dawn # Landscape image GET image_gen.php?prompt=Futuristic+city+skyline+at+night&landscape=1 # Enable acceleration GET image_gen.php?prompt=A+serene+Japanese+garden+at+dawn&acceleration=high # Enable AIML safety checker GET image_gen.php?prompt=A+serene+Japanese+garden+at+dawn&safety_checker=1 # Optimize and sanitize the prompt with llm.php first GET image_gen.php?prompt=quick+sketch+of+a+cozy+robot+cafe&optimize_prompt=1 # Fetch in JavaScript (browser app) const res = await fetch('image_gen.php?prompt=' + encodeURIComponent(prompt)); const blob = await res.blob(); img.src = URL.createObjectURL(blob); # Neocities/free-CSP direct image loading img.src = 'https://promptbox.cn/api/image_gen.php?prompt=' + encodeURIComponent(prompt);

image_gen_gemini.php

Gemini image generation with optional image editing

Use image_gen.php for normal text-to-image generation. Use this helper only when an existing input image is needed for Gemini image editing, style transfer, or image-conditioned generation. It uses Gemini's gemini-3.1-flash-image-preview model and returns raw image bytes; send the input image as base64 (with or without a data URI prefix) in the image parameter, or as a multipart file upload. Portrait (3:4) is the default; landscape (4:3) can be requested. The helper uses Gemini's default 1K output unless image_size=4K or four_k=1 is passed.

On sites that block external fetch() but allow external images, such as newer free Neocities sites, set the helper URL directly as an image source instead of fetching a blob.

https://promptbox.cn/api/image_gen_gemini.php  GET POST
NameTypeDescription
promptstringrequiredText prompt describing the image to generate (or the edit to apply to an input image). Also accepted as q.
landscapebooloptionalPass 1 or true for landscape (4:3). Default is portrait (3:4).
image_sizestringoptionalPass 4K to request Gemini 4K output while keeping the selected 3:4 or 4:3 aspect ratio. Aliases: imageSize=4K, four_k=1, 4k=1, image_4k=1, use_4k=1.
imagestring or fileoptionalInput image for editing/style transfer. Accepted as a base64 string (plain or data URI), a JSON object with inlineData.data, or a multipart file upload. Supported formats: PNG, JPEG, WEBP, HEIC, HEIF. Max 20 MB.
image_mime_typestringoptionalMIME type of the input image when passing plain base64 without a data URI. E.g. image/png.

HTTP 200 with the detected MIME type (image/png, image/jpeg, etc.) and raw image bytes. On error: plain text message with appropriate HTTP status code.

# Text-to-image (landscape) GET image_gen_gemini.php?prompt=Watercolor+painting+of+a+mountain+lake&landscape=1 # Neocities/free-CSP direct image loading img.src = 'https://promptbox.cn/api/image_gen_gemini.php?prompt=' + encodeURIComponent(prompt); # Image editing via POST POST image_gen_gemini.php Content-Type: application/json { "prompt": "Make this photo look like a Van Gogh painting", "image_size": "4K", "image": "data:image/jpeg;base64,/9j/4AAQ..." }

image_gen_seedream.php

Seedream v4 image generation and editing via AIML

Use image_gen.php for normal text-to-image generation. Use this helper only when one or more existing input images are needed for Seedream editing or image-conditioned generation. It uses ByteDance Seedream v4 through AIML; without input images it calls bytedance/seedream-v4-text-to-image, and with input images it calls bytedance/seedream-v4-edit with image_urls. It returns raw image bytes like image_gen_gemini.php.

https://promptbox.cn/api/image_gen_seedream.php  GET POST
NameTypeDescription
promptstringrequiredText prompt describing the image to generate or edit. Also accepted as q.
landscapebooloptionalShortcut for landscape_4_3 when image_size is omitted. Default is portrait.
imagestring or fileoptionalInput image for editing. Accepted as a URL, base64 string, data URI, JSON object with inline data, or multipart file upload. Supported upload/base64 formats: PNG, JPEG, WEBP. Max 8 MB each.
image_urlsarray or stringoptionalOne or more public image URLs or base64/data URI images for Seedream edit mode. Also accepts images. Max 10 input images.
image_sizestringoptionalsquare_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, or landscape_16_9.
num_imagesintegeroptionalNumber of images requested from AIML, 1 to 4. The helper returns the first image.
seedintegeroptionalOptional seed.
sync_modebooloptionalPassed through to AIML when provided.
safety_checkerbooloptionalPassed as enable_safety_checker. Default false.

HTTP 200 with the detected image MIME type and raw image bytes. On error: plain text message with an appropriate HTTP status code.

# Text-to-image GET image_gen_seedream.php?prompt=A+T-Rex+relaxing+on+a+beach&landscape=1 # Image edit via JSON POST image_gen_seedream.php Content-Type: application/json { "prompt": "Put the T-Rex in a business suit in a cozy cafe", "image_urls": [ "https://example.com/t-rex.png", "https://example.com/blue-mug.jpg" ] }

kgraph.php

Local knowledge graph helper powered by llm.php

Creates, updates, deletes, and answers questions from local JSON knowledge graphs saved in the site-level kgraph/ folder. It uses llm.php to extract entities and relationships from new knowledge, merge them into existing graph nodes and edges, and answer questions using only the saved graph. The helper is rate limited as kgraph and logs failures to api/kgraph.log.

Use this when an app needs a small, editable memory graph instead of document search. Each graph is stored as https://promptbox.cn/kgraph/{graph_id}.json with nodes, edges, and notes.

https://promptbox.cn/api/kgraph.php  GET POST
NameTypeDescription
actionstringoptionalDefault: answer. Supported values: create, delete, add, answer, and get. Hyphenated aliases are accepted.
graph_idstringrequired except create with title/nameSafe graph identifier. Letters, numbers, dots, underscores, and hyphens are kept; other characters become hyphens. Aliases: id, name.
titlestringoptionalHuman-readable title for a new graph. Aliases: display_name, name. If graph_id is omitted on create, the title/name is slugged into the graph ID.
knowledgestringrequired for add; optional for createPlain-text facts, notes, records, or source material to merge into the graph. The LLM may update previous node summaries and relationships. Aliases: text, content, prompt for add.
questionstringrequired for answerQuestion to answer from the graph. Aliases: prompt, q.
modelstringoptionalModel selector passed to llm.php. Default uses the standard DeepSeek flash model; pass pro for the pro model.
{ "success": true, "graph_id": "travel-expenses", "content": "Answer from the graph...", "node_count": 8, "edge_count": 10, "code": 200 }

Create and add return the saved graph JSON. Delete returns { "success": true, "deleted": "graph-id" }. On error: { "success": false, "error": "...", "code": 400 } or another relevant HTTP status. Rate-limit failures return HTTP 429 and may include a Retry-After header.

# Create a graph with initial knowledge POST kgraph.php Content-Type: application/json { "action": "create", "graph_id": "travel-expenses", "title": "Travel Expenses", "knowledge": "Adam can expense business meals up to $75 with receipts." } # Add or update knowledge POST kgraph.php Content-Type: application/json { "action": "add", "graph_id": "travel-expenses", "knowledge": "Hotel stays require manager approval when over $250 per night." } # Answer a question from the graph GET kgraph.php?graph_id=travel-expenses&question=What+needs+approval%3F # Fetch the raw graph JSON GET kgraph.php?action=get&graph_id=travel-expenses # Delete a graph POST kgraph.php Content-Type: application/json { "action": "delete", "graph_id": "travel-expenses" }

memory.php

Structured long-term memory manager powered by llm.php

Creates and manages compact long-term memory JSON files for LLM apps. Memory files are saved in the site-level memory/ folder as https://promptbox.cn/memory/{memory_id}.json. The helper stores only a summary plus structured sections: user_profile, preferences, operational_directives, interaction_tips, projects, knowledge_nodes, recent_context, and open_loops.

Use this when an app needs durable, compact context that can be read by humans and reloaded into prompts. Add and forget actions call llm.php to merge new facts, deduplicate memory, delete weak/noisy/insignificant details, and remove forgotten content. The helper is rate limited as memory and logs failures to api/memory.log.

https://promptbox.cn/api/memory.php  GET POST
NameTypeDescription
actionstringoptionalDefault: get. Supported values: create, add, forget, get, and purge. Aliases: new, output, full, delete, and clear.
memory_idstringrequired except generated createSafe memory identifier. Letters, numbers, dots, underscores, and hyphens are kept; other characters become hyphens. Aliases: id, name.
titlestringoptionalHuman-readable title for a new memory file. If memory_id is omitted on create, the title/name is slugged into the memory ID or a random ID is generated.
textstringrequired for addPlain-text memory to merge into the file. Aliases: memory, content, add, entry, and new_memory.
forgetstringrequired for forgetFact, preference, topic, or instruction to remove from memory. Aliases: forget_text, text, content, and query.
overwritebooleanoptionalFor create, set to 1 to replace an existing memory file with the same ID.
callbackstringoptionalGET-only JSONP callback name for sites where external fetch() is blocked. Alias: cb.
{ "success": true, "action": "add", "memory_id": "agent-main", "memory": { "summary": "...", "sections": { "preferences": ["..."] } } }

Create, add, forget, and get return the complete memory JSON for easy review. Purge returns { "success": true, "purged": true }. On error: { "success": false, "error": "...", "code": 400 } or another relevant HTTP status. Rate-limit failures return HTTP 429 and may include a Retry-After header.

# Create a new memory file POST memory.php Content-Type: application/json { "action": "create", "memory_id": "agent-main", "title": "Main Agent Memory" } # Add a memory POST memory.php Content-Type: application/json { "action": "add", "memory_id": "agent-main", "text": "The user prefers compact mobile screens with secondary options hidden in settings." } # Forget a memory POST memory.php Content-Type: application/json { "action": "forget", "memory_id": "agent-main", "forget": "old preference for beige color palettes" } # Full memory output GET memory.php?action=get&memory_id=agent-main # Purge a complete memory file POST memory.php Content-Type: application/json { "action": "purge", "memory_id": "agent-main" }

notes.php

Durable JSON note store for apps and Logi

Creates and manages note files saved in the site-level notes/ folder as individual JSON documents. Each note includes note_id, title, text, status, tags, timestamps, and optional metadata.

Use this when an app needs server-backed notes instead of browser-only localStorage. The helper supports the existing Logi note vocabulary (add, list, update, complete, delete) plus REST-style actions (create, read, edit, overview, restore). It is rate limited as notes and logs failures to api/notes.log.

https://promptbox.cn/api/notes.php  GET POST
NameTypeDescription
actionstringoptionalDefault: overview. Supported values: create, read, edit, overview, delete, complete, and restore. Aliases include add, get, update, list, search, and remove.
note_idstringrequired except createSafe note identifier. If omitted on create, the helper generates one. Alias: id.
textstringrequired for createNote body text. Used by edit when replacing the body. Aliases: content and note.
titlestringoptionalShort human-readable title, up to 180 characters.
statusstringoptionalactive, completed, or archived. complete sets completed; restore sets active.
tagsarray/stringoptionalArray of tags, or a comma-separated string. Tags are normalized and capped for safe storage.
filterstringoptionalFor overview, use all, active, completed, or archived. Alias: status. Default: all.
qstringoptionalFor overview, filters by text found in title, body, or tags. Aliases: query and search.
limitnumberoptionalMaximum notes returned by overview. Range: 1-500. Default: 100.
include_textbooleanoptionalFor overview, include full note text in each row. Default returns excerpts only.
overwritebooleanoptionalFor create with a supplied ID, set to 1 to replace an existing note.
callbackstringoptionalGET-only JSONP callback name for sites where external fetch() is blocked. Alias: cb.
{ "success": true, "action": "create", "note_id": "note-20260618-021530-a1b2c3d4", "note": { "title": "Trip idea", "text": "...", "status": "active", "tags": [] } }

read, edit, complete, and restore return the full note. overview returns { "success": true, "count": 2, "total": 2, "notes": [...] }. delete returns { "success": true, "deleted": true }. On validation, missing note, rate-limit, or storage errors, the helper returns JSON like { "success": false, "error": "...", "code": 400 } with the matching HTTP status.

# Create a note POST notes.php Content-Type: application/json { "action": "create", "title": "Packing list", "text": "Bring passport, charger, and receipts.", "tags": ["travel"] } # Read one note GET notes.php?action=read&note_id=note-20260618-021530-a1b2c3d4 # Edit note text POST notes.php Content-Type: application/json { "action": "edit", "note_id": "note-20260618-021530-a1b2c3d4", "text": "Bring passport, charger, receipts, and headphones." } # Overview of active notes GET notes.php?action=overview&filter=active&q=travel # Mark completed, then delete POST notes.php Content-Type: application/json { "action": "complete", "note_id": "note-20260618-021530-a1b2c3d4" } POST notes.php Content-Type: application/json { "action": "delete", "note_id": "note-20260618-021530-a1b2c3d4" }

llm.php

Lightweight LLM proxy for text answers

Recommended LLM API. Use llm.php for normal text prompts and answers; use the other LLM helpers only when an attachment, image, audio, or provider-specific capability is needed. The default model is deepseek/deepseek-v4-flash through AIMLAPI; pass model=pro, model=premium, quality=pro, or pro=1 to offload the request to llm_gemini.php using Gemini gemini-3-flash-preview. Passing model=lite, omitting model, or using any other value keeps the default flash model. Responses are uncapped by default; pass max_sentences to add sentence-limit guidance. Suitable for translations, classifications, rewrites, summaries, extractions, trivia lookups, and simple puzzles. For live web data use web.php instead.

Returns text/plain — no JSON wrapper — so it can be used directly in browser fetch() calls with response.text(). If you pass callback or cb on a GET request, it returns JSONP as application/javascript: callback({ ok: true, text: "..." }). JSONP responses use Cache-Control: no-store.

https://promptbox.cn/api/llm.php  GET POST
NameTypeDescription
promptstringrequiredThe task or question to send to the selected LLM. Also accepted as q.
max_sentencesintegeroptionalCaps the response length. Default: 0 (no cap).
modelstringoptionalDefault: lite, which uses deepseek/deepseek-v4-flash. Pass pro, premium, advanced, gemini, gemini-flash, or gemini-3-flash-preview to offload to llm_gemini.php. Legacy pro selectors such as minimax-m3, gpt-5-mini, or deepseek-v4-pro are also treated as pro and routed to Gemini.
qualitystringoptionalAlias for model selection. Use quality=pro to offload to llm_gemini.php.
probooleanoptionalSet to 1, true, or yes to offload to llm_gemini.php. Aliases: use_pro, deepseek_pro.
callbackstringoptionalGET-only JSONP callback name for sites where external fetch() is blocked, such as newer free Neocities sites. Alias: cb.

text/plain with the model's answer and an X-LLM-Model response header showing deepseek-v4-flash or gemini-3-flash-preview. On error: plain error string with appropriate HTTP status. In JSONP mode, the response is always JavaScript with { ok, text, model } or { ok: false, error, status }.

# Translate a sentence GET llm.php?prompt=Translate+"Hello, how are you?" to Spanish # Classify sentiment GET llm.php?q=Is+this+positive+or+negative%3F+"The+food+was+cold+and+service+was+rude." # Use the pro model GET llm.php?prompt=Explain+quantum+tunneling&model=pro # Alternate pro selector GET llm.php?prompt=Explain+quantum+tunneling&pro=1 # In browser JavaScript const answer = await fetch('llm.php?prompt=' + encodeURIComponent(prompt)).then(r => r.text()); # JSONP for Neocities/free-CSP pages window.handleLlm = (payload) => console.log(payload.ok ? payload.text : payload.error); const script = document.createElement('script'); script.src = 'https://promptbox.cn/api/llm.php?callback=handleLlm&prompt=' + encodeURIComponent(prompt); document.head.appendChild(script);

photo_score.php

Score a person photo and return one practical framing hint

Scores one photo of a person against a weighted beginner composition checklist: eyes open, clean background, face lighting, focus, crop, level camera, headroom, distractions, flattering camera angle/height, and subject size. The built-in weights add to 15 points, and optional additional rules must include weights that are added to max_score. It uses llm_gemini.php with the lite Gemini model and returns a compact JSON score plus one short hint that prioritizes actions the picture taker can control, such as moving left, stepping closer, raising the camera, or reframing.

Requests are rate-limited under program photo_score. Server-side failures are logged to api/photo_score.log.

https://promptbox.cn/api/photo_score.php  POST
NameTypeDescription
imagefile|stringrequiredMultipart upload field named image, or JSON field image containing a base64 JPEG, PNG, or WEBP image. Data URI format such as data:image/jpeg;base64,... is accepted. Max size: about 8 MB.
imagesarrayoptionalJSON alternative to image. If supplied, the first array item is scored.
additional_rulesstring|arrayoptionalWeighted extra scoring rules. JSON format: [{"rule":"Subject follows rule of thirds","weight":1}]. String/multipart format: one rule per line, 1.0 | Subject follows rule of thirds. Alias: rules. Each weight must be positive and no more than 5; total extra weight is capped at 10.
languagestringoptionalResponse language for hint and comment, e.g. Chinese. Alias: lang. Omit or leave blank for default model behavior.
detailsbooleanoptionalSet to 1 to include the 15 individual item scores in the response.
{ "ok": true, "score": 13.5, "max_score": 16, "hint": "Move a step left to clear the background object.", "comment": "Move a step left to clear the background object." }

Scores are rounded to half-point steps. With details=1, the response includes base item scores, base weights, and any additional rule scores. If the weighted score is within 10% of max_score, hint and comment return PERFECT!. If no person is visible, hint and comment return No person detected in the image. Error responses are JSON with { "ok": false, "error": "..." } and an appropriate HTTP status.

# Multipart upload curl -X POST https://promptbox.cn/api/photo_score.php \ -F image=@portrait.jpg \ -F 'additional_rules=1.0 | Subject follows rule of thirds' # JSON upload with individual checklist scores POST photo_score.php?details=1 Content-Type: application/json { "image": "data:image/jpeg;base64,/9j/4AAQ...", "language": "Chinese", "additional_rules": [ { "rule": "Subject follows rule of thirds", "weight": 1.0 }, { "rule": "Expression looks natural", "weight": 0.5 } ] }

llm_gemini.php

Lightweight Gemini LLM proxy with optional image input

Use llm.php for normal text prompts and answers. Use this helper only when Gemini attachments, image/audio content, structured Gemini contents or parts, or Gemini-specific generation controls are needed. The default model is gemini-3-flash-preview; pass model=lite or model=gemini-3.1-flash-lite to use gemini-3.1-flash-lite, which always runs with temperature=0.

This helper is for general Gemini text, vision, and audio/content requests. It does not accept Gemini File Search tools; use rag.php for File Search / RAG queries against a document store.

Like llm.php, the response is text/plain with no JSON wrapper. If you pass callback or cb on a GET request, it returns JSONP as application/javascript for Neocities/free-CSP pages.

https://promptbox.cn/api/llm_gemini.php  GET POST
NameTypeDescription
promptstringrequired*The task or question. Also accepted as q. Required unless parts or contents is supplied.
modelstringoptionalUse lite or gemini-3.1-flash-lite to request the lite Gemini model. Any other value uses the default gemini-3-flash-preview.
imagesarrayoptionalArray of base64 image strings (plain base64 or data URI format: data:image/jpeg;base64,...). Supported types: JPEG, PNG, WEBP. Only accepted via POST with JSON body. HTTP URLs are rejected.
partsarrayoptionalRaw Gemini-style parts. Supports { "text": "..." } and { "inlineData": { "mimeType": "...", "data": "base64..." } }. If prompt is also supplied, it is prepended.
contentsarrayoptionalRaw Gemini-style conversation contents. Each item may include role as user or model and a parts array.
languagestringoptionalWhen supplied, appends Give your response in <language> language. to the Gemini request. Alias: lang. Blank values are ignored.
system_promptstringoptionalSystem instruction for Gemini. Alias: system. A Gemini-style systemInstruction.parts object is also accepted.
generationConfigobjectoptionalGemini generation settings such as temperature or maxOutputTokens. Alias: generation_config.
callbackstringoptionalGET-only JSONP callback name for sites where external fetch() is blocked. Alias: cb.

text/plain with the model's answer. Returns null (the literal string) on API-level errors, or an HTTP error code on input validation failures. In JSONP mode, the response is always JavaScript with { ok, text } or { ok: false, error, status }.

# Text-only query GET llm_gemini.php?prompt=What+is+the+Fibonacci+sequence%3F # Text-only query with lite model GET llm_gemini.php?prompt=Summarize+this&model=lite # Text-only query with response language GET llm_gemini.php?prompt=Summarize+this&language=Chinese # Multimodal query with an image POST llm_gemini.php Content-Type: application/json { "prompt": "What is shown in this image?", "model": "lite", "images": ["data:image/jpeg;base64,/9j/4AAQ..."] }

llm_grok.php

Grok Responses API proxy with default/lite model selection and image uploads

Use llm.php for normal text prompts and answers. Use this helper only when image attachments or Grok-specific behavior are needed. It is a thin proxy to the xAI Responses API, including multimodal prompts with image uploads. It uses xAI directly when grok_key.txt is available. The default model is grok-4.5; pass model=lite or model=grok-4-1-fast-non-reasoning to use the AIMLAPI lite model. Text-only responses are uncapped by default; pass max_sentences to add sentence-limit guidance.

Returns text/plain with no JSON wrapper, so browser apps can call it directly with response.text(). If you pass callback or cb on a GET request, it returns JSONP as application/javascript: callback({ ok: true, text: "..." }). Use this mode for newer free Neocities sites, where external fetch() is blocked by Content Security Policy.

https://promptbox.cn/api/llm_grok.php  GET POST
NameTypeDescription
promptstringrequiredThe task, question, or chat prompt to send to Grok. Also accepted as q.
imagesarrayoptionalBase64 JPEG/PNG images, HTTPS image URLs, or base64 data URIs. When images are provided, max_sentences is ignored so the model has room for visual detail.
systemstringoptionalOptional system instruction. Alias: system_prompt.
max_sentencesintegeroptionalCaps text-only response length. Default: 0 (no cap).
reasoning_effortstringoptionalFor grok-4.5, pass low, medium, or high. xAI defaults to high when omitted. Alias: reasoning.
modelstringoptionalDefault: grok-4.5. Pass lite or grok-4-1-fast-non-reasoning for the lite model, or pass another model name beginning with grok-.
callbackstringoptionalGET-only JSONP callback name for sites where external fetch() is blocked, such as newer free Neocities sites. Alias: cb.

text/plain with the model's answer. On error: plain error string with appropriate HTTP status. In JSONP mode, the response is always JavaScript with { ok, text } or { ok: false, error, status }.

# Short chat reply GET llm_grok.php?prompt=Write+a+flirty+one-line+dating+app+reply # Limit response length GET llm_grok.php?prompt=Draft+a+brief+summary&max_sentences=2 # Use the lite model GET llm_grok.php?q=Brainstorm+three+game+ideas&model=lite # Use lower reasoning effort for a faster simple answer GET llm_grok.php?prompt=Explain+webhooks+briefly&reasoning_effort=low # In browser JavaScript const answer = await fetch('llm_grok.php?prompt=' + encodeURIComponent(prompt)).then(r => r.text()); # JSONP for Neocities/free-CSP pages window.handleGrok = (payload) => console.log(payload.ok ? payload.text : payload.error); const script = document.createElement('script'); script.src = 'https://promptbox.cn/api/llm_grok.php?callback=handleGrok&prompt=' + encodeURIComponent(prompt); document.head.appendChild(script);

music_gen.php

MiniMax Music 2.0 generation via AIMLAPI

Creates a MiniMax minimax/music-2.0 music generation job through AIMLAPI, checks the status of an existing job, and streams completed audio through Promptbox so browser apps do not need to fetch provider storage URLs directly. This is a JSON REST helper for create/status: use POST with a prompt and lyrics to start generation, or set is_instrumental and omit lyrics for a no-vocal instrumental request. Use GET with generation_id for status or action=audio to download the finished MP3. The AIMLAPI key remains server-side. The helper is rate limited as music_gen and logs failures to api/music_gen.log.

Successful create/status responses pass through AIMLAPI's JSON, usually including id, status, optional audio_file.url, optional error, and optional meta.usage. action=audio returns raw audio bytes with Content-Type: audio/mpeg or another provider audio MIME type. The model can take time; use conservative, user-started automatic status checks.

https://promptbox.cn/api/music_gen.php  GET POST
prompt: minimum 10 characters, maximum 2000 characters lyrics: minimum 10 characters, maximum 3000 characters unless is_instrumental is true
NameTypeDescription
actionstringoptionalgenerate to create a job, status to check one, or audio to stream a completed song from the server. Aliases: create, start, check, check_status, retrieve, download, stream. POST defaults to generate; requests with generation_id default to status.
promptstringrequired for generateMusic style, mood, arrangement, or scenario. AIMLAPI requires 10-2000 characters. Alias: style.
lyricsstringrequired for vocal generateSong lyrics. AIMLAPI requires 10-3000 characters for vocal music. Structure tags like [Verse], [Chorus], and [Bridge] are supported. When is_instrumental is true, this can be omitted and the helper sends a minimal non-lyrical structure.
is_instrumentalbooleanoptionalWhen true, asks the provider for instrumental/no-vocal output and allows lyrics to be omitted. Alias: instrumental.
generation_idstringrequired for statusThe id returned by a generate request. Alias: id.
audio_settingobjectoptionalOptional JSON object passed to AIMLAPI. Supported fields are sample_rate, bitrate, and format.
sample_rateintegeroptionalShortcut for audio_setting.sample_rate. Must be 8000-48000.
bitrateintegeroptionalShortcut for audio_setting.bitrate. Must be 16000-320000.
formatstringoptionalShortcut for audio_setting.format. Allowed values: mp3 or wav.
callbackstringoptionalJSONP callback for GET status checks. Alias: cb. JSONP is not available for POST.
{ "id": "60ac7c34-3224-4b14-8e7d-0aa0db708325", "status": "queued" }
{ "id": "60ac7c34-3224-4b14-8e7d-0aa0db708325", "status": "completed", "audio_file": { "url": "https://cdn.aimlapi.com/..." }, "meta": { "usage": { "credits_used": 120000 } } }

On validation, rate-limit, or upstream API errors, returns JSON like { "success": false, "error": "..." } with an appropriate HTTP status code. Rate-limit denials also set Retry-After when available.

# Create a generation job POST music_gen.php Content-Type: application/json { "prompt": "Lo-fi pop with warm bass, soft drums, and a bright chorus", "lyrics": "[Verse]\nCity lights are waking\n[Chorus]\nWe rise into the morning", "format": "mp3" } # Create an instrumental generation job POST music_gen.php Content-Type: application/json { "prompt": "Instrumental-only cinematic score, tense opening, hopeful payoff, piano and strings, no vocals", "is_instrumental": true, "format": "mp3" } # Check status GET music_gen.php?generation_id=60ac7c34-3224-4b14-8e7d-0aa0db708325 # Stream completed audio through Promptbox GET music_gen.php?action=audio&generation_id=60ac7c34-3224-4b14-8e7d-0aa0db708325 # Browser create request const job = await fetch('https://promptbox.cn/api/music_gen.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt, lyrics, format: 'mp3' }) }).then(r => r.json()); # JSONP status check for restricted pages script.src = 'https://promptbox.cn/api/music_gen.php?callback=handleMusic&generation_id=' + encodeURIComponent(job.id);

music_video_studio.php

Music Video Studio planning API

Provides the REST planning interface used by logi/logi_code/music-videos.html. It generates original lyrics from a song idea without section markers, and creates batched image-generation prompt directions for lyric lines. Uploaded MP3 lyric transcription is handled by lyrics.php so subtitles are based on audio instead of filename inference. Music audio is still generated by music_gen.php, images by image_gen.php, and MP4 assembly by assemble_shortform_mp4.php.

The helper is rate limited as music_video_studio and logs errors to api/music_video_studio.log. It accepts JSON, form data, GET parameters, and JSONP for GET requests.

https://promptbox.cn/api/music_video_studio.php  GET POST
ActionMethodReturnsDescription
lyricsGET/POSTJSONGenerate full original song lyrics from an idea or prompt and target duration_seconds. The returned lyrics and lines omit section markers such as verse, chorus, bridge, intro, and outro labels.
uploaded_lyricsGET/POSTJSONRetired. Use lyrics.php with a multipart MP3 upload for real audio transcription.
visual_promptsPOSTJSONGenerate a batch of distinct image prompt directions from lyric lines, art_style, start_index, and total.
healthGETJSONReturn service name and version.
NameTypeDescription
actionstringrequiredlyrics, visual_prompts, or health. Alias examples: song_lyrics and image_prompts. uploaded_lyrics is retired; use lyrics.php.
ideastringoptionalSong idea or visual context. For lyrics, idea or prompt is required.
promptstringoptionalAlias for idea on lyric generation.
duration_secondsintegeroptionalTarget length for generated lyrics. Clamped from 15 to 420 seconds. Aliases: duration, length.
filenamestringretiredRetained only for older callers. It is no longer used to infer uploaded MP3 lyrics.
notestringretiredRetained only for older callers. It is no longer used to infer uploaded MP3 lyrics.
linesarray/stringrequired for visual_promptsLyric lines for a visual prompt batch. POST JSON arrays are preferred; newline text is accepted.
art_stylestringoptionalVisual art style used by visual_prompts.
start_indexintegeroptionalZero-based scene index for the first line in the batch.
totalintegeroptionalTotal number of scenes in the full video.
callbackstringoptionalJSONP callback for GET requests. Alias: cb.
{ "success": true, "action": "lyrics", "lyrics": "First lyric line\nSecond lyric line", "lines": ["First lyric line", "Second lyric line"], "duration_seconds": 210 }
{ "success": true, "action": "visual_prompts", "prompts": ["cinematic vertical still..."] }

On validation, rate-limit, or upstream text-helper errors, returns JSON like { "success": false, "error": "..." } with the relevant HTTP status. Rate-limit denials may include a Retry-After header.

# Generate lyrics POST music_video_studio.php Content-Type: application/json { "action": "lyrics", "idea": "A synthwave song about leaving the city at dawn", "duration_seconds": 210 } # Transcribe uploaded MP3 subtitles with the lyrics helper POST lyrics.php Content-Type: multipart/form-data mp3=@song.mp3 language=English # Generate batched image prompt directions POST music_video_studio.php Content-Type: application/json { "action": "visual_prompts", "lines": ["Turn the headlights into halos", "Let the midnight learn our names"], "art_style": "neon noir city scenes, rain, reflections", "start_index": 0, "total": 12 }

pdf_creator.php

Plain-text PDF creator for reports and handouts

Creates a downloadable PDF from finished, PDF-ready text. The helper supports a title, page size, orientation, margins, font size, headings written as # Heading, simple bullet lines, escaped newline normalization, and cleanup of common inline Markdown markers. It is rate limited as pdf_creator and logs failures to api/pdf_creator.log.

https://promptbox.cn/api/pdf_creator.php  GET POST
NameTypeDescription
contentstringrequiredFinished document text. Also accepts prompt or instructions. Actual line breaks are preferred; literal \n sequences are normalized as line breaks.
titlestringoptionalDocument title printed at the top unless hide_title is true.
filenamestringoptionalDownload filename. .pdf is added if omitted.
page_sizestringoptionalletter, a4, or legal. Default: letter.
orientationstringoptionalportrait or landscape. Default: portrait.
marginnumberoptionalMargin in points, clamped from 24 to 96. Default: 54.
font_sizenumberoptionalBody font size in points, clamped from 8 to 18. Default: 11.
hide_titlebooloptionalSet to 1, true, or yes to omit the title from the page.

HTTP 200 with Content-Type: application/pdf and raw PDF bytes on success. On error: JSON { "success": false, "error": "..." } with an appropriate HTTP status. Rate-limit failures return HTTP 429 and may include a Retry-After header.

# Create a short PDF report POST pdf_creator.php Content-Type: application/json { "title": "Weekly Notes", "content": "# Summary\n- First point\n- Second point", "filename": "weekly-notes.pdf" }

rag.php

Gemini File Search RAG helper

Asks a question against a Gemini File Search store and returns a short answer grounded in that store's documents. The helper uses gemini-2.5-flash, automatically adds a briefness hint to the prompt, enforces the shared rag rate limit, and logs failures to api/rag.log.

Use this when an app needs answers from a specific uploaded document corpus instead of open-web search or a general chat model. The caller must provide the File Search store name or ID in store_id. Prefer the full resource name, such as fileSearchStores/abc123; bare IDs such as abc123 are accepted and normalized. Contact admin@promptbox.cn to add new RAG file stores. Optional voice fields let a browser send microphone audio together with an instruction prompt.

https://promptbox.cn/api/rag.php  GET POST
NameTypeDescription
promptstringrequiredThe question to answer from the File Search store.
store_idstringrequiredGemini File Search store resource name or ID to query. Prefer fileSearchStores/abc123; bare IDs are converted to that form. Common copied wrappers such as quotes, brackets, angle brackets, and backticks are trimmed before validation.
voice_b64stringoptionalBase64 audio to include with the prompt, typically from MediaRecorder. Max decoded size: 5 MB.
voice_mimestringoptionalMIME type for voice_b64. Defaults to audio/webm.
modelstringoptionalDefault: gemini-2.5-flash. Pass flash or gemini-3-flash-preview for stores/apps that need the newer Gemini Flash model.
generationConfigobjectoptionalOverride default generation settings. Defaults are temperature: 0.5 and maxOutputTokens: 8192. Alias: generation_config.
append_keep_brief_hintbooleanoptionalDefault: true. Set to false if your prompt already contains its own brevity or formatting instructions.
{ "success": true, "content": "Brief answer from the file store...", "code": 200 }

On error: { "success": false, "error": "...", "code": 400 } or another relevant HTTP status. Rate-limit failures return HTTP 429 and may include a Retry-After header.

# Simple GET GET rag.php?store_id=fileSearchStores/abc123&prompt=Summarize+the+refund+policy # POST with JSON body POST rag.php Content-Type: application/json { "store_id": "fileSearchStores/abc123", "prompt": "What does the handbook say about travel reimbursement?" } # POST with browser voice input and exact prompt controls POST rag.php Content-Type: application/json { "store_id": "fileSearchStores/abc123", "prompt": "Transcribe the user's audio question and answer only from these files.", "voice_b64": "GkXfo59...", "voice_mime": "audio/webm", "model": "gemini-3-flash-preview", "generationConfig": { "temperature": 0.7 }, "append_keep_brief_hint": false }

rate-limit.php

Per-program rate limiting API and admin dashboard

Provides rolling-window rate limiting for the public helpers. Unknown programs default to 300 requests per 24-hour window. An optional hourly sub-limit can also be configured.

Can also be called directly as an HTTP API to check or record usage for any program name, and includes an admin dashboard (password-protected) for monitoring and adjusting limits.

https://promptbox.cn/api/rate-limit.php  GET POST
NameTypeDescription
programstringrequiredProgram name to check/record. Letters, numbers, underscores, hyphens, and dots only.
actionstringoptionalrecord (default) — checks limit and records a use if allowed. check — checks limit only without recording.
{ "allowed": true, "usage_day": 5, "usage_hour": 2, "limit_day": 300, "limit_hour": null, "remaining_day": 295, "remaining_hour": null, "last_used": 1746388800 }
{ "allowed": false, "retry_after": 3612, "limit_type": "day", "message": "Rate limit exceeded (daily). Retry after 3612 seconds." }

The Retry-After HTTP header is also set when denied.

Visit rate-limit.php?password=<password> in a browser to view all registered programs, their usage bars, last-used times, and controls for adjusting limits, resetting usage, or deleting program records.

# Record a use for "myapp" GET rate-limit.php?program=myapp # Check limit without recording GET rate-limit.php?program=myapp&action=check # Admin dashboard GET rate-limit.php?password=<password> # POST record POST rate-limit.php Content-Type: application/json { "program": "myapp", "action": "record" }

steam.php

Steam game reviews and community discussions

Looks up a Steam game by name, resolves its App ID via the Steam store search API, then fetches either user reviews or community discussion search results. If the game name fails to resolve, the helper returns alternative search term suggestions and retry strategies. Discussion results are extracted from HTML and returned as a plain-text summary (up to 3000 words).

https://promptbox.cn/api/steam.php  GET POST
NameTypeDescription
game_namestringrequiredName of the Steam game to look up. The helper tries multiple fuzzy variations (removing articles, subtitles, edition labels, etc.) to improve match rate.
reviewsbooloptionalWhen true, fetches the 40 most recent user reviews instead of community discussions.
search_termsstringoptionalCustom search query for the community discussion search. Defaults to the game name if omitted.
{ "success": true, "content": "Plain-text summary of discussions or reviews..." }
# Community discussions about boss difficulty GET steam.php?game_name=Elden+Ring&search_terms=boss+difficulty # User reviews GET steam.php?game_name=Hades&reviews=true # POST POST steam.php Content-Type: application/json { "game_name": "Baldur's Gate 3", "search_terms": "multiplayer co-op" }

stock.php

Finnhub stock data — quotes, profiles, financials

Fetches stock data from Finnhub's API. Given a ticker symbol (or ISIN/CUSIP), it can return a real-time quote snapshot, the company's profile, and key financial metrics. All three sections are returned by default; you can request only a subset. Quote data on the free tier may be delayed ~15 minutes during market hours.

https://promptbox.cn/api/stock.php  GET POST
NameTypeDescription
symbolstringrequired*Ticker symbol, e.g. AAPL. Exactly one of symbol, isin, or cusip must be provided.
isinstringoptional*ISIN identifier. Used instead of symbol when no ticker is known.
cusipstringoptional*CUSIP identifier. Used instead of symbol when no ticker is known.
sectionsstringoptionalComma-separated list of sections to fetch: quote, profile, financials. Also accepts all. Default: all three.
financial_metricstringoptionalWhich financial metric group to request from Finnhub: all (default), price, valuation, or margin.
{ "success": true, "content": "Stock data result\n...", "data": { "identifier": {...}, "resolved_symbol": "AAPL", "sections": [...], "profile": {...}, "quote": {...}, "financials": {...}, "warnings": [] } }

On error: { "success": false, "error": "..." } with HTTP 400.

# Quote + profile for Apple GET stock.php?symbol=AAPL&sections=quote,profile # Full data for a stock identified by ISIN GET stock.php?isin=US0231351067 # POST – financials only POST stock.php Content-Type: application/json { "symbol": "NVDA", "sections": "financials", "financial_metric": "valuation" }

lyrics.php

MP3-to-lyrics transcription via AIMLAPI

Accepts an uploaded MP3, optionally creates a Hostinger-local FFmpeg vocal-focused version, submits it to AIMLAPI speech-to-text, then formats the raw transcript into lyric lines. It can return plain lyric text or JSON with each line's start and end time for subtitle planning. This helper is intended for original songs, demos, voice memos, and user-provided audio where automatic lyrics are useful.

https://promptbox.cn/api/lyrics.php  POST
NameTypeDescription
mp3filerequired*Multipart MP3 upload. Field aliases: audio or file. Maximum size: 20 MB.
languagestringoptionalExpected lyrics language name or code, such as English, en, Spanish, es, Chinese, or zh. Helps transcription and formatting.
modelstringoptionalSpeech-to-text model. Default: #g1_nova-2-general for timestamp-capable output. Supported alternatives include #g1_nova-2-meeting, #g1_nova-2-video, #g1_nova-2-phonecall, openai/gpt-4o-transcribe, openai/gpt-4o-mini-transcribe, #g1_whisper-large, #g1_whisper-medium, and #g1_whisper-small.
vocal_isolationstringoptionalControls FFmpeg vocal-focused preprocessing before STT. Default: auto, which tries a voice-band, denoised, normalized mono MP3 first and falls back to the original upload if needed. Use off for original audio only, or on to request preprocessing explicitly. Aliases: isolate_vocals, audio_preprocess, preprocess_audio.
formatstringoptionalSet to json, timed, or timestamps to receive line timing metadata. You can also send Accept: application/json.

By default, returns text/plain with one cleaned lyric sentence or phrase per line. With JSON output, returns success, lyrics, lines, words, model, requested_model, and audio_preprocess; each line has text, start, and end in seconds when AIMLAPI provides word timestamps. Errors are plain text with an appropriate HTTP status. The helper logs server-side failures to api/lyrics.log and is rate-limited as program lyrics.

I heard your voice across the rain. The lights went low and called my name. We kept on singing through the night.
{ "success": true, "lyrics": "I heard your voice across the rain.", "lines": [{ "text": "I heard your voice across the rain.", "start": 4.21, "end": 7.84 }], "words": [{ "text": "I", "start": 4.21, "end": 4.34 }] }
# Multipart upload curl -X POST https://promptbox.cn/api/lyrics.php \ -F mp3=@song.mp3 \ -F language=English # Timed JSON for subtitles curl -X POST https://promptbox.cn/api/lyrics.php \ -H "Accept: application/json" \ -F mp3=@song.mp3 \ -F language=English \ -F format=json # Original audio only, no vocal-focused preprocessing curl -X POST https://promptbox.cn/api/lyrics.php \ -F mp3=@song.mp3 \ -F language=English \ -F vocal_isolation=off # Browser upload const form = new FormData(); form.append('mp3', fileInput.files[0]); form.append('language', 'English'); const lyrics = await fetch('https://promptbox.cn/api/lyrics.php', { method: 'POST', body: form }).then(r => r.text());

transfer.php

Temporary file transfer REST API

Provides a REST interface to the same temporary file-transfer storage used by transfer.promptbox.cn. Upload a file or several files, receive an 8-character receipt plus browser and API download URLs, inspect receipt metadata, stream the file, or delete a one-time file after clipboard copy. Files expire after 3 days; by default they are also deleted after first API download unless auto_delete=0 is sent during upload.

The helper is rate limited as program transfer and logs server-side failures to api/transfer.log. API uploads and browser downloads share the same storage metadata as transfer/index.php, so the returned download_url opens the standard transfer page and api_download_url streams the same file directly.

https://promptbox.cn/api/transfer.php  GET POST
NameTypeDescription
actionstringrequiredupload, info, download, delete, or clipboard_copied. If omitted, multipart uploads default to upload and GET with receipt defaults to info.
userfile[] / filefilerequired for uploadMultipart file field. Multiple userfile[] parts are bundled into a ZIP unless clipboard_upload=1.
receiptstringrequired for receipt actionsThe 8-character transfer receipt. A full transfer URL containing ?receipt=... is also accepted.
auto_deletebooloptionalUpload option. Default 1; set 0 to retain the file until the 3-day expiration even after download.
folder_uploadbooloptionalUpload option. Set 1 to force ZIP packaging and preserve paths from userfile_paths[].
userfile_paths[]string[]optionalRelative paths for ZIP entries when uploading folders or multiple files.
clipboard_uploadbooloptionalUpload option. Set 1 to mark the single file as clipboard-origin content.
inlinebooloptionalDownload option. Set 1 to stream with Content-Disposition: inline instead of attachment.
{ "success": true, "receipt": "AbC234xy", "filename": "photo.jpg", "mime_type": "image/jpeg", "size": 12345, "auto_delete": true, "expires_after_seconds": 259200, "download_url": "https://transfer.promptbox.cn/index.php?receipt=AbC234xy", "api_download_url": "https://promptbox.cn/api/transfer.php?action=download&receipt=AbC234xy" }

info, upload, delete, and clipboard_copied return JSON. download streams the file bytes directly and removes the receipt afterward unless the upload was retained. Validation, missing receipt, expired receipt, storage, and rate-limit errors return JSON like { "success": false, "error": "...", "code": 400 }; rate-limit denials also set Retry-After when available.

# Upload one file curl -F action=upload -F auto_delete=1 -F userfile[]=@photo.jpg https://promptbox.cn/api/transfer.php # Get receipt metadata GET transfer.php?action=info&receipt=AbC234xy # Download the file bytes GET transfer.php?action=download&receipt=AbC234xy # Upload several files as one ZIP curl -F action=upload -F userfile[]=@a.txt -F userfile[]=@b.txt https://promptbox.cn/api/transfer.php

transcribe.php

Speech-to-text transcription via Gemini

Transcribes spoken audio into plain text using Gemini (gemini-3.1-flash-lite). It is designed for browser microphone recordings from MediaRecorder, but also accepts base64 audio in JSON or form posts. The helper is rate limited as transcribe.

Returns text/plain with no JSON wrapper. Recordings under 0.5 seconds and locally detectable silent/near-silent WAV input return null without calling Gemini; if there is no intelligible speech in other audio formats, Gemini is instructed to return null.

https://promptbox.cn/api/transcribe.php  GET POST
NameTypeDescription
audiofile or stringrequiredAudio to transcribe. For browser use, send a multipart file field named audio, audio_blob, or file. For JSON/form use, send a base64 string or data URI in audio or audio_base64. Max 10 MB.
audio_mime_typestringoptionalMIME type when it is not supplied by the upload or data URI. Common values: audio/webm, audio/mp4, audio/mpeg, audio/wav, audio/ogg.
duration_msnumberoptionalRecording duration in milliseconds. Also accepts audio_duration_ms, duration_seconds, audio_duration_seconds, duration, or audio_duration. Values under 500 ms return null.
languagestringoptionalExpected spoken language, e.g. English, Chinese, or es. Helps accuracy but is not required.
contextstringoptionalNames, vocabulary, or preceding text to help recognition. The context itself is not transcribed.
promptstringoptionalOverride the default transcription instruction. Use only when you need a custom transcript format.

text/plain transcript text. Too-short, silent, near-silent, or unintelligible recordings return null. On input errors, returns a plain error string with HTTP 400. On Gemini/API failure, returns null with HTTP 502.

# Browser microphone recording via MediaRecorder const form = new FormData(); form.append('audio', audioBlob, 'speech.webm'); form.append('audio_mime_type', audioBlob.type || 'audio/webm'); form.append('duration_ms', String(recordingMs)); const transcript = await fetch('transcribe.php', { method: 'POST', body: form }).then(r => r.text()); # JSON base64 / data URI POST transcribe.php Content-Type: application/json { "audio": "data:audio/webm;base64,GkXfo59...", "language": "English", "context": "The speaker may mention PromptBox or Logi." }

transcript.php

YouTube transcript extraction API

Returns the plain-text transcript for a public YouTube video using the same multi-strategy extraction logic used by youtube.php. Pass either an 11-character YouTube videoId or a full YouTube URL. The helper is rate limited as transcript and logs failures to api/transcript.log.

https://promptbox.cn/api/transcript.php  GET POST
NameTypeDescription
videoIdstringoptionalThe 11-character YouTube video ID. Also accepted as video_id.
urlstringoptionalA YouTube watch, share, embed, or Shorts URL. Required only when videoId is omitted.
callbackstringoptionalGET-only JSONP callback name. cb is also accepted.
{ "success": true, "videoId": "dQw4w9WgXcQ", "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "transcript": "...", "length": 2335 }

Returns an error if the video ID is invalid, no transcript can be retrieved, or the helper hits its rate limit.

# Simple GET by video ID GET transcript.php?videoId=dQw4w9WgXcQ # GET by URL GET transcript.php?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ # POST with JSON body POST transcript.php Content-Type: application/json { "videoId": "dQw4w9WgXcQ" }

tts_inworld.php

Text-to-speech via AIML / Inworld TTS - streams audio

Converts text to speech using AIMLAPI's Inworld inworld/tts-1 model and streams the generated audio file. HTML tags, markdown syntax, control characters, and URL bodies are automatically stripped from the input before synthesis; URLs are spoken only as http, then narration continues with the next real text. Inworld TTS has a hard 2000-character limit per request; split longer narration at sentence breaks and combine the returned audio blocks in order. If the Inworld request fails, the helper silently falls back to tts.php.

https://promptbox.cn/api/tts_inworld.php  GET POST

tts_inworld_test.html lets you enter a prompt, choose an Inworld voice, and play the generated audio in the browser.

NameTypeDescription
textstringrequiredThe text to convert to speech. Maximum 2000 characters per request.
voicestringoptionalVoice name. Default: Ashley. Options: Alex, Ashley, Craig, Deborah, Dennis, Edward, Elizabeth, Julia, Mark, Olivia, Priya, Sarah, Shaun, Theodore, Timothy, Wendy, Yichen, Xiaoyin, Xinyi, Jing.
formatstringoptionalAudio format: mp3 (default) or wav.

HTTP 200 with raw audio bytes on success. The response uses Content-Type: audio/mpeg for MP3 and audio/wav for WAV. On error: JSON { "success": false, "error": "..." } with appropriate HTTP status.

# Default voice, MP3 output GET tts_inworld.php?text=Hello+world # Custom voice and WAV output GET tts_inworld.php?text=Welcome+to+PromptBox&voice=Xinyi&format=wav

twitter.php

Social media search — Twitter/X, Facebook, Reddit

Searches multiple social platforms via the API Direct service. Despite the filename, it supports Twitter/X posts, Facebook posts, Reddit posts, and Reddit comments. Results are returned as a formatted text summary alongside the raw structured data. Up to 8 items per platform are included in the response.

https://promptbox.cn/api/twitter.php  GET POST
NameTypeDescription
querystringrequiredSearch query. Also accepted as q. Max 500 characters.
platformsstringoptionalComma-separated platforms: twitter, facebook, reddit_posts, reddit_comments, or all. Default: twitter,facebook,reddit_posts.
pagesintegeroptionalNumber of result pages to fetch per platform (1–10 for Twitter/Facebook; 1–5 for Reddit). Default: 1.
sort_bystringoptionalSort order. Twitter: most_recent (default) or relevance. Reddit: most_recent, relevance, hot, top. Facebook: relevance (default) or most_recent.
start_datestringoptionalFacebook only. Filter start date in YYYY-MM-DD format.
end_datestringoptionalFacebook only. Filter end date in YYYY-MM-DD format.
get_sentimentbooloptionalFacebook only. Pass true to include sentiment analysis (polarity + emotion) in results.
{ "success": true, "content": "Social media search results\n...", "data": { "query": "...", "platforms": [...], "results": { "twitter": [...], "reddit_posts": [...] }, "warnings": [] } }
# Twitter + Reddit search GET twitter.php?query=electric+vehicles&platforms=twitter,reddit_posts # Facebook with sentiment and date filter GET twitter.php?query=climate&platforms=facebook&get_sentiment=true&start_date=2025-01-01&end_date=2025-06-01 # All platforms, 2 pages each POST twitter.php Content-Type: application/json { "query": "AI news", "platforms": "all", "pages": 2 }

web.php

Live web search — returns a number or plain-text answer

A Tavily search proxy designed to be called from browser apps for live, public web data. By default it extracts and returns the first numeric value from the search answer — ideal for stock prices, scores, rates, and similar. Set text=true to get a plain-text answer instead, with length optionally capped by max_sentences. An optional url parameter narrows results to a specific domain.

A secondary mode (mode=image_prompt_refine) passes the prompt to Gemini and returns an enhanced image generation prompt — useful for improving image_gen.php inputs.

https://promptbox.cn/api/web.php  GET POST
NameTypeDescription
promptstringrequiredThe question or search query. Also accepted as q. Tavily queries are capped at 400 characters; longer queries are truncated before sending.
urlstringoptionalDomain to restrict search results to, e.g. reuters.com. Leave empty to search the open web.
textbooloptionalDefault false. When false, returns only the first number found. When true, returns a plain-text answer (length controlled by max_sentences).
max_sentencesintegeroptionalOnly applies when text=true. Caps the answer to this many sentences. Default: 0 (no cap — full answer returned).
modestringoptionalSet to image_prompt_refine to use Gemini to rewrite the prompt into a detailed image generation prompt (skips Tavily entirely).

Returns text/plain. With text=false (default): a plain number string like 189.34, or null if no number was found. With text=true: a plain-text answer. If the Tavily query is over 400 characters, it is truncated and the response appends Tool Error: Query truncated, max query length is 400 characters. On error: null with an appropriate HTTP status code.

# Get current Apple stock price (returns a number) GET web.php?prompt=What+is+the+current+AAPL+stock+price # Full text answer, no sentence cap GET web.php?prompt=Explain+the+Fed+rate+decision&text=true # Text answer capped at 3 sentences, from a specific source GET web.php?prompt=latest+Fed+interest+rate+decision&url=reuters.com&text=true&max_sentences=3 # Refine an image prompt using Gemini GET web.php?mode=image_prompt_refine&prompt=a+dog+on+the+moon

web_read.php

Exact webpage reader returning cleaned JSON text

Fetches one specific public http or https URL from the server side and returns readable text for many source types. It reads HTML pages, plain/document text, basic generated PDFs, RSS/Atom feeds, Office-style archives such as docx, pptx, xlsx, odt, and epub, GitHub blob URLs via raw content, public YouTube transcripts, image descriptions through llm_gemini.php lite, and audio/video transcripts through transcribe.php. It also uses an MSN article JSON fallback and can use Tavily extraction when normal reading finds no usable text.

The helper blocks localhost, private-network, reserved, and credential-bearing URLs, follows up to 5 validated redirects, caps ordinary downloads at 1 MB and media downloads at 10 MB, rate-limits as web_read, and logs failures to api/web_read.log.

https://promptbox.cn/api/web_read.php  GET POST
NameTypeDescription
urlstringrequiredThe exact public webpage URL to read. If the scheme is omitted, https:// is assumed.
max_charsintegeroptionalMaximum returned text characters. Default: 12000. Minimum: 1000. Maximum: 30000.
fallbackstringoptionalSet to off to disable the Tavily extraction fallback. Default: auto, used only when normal reading returns no usable text and a Tavily key is available.
callbackstringoptionalJSONP callback for GET requests. cb is also accepted.

Returns application/json. On success: { ok, url, final_url, title, text, text_length, truncated, content_type, status, redirects }. Some sources may also include source_url, video_id, and reader_mode such as html_text, document_text, pdf_text, archive_document_text, feed_text, youtube_transcript, image_description, media_transcript, tavily_extract, or msn_article_json. On error: { ok:false, error } with an appropriate HTTP status code. Bad URL inputs return clear messages such as Missing required url., Invalid URL: only http:// and https:// URLs are supported., Invalid URL: hostname is not valid., or Invalid URL: target hostname could not be resolved.. JSONP mode wraps the response as { ok, status, data, error }.

# Read one exact page GET web_read.php?url=https://promptbox.cn/index.html&max_chars=8000 # Read a PDF with extractable text GET web_read.php?url=https://promptbox.cn/datacenters.pdf # Read a public YouTube transcript GET web_read.php?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ # Read GitHub source, feeds, images, or media GET web_read.php?url=https://github.com/user/repo/blob/main/file.js GET web_read.php?url=https://example.com/feed.xml GET web_read.php?url=https://example.com/photo.jpg GET web_read.php?url=https://example.com/interview.mp3 # POST JSON POST web_read.php Content-Type: application/json { "url": "https://promptbox.cn/index.html", "max_chars": 12000 }

youtube.php

YouTube search + transcript AI synthesis

Accepts a natural-language question, searches YouTube for up to 3 relevant videos, retrieves their transcripts (using multiple extraction strategies including the /youtubei/v1/get_panel API), and then feeds the transcripts to llm.php to synthesize a comprehensive answer. Only the transcript content is used — no external web search. The helper is rate limited as youtube and logs failures to api/youtube.log.

https://promptbox.cn/api/youtube.php  GET POST
NameTypeDescription
promptstringrequiredThe question or topic to research. Also accepted as q.
{ "success": true, "content": "AI-synthesized answer from video transcripts..." }

Returns an error if no videos are found, none have accessible transcripts, a dependency key is missing, or the helper hits its rate limit. GET also supports JSONP with callback or cb.

# Simple GET GET youtube.php?prompt=How+do+black+holes+form # POST with JSON body POST youtube.php Content-Type: application/json { "prompt": "What are the best stretches for lower back pain?" }