Contents

email.phpSend plain-text email via SMTP / PHPMailer
html_gen.phpGenerate and save a self-contained HTML app from a plain-English prompt
image_gen.phpGenerate a PNG image from a text prompt using AIML / z-image-turbo
image_api.phpGenerate or edit a PNG image through Adam's local Z-Image server
image_gen_gemini.phpGenerate or edit a PNG image using Gemini (supports an input image)
image_gen_seedream.phpGenerate or edit a PNG image using AIML / ByteDance Seedream v4
llm.phpLightweight DeepSeek LLM proxy for text answers
llm_gemini.phpLightweight Gemini LLM proxy with optional image input
llm_grok.phpLightweight Grok LLM proxy with default/lite model selection and image upload support
rag.phpAsk a Gemini File Search store and get a brief JSON answer
rate-limit.phpPer-program rate-limit API and admin dashboard
steam.phpFetch Steam game reviews or community discussion search results
stock.phpFetch stock quotes, company profiles, and financial metrics via Finnhub
support/admin filescode.php, edit pages, and JSON save endpoints
transcribe.phpTranscribe uploaded or base64 audio to plain text using Gemini
transcript.phpRetrieve plain-text transcripts for public YouTube videos
tts.phpConvert text to speech and stream MP3 audio via OpenAI TTS
tts_inworld.phpConvert text to speech and stream audio via AIML / Inworld TTS. Test page: tts_inworld_test.html
twitter.phpSearch Twitter/X, Facebook, and Reddit posts and comments
web.phpLive web search proxy returning a number or plain-text answer
youtube.phpSearch YouTube and get AI-synthesized answers from video transcripts

stock.php

Finnhub stock data — quotes, profiles, financials

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

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

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

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

twitter.php

Social media search — Twitter/X, Facebook, Reddit

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

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

youtube.php

YouTube search + transcript AI synthesis

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

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

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

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

transcript.php

YouTube transcript extraction API

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

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

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

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

html_gen.php

AI-powered HTML app generator

Takes a plain-English description and uses Gemini to generate a complete, self-contained single-file HTML app optimized for mobile. The file goes through an iterative verification and improvement loop (up to 5 rounds) before being saved to the api/ directory as codeN.html. The public URL is returned in the response.

Generated 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 the HTML to generate up to 30 static images at save time.

https://promptbox.cn/api/html_gen.php  GET POST
NameTypeDescription
promptstringrequiredDescription of the app to generate. Also accepted as q.
{ "success": true, "filename": "code42.html", "filepath": "/path/to/code42.html", "url": "https://promptbox.cn/api/code42.html", "generated_images": [...], "image_errors": [] }
# Generate a tip calculator app GET html_gen.php?prompt=A+tip+calculator+with+split+bill+support # POST with JSON body POST html_gen.php Content-Type: application/json { "prompt": "A flashcard quiz app with spaced repetition for learning vocabulary" }

web.php

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

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

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

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

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

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

image_gen.php

AI image generation via AIML / z-image-turbo

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's safety checker is off by default; opt in with safety_checker=1.

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

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

https://promptbox.cn/api/image_gen.php  GET POST
NameTypeDescription
promptstringrequiredText description of the image to generate. Also accepted as q.
landscapebooloptionalPass 1, true, or landscape to generate landscape (4:3). Default is portrait (3:4).
safety_checkerbooloptionalPass 1, true, yes, or on to enable AIML's safety checker. Default is off. Aliases: safetyChecker, enable_safety_checker, enableSafetyChecker.
copyToDeletedbooloptionalIf true, also copies the image to a storage/deleted/ archive directory on the server.

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

# Portrait image (default) GET image_gen.php?prompt=A+serene+Japanese+garden+at+dawn # Landscape image GET image_gen.php?prompt=Futuristic+city+skyline+at+night&landscape=1 # Enable AIML safety checker GET image_gen.php?prompt=A+serene+Japanese+garden+at+dawn&safety_checker=1 # Fetch in JavaScript (browser app) const res = await fetch('image_gen.php?prompt=' + encodeURIComponent(prompt)); const blob = await res.blob(); img.src = URL.createObjectURL(blob); # Neocities/free-CSP direct image loading img.src = 'https://promptbox.cn/api/image_gen.php?prompt=' + encodeURIComponent(prompt);

image_api.php

Local Z-Image image generation and editing proxy

Generates a new image from text, or edits an existing input image, by forwarding the request to Adam's local Z-Image-Turbo server. This helper is shaped like image_gen_gemini.php: it is CORS-open, accepts GET or POST, supports prompt or q, accepts optional base64/data-URI images or multipart uploads, and returns raw image bytes.

