Image and Audio APIs
Image generation uses OpenAI-compatible or native Gemini endpoints depending on the model; layer separation uses an OpenAI-compatible endpoint. The connected text-to-speech models use separate Novita speech plugin endpoints. Use your CoreRouter API Key; no Novita Key or local plugin installation is required. Model access depends on your account group and Key permissions; refer to the console.
Verified Models
| Purpose | Model ID | Endpoint | Verified Scope |
|---|---|---|---|
| Text-to-image | ming-image-0.1-design | /v1/images/generations | One 1024×1024 PNG |
| Text-to-image (GPT Image) | gpt-image-2.5-flare-oai | /v1/images/generations | One 1024×1024 PNG, quality: "low", blue circle visually confirmed |
| Text-to-image (Nano Banana) | gemini-2.5-flash-image | /v1beta/models/gemini-2.5-flash-image:generateContent | One candidate, image-only output, one 1024×1024 PNG, green square visually confirmed |
| Image layer separation | ming-image-0.1-design-layer | /v1/images/edits | Upload one PNG and receive multiple layers |
| Text-to-speech | minimax-speech-2.8-turbo | /novita/audio/speech | Short Chinese text, non-streaming MP3, user playback confirmed |
| Text-to-speech | elevenlabs-tts-multilingual-v2 | /novita/elevenlabs/speech | George voice, short Chinese text, non-streaming Base64 MP3, user playback confirmed |
Layer separation does not provide background replacement from instructions. No general instruction-based image editing model is currently confirmed, and no working transcription, audio translation or realtime audio integration has been verified. The standard audio routes below require their own compatible models and channels; the speech plugin's model ID cannot simply be used on those routes.
API Overview
| Capability | Endpoint | Request Format | Key Fields |
|---|---|---|---|
| Image Generation | /v1/images/generations | JSON | model, prompt, size, n |
| Gemini Image Generation | /v1beta/models/{model}:generateContent | Gemini JSON | contents, generationConfig; model ID goes in the URL path |
| Image Editing | /v1/images/edits | multipart/form-data or JSON | model, image, prompt |
| Legacy Image Edit Compatibility Path | /v1/edits | JSON | Legacy client compatibility; prefer /v1/images/edits when uploading files |
| Audio Transcription (separate setup required) | /v1/audio/transcriptions | multipart/form-data | model, file |
| Audio Translation (separate setup required) | /v1/audio/translations | multipart/form-data | model, file |
| Standard TTS (separate setup required) | /v1/audio/speech | JSON | model, input, voice |
| Novita Speech Plugin | /novita/audio/speech | JSON task result | model, input, voice; download audio after completion |
| ElevenLabs Speech Plugin | /novita/elevenlabs/speech | JSON with Base64 MP3 | model, input, voice; decode audio_base64 to save audio |
Image Generation
Ming Image Generation
export COREROUTER_API_KEY="sk-xxxxxxxxxxxxxxxx"
curl --fail-with-body --show-error https://api.corerouter.cloud/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-d '{
"model": "ming-image-0.1-design",
"prompt": "A clean tech product documentation cover, dark background, blue-green light effects",
"size": "1024x1024",
"n": 1
}' \
--output image-response.jsonThe response is JSON, not a PNG file. The tested Ming and GPT Image models return images in data[].b64_json. This local script saves all Base64 images without another model request. Nano Banana uses a different response structure; see its dedicated example below:
import base64
import json
from pathlib import Path
response = json.loads(Path("image-response.json").read_text())
images = response.get("data", [])
if not images:
raise SystemExit("No images returned; check the HTTP status and error first")
for index, item in enumerate(images, 1):
if item.get("b64_json"):
Path(f"image-{index}.png").write_bytes(
base64.b64decode(item["b64_json"], validate=True)
)Other models may return data[].url; download those URLs instead. Open the saved files to verify their contents and actual format. One 1024×1024 PNG was verified; other sizes, multiple-image generation and exact text layout were not covered.
GPT Image
The verified model ID is gpt-image-2.5-flare-oai, using the OpenAI-compatible image generation endpoint. This request matches the successful sample parameters:
curl --silent --show-error --fail-with-body --max-time 180 \
https://api.corerouter.cloud/v1/images/generations \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-flare-oai",
"prompt": "A simple blue circle centered on a plain white background.",
"n": 1,
"size": "1024x1024",
"quality": "low",
"output_format": "png"
}' --output image-response.jsonAfter confirming HTTP success, reuse the data[].b64_json decoder above. On 2026-10-22, one sample returned HTTP 200 and a 1024×1024 PNG. The user confirmed the blue circle on white and exactly one consumption record matching the temporary test price. Other GPT Image models, quality settings, sizes, multiple-image generation, and image editing were not validated by this sample.
Nano Banana
The verified model ID is gemini-2.5-flash-image, using the native Gemini endpoint. Put the model ID in the URL path, appending /v1beta/... to the API domain root. The request body uses contents and generationConfig:
curl --silent --show-error --fail-with-body --max-time 180 \
https://api.corerouter.cloud/v1beta/models/gemini-2.5-flash-image:generateContent \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"role": "user",
"parts": [{
"text": "Generate exactly one image: a simple green square centered on a plain white background."
}]
}],
"generationConfig": {
"candidateCount": 1,
"responseModalities": ["IMAGE"]
}
}' --output nano-banana-response.jsonImages are in candidates[].content.parts[].inlineData.data, with the format in inlineData.mimeType. After confirming HTTP success, run this local decoder; it also accepts the inline_data / mime_type field names:
import base64
import json
from pathlib import Path
response = json.loads(Path("nano-banana-response.json").read_text())
saved = 0
for candidate in response.get("candidates", []):
for part in candidate.get("content", {}).get("parts", []):
inline = part.get("inlineData") or part.get("inline_data")
if not isinstance(inline, dict):
continue
mime = inline.get("mimeType") or inline.get("mime_type")
extension = {"image/png": "png", "image/jpeg": "jpg", "image/webp": "webp"}.get(mime)
if extension is None:
continue
image = base64.b64decode(inline["data"], validate=True)
saved += 1
Path(f"nano-banana-{saved}.{extension}").write_bytes(image)
if saved == 0:
raise SystemExit("No image saved; check HTTP status and response before resubmitting")On 2026-10-22, these parameters returned HTTP 200 and one 1024×1024 PNG. The user confirmed the green square on white and exactly one consumption record matching the temporary test price. The dimensions describe the actual sample; the request does not explicitly constrain them. This test covers text-to-image only, excluding reference-image editing, other Nano Banana models, multiple candidates, streaming, and other resolutions.
Prices for both models follow the console; temporary test prices do not establish Novita's official prices or upstream costs. After a timeout, disconnect, or error, check consumption records and request IDs first. Saving and decoding an existing JSON response does not require another generation request.
Image Editing
The currently verified /v1/images/edits model performs layer separation. Upload a local image and save the response as JSON:
curl --fail-with-body --show-error https://api.corerouter.cloud/v1/images/edits \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-F "model=ming-image-0.1-design-layer" \
-F "[email protected]" \
-F "prompt=Separate the text, subject and background into image layers" \
--output image-response.json/v1/images/edits can also use JSON per client protocol, but images must be passed as URLs or Base64 data supported by that protocol. Don't convert the same multipart request to /v1/edits; the legacy path won't process it as a new multipart image edit flow.
Model Capabilities and Response Handling
ming-image-0.1-design-layer only supports layer separation. In testing, a background-change prompt still returned separate text, subject and background layers. HTTP 200 alone does not confirm that the requested background change succeeded. Instruction-based edits, background replacement and masks require a model that supports those operations.
The response data array may contain multiple images, each with b64_json or url. Decode and save or download every item, then inspect the images instead of reading only the first item. The tested layer model returned three 1024×1024 PNGs with alpha channels. Its response size field was null, so verify dimensions from the actual files. Reuse the local Base64-saving script above to process image-response.json.
Audio Transcription
No working transcription model is currently verified. This is a standard interface example requiring a separately enabled model and channel; do not use minimax-speech-2.8-turbo here.
curl https://api.corerouter.cloud/v1/audio/transcriptions \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-F "model=audio-model-id" \
-F "[email protected]"Audio Translation
No working audio translation model is currently verified. This is a standard interface example requiring a separately enabled model and channel.
curl https://api.corerouter.cloud/v1/audio/translations \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-F "model=audio-model-id" \
-F "[email protected]"Text-to-Speech
Use the respective plugin endpoints below for minimax-speech-2.8-turbo and elevenlabs-tts-multilingual-v2. The standard /v1/audio/speech example below requires a separately enabled compatible TTS model and does not apply to either plugin.
curl --fail --show-error https://api.corerouter.cloud/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-d '{
"model": "tts-model-id",
"voice": "alloy",
"input": "Hello, welcome to CoreRouter."
}' \
--output speech.mp3Novita Text-to-Speech Plugin
minimax-speech-2.8-turbo uses POST /novita/audio/speech. Users provide their CoreRouter Key; they do not need a Novita Key or a local plugin installation. This path starts at the API domain root and returns a JSON task result. Download the audio separately. Clients that only implement /v1/audio/speech cannot use this plugin merely by changing the model name or Base URL.
Submit one short text:
curl --silent --show-error --fail-with-body --max-time 180 \
https://api.corerouter.cloud/novita/audio/speech \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-speech-2.8-turbo",
"input": "你好,欢迎使用芯链智能。",
"voice": "male-qn-qingse",
"response_format": "mp3",
"stream": false,
"metadata": { "language_boost": "Chinese" }
}'A successful response includes id, status: "completed", and content_path. Replace the variable below with that actual id and download the same task's audio. Do not submit another generation to download an existing result:
TASK_ID="replace_with_the_returned_task_ID"
curl --silent --show-error --fail --max-time 180 \
"https://api.corerouter.cloud/v1/tasks/$TASK_ID/artifacts/audio/content" \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
--output speech.mp3Use GET /v1/tasks/{id} to retrieve an existing task, or GET /v1/tasks/{id}/artifacts to list its artifacts. content_path is relative to https://api.corerouter.cloud; do not add an extra /v1 prefix.
The artifact list includes a content_url with an access signature. Anyone holding the complete URL can download that task's audio without an Authorization header, so treat it as a download credential. The signature is bound to the task and artifact. Requests without a signature or Bearer Key return 401; a modified signature or task/artifact path, duplicate signatures, or an empty signature return 404. The current signature has no separate expiration time and does not extend the upstream audio file's lifetime.
This plugin supports non-streaming, mono MP3 only, with nonempty text of 1–500 Unicode characters in input. voice takes a Novita/MiniMax voice ID and defaults to male-qn-qingse; OpenAI voice aliases such as alloy are unsupported. speed accepts 0.5–2 and defaults to 1. Optional metadata fields are volume, pitch, emotion, sample_rate, bitrate, and language_boost; upstream support determines which voices and parameter combinations work. This plugin does not cover transcription, translation, voice cloning, or realtime audio. Missing or empty input, more than 500 characters, stream: true, a non-MP3 format or alloy were each verified to return HTTP 400 with top-level code: "invalid_request" and message, not audio bytes.
Billing uses the per-call price shown in the console. usage.calls counts synthesis calls. usage.provider_usage_characters reports the provider's billable characters for comparison only, or null when absent; it does not enable automatic settlement by actual character count. Novita documents a 24-hour lifetime for the upstream audio URL, so download results promptly.
On 2026-10-20, one short Chinese sample passed generation, task retrieval, download, and full decoding: approximately 3.02 seconds of 24 kHz mono MP3. Bearer Range GET and HEAD both returned 206, the downloaded prefix matched the full file, and HEAD returned no body. The user then listened and reported that the audio was normal, confirming this sample's content and sound by user feedback. Reusing the same task's signed URL without an Authorization header, Range GET and HEAD also returned 206; the first 1024 bytes matched the original file, and HEAD returned no body. The unauthorized and signature-tampering checks described above passed. Other voices and parameters, file availability after 24 hours, and failure refunds remain unverified. This result does not establish /v1/audio/speech compatibility.
ElevenLabs Multilingual V2
elevenlabs-tts-multilingual-v2 uses POST /novita/elevenlabs/speech, starting at the API domain root. Users only need their CoreRouter Key; no local plugin or Novita Key is required. A successful response is JSON containing the MP3 in audio_base64. Save the JSON, then decode the audio locally.
Submit one short sentence and save the response:
curl --silent --show-error --fail-with-body --max-time 120 \
https://api.corerouter.cloud/novita/elevenlabs/speech \
-H "Authorization: Bearer $COREROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "elevenlabs-tts-multilingual-v2",
"input": "你好,欢迎使用芯链智能。",
"voice": "JBFqnCBsd6RMkjVDRZzb",
"response_format": "mp3",
"stream": false
}' --output elevenlabs-response.jsonA successful response includes id, status: "completed", format: "mp3", audio_base64, audio_bytes, and usage. After confirming HTTP success, run this local decoder; it makes no further model requests:
import base64
import json
from pathlib import Path
result = json.loads(Path("elevenlabs-response.json").read_text())
if result.get("status") != "completed":
raise SystemExit("Task incomplete; check HTTP status and the existing task before resubmitting")
audio = base64.b64decode(result["audio_base64"], validate=True)
if len(audio) != result["audio_bytes"]:
raise SystemExit("Audio length mismatch; retain the response for diagnosis")
Path("elevenlabs-speech.mp3").write_bytes(audio)The current plugin accepts 1–100 Unicode characters and non-streaming MP3 only, fixed at 22.05 kHz, 32 kbps, mono, with a maximum of 256 KiB per audio result. Omit voice to use George (JBFqnCBsd6RMkjVDRZzb); other voice IDs depend on upstream availability. Voice IDs must contain exactly 20 ASCII letters or digits. Only the five request fields shown above are supported; MiniMax's speed and metadata, and OpenAI voice aliases such as alloy, are unsupported. This endpoint does not provide MiniMax's content_path download flow. Clients implementing only standard /v1/audio/speech cannot use it directly.
Keep the first successful response JSON and task ID instead of submitting another POST to save the audio. GET /v1/tasks/{id} returns a status summary without Base64 audio; this plugin has no separate audio download or result recovery endpoint. If the response is lost or a timeout or disconnect occurs, check the existing task and consumption records, then contact support. Another POST creates a new generation rather than recovering the result. usage.calls counts synthesis calls; usage.input_characters counts input characters and is not the provider's actual billable character count. Per-call prices follow the console, and actual upstream costs require separate verification.
On 2026-10-22, one 12-character Chinese sentence using George passed generation through the CoreRouter plugin and bridge: HTTP 200, completed task, 10675-byte MP3, approximately 2.55 seconds, and full decoding passed. The user confirmed normal audio, exactly one consumption record, and the configured temporary test charge. This sample does not validate other voices, languages, long text, streaming, task retrieval, failure refunds, or concurrency.
Usage Recommendations
- Image count, size, quality, and audio duration all affect costs; test on a small scale first.
nin image generation indicates the number of images. Don't allow users to pass unlimitednin your application.- Image sizes use the letter
x, e.g.,1024x1024, not the multiplication sign×. - When providing upload interfaces, limit file size, format, and duration.
- Don't reuse chat model IDs for image and audio models unless the console explicitly indicates support.
- If SDK wrapping of media interfaces is incomplete, directly use curl or HTTP clients.
- Standard TTS typically returns audio bytes. The MiniMax plugin returns JSON followed by a separate download; the ElevenLabs plugin returns JSON with
audio_base64to decode. Do not save either submission response directly as an MP3. - Voice recognition and translation typically require file upload, not just passing file path strings to JSON.
Common Issues
400: Check ifmultipart/form-datafield names are correct and file paths exist.415: Check if file format is supported by the model.- Empty file returned: Confirm command has
--outputand check if response Header is audio content. - Abnormal costs: Check if
n, size, audio duration, and quality parameters meet expectations.
