Reference for the public helper endpoints in api/. Public API helpers are CORS-open HTTP endpoints; admin and support pages are listed separately.
Newer free Neocities sites block JavaScript fetch() calls to external domains with connect-src 'self'. For text and JSON helpers, add callback=... or cb=... to a GET request and load the URL with a temporary <script> tag. This JSONP mode is available on stock.php, twitter.php, youtube.php, transcript.php, html_gen.php, web.php, web_read.php, steam.php, llm.php, llm_grok.php, llm_gemini.php, memory.php, notes.php, transcribe.php, email.php, music_gen.php, music_video_studio.php, and rate-limit.php. Load image helpers directly with <img src="..."> or new Image(), and load audio helpers like tts_inworld.php directly with <audio src="..."> or new Audio(url). Legacy GET, POST, and CORS behavior remains available for other sites.
| convert_video_mp4.php | Convert an uploaded browser video to iPhone-compatible MP4 |
| video_studio_job.php | Create Shortform Studio MP4 jobs with optional uploaded starting photos |
| email.php | Send plain-text email via SMTP / PHPMailer |
| ffmpeg_helper.php | Inspect, convert, and thumbnail uploaded media with safe FFmpeg presets |
| html_gen.php | Generate HTML apps or PHP REST API endpoints from a plain-English prompt |
| image_gen.php | Recommended image generation API for text-to-image PNG output |
| image_gen_gemini.php | Use only when an input image is needed for Gemini image editing |
| image_gen_seedream.php | Use only when one or more input images are needed for Seedream editing |
| kgraph.php | Create, update, delete, and query local knowledge graphs with llm.php |
| llm.php | Recommended LLM API for text answers |
| photo_score.php | Score a person photo against the 15-point composition checklist |
| llm_gemini.php | Use only when Gemini attachment/image/audio content is needed |
| llm_grok.php | Use only when image attachments or Grok-specific behavior are needed |
| lyrics.php | Transcribe an uploaded MP3 into cleaned lyric lines via AIMLAPI |
| memory.php | Create and manage structured long-term memory files with llm.php |
| notes.php | Create, read, edit, list, complete, restore, and delete durable note files |
| music_gen.php | Create and check MiniMax Music 2.0 generation jobs via AIMLAPI |
| music_video_studio.php | Plan Music Video Studio lyrics and image prompts via REST |
| pdf_creator.php | Create a PDF from finished document text and layout options |
| rag.php | Ask a Gemini File Search store and get a brief JSON answer |
| rate-limit.php | Per-program rate-limit API and admin dashboard |
| steam.php | Fetch Steam game reviews or community discussion search results |
| stock.php | Fetch stock quotes, company profiles, and financial metrics via Finnhub |
| transfer.php | Upload temporary files and retrieve them with transfer.promptbox.cn receipts |
| transcribe.php | Transcribe uploaded or base64 audio to plain text using Gemini |
| transcript.php | Retrieve plain-text transcripts for public YouTube videos |
| tts_inworld.php | Convert text to speech and stream audio via AIML / Inworld TTS |
| twitter.php | Search Twitter/X, Facebook, and Reddit posts and comments |
| web.php | Live web search proxy returning a number or plain-text answer |
| web_read.php | Fetch one exact public webpage and return cleaned readable text |
| youtube.php | Search YouTube and get AI-synthesized answers from video transcripts |
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.
| Name | Type | Description | |
|---|---|---|---|
| video | file | required | Uploaded 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| action | string | required | Use start, then call step with the returned job_id until phase is complete. |
| narration | string | required | Spoken script or music-only subtitle script. |
| topic | string | optional | Topic context for image prompts and outro generation. |
| voice | string | optional | Narrator voice. Default: Ashley. |
| music_only | boolean | optional | When true, creates instrumental music and subtitles without spoken narration. |
| starting_photos[] | file[] | optional | Multipart-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. |
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/.
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.
| Name | Type | Description | |
|---|---|---|---|
| recipient | string | required | Destination email address. Must be a valid email format. |
| subject | string | required | Email subject line. |
| body | string | required | Plain-text body of the email. |
| sender | string | optional | Preferred From address (used as Reply-To if it differs from the server's SMTP address). Default: adam@promptbox.cn. |
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.
| Action | Method | Returns | Description |
|---|---|---|---|
info | GET or POST | JSON | Returns helper version, FFmpeg version, limits, and supported presets. |
probe | POST | JSON | Returns FFprobe stream and format metadata for the uploaded media. |
convert | POST | File bytes | Converts uploaded media with a safe preset: mp4, webm, mp3, m4a, wav, or gif. |
thumbnail | POST | JPEG | Extracts one video frame as a JPEG thumbnail. |
| Name | Type | Description | |
|---|---|---|---|
| action | string | required* | info, probe, convert, or thumbnail. Defaults to info for GET. |
| media | file | required | Uploaded audio or video file, up to 300 MB. Aliases file, video, and audio are also accepted. |
| preset | string | optional | For convert; one of mp4, webm, mp3, m4a, wav, or gif. Default: mp4. |
| start | number | optional | Start time in seconds for conversion. Range: 0-600. |
| duration | number | optional | Maximum converted duration in seconds. Range: 0-600. |
| width | number | optional | Output width for video, GIF, or thumbnail. Keeps aspect ratio. Range: 64-3840. |
| quality | number | optional | Video CRF quality for mp4 and webm. Lower is better/larger. Range: 18-35, default 23. |
| audio_bitrate | number | optional | Audio bitrate in kbps for compressed outputs. Range: 64-320, default 128. |
| time | number | optional | For 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | Description of the HTML app or REST API to generate. Also accepted as q. |
| api | bool | optional | Pass 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_id | string | optional | Stable 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/:
API mode returns the created descriptive .php endpoint under api/ and reports whether this page was updated with generated endpoint documentation:
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | Text description of the image to generate. Also accepted as q. |
| landscape | bool | optional | Pass 1, true, or landscape to generate landscape (4:3). Default is portrait (3:4). |
| acceleration | string | optional | Default is off, which omits AIML's acceleration field. Pass high for faster generation. Alias: speed. |
| safety_checker | bool | optional | Pass 1, true, yes, or on to enable AIML's safety checker. Default is off. Aliases: safetyChecker, enable_safety_checker, enableSafetyChecker. |
| optimize_prompt | bool | optional | Pass 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. |
| copyToDeleted | bool | optional | If 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | Text prompt describing the image to generate (or the edit to apply to an input image). Also accepted as q. |
| landscape | bool | optional | Pass 1 or true for landscape (4:3). Default is portrait (3:4). |
| image_size | string | optional | Pass 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. |
| image | string or file | optional | Input 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_type | string | optional | MIME 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | Text prompt describing the image to generate or edit. Also accepted as q. |
| landscape | bool | optional | Shortcut for landscape_4_3 when image_size is omitted. Default is portrait. |
| image | string or file | optional | Input 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_urls | array or string | optional | One or more public image URLs or base64/data URI images for Seedream edit mode. Also accepts images. Max 10 input images. |
| image_size | string | optional | square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, or landscape_16_9. |
| num_images | integer | optional | Number of images requested from AIML, 1 to 4. The helper returns the first image. |
| seed | integer | optional | Optional seed. |
| sync_mode | bool | optional | Passed through to AIML when provided. |
| safety_checker | bool | optional | Passed 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| action | string | optional | Default: answer. Supported values: create, delete, add, answer, and get. Hyphenated aliases are accepted. |
| graph_id | string | required except create with title/name | Safe graph identifier. Letters, numbers, dots, underscores, and hyphens are kept; other characters become hyphens. Aliases: id, name. |
| title | string | optional | Human-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. |
| knowledge | string | required for add; optional for create | Plain-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. |
| question | string | required for answer | Question to answer from the graph. Aliases: prompt, q. |
| model | string | optional | Model selector passed to llm.php. Default uses the standard DeepSeek flash model; pass pro for the pro model. |
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| action | string | optional | Default: get. Supported values: create, add, forget, get, and purge. Aliases: new, output, full, delete, and clear. |
| memory_id | string | required except generated create | Safe memory identifier. Letters, numbers, dots, underscores, and hyphens are kept; other characters become hyphens. Aliases: id, name. |
| title | string | optional | Human-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. |
| text | string | required for add | Plain-text memory to merge into the file. Aliases: memory, content, add, entry, and new_memory. |
| forget | string | required for forget | Fact, preference, topic, or instruction to remove from memory. Aliases: forget_text, text, content, and query. |
| overwrite | boolean | optional | For create, set to 1 to replace an existing memory file with the same ID. |
| callback | string | optional | GET-only JSONP callback name for sites where external fetch() is blocked. Alias: cb. |
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| action | string | optional | Default: overview. Supported values: create, read, edit, overview, delete, complete, and restore. Aliases include add, get, update, list, search, and remove. |
| note_id | string | required except create | Safe note identifier. If omitted on create, the helper generates one. Alias: id. |
| text | string | required for create | Note body text. Used by edit when replacing the body. Aliases: content and note. |
| title | string | optional | Short human-readable title, up to 180 characters. |
| status | string | optional | active, completed, or archived. complete sets completed; restore sets active. |
| tags | array/string | optional | Array of tags, or a comma-separated string. Tags are normalized and capped for safe storage. |
| filter | string | optional | For overview, use all, active, completed, or archived. Alias: status. Default: all. |
| q | string | optional | For overview, filters by text found in title, body, or tags. Aliases: query and search. |
| limit | number | optional | Maximum notes returned by overview. Range: 1-500. Default: 100. |
| include_text | boolean | optional | For overview, include full note text in each row. Default returns excerpts only. |
| overwrite | boolean | optional | For create with a supplied ID, set to 1 to replace an existing note. |
| callback | string | optional | GET-only JSONP callback name for sites where external fetch() is blocked. Alias: cb. |
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | The task or question to send to the selected LLM. Also accepted as q. |
| max_sentences | integer | optional | Caps the response length. Default: 0 (no cap). |
| model | string | optional | Default: 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. |
| quality | string | optional | Alias for model selection. Use quality=pro to offload to llm_gemini.php. |
| pro | boolean | optional | Set to 1, true, or yes to offload to llm_gemini.php. Aliases: use_pro, deepseek_pro. |
| callback | string | optional | GET-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 }.
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.
| Name | Type | Description | |
|---|---|---|---|
| image | file|string | required | Multipart 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. |
| images | array | optional | JSON alternative to image. If supplied, the first array item is scored. |
| additional_rules | string|array | optional | Weighted 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. |
| language | string | optional | Response language for hint and comment, e.g. Chinese. Alias: lang. Omit or leave blank for default model behavior. |
| details | boolean | optional | Set to 1 to include the 15 individual item scores in the response. |
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required* | The task or question. Also accepted as q. Required unless parts or contents is supplied. |
| model | string | optional | Use lite or gemini-3.1-flash-lite to request the lite Gemini model. Any other value uses the default gemini-3-flash-preview. |
| images | array | optional | Array 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. |
| parts | array | optional | Raw Gemini-style parts. Supports { "text": "..." } and { "inlineData": { "mimeType": "...", "data": "base64..." } }. If prompt is also supplied, it is prepended. |
| contents | array | optional | Raw Gemini-style conversation contents. Each item may include role as user or model and a parts array. |
| language | string | optional | When supplied, appends Give your response in <language> language. to the Gemini request. Alias: lang. Blank values are ignored. |
| system_prompt | string | optional | System instruction for Gemini. Alias: system. A Gemini-style systemInstruction.parts object is also accepted. |
| generationConfig | object | optional | Gemini generation settings such as temperature or maxOutputTokens. Alias: generation_config. |
| callback | string | optional | GET-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 }.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | The task, question, or chat prompt to send to Grok. Also accepted as q. |
| images | array | optional | Base64 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. |
| system | string | optional | Optional system instruction. Alias: system_prompt. |
| max_sentences | integer | optional | Caps text-only response length. Default: 0 (no cap). |
| reasoning_effort | string | optional | For grok-4.5, pass low, medium, or high. xAI defaults to high when omitted. Alias: reasoning. |
| model | string | optional | Default: grok-4.5. Pass lite or grok-4-1-fast-non-reasoning for the lite model, or pass another model name beginning with grok-. |
| callback | string | optional | GET-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 }.
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.
| Name | Type | Description | |
|---|---|---|---|
| action | string | optional | generate 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. |
| prompt | string | required for generate | Music style, mood, arrangement, or scenario. AIMLAPI requires 10-2000 characters. Alias: style. |
| lyrics | string | required for vocal generate | Song 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_instrumental | boolean | optional | When true, asks the provider for instrumental/no-vocal output and allows lyrics to be omitted. Alias: instrumental. |
| generation_id | string | required for status | The id returned by a generate request. Alias: id. |
| audio_setting | object | optional | Optional JSON object passed to AIMLAPI. Supported fields are sample_rate, bitrate, and format. |
| sample_rate | integer | optional | Shortcut for audio_setting.sample_rate. Must be 8000-48000. |
| bitrate | integer | optional | Shortcut for audio_setting.bitrate. Must be 16000-320000. |
| format | string | optional | Shortcut for audio_setting.format. Allowed values: mp3 or wav. |
| callback | string | optional | JSONP callback for GET status checks. Alias: cb. JSONP is not available for POST. |
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.
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.
| Action | Method | Returns | Description |
|---|---|---|---|
| lyrics | GET/POST | JSON | Generate 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_lyrics | GET/POST | JSON | Retired. Use lyrics.php with a multipart MP3 upload for real audio transcription. |
| visual_prompts | POST | JSON | Generate a batch of distinct image prompt directions from lyric lines, art_style, start_index, and total. |
| health | GET | JSON | Return service name and version. |
| Name | Type | Description | |
|---|---|---|---|
| action | string | required | lyrics, visual_prompts, or health. Alias examples: song_lyrics and image_prompts. uploaded_lyrics is retired; use lyrics.php. |
| idea | string | optional | Song idea or visual context. For lyrics, idea or prompt is required. |
| prompt | string | optional | Alias for idea on lyric generation. |
| duration_seconds | integer | optional | Target length for generated lyrics. Clamped from 15 to 420 seconds. Aliases: duration, length. |
| filename | string | retired | Retained only for older callers. It is no longer used to infer uploaded MP3 lyrics. |
| note | string | retired | Retained only for older callers. It is no longer used to infer uploaded MP3 lyrics. |
| lines | array/string | required for visual_prompts | Lyric lines for a visual prompt batch. POST JSON arrays are preferred; newline text is accepted. |
| art_style | string | optional | Visual art style used by visual_prompts. |
| start_index | integer | optional | Zero-based scene index for the first line in the batch. |
| total | integer | optional | Total number of scenes in the full video. |
| callback | string | optional | JSONP callback for GET requests. Alias: cb. |
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| content | string | required | Finished document text. Also accepts prompt or instructions. Actual line breaks are preferred; literal \n sequences are normalized as line breaks. |
| title | string | optional | Document title printed at the top unless hide_title is true. |
| filename | string | optional | Download filename. .pdf is added if omitted. |
| page_size | string | optional | letter, a4, or legal. Default: letter. |
| orientation | string | optional | portrait or landscape. Default: portrait. |
| margin | number | optional | Margin in points, clamped from 24 to 96. Default: 54. |
| font_size | number | optional | Body font size in points, clamped from 8 to 18. Default: 11. |
| hide_title | bool | optional | Set 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | The question to answer from the File Search store. |
| store_id | string | required | Gemini 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_b64 | string | optional | Base64 audio to include with the prompt, typically from MediaRecorder. Max decoded size: 5 MB. |
| voice_mime | string | optional | MIME type for voice_b64. Defaults to audio/webm. |
| model | string | optional | Default: gemini-2.5-flash. Pass flash or gemini-3-flash-preview for stores/apps that need the newer Gemini Flash model. |
| generationConfig | object | optional | Override default generation settings. Defaults are temperature: 0.5 and maxOutputTokens: 8192. Alias: generation_config. |
| append_keep_brief_hint | boolean | optional | Default: true. Set to false if your prompt already contains its own brevity or formatting instructions. |
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| program | string | required | Program name to check/record. Letters, numbers, underscores, hyphens, and dots only. |
| action | string | optional | record (default) — checks limit and records a use if allowed. check — checks limit only without recording. |
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.
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).
| Name | Type | Description | |
|---|---|---|---|
| game_name | string | required | Name of the Steam game to look up. The helper tries multiple fuzzy variations (removing articles, subtitles, edition labels, etc.) to improve match rate. |
| reviews | bool | optional | When true, fetches the 40 most recent user reviews instead of community discussions. |
| search_terms | string | optional | Custom search query for the community discussion search. Defaults to the game name if omitted. |
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.
| Name | Type | Description | |
|---|---|---|---|
| symbol | string | required* | Ticker symbol, e.g. AAPL. Exactly one of symbol, isin, or cusip must be provided. |
| isin | string | optional* | ISIN identifier. Used instead of symbol when no ticker is known. |
| cusip | string | optional* | CUSIP identifier. Used instead of symbol when no ticker is known. |
| sections | string | optional | Comma-separated list of sections to fetch: quote, profile, financials. Also accepts all. Default: all three. |
| financial_metric | string | optional | Which financial metric group to request from Finnhub: all (default), price, valuation, or margin. |
On error: { "success": false, "error": "..." } with HTTP 400.
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.
| Name | Type | Description | |
|---|---|---|---|
| mp3 | file | required* | Multipart MP3 upload. Field aliases: audio or file. Maximum size: 20 MB. |
| language | string | optional | Expected lyrics language name or code, such as English, en, Spanish, es, Chinese, or zh. Helps transcription and formatting. |
| model | string | optional | Speech-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_isolation | string | optional | Controls 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. |
| format | string | optional | Set 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| action | string | required | upload, info, download, delete, or clipboard_copied. If omitted, multipart uploads default to upload and GET with receipt defaults to info. |
| userfile[] / file | file | required for upload | Multipart file field. Multiple userfile[] parts are bundled into a ZIP unless clipboard_upload=1. |
| receipt | string | required for receipt actions | The 8-character transfer receipt. A full transfer URL containing ?receipt=... is also accepted. |
| auto_delete | bool | optional | Upload option. Default 1; set 0 to retain the file until the 3-day expiration even after download. |
| folder_upload | bool | optional | Upload option. Set 1 to force ZIP packaging and preserve paths from userfile_paths[]. |
| userfile_paths[] | string[] | optional | Relative paths for ZIP entries when uploading folders or multiple files. |
| clipboard_upload | bool | optional | Upload option. Set 1 to mark the single file as clipboard-origin content. |
| inline | bool | optional | Download option. Set 1 to stream with Content-Disposition: inline instead of attachment. |
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.
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.
| Name | Type | Description | |
|---|---|---|---|
| audio | file or string | required | Audio 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_type | string | optional | MIME 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_ms | number | optional | Recording duration in milliseconds. Also accepts audio_duration_ms, duration_seconds, audio_duration_seconds, duration, or audio_duration. Values under 500 ms return null. |
| language | string | optional | Expected spoken language, e.g. English, Chinese, or es. Helps accuracy but is not required. |
| context | string | optional | Names, vocabulary, or preceding text to help recognition. The context itself is not transcribed. |
| prompt | string | optional | Override 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| videoId | string | optional | The 11-character YouTube video ID. Also accepted as video_id. |
| url | string | optional | A YouTube watch, share, embed, or Shorts URL. Required only when videoId is omitted. |
| callback | string | optional | GET-only JSONP callback name. cb is also accepted. |
Returns an error if the video ID is invalid, no transcript can be retrieved, or the helper hits its rate limit.
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.
tts_inworld_test.html lets you enter a prompt, choose an Inworld voice, and play the generated audio in the browser.
| Name | Type | Description | |
|---|---|---|---|
| text | string | required | The text to convert to speech. Maximum 2000 characters per request. |
| voice | string | optional | Voice name. Default: Ashley. Options: Alex, Ashley, Craig, Deborah, Dennis, Edward, Elizabeth, Julia, Mark, Olivia, Priya, Sarah, Shaun, Theodore, Timothy, Wendy, Yichen, Xiaoyin, Xinyi, Jing. |
| format | string | optional | Audio 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| query | string | required | Search query. Also accepted as q. Max 500 characters. |
| platforms | string | optional | Comma-separated platforms: twitter, facebook, reddit_posts, reddit_comments, or all. Default: twitter,facebook,reddit_posts. |
| pages | integer | optional | Number of result pages to fetch per platform (1–10 for Twitter/Facebook; 1–5 for Reddit). Default: 1. |
| sort_by | string | optional | Sort order. Twitter: most_recent (default) or relevance. Reddit: most_recent, relevance, hot, top. Facebook: relevance (default) or most_recent. |
| start_date | string | optional | Facebook only. Filter start date in YYYY-MM-DD format. |
| end_date | string | optional | Facebook only. Filter end date in YYYY-MM-DD format. |
| get_sentiment | bool | optional | Facebook only. Pass true to include sentiment analysis (polarity + emotion) in results. |
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | The question or search query. Also accepted as q. Tavily queries are capped at 400 characters; longer queries are truncated before sending. |
| url | string | optional | Domain to restrict search results to, e.g. reuters.com. Leave empty to search the open web. |
| text | bool | optional | Default false. When false, returns only the first number found. When true, returns a plain-text answer (length controlled by max_sentences). |
| max_sentences | integer | optional | Only applies when text=true. Caps the answer to this many sentences. Default: 0 (no cap — full answer returned). |
| mode | string | optional | Set 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.
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.
| Name | Type | Description | |
|---|---|---|---|
| url | string | required | The exact public webpage URL to read. If the scheme is omitted, https:// is assumed. |
| max_chars | integer | optional | Maximum returned text characters. Default: 12000. Minimum: 1000. Maximum: 30000. |
| fallback | string | optional | Set 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. |
| callback | string | optional | JSONP 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 }.
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.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | The question or topic to research. Also accepted as q. |
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.