The public proxy depends on the local Z-Image server being online and reachable through the router port forward to 73.241.203.94:3477.

https://promptbox.cn/api/image_api.php  GET POST
NameTypeDescription
promptstringrequiredText prompt describing the edit to apply. Also accepted as q.
imagestring or fileoptionalInput image for editing/style transfer. Omit it for text-to-image. Accepted as a base64 string, data URI, JSON object with inlineData.data, or multipart file upload. Aliases: input_image, picture, image_base64, and multipart field file. Max 8 MB.
widthintegeroptionalOutput width in pixels. Range: 64 to 512. Default: 384.
heightintegeroptionalOutput height in pixels. Range: 64 to 512. Default: 512.
sizeintegeroptionalBackward-compatible square output size in pixels. Ignored when width or height is provided.
stepsintegeroptionalGeneration steps. Range: 1 to 24. Default: 8.
strengthnumberoptionalHow strongly to transform the input image. Range: 0.05 to 0.95. Default: 0.45.
guidance_scalenumberoptionalPrompt guidance scale. Range: 0 to 12. Default: 0.
landscapebooloptionalAccepted for compatibility with image helpers. For this local model it selects a larger square default size, not a true landscape aspect ratio.

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

# Text-to-image via JSON POST POST image_api.php Content-Type: application/json { "prompt": "A cinematic product photo of a red sports car in rain", "width": 384, "height": 512, "steps": 8 } # Image editing via JSON POST POST image_api.php Content-Type: application/json { "prompt": "Make this photo look like a clean product shot", "image": "data:image/jpeg;base64,/9j/4AAQ...", "width": 384, "height": 512, "steps": 8, "strength": 0.45 } # Multipart file upload curl -X POST https://promptbox.cn/api/image_api.php \ -F 'prompt=Make this image brighter and more polished' \ -F 'image=@input.jpg' \ --output edited.png # Browser app usage const form = new FormData(); form.append('prompt', prompt); form.append('image', file); const res = await fetch('https://promptbox.cn/api/image_api.php', { method: 'POST', body: form }); const blob = await res.blob(); img.src = URL.createObjectURL(blob);

image_gen_gemini.php

Gemini image generation with optional image editing

Generates images using Gemini's gemini-3.1-flash-image-preview model and returns raw image bytes. Uniquely, it supports passing an existing input image to enable image editing or style transfer — send the 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.

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

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

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

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

image_gen_seedream.php

Seedream v4 image generation and editing via AIML

Generates images with ByteDance Seedream v4 through AIML. With no input image it uses bytedance/seedream-v4-text-to-image. If you provide one or more input images, it uses bytedance/seedream-v4-edit with image_urls. It returns raw image bytes like image_gen_gemini.php.

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

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

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

steam.php

Steam game reviews and community discussions

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

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

llm.php

Lightweight DeepSeek LLM proxy for text answers

A thin proxy to DeepSeek via the AIML chat completions API. The default model is deepseek/deepseek-v4-flash; pass model=pro to use deepseek/deepseek-v4-pro. Passing model=lite, omitting model, or using any other value keeps the default flash model. Responses are uncapped by default; pass max_sentences to add sentence-limit guidance. Suitable for translations, classifications, rewrites, summaries, extractions, trivia lookups, and simple puzzles. For live web data use web.php instead.

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

https://promptbox.cn/api/llm.php  GET POST
NameTypeDescription
promptstringrequiredThe task or question to send to DeepSeek. Also accepted as q.
max_sentencesintegeroptionalCaps the response length. Default: 0 (no cap).
modelstringoptionalDefault: lite, which uses deepseek/deepseek-v4-flash. Pass pro to use deepseek/deepseek-v4-pro.
callbackstringoptionalGET-only JSONP callback name for sites where external fetch() is blocked, such as newer free Neocities sites. Alias: cb.

text/plain with the model's answer. 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 }.

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

llm_grok.php

Grok chat-completions proxy with default/lite model selection and image uploads

A thin proxy to Grok chat completions, including multimodal prompts with image uploads. It uses xAI directly when grok_key.txt is available. The default model is grok-4.3; pass model=lite or model=grok-4-1-fast-non-reasoning to use the lite model. Text-only responses are uncapped by default; pass max_sentences to add sentence-limit guidance. Suitable for conversational text tasks, image-aware questions, and app chat flows.

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

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

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

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

llm_gemini.php

Lightweight Gemini LLM proxy with optional image input

A thin proxy to Gemini. 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. It supports simple text prompts, structured Gemini contents or parts, optional image input, system prompts, and generation configuration.

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

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

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

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

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

rag.php

