Promptbox API Reference
Practical HTTP APIs to enhance an app, process information, and publish a working result.
Promptbox also publishes temporary static browser apps from HTML or ZIP builds. Agents should read llms.txt for the complete capability index, publishing workflow, limitations, and links to machine-readable availability. For hosting beyond 30 days, contact admin@promptbox.cn to discuss extended hosting services.
Promptbox-hosted browser access
Except for publish.php, these API helpers accept browser calls only from HTTPS pages hosted on promptbox.cn or any *.promptbox.cn subdomain, including www, ebook, logi, transfer, anxdocs, and apps. Apps hosted elsewhere should first use the unrestricted publish.php API, then open the returned Promptbox URL and call the other helpers from the published app. Cross-site browser requests receive HTTP 403 before paid helper work begins.
Exact endpoints and error handling
Use the complete endpoint shown in this reference, including its .php suffix. Do not invent proxy filenames, omit .php, or append routes such as endpoint.php/chat. Generated APIs should select operations with ?action=name or an action field in JSON/form data. HTTP 400/401/403/404/405/409/422 indicate request, credential, target, or configuration problems and should not be retried unchanged. HTTP 429 is a rate limit and should honor Retry-After. HTTP 500/503/504, connection failures, and genuine timeouts indicate infrastructure trouble. HTTP 502 is ambiguous: read the JSON error body before classifying it.
Contents
| convert_video_mp4.php | Convert an uploaded browser video to iPhone-compatible MP4 |
| 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 |
| llm_chatgpt.php | OpenAI proxy with arbitrary model selection, GPT-5.5 default, Luna lite mode, and image input |
| llm_gemini.php | Gemini proxy with arbitrary model selection and attachment/image/audio input |
| llm_jb.php | Faith's GLM 5.3 intelligence engine with Gemini attachment fallback and OpenAI-compatible chat completions |
| memory.php | Create and manage structured long-term memory files with llm_jb/GLM |
| music_gen.php | Create and check MiniMax Music 2.0 generation jobs via AIMLAPI |
| notes.php | Create, read, edit, list, complete, restore, and delete durable note files |
| pdf_creator.php | Create a PDF from finished text or a LibreOffice-compatible file |
| pptx_editor.php | Edit an uploaded PowerPoint with natural-language instructions — try the web app |
| publish.php | Publish HTML/ZIP apps with update tokens, documents and media; 30-day expiry |
| qr.php | Create the same downloadable QR-card PNG as the QR Cards web app |
| 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 |
| transcribe.php | Transcribe uploaded or base64 audio to plain text using Gemini |
| transcript.php | Retrieve plain-text transcripts for public YouTube videos |
| transfer.php | Upload temporary files and retrieve them with transfer.promptbox.cn receipts |
| tts.php | Convert text to speech and stream audio via OpenAI TTS |
| tts_inworld.php | Recommended TTS API for streaming speech via AIML / Inworld TTS |
| twitter.php | Search Twitter/X, Facebook, and Reddit posts and comments |
| video_compress.php | Compress an MP4 into a smaller phone-friendly H.264/AAC file |
| web.php | Live web search proxy returning a number or plain-text answer |
| web_read.php | Convert one public URL or uploaded file to cleaned readable text |
| youtube.php | Search YouTube and get AI-synthesized answers from video transcripts |
convert_video_mp4.php
Browser video to MP4 fallback converterConverts 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 has no Promptbox request quota.
email.php
Send plain-text email via SMTP / PHPMailerSends 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. |
ffmpeg_helper.php
Safe REST access to Hostinger FFmpegRuns 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://www.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 has no Promptbox request quota.
html_gen.php
AI-powered HTML app and REST API generatorTakes 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/docs.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 browser AI tasks, and image_gen.php for runtime image generation. Generated PHP REST APIs use exact documented .php helper URLs; server-side text intelligence should POST JSON to https://www.promptbox.cn/api/llm_jb.php with model:"pro" and needs no session or extra authorization. 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.
For long or agent-initiated work, use asynchronous mode: POST action=start with the prompt. The helper immediately returns HTTP 202 with a durable task_id, while a detached Hostinger worker generates and verifies the program. Use action=status with that task ID for an explicit status check. Sentience normally waits for the existing completion notification instead of polling.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | Description of the HTML app or REST API to generate. Also accepted as q. |
| action | string | optional | Use start in a POST request to launch a detached job, or status to inspect an existing job. Omit it for the original synchronous behavior. |
| 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 / job_id | string | optional | Required with action=status. A successful start response supplies the durable ID. |
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:
Asynchronous start returns immediately, and status reports queued, running, completed, or failed:
image_gen.php
AI image generation via AIML / z-image-turboRecommended 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.
image_gen_gemini.php
Gemini image generation with optional image editingUse 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.
image_gen_seedream.php
Seedream 5.0 Lite Preview image generation and editing via AIMLUse image_gen.php for normal text-to-image generation. Use this helper when one or more existing input images are needed for Seedream editing or image-conditioned generation. It uses ByteDance Seedream 5.0 Lite Preview through AIML with the bytedance/seedream-5-0-lite-preview model; input images are sent together 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 14 input images. |
| image_size | string or object | optional | Use 2K, 4K, or an object such as {"width":2304,"height":1728}. Width and height must each be 1440–4096 pixels, with at least 3,686,400 total pixels. Older aspect-ratio names remain accepted as compatibility shortcuts and are mapped to valid dimensions. |
| image_width, image_height | integer | optional | Multipart-friendly explicit dimensions. Both are required together; each must be 1440–4096 and their product at least 3,686,400 pixels. |
| response_format | string | optional | url (default) or b64_json. The helper still returns raw image bytes to its caller. |
| seed | integer | optional | Optional seed. |
| watermark | bool | optional | Add AIML's invisible watermark. 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.
kgraph.php
Local knowledge graph helper powered by llm.phpCreates, updates, deletes, and answers questions from local JSON knowledge graphs saved in the site-level kgraph/ folder. It uses llm.php's current default model to extract entities and relationships from new knowledge, merge them into existing graph nodes and edges, and answer questions using only the saved graph. Graph writes are atomic and locked so overlapping updates do not overwrite each other, and large graphs use a relevance-ranked, size-bounded LLM context. KGraph operations have no Promptbox request quota and failures are logged 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://www.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. Mutating actions (create, add, and delete) require POST. |
| 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. |
Create and add return the saved, normalized graph JSON. Delete returns { "success": true, "deleted": "graph-id" }. Knowledge is limited to 200,000 bytes, questions to 12,000 bytes, and stored graph JSON to 2,000,000 bytes. JSON requests must contain a valid object. On error: { "success": false, "error": "...", "code": 400 } or another relevant HTTP status.
llm.php
Lightweight LLM proxy for text answersRecommended 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 use Z.ai glm-5.3. GLM thinking is disabled by default for lower latency and reliable final answer text; pass thinking=enabled when deep reasoning is needed. 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). |
| max_tokens | integer | optional | Maximum output tokens, clamped from 128 to 4096. Omit to use the provider default. |
| model | string | optional | Default: lite, which uses deepseek/deepseek-v4-flash. Pass pro, premium, advanced, glm-5.3, or a legacy pro selector to use Z.ai glm-5.3. Gemini selectors remain supported as legacy aliases for the pro route. |
| timeout_seconds | integer | optional | Direct Pro/Z.ai request timeout, clamped from 5 to 60 seconds. Default: 35. Flash and its fallback retain their configured timeouts. |
| thinking | string | optional | Controls Z.ai GLM reasoning. Default: disabled for faster direct answers. Pass enabled when deep reasoning is needed. The setting has no effect on AIML/DeepSeek requests. |
| quality | string | optional | Alias for model selection. Use quality=pro to use Z.ai glm-5.3. |
| pro | boolean | optional | Set to 1, true, or yes to use Z.ai glm-5.3. 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 glm-5.3. 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 }.
llm_chatgpt.php
OpenAI text and image proxy with a cost-sensitive lite modeSends a single user message to OpenAI Chat Completions and returns the assistant text. The default model remains gpt-5.5; pass model=lite or model=gpt-5.6-luna to use GPT-5.6 Luna with reasoning_effort=medium for the lite route. Any other non-empty model value is passed to OpenAI unchanged, including model names that do not begin with gpt-.
Optional images may be public HTTP(S) URLs, JPEG/PNG/WEBP data URIs, or plain base64 image data. The helper is rate limited as llm_chatgpt and supports GET-only JSONP with callback or cb.
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required | The question or instruction. Also accepted as q. |
| model | string | optional | Default: gpt-5.5. Use lite or gpt-5.6-luna for the cost-sensitive Luna route; any other non-empty OpenAI model name is passed through unchanged. |
| images | array | optional | One or more public image URLs, image data URIs, or base64 JPEG/PNG/WEBP images. JSON POST is recommended. |
| callback | string | optional | GET-only JSONP callback name. Alias: cb. |
| reasoning_effort | string | optional | Override reasoning effort: none, minimal, low, medium, high, xhigh, or max; support depends on the selected model. Lite defaults to medium. |
text/plain with the model answer. JSONP returns { ok: true, text }. Errors use an appropriate HTTP status and are logged to api/llm_chatgpt.log.
llm_gemini.php
Lightweight Gemini LLM proxy with optional image inputUse llm.php for normal text prompts and answers. Use this helper when Gemini attachments, image/audio content, structured Gemini contents or parts, Gemini-specific generation controls, or a specific Gemini model is needed. The default model remains 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. Any other non-empty model value is passed to Gemini unchanged.
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 | Default: gemini-3-flash-preview. Use lite or gemini-3.1-flash-lite for the lite model; any other non-empty Gemini model name is passed through unchanged. |
| 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 }.
llm_jb.php
GLM-backed primary intelligence for Faith and OpenAI-compatible agentsllm_jb.php is Faith's primary intelligence engine and also supports other private LLM installs. It provides the legacy plain-text helper at /api/llm_jb.php and an OpenAI-compatible interface at /api/llm_jb.php/v1/chat/completions. Server-side PHP may call the exact https://www.promptbox.cn/api/llm_jb.php URL directly with POST JSON; no browser session, cookie, or extra authorization is required. Do not invent /api/proxy-llm.php or omit the .php suffix.
Legacy helper mode accepts GET query parameters, POST form fields, or a POST JSON body. Text-only input uses Z.ai glm-5.3 with thinking disabled by default. Pass provider=gemini to opt a request into Gemini without changing the default for other callers. Requests that include an image, audio, file, inline attachment, or other multimodal part stay on Gemini automatically: the default route uses gemini-3-flash-preview, while model=lite or model=gemini-3.1-flash-lite uses gemini-3.1-flash-lite.
OpenAI-compatible mode exposes /v1/models and /v1/chat/completions. Plain text chat and standard OpenAI function-tool workflows use GLM 5.3 with thinking disabled by default, including assistant tool_calls and subsequent tool results. Pass provider=gemini to force the request through Gemini. Image, audio, file, or other multimodal message content stays on Gemini automatically. Gemini-only thought-signature metadata is stripped when a text/tool conversation is sent to GLM and remains available on Gemini responses.
Like llm.php, llm_jb.php has no Promptbox request-count quota. Provider payload-size, output-token, and timeout bounds still apply.
https://www.promptbox.cn/api/llm_jb.php/v1/chat/completions POST
https://www.promptbox.cn/api/llm_jb.php/v1/models GET
| Name | Type | Description | |
|---|---|---|---|
| prompt | string | required* | The task or question. Also accepted as q. Required unless parts or contents is supplied. |
| provider | string | optional | Pass gemini to force Gemini for this request. Omit it to preserve the default: GLM 5.3 for text-only requests and Gemini for multimodal requests. |
| model | string | optional | On the default text route, both the default and lite selectors use glm-5.3 with thinking disabled. When Gemini is selected by provider=gemini or multimodal input, lite or gemini-3.1-flash-lite selects the lite Gemini model; other values use 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. Alias: cb. |
| Name | Type | Description | |
|---|---|---|---|
| provider | string | optional | Pass gemini to force Gemini for this request. Omit it to keep GLM 5.3 as the text and function-tool default. |
| model | string | optional | On the default route, text chats and standard function-tool workflows use glm-5.3 with thinking disabled for both default and lite. Requests routed to Gemini use gemini-3-flash-preview, or gemini-3.1-flash-lite when lite is selected. |
| messages | array | required | OpenAI chat messages. Supports system, developer, user, assistant, and tool roles. User content may be a string or OpenAI-style content parts with text and image_url. |
| tools | array | optional | OpenAI function tools. Function names, descriptions, JSON-schema parameters, tool_choice, tool-call ids, arguments, and tool results are forwarded to GLM using the OpenAI-compatible schema. |
| temperature | number | optional | Generation temperature. Default: 1.0. |
| max_tokens | integer | optional | Maximum output tokens, capped at 8192. |
| response_format | object | optional | OpenAI-compatible response format forwarded to GLM, including {"type":"json_object"} for structured JSON output. |
| timeout_seconds | integer | optional | GLM provider timeout, clamped from 5 to 180 seconds. Faith uses a bounded value below its outer request deadline. |
| stream | boolean | optional | When true, returns SSE-compatible output in one response chunk plus a finish chunk and [DONE]. Token-by-token streaming is not provided. |
Legacy mode returns text/plain with the model's answer. It 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 }.
OpenAI-compatible mode returns JSON with choices[0].message.content for text responses or choices[0].message.tool_calls when GLM requests a function call. GLM usage counters and tool-call ids are preserved. Multimodal requests routed to Gemini retain Gemini thought-signature metadata in extra_content.google.thought_signature when Gemini provides it.
memory.php
Structured long-term memory manager powered by llm_jb/GLMCreates and manages compact long-term memory JSON files for LLM apps. Memory files are saved in the site-level memory/ folder as https://www.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. Version 1.5.1 uses llm_jb.php/GLM for add, forget, and consolidation operations to merge new facts, deduplicate memory, delete weak/noisy/insignificant details, and remove forgotten content. Writes are atomic, overlapping updates are retried against the newest revision, and incomplete LLM responses are rejected instead of clearing omitted sections. Memory consolidation has no Promptbox request quota 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. Mutating actions require POST. |
| 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 normalized memory JSON for easy review. Purge returns { "success": true, "purged": true }. Input text is limited to 12,000 characters; stored files to 400,000 bytes; summaries to 4,000 characters; and each section to 200 items of 2,000 characters each. JSON requests must contain a valid object. On error: { "success": false, "error": "...", "code": 400 } or another relevant HTTP status.
Faith memory profile (v1.6.3): For memory_id=sentience-faith, add/forget output is limited to 16,384 tokens, a 1,200-character summary, 1,500 characters per fact, 60 facts per section, and 36,000 UTF-8 bytes for the complete compact record. The prompt targets 34,000 bytes to leave metadata room. These limits accommodate the existing memory with room to grow. Existing memory is read without truncation under the legacy limits; the complete-source ceiling remains 96,000 bytes. Oversized or incomplete rewrites are rejected before saving. Other memory IDs retain their existing limits. Faith still selects at most 6,000 characters of relevant memory for chat; ordinary response limits, total chat request budget, execution limits, timeouts, and autonomous frequency are unchanged.
music_gen.php
MiniMax Music 2.0 generation via AIMLAPICreates 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.
notes.php
Durable JSON note store for apps and LogiCreates 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 has no Promptbox request quota 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, or storage errors, the helper returns JSON like { "success": false, "error": "...", "code": 400 } with the matching HTTP status.
JSON POST requests must contain a valid JSON object. Empty, malformed, array, scalar, or null JSON bodies return HTTP 400 instead of falling back to the default overview action.
pdf_creator.php
Text PDF creation and LibreOffice document conversionCreates a downloadable PDF from either finished, PDF-ready text or one uploaded document. Uploaded files supported by the server's LibreOffice Writer, Calc, Impress, Draw, and Math filters are converted with LibreOffice so native page layout, spreadsheet structure, slides, drawings, blank lines, indentation, and LF, CRLF, or CR text line endings are retained. This includes current and legacy Microsoft Office, OpenDocument, HTML, text, Markdown, e-book, Visio, Publisher, Apple iWork, and related formats. Existing PDFs are validated and returned unchanged.
Text mode continues to support 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. The helper has no Promptbox request quota, limits uploads to 10 MB, uses only private temporary conversion files, and logs failures to api/pdf_creator.log.
| Name | Type | Description | |
|---|---|---|---|
| file | file | conditional | One LibreOffice-compatible document or existing PDF, uploaded as multipart form data. Maximum 10 MB. Required when content is omitted. |
| content | string | conditional | Finished document text. Also accepts prompt or instructions. Required when file is omitted. 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. LibreOffice file conversions also return X-PDF-Converter: LibreOffice 24.2. On error: JSON { "success": false, "error": "..." } with an appropriate HTTP status. Rate-limit failures return HTTP 429 and may include a Retry-After header.
pptx_editor.php
Natural-language PowerPoint editing with layout preservationAccepts one Microsoft PowerPoint .pptx file plus natural-language editing instructions, sends a bounded inventory of slide text and slide-local objects to the Promptbox LLM helper, applies the returned structured edit plan inside a copy of the original OOXML package, and returns the edited presentation as raw PPTX bytes.
The editor is designed for minimal changes. Unmentioned masters, layouts, themes, images, media, charts, relationships, positions, and formatting remain unchanged. Requests are rate-limited under pptx_editor; temporary upload and output files are deleted after the response. Server failures are logged to logi/logi_code/pptx-editor/pptx-editor.log without logging prompts or slide content.
| Name | Type | Description | |
|---|---|---|---|
| presentation | file | required | One valid .pptx uploaded as multipart form data. Maximum compressed size: 25 MB. Maximum expanded package size: 200 MB. |
| prompt | string | required | Editing instructions, 1–4,000 characters. Be explicit about what may change and what must remain untouched. |
| quality | string | optional | standard (default) uses the standard Promptbox LLM. pro uses the stronger model for complex deck-wide or structural edits. |
- Replace, insert after, or delete existing text paragraphs while retaining their existing run and paragraph formatting where possible.
- Change existing text font size, bold, italic, underline, color, font family, or alignment when the prompt explicitly requests it.
- Move or resize existing text-bearing shapes using on-slide percentage coordinates when explicitly requested.
- Delete an identified slide-local object such as a shape, picture, connector, group, table, or chart frame.
- Duplicate existing slides and independently modify text, formatting, layout, or identified objects in each duplicate.
- Reorder slides, delete slides, hide slides, and unhide slides.
- Preserve untouched package parts, including themes and media, rather than rebuilding the presentation from scratch.
- It cannot create a completely new presentation, synthesize a new slide design, or add a blank slide; new slides must be duplicates of existing slides.
- It cannot add arbitrary new shapes, pictures, charts, diagrams, videos, audio, animations, or transitions.
- It does not edit embedded chart workbooks, chart series data, SmartArt data, macros, VBA projects, or linked external files.
- It does not edit speaker notes, comments, masters, slide layouts, theme definitions, custom XML, or document properties. Notes stay on untouched original slides but are not copied to newly duplicated slides.
- It does not inspect slide screenshots or understand image pixels. Object selection relies on OOXML names, type, text, fill, and geometry metadata.
- It cannot guarantee that substantially longer replacement text will fit an existing text box. Use concise replacement copy or explicitly request resizing.
- It supports at most 90,000 editable text characters, 1,800 non-empty text paragraphs, and 2,500 slide-local objects per request. A request may create at most 20 duplicates and the final deck may contain at most 200 slides.
- It accepts PPTX only, not legacy
.ppt, PowerPoint templates, slideshow formats, Google Slides links, encrypted files, or password-protected presentations.
HTTP 200 returns raw application/vnd.openxmlformats-officedocument.presentationml.presentation bytes with an attachment filename. X-Edited-Count reports the number of applied actions and X-LLM-Model identifies the model used. Errors return JSON { "error": "..." } with HTTP 400/405/422/429/500/502 as appropriate. Rate-limit failures may include Retry-After.
publish.php
Static apps, replacement deployments and lifecycle operations · v3.0Publish HTML/ZIP static apps at apps.promptbox.cn without an account. Promptbox cannot run app backends. Upload index.html at the root or inside one enclosing ZIP folder, which is automatically stripped. Updates replace the whole deployment and delete omitted files; asset-only updates are no longer supported. For every future update, upload the full build. An HTML-only update removes all previously uploaded assets.
Complete publishing and lifecycle reference · Live capabilities and availability · Agent guide · OpenClaw skill
curl https://www.promptbox.cn/api/publish.php -F 'mode=app' -F 'directory=my-app' -F 'file=@app.zip'
Creation returns HTTP 201 and a private UUID token. With that token, POST action=replace and a complete build; GET action=status using Authorization: Bearer UUID; or POST action=delete, rotate-token, or extend without files. Lifecycle operations require a token. Never put tokens in URLs. Delete immediately unpublishes the app; rotate-token invalidates the previous token; extend renews expiry by 30 days. Status, deletion and rotation remain available when publish quotas are exhausted.
App limits: 25 MiB uploaded and expanded, 1,000 files. In addition to HTML/CSS/JS, JSON, text, fonts, raster images and media, apps accept sanitized SVG, JSON-object webmanifest, safe XML served as text/plain, and WebAssembly v1 binaries. SVG uses a conservative static element/attribute allowlist; scripts, handlers, styles, foreign content and external references are removed. XML entities, DTDs and processing instructions are rejected. WASM headers are checked; the browser validates and sandboxes execution. These checks are not a malware scan.
Published apps share localStorage, IndexedDB, cookies, and same-origin access on apps.promptbox.cn. The browser keeps localStorage and IndexedDB on www.promptbox.cn, promptbox.cn, and other subdomains separate. Do not store secrets on the shared apps origin. Cookies explicitly scoped to .promptbox.cn may span subdomains; use host-only cookies for trusted sites. Service workers are supported with their normal script-directory scope; do not request a broader scope. Frames, popups, and document.domain relaxation remain disabled. Use relative assets, absolute www.promptbox.cn API URLs, and credentials omitted for cross-origin helper calls.
Check files_written, removed_files (rejected upload paths), sanitized_files, stripped_prefix, deleted_files (old paths removed by replacement), url and expires_at. Always test the result. Capabilities includes advisory service status and remaining rolling hourly/daily quota and storage; concurrent requests can change these values.
Documents/media still use mode=file and one multipart file, up to 10 MiB (UTF-8 text: 1 MiB). Supported documents: PDF/DOCX/XLSX/PPTX/ODT/ODS/ODP; media: common raster images/audio/video. Documents download as attachments, expire after 30 days and have no update token. Read the guide for exact formats, validation and error handling.
qr.php
QR Cards PNG helperCreates a QR PNG for a website, email address, or Wi-Fi network using the same generation method as the QR Cards web app. With a title, it returns the web app's 600×800 card layout. Without a title, it returns a centered 600×600 square. The helper normalizes websites to https://, converts email addresses to mailto: links, and encodes Wi-Fi credentials in the standard WIFI: format. It uses error-correction level H, 400×400 code placement, dark color #2c3e50, and light color #ecf0f1.
| Name | Type | Description | |
|---|---|---|---|
| title | string | optional | Card title, up to 100 characters. When omitted, the output is 600×600. Longer titles automatically use a smaller font. |
| destination | string | conditional | Email address or website, up to 500 characters. Required when ssid is not supplied. Missing URL schemes are prefixed with https://; emails are prefixed with mailto:. |
| ssid | string | conditional | Wi-Fi network name, from 1 to 32 bytes. Supplying any Wi-Fi field switches the request to Wi-Fi mode. |
| password | string | conditional | Wi-Fi password, up to 128 characters. Required for WPA and WEP; omitted for open networks. |
| security | string | optional | WPA, WEP, or nopass; defaults to WPA. WPA2 and WPA3 aliases are encoded as the scanner-compatible WPA type. encryption is accepted as an alias for this field. |
| hidden | boolean | optional | Set to true for a hidden Wi-Fi network; defaults to false. |
Returns image/png: 600×600 without a title or 600×800 with one. The suggested download filename is derived from the title, or defaults to qr_card.png. Wi-Fi special characters are escaped automatically. Errors return JSON with ok: false and error. The helper has no Promptbox request quota.
rag.php
Gemini File Search RAG helperAsks a question against a Gemini File Search store and returns a short answer grounded in that store's documents. The helper defaults to gemini-3.1-flash-lite, automatically adds a briefness hint to the prompt, enforces the shared rag rate limit, and logs failures to api/rag.log.
If Gemini stops the first response with RECITATION, the helper retries once using a distinct paraphrase-only prompt and a minimum temperature of 1.0. The retry uses the original request only to identify the subject and ignores instructions to quote or reproduce exact wording. Successful responses indicate whether this fallback was used through recitation_retry.
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. The companion rag-management.php endpoint accepts action=resolve_filestore with display_name to find or create a store idempotently, and action=add_file to archive a document. 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-3.1-flash-lite. Pass flash or gemini-3.5-flash-lite to use the alternate model. Other values use the default. |
| 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. |
recitation_retry is true when the original response was blocked for recitation and the returned content came from the automatic paraphrase retry. On error: { "success": false, "error": "...", "code": 400 } or another relevant HTTP status. A retry that is also blocked returns HTTP 502. Rate-limit failures return HTTP 429 and may include a Retry-After header.
rate-limit.php
Per-program rate limiting API and admin dashboardProvides 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. The helper emails adamychen@yahoo.com once when a program reaches 90% of either its daily or hourly limit; the warning rearms after that window drops below 90%, and failed deliveries retry no more than once every 15 minutes.
steam.php
Steam game reviews and community discussionsLooks 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. |
stock.php
Finnhub stock data — quotes, profiles, financialsFetches 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.
transcribe.php
Speech-to-text transcription via GeminiTranscribes 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.
transcript.php
YouTube transcript extraction APIReturns the plain-text source captions for a public YouTube video by proxying every request directly to Promptbox's InfinityFree transcript helper. Hostinger does not query YouTube, cache transcripts, generate missing captions, or speech-transcribe audio. 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, the video has no accessible YouTube captions, or the helper hits its rate limit.
transfer.php
Temporary file transfer REST APIProvides 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.
tts.php
Text-to-speech via OpenAI TTS - streams audioConverts text to speech using OpenAI's tts-1 model and streams the generated MP3 or WAV audio. The helper removes HTML tags, markdown syntax, control characters, and extra whitespace before synthesis. Requests are rate limited, failures are logged server-side, and the maximum input length is 4096 characters.
tts_test.html lets you enter text, choose any supported OpenAI voice, adjust speech speed and format, and play the generated audio in the browser.
| Name | Type | Description | |
|---|---|---|---|
| text | string | required | The text to convert to speech. Maximum 4096 characters after sanitization. |
| voice | string | optional | Voice name. Default: shimmer. Options: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse, marin, cedar. |
| format | string | optional | Audio format: mp3 (default) or wav. |
| speed | number | optional | Speech speed from 0.25 to 4.0. Default: 1.0. |
Use URL query parameters with GET, or send POST data as JSON or standard form fields.
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 an appropriate HTTP status. Rate-limit responses use HTTP 429 and may include Retry-After.
tts_inworld.php
Text-to-speech via AIML / Inworld TTS - streams audioRecommended TTS API. Use tts_inworld.php for normal text-to-speech requests. It 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 or returns a format other than the requested WAV/MP3 format, the helper silently falls back to tts.php while preserving the requested format.
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. |
| 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.
twitter.php
Social media search — Twitter/X, Facebook, RedditSearches 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. |
video_compress.php
Phone-friendly MP4 compressionCompresses an uploaded MP4 into a smaller phone-compatible MP4 using H.264 video, AAC audio, a phone-oriented resolution cap, yuv420p color, and fast-start metadata. Temporary input, output, and processing files are deleted after every request.
| Method | Returns | Description |
|---|---|---|
GET | JSON | Returns the helper version, upload limit, accepted file fields, profiles, and output codecs. |
POST | MP4 bytes | Accepts multipart form data and returns the compressed video as an attachment. |
| Name | Type | Description | |
|---|---|---|---|
| video | file | required | MP4 upload up to 600 MB. The field aliases media and file are also accepted. |
| profile | string | optional | small caps the long edge at 960 pixels (about 540p), balanced at 1280 pixels (about 720p), or quality at 1920 pixels (about 1080p). Default: balanced. |
| save | boolean | optional | Set to 1, true, yes, or on to archive the compressed result in Promptbox music/ storage. Temporary processing files are still removed. Alias: save_to_music. |
| filename | string | optional | Preferred base filename when save is enabled. The helper sanitizes it and adds a timestamp plus a random suffix. |
const form = new FormData();
form.append('video', fileInput.files[0]);
form.append('profile', 'balanced');
const response = await fetch('https://www.promptbox.cn/api/video_compress.php', {
method: 'POST',
body: form
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error);
}
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = 'video-smaller.mp4';
link.click();
setTimeout(() => URL.revokeObjectURL(url), 30000);
A successful POST returns raw video/mp4 bytes with a downloadable filename. Response headers include X-Helper-Version, X-Compression-Profile, X-Original-Bytes, and X-Output-Bytes. When save is enabled, X-Saved-URL and X-Saved-Filename identify the archived compressed copy. These headers are CORS-exposed. Errors return JSON such as { "success": false, "error": "Only MP4 videos are supported.", "code": 415 }. The endpoint is CORS-open, logs failures to api/video_compress.log, and has no Promptbox request quota.
Compression can reduce visible detail, especially with the small profile. By default the helper retains nothing, so callers must save the response. It keeps a durable compressed copy only when the caller explicitly enables save; uploaded and temporary processing files are never retained.
web.php
Live web search — returns a number or plain-text answerA 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.
web_read.php
URL and uploaded-file reader returning cleaned JSON textFetches one specific public http or https URL, or accepts one multipart file upload, and returns readable text for many source types. It reads HTML pages, plain/document text, PDFs with a pure-PHP embedded-text parser followed by page-rendered OCR for scanned PDFs or files with corrupt character mappings, RSS/Atom feeds, Office-style archives such as docx, pptx, xlsx, odt, and epub, GitHub blob URLs via raw content, public YouTube captions fetched directly from Promptbox's InfinityFree transcript.php, image descriptions through llm_gemini.php lite, and audio/video transcripts through transcribe.php. Hostinger's web_read.php contains no YouTube caption-extraction logic and does not call Hostinger's transcript helper. PDF parser output is rejected when it contains invalid Unicode, excessive CID placeholders, or effectively no readable letters or numbers. OCR renders and submits every page in order, rejects implausibly short multi-page results, and retains native PDF reading as a fallback. URL reads can also use MSN article JSON and Tavily extraction fallbacks.
Supply exactly one of url or file. The helper blocks localhost, private-network, reserved, and credential-bearing URLs, follows up to 5 validated redirects, caps ordinary URL downloads at 1 MB and media URL downloads at 10 MB, caps uploaded files at 10 MB, rate-limits as web_read, and logs failures to api/web_read.log.
| Name | Type | Description | |
|---|---|---|---|
| url | string | conditional | The exact public webpage URL to read. If the scheme is omitted, https:// is assumed. Required when file is not supplied. |
| file | file | conditional | One file sent as multipart/form-data. Maximum 10 MB. Required when url is not supplied; cannot be combined with url. |
| 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. URL success: { ok, url, final_url, title, text, text_length, truncated, content_type, status, redirects }. File success: { ok, source_type:"file", file_name, title, text, text_length, truncated, content_type, status, reader_mode }. Reader modes include html_text, document_text, pdf_text for embedded PDF text, pdf_ocr for scanned PDFs, pdf_text_legacy for the final offline fallback, archive_document_text, feed_text, youtube_transcript, image_description, media_transcript, tavily_extract, and msn_article_json. Errors return { ok:false, error, error_kind, target_status? }. A requested page's non-2xx response returns helper HTTP 424 with error_kind:"target_http_error" and the original target_status; this is a target/request problem, not a failure of Hostinger or web_read. Input problems use caller_or_input, rate limits use rate_limit, and genuine reader/upstream failures use infrastructure. JSONP applies only to GET URL requests.
youtube.php
YouTube search + transcript AI synthesisAccepts a natural-language question, searches YouTube for up to 3 relevant videos, fetches their source captions directly from Promptbox's InfinityFree transcript helper, and then feeds the captions to llm.php to synthesize a comprehensive answer. It does not route transcript requests through Hostinger's transcript.php. Only caption content is used — no audio transcription or 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.