Gemini File Search RAG helper

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

Use this when an app needs answers from a specific uploaded document corpus instead of open-web search or a general chat model. The caller must provide the File Search store name or ID in store_id. Optional voice fields let a browser send microphone audio together with an instruction prompt.

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

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

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

transcribe.php

Speech-to-text transcription via Gemini

Transcribes spoken audio into plain text using Gemini (gemini-3.1-flash-lite-preview). 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. If there is no intelligible speech, Gemini is instructed to return null.

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

text/plain transcript text. On input errors, returns a plain error string with HTTP 400. On Gemini/API failure, returns null with HTTP 502.

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

email.php

Send plain-text email via SMTP / PHPMailer

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

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

tts.php

OpenAI text-to-speech - streams MP3 audio

Converts text to speech using OpenAI tts-1 and streams MP3 audio. The helper strips HTML, markdown syntax, and control characters before synthesis, enforces the shared tts rate limit, and reads the OpenAI key server-side from openai_key.txt.

https://promptbox.cn/api/tts.php  GET POST
NameTypeDescription
textstringrequiredThe text to convert to speech. Max 4096 characters after sanitization.
voicestringoptionalDefault: shimmer. Allowed voices: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse, marin, cedar.
speednumberoptionalDefault: 1.0. Clamped between 0.25 and 4.0.

HTTP 200 with raw MP3 bytes and Content-Type: audio/mpeg. On error: JSON { "success": false, "error": "..." } with an appropriate HTTP status.

# Simple GET GET tts.php?text=Hello+from+PromptBox&voice=nova # POST JSON and play in browser JavaScript const res = await fetch('https://promptbox.cn/api/tts.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text, voice: 'onyx', speed: 1.1 }) }); const audio = new Audio(URL.createObjectURL(await res.blob())); audio.play();

tts_inworld.php

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

Converts text to speech using AIMLAPI's Inworld inworld/tts-1 model and streams the generated audio file. HTML tags, markdown syntax, and control characters are automatically stripped from the input before synthesis. Maximum input length is 500000 characters.

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

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

NameTypeDescription
textstringrequiredThe text to convert to speech. Max 500000 characters.
voicestringoptionalVoice name. Default: Ashley. See the voice list below.
formatstringoptionalAudio format: mp3 (default) or wav.

Allowed Inworld voices: Alex, Ashley (default), Craig, Deborah, Dennis, Dominus, Edward, Elizabeth, Hades, Heitor, Julia, Maite, Maitê, Mark, Olivia, Pixie, Priya, Ronald, Sarah, Shaun, Theodore, Timothy, Wendy.

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

# Default Ashley voice, MP3 output GET tts_inworld.php?text=Hello+world # Custom voice and WAV output GET tts_inworld.php?text=Welcome+to+PromptBox&voice=Deborah&format=wav # Play in browser JavaScript const res = await fetch('tts_inworld.php?text=' + encodeURIComponent(text)); const blob = await res.blob(); const audio = new Audio(URL.createObjectURL(blob)); audio.play();

support/admin files

HTTP pages and small save APIs that are not general-purpose public helpers

These files are live HTTP endpoints, but they are support tools rather than reusable app-generation helpers. They are included here so the reference matches the actual folder.

FileHTTPStatusDescription
code.phpGET/POSTadmin UILists generated .html apps and supports rename/delete actions for generated HTML and matching text files.
image-proxy.phpGETsupport APIFetches a public HTTP(S) image URL for generated apps, rejects localhost/private network targets, optionally resizes oversized images to a maximum side of 1024px, and streams the image back. Not rate limited.
image_gen_lora.phpGET/POSTsupport APIGenerates PNG images with AIML alibaba/z-image-turbo-lora and optional LoRA weights. Supports prompt, lora/loras, scale, image_size, landscape, steps, safety_checker, and seed. Rate limited as image_gen_lora: 800/day.
preference-edit.phpGET/POSTadmin UIPassword-protected editor for the preference/ dataset, uploads, traits, and image metadata.
waifu-description-save.phpPOSTsupport APIJSON-only save endpoint for updating one waifu.json record's description. Requires id and description; backs up the JSON file to old/waifu.json.
waifu-edit.phpGET/POSTadmin UIPassword-protected editor for waifu.json and additional_waifus/ uploads.
women-description-save.phpPOSTsupport APIJSON-only save endpoint for updating one women.json record's description. Requires id and description; backs up the JSON file to old/women.json.
women-edit.phpGET/POSTadmin UIPassword-protected editor for women.json and additional_women/ uploads.

rate-limit.php

Per-program rate limiting API and admin dashboard

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

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

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

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

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

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