媒體與 OCR
圖片工具、檔案工具、OCR、Google Cloud Vision、審核、音樂與參數處理
檔案端點接受 multipart 檔案上傳或 JSON data URL。審核接受文字或聊天訊息。音樂接受提示詞與選填圖片。請以你的 SilentAPI API 金鑰驗證。
| 上限 | 值 |
|---|---|
| 檔案工具與 OCR 的解碼後輸入 | 20 MB |
| 圖片轉換與 SilentAPI 圖片 OCR 的圖片大小 | 每邊 12,000 像素 |
| OCR 選取的 PDF 頁面 | 50 頁 |
| Mistral OCR 4.1 選取的頁面 | 1,000 頁 |
| Multipart 檔案大小 | 每個檔案 25 MB |
| Multipart 檔案數量 | 8 個檔案 |
| Multipart 總大小 | 50 MB |
以下回應值僅為範例,並非現行價格。Base64 回應字串僅顯示部分輸出。cost 欄位以額度計。現行價格請見 [ Services ] 頁面或 [ 計算機 ]。
JSON 檔案請求請將 file 設為完整的 data URL。範例使用含小型 PNG 的變數:
IMAGE_DATA='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aBZkAAAAASUVORK5CYII='
圖片壓縮
POST /v1/images/compress 會產生較小的圖片,預設並移除詮釋資料。
curl https://api.silentapi.com/v1/images/compress \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@photo.png" \
-F "format=webp" \
-F "quality=75" \
-F "response_format=b64_json"
curl https://api.silentapi.com/v1/images/compress \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file\":\"$IMAGE_DATA\",\"format\":\"webp\",\"quality\":75,\"response_format\":\"b64_json\"}"
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| file | 檔案或 data URL | 必填 | JPEG、PNG、WebP、GIF 或 HEIC 輸入 |
| format | string | webp | webp、jpeg、png 或 avif |
| quality | integer | 75 | 1 至 100 |
| lossless | boolean | false | 僅限 PNG 或 WebP。WebP 會強制 quality 為 100。 |
| stripMetadata | boolean | true | 在支援時移除詮釋資料 |
| maxWidth | integer | none | 1 至 12,000 像素 |
| maxHeight | integer | none | 1 至 12,000 像素 |
| response_format | string | binary | binary 或 b64_json |
{
"object": "image",
"data": [{ "b64_json": "UklGRg==", "mime_type": "image/webp" }],
"width": 1600,
"height": 900,
"bytes_in": 842100,
"bytes_out": 126400,
"cost": 0.12
}
預設回應為 binary。搭配 curl 使用 -o output.webp 儲存。費用請看 X-SilentAPI-Cost。壓縮按次計費。輸入須符合 20 MB 與圖片尺寸上限。現行價格請見 [ Services ] 頁面。
圖片轉換
POST /v1/images/convert 可將圖片轉為所選格式。請求欄位與回應結構與圖片壓縮相同。format 欄位為必填。
curl https://api.silentapi.com/v1/images/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@photo.png" \
-F "format=jpeg" \
-F "quality=82" \
-F "response_format=b64_json"
curl https://api.silentapi.com/v1/images/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file\":\"$IMAGE_DATA\",\"format\":\"jpeg\",\"quality\":70,\"response_format\":\"b64_json\"}"
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| file | 檔案或 data URL | 必填 | JPEG、PNG、WebP、GIF 或 HEIC 輸入 |
| format | string | 必填 | webp、jpeg、png 或 avif |
| quality | integer | WebP、JPEG 與 AVIF 適用 82 | 1 至 100。PNG 預設不設定 quality。 |
| lossless | boolean | false | jpeg 或 avif 不適用 |
| stripMetadata | boolean | true | 在支援時移除詮釋資料 |
| maxWidth | integer | none | 1 至 12,000 像素 |
| maxHeight | integer | none | 1 至 12,000 像素 |
| response_format | string | binary | binary 或 b64_json |
{
"object": "image",
"data": [{ "b64_json": "/9j/", "mime_type": "image/jpeg" }],
"width": 1200,
"height": 800,
"bytes_in": 520000,
"bytes_out": 98000,
"cost": 0.12
}
轉換按次計費。輸入須符合 20 MB 與圖片尺寸上限。現行價格請見 [ Services ] 頁面。
移除檔案詮釋資料
POST /v1/files/metadata/remove 可移除圖片、PDF 檔案與 Office 檔案的詮釋資料。
curl https://api.silentapi.com/v1/files/metadata/remove \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@document.pdf" \
-F "response_format=b64_json"
curl https://api.silentapi.com/v1/files/metadata/remove \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file\":\"$IMAGE_DATA\",\"response_format\":\"b64_json\"}"
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| file | 檔案或 data URL | 必填 | JPEG、PNG、WebP、GIF、HEIC、PDF、DOCX、XLSX 或 PPTX |
| filename | string | file | JSON 檔案輸入的名稱 |
| response_format | string | binary | binary 或 b64_json |
{
"object": "file",
"data": [{ "b64_json": "JVBERi0=", "mime_type": "application/pdf" }],
"removed": ["document-properties", "xmp"],
"cost": 0.02
}
輸入上限為 20 MB。不支援加密的 PDF 檔案。JPEG 方位與圖片色彩描述檔可能保留。HEIC 輸入會轉為 JPEG。Office 處理會移除文件屬性與部分作者欄位,不會移除文件內容。
詮釋資料移除按次計費。檔案轉換可能加收轉換費用。現行價格請見 [ Services ] 頁面。
OCR
POST /v1/ocr 可從圖片與文件讀取文字。將 model 設為以下其中一個值:
| 模型 | 輸入 | 頁面上限 |
|---|---|---|
| silentapi-ocr | 圖片與 PDF 檔案。英文 OCR 資料。 | 選取 50 頁 |
| vision-document-text-detection | 每次呼叫一張圖片(Google Cloud Vision 文件文字偵測)。不接受 PDF 輸入。 | 一張圖片 |
| mistral-ocr-4-1 | 圖片與文件 | 選取 1,000 頁 |
curl https://api.silentapi.com/v1/ocr \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@scan.pdf" \
-F "model=silentapi-ocr" \
-F "outputFormat=blocks" \
-F "pages=1-3"
curl https://api.silentapi.com/v1/ocr \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file\":\"$IMAGE_DATA\",\"model\":\"silentapi-ocr\",\"outputFormat\":\"text\"}"
OCR
OCR 支援圖片與 PDF 檔案,使用英文 OCR 資料,最多允許選取 50 頁。
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| file | 檔案或 data URL | 必填 | JPEG、PNG、WebP、GIF、HEIC 或 PDF |
| model | string | silentapi-ocr | silentapi-ocr |
| outputFormat | string | text | text 或 blocks |
| pages | 陣列或範圍 | all | 最多 50 頁,例如 [1,2] 或 1-3 |
| 頁面選取 | 範例 | 規則 |
|---|---|---|
| 範圍 | 1-3 | 頁碼從 1 開始 |
| 陣列 | [1,3] | 每個頁碼必須不重複 |
所選頁面必須存在。可使用 output_format 替代 outputFormat。
{
"object": "ocr",
"model": "silentapi-ocr",
"pages": [{ "page": 1, "text": "Example text", "source": "ocr" }],
"usage": { "pages": 1, "ocrPages": 1, "cpuMs": 215 },
"cost": 0.17
}
source 欄位顯示 SilentAPI 讀取各頁的方式:
| 值 | 意義 |
|---|---|
| text-layer | PDF 頁面內嵌了足夠的文字,SilentAPI 會回傳該文字。 |
| ocr | 該頁為掃描頁或圖片,SilentAPI 會以 OCR 讀取。 |
區塊可包含以下欄位:
| 欄位 | 類型 | 意義 |
|---|---|---|
| text | string | 區塊文字 |
| bbox | object | 含 x0、y0、x1 與 y1 的區塊方框 |
| confidence | number | 辨識信賴度 |
費用按頁數、OCR 頁數與圖片轉換計算。現行價格請見 [ Services ] 頁面。
Google Cloud Vision 文件文字偵測
文件文字偵測是 Google Cloud Vision 的文字讀取器,適用於密集文字與文件。在 POST /v1/ocr 上將 model 設為 vision-document-text-detection,即可取得與其他模型相同的 OCR 回應結構。每次呼叫讀取一張圖片(JPEG、PNG、WebP 或 GIF,最多 20 MB),不支援 PDF 輸入。舊版模型名稱 google-ocr 仍可使用。若要取得完整的 Google Cloud Vision 回應,請呼叫 POST /v1/google/vision-document-text-detection,或使用 vision-text-detection 讀取照片中的短文字。
curl https://api.silentapi.com/v1/ocr \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@scan.png" \
-F "model=vision-document-text-detection" \
-F "outputFormat=blocks"
Mistral OCR 4.1
Mistral OCR 4.1 可讀取圖片與文件。輸入上限為 20 MB。頁面選取使用 1 至 1,000 的編號。供應商上限亦適用。
curl https://api.silentapi.com/v1/ocr \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@scan.pdf" \
-F "model=mistral-ocr-4-1" \
-F "pages=1-3" \
-F "outputFormat=markdown" \
-F "table_format=markdown"
curl https://api.silentapi.com/v1/ocr \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file\":\"$IMAGE_DATA\",\"model\":\"mistral-ocr-4-1\",\"outputFormat\":\"blocks\",\"include_image_base64\":false}"
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| file | 檔案或 data URL | 必填 | 圖片或文件輸入 |
| model | string | silentapi-ocr | 設為 mistral-ocr-4-1 |
| pages | 陣列或範圍 | all | 有效頁面,API 最多選取 1,000 頁 |
| outputFormat | string | text | text、markdown 或 blocks |
| table_format | string | 供應商預設值 | markdown 或 html |
| extract_header | boolean | 供應商預設值 | 為 true 時請求文件頁首 |
| extract_footer | boolean | 供應商預設值 | 為 true 時請求文件頁尾 |
| include_image_base64 | boolean | 供應商預設值 | 為 true 時請求頁面圖片 |
| confidence_scores_granularity | string | none | page、block 或 word |
| document_annotation_format | object | none | type:json_schema,附 json_schema.schema |
| bbox_annotation_format | object | none | type:json_schema,附 json_schema.schema |
| document_annotation_prompt | string | none | 必須提供 document_annotation_format,最多 4,000 個字元 |
{
"object": "ocr",
"model": "mistral-ocr-4-1",
"pages": [{ "page": 1, "markdown": "# Example document", "images": [] }],
"usage": { "pages": 1 },
"cost": 0.8
}
每頁都有 page 與 markdown,其他欄位在回應包含時出現:
| 欄位 | 意義 |
|---|---|
| page | 頁碼,從 1 開始 |
| markdown | Markdown 格式的頁面文字。Mistral OCR 即使在你選擇 text 時仍會回傳。 |
| blocks | 文字區塊。請選擇 blocks 以請求。 |
| tables | 頁面上的表格 |
| images | 頁面上的圖片,存在時含 id、bbox、image_base64 與 image_annotation |
| header | 頁面頁首 |
| footer | 頁面頁尾 |
| dimensions | 頁面尺寸 |
| confidence_scores | 信賴度分數 |
回應頂層可能出現 document_annotation 欄位。
Mistral OCR 按 OCR 頁數計費。註解選項按註解頁面費率計費。現行價格請見 [ Services ] 頁面。
Google Cloud Vision
POST /v1/google_cloud/ 可在單張圖片上執行一項 Google Cloud Vision 功能,並回傳完整的 Google Cloud Vision 結果。圖片請以 multipart image 檔案傳送,或以 JSON 將 image 設為 data URL 或圖片 URL。圖片可為 JPEG、PNG、WebP 或 GIF,最多 20 MB。
| 模型 | 回傳內容 |
|---|---|
| vision-label-detection | 物件、場景與活動的標籤,附分數 |
| vision-text-detection | 照片中的短文字(如招牌與標籤),附單詞方框 |
| vision-document-text-detection | 密集文字與文件,含頁面、區塊、段落與單詞 |
| vision-face-detection | 臉部方框、地標與表情可能性。不會辨識人物身分。 |
| vision-landmark-detection | 知名地標,附位置座標 |
| vision-logo-detection | 產品與品牌標誌,附方框 |
| vision-safe-search-detection | 成人、暴力、醫療、仿冒與煽情內容的可能性 |
| vision-image-properties | 主色與裁剪提示 |
| vision-object-localization | 物件,含名稱、分數與正規化方框 |
| vision-web-detection | 網頁實體、相符圖片與使用該圖片的頁面 |
curl https://api.silentapi.com/v1/google_cloud/vision-label-detection \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@photo.jpg" \
-F "maxResults=5"
curl https://api.silentapi.com/v1/google_cloud/vision-object-localization \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"image\":\"$IMAGE_DATA\",\"maxResults\":10}"
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| image | 檔案、data URL 或 URL | 必填 | 一張圖片。image_url 與 url 亦可接受。 |
| maxResults | integer | 10 | 回傳清單的功能適用 1 至 50 個結果 |
{
"response": {
"labelAnnotations": [
{ "mid": "/m/01bqvp", "description": "Sky", "score": 0.97, "topicality": 0.97 },
{ "mid": "/m/0838f", "description": "Water", "score": 0.94, "topicality": 0.94 }
]
},
"cost": 0.15
}
response 欄位存放該功能的 Google Cloud Vision 結果,如 labelAnnotations、textAnnotations、fullTextAnnotation、faceAnnotations、landmarkAnnotations、logoAnnotations、safeSearchAnnotation、imagePropertiesAnnotation、localizedObjectAnnotations 或 webDetection。每次呼叫計費一次。現行價格請見 [ Services ] 頁面。
內容審核
POST /v1/moderations 以 mistral-moderation-2603(亦稱 Mistral Moderation 2)檢查文字或聊天訊息。
curl https://api.silentapi.com/v1/moderations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"mistral-moderation-2603","input":["Example text to check"]}'
curl https://api.silentapi.com/v1/moderations \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=mistral-moderation-2603" \
-F "input=Example text to check"
審核不接受檔案上傳或 data URL 作為媒體輸入。文字請用 input,聊天請用 messages。兩者並存時使用 messages。
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| model | string | mistral-moderation-2603 | mistral-moderation-2603 |
| input | 字串或陣列 | 無 messages 時必填 | 最多 32 個非空文字值,合計 400,000 個字元 |
| messages | array | none | 非空陣列。角色:system、user、assistant、tool。內容須為文字。合計最多 400,000 個字元。 |
{
"id": "modr-12345678-1234-4234-8234-123456789012",
"model": "mistral-moderation-2603",
"results": [{ "flagged": false, "categories": { "hate": false }, "category_scores": { "hate": 0.01 } }],
"cost": 0.0203
}
類別名稱視模型回應而定。成功的審核呼叫收取呼叫費與輸入 詞元 費,並適用共用服務與帳號媒體上限。現行價格請見 [ Rate Limits ] 與 [ Services ] 頁面。
音樂
POST /v1/audio/music creates music with lyria-3-pro or lyria-3-clip. The default is lyria-3-clip.
curl https://api.silentapi.com/v1/audio/music \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\":\"lyria-3-clip\",\"prompt\":\"A quiet electronic morning\",\"image\":\"$IMAGE_DATA\",\"response_format\":\"wav\"}"
curl https://api.silentapi.com/v1/audio/music \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "prompt=A quiet electronic morning" \
-F "model=lyria-3-clip" \
-F "image=@reference.png"
| 名稱 | 類型 | 預設值 | 規則 |
|---|---|---|---|
| model | string | lyria-3-clip | lyria-3-pro 或 lyria-3-clip |
| prompt | string | 必填 | 音樂描述,不可留空。也可使用 input。 |
| image | data URL, HTTPS URL, or file | none | 選填的圖片輸入 |
| image_url | data URL 或 HTTPS URL | none | 選填的圖片輸入 |
| response_format | string | model default | wav, pcm, flac, mp3, opus, or aac. See Music options. |
{
"object": "music",
"created": 1770000000,
"data": [{ "b64_json": "UklGRg==", "mime_type": "audio/wav", "lyrics": null }],
"silentapi": { "cost": 4, "fallback": null, "model": "lyria-3-clip", "model_name": "Lyria 3 Clip" }
}
音樂一律以 JSON 傳回,其中包含 base64 編碼的音訊。輸出媒體類型取決於處理請求的路由。歌詞可能為 null。不支援二進位回應。
| 上限 | 值 |
|---|---|
| 上傳檔案大小 | 每個檔案 25 MB |
| 上傳檔案數量 | 8 個檔案。僅使用第一個圖片檔。 |
| 上傳總大小 | 50 MB |
| JSON 中的 data URL 輸入 | 解碼後為 50 MB,即標準媒體大小限制 |
檔案工具的圖片尺寸限制不適用於此端點。音樂依產生次數計費,目前價格請見[ 服務 ]頁面。
參數處理
各模型接受各自的選項組合。SilentAPI 會使用支援的值、在可轉換時轉換輸出,或略去模型不用的控制項。可復原的選項不應阻擋其他有效的請求。損毀的檔案、缺少必要輸入與無法讀取的格式仍會回傳錯誤。SilentAPI 不會以編造的文字取代不支援的圖片或音訊內容。
| 動作 | 意義 |
|---|---|
| 轉換 | SilentAPI 會改變輸出,例如將 PCM 音訊轉為 WAV 檔。 |
| 最接近的值 | SilentAPI 會使用最接近的支援值,例如 1792x1024 會變為 16:9 長寬比。 |
| 忽略 | SilentAPI 不會傳送該選項,因為模型沒有此控制項。 |
音訊回應帶有顯示實際格式的 X-SilentAPI-Format 標頭,如 wav。Content-Type 與回傳的位元組相符。常見的 MIME 與檔名別名皆可接受,包括 audio/wav、audio/mpeg 與 .MP3。若請求的格式改變,X-SilentAPI-Notice 會說明,例如 Requested opus. Returned mp3.。未知格式會使用模型預設值並回傳通知。壓縮音訊不會假裝已轉換而重新命名。
語音
POST /v1/audio/speech 在每個語音模型上接受 response_format 的值 mp3、wav、opus、aac、flac 與 pcm。
| 模型 | 你會取得的格式 | 其他請求 |
|---|---|---|
| voxtral-mini-tts-3.0 | mp3, wav, pcm | opus and aac return mp3. flac returns wav. |
| gemini-3.8-flash-tts | wav, pcm | mp3、opus、aac 與 flac 會回傳 wav。 |
| gemini-3.8-flash-lite-tts | wav, pcm | mp3、opus、aac 與 flac 會回傳 wav。 |
未傳送 response_format 時,Voxtral 回傳 mp3,Gemini 回傳 wav。SilentAPI 會為 PCM 音訊加上 WAV 標頭製成 WAV 檔,音訊本身不變。PCM 輸出為原始有號 16 位元取樣,小端序,單聲道。Content-Type 會給出取樣率,例如 audio/pcm;rate=24000;channels=1。
curl https://api.silentapi.com/v1/audio/speech \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"voxtral-mini-tts-3.0","input":"Your request is ready.","voice":"en_paul_neutral","response_format":"wav"}' \
-D headers.txt \
-o speech.wav
| 選項 | 處理方式 |
|---|---|
| voice | 語音名稱比對不分大小寫。未知語音(例如 OpenAI 語音名稱 alloy)會使用模型預設語音。 |
| speed | 以 0.25 至 4 的數字傳送。SilentAPI 會將其他值改為此範圍最接近的一端。無語速控制的模型會忽略它。 |
| 模型 | 預設語音 | 語音 |
|---|---|---|
| voxtral-mini-tts-3.0 | en_paul_neutral | en_paul_neutral, en_paul_happy, en_paul_sad, en_paul_frustrated, en_paul_excited, en_paul_confident, en_paul_cheerful, en_paul_angry, gb_oliver_neutral, gb_oliver_sad, gb_oliver_excited, gb_oliver_curious, gb_oliver_confident, gb_oliver_cheerful, gb_oliver_angry, gb_jane_neutral, gb_jane_sarcasm, gb_jane_confused, gb_jane_shameful, gb_jane_sad, gb_jane_jealousy, gb_jane_frustrated, gb_jane_curious, gb_jane_confident, fr_marie_neutral, fr_marie_sad, fr_marie_happy, fr_marie_excited, fr_marie_curious, fr_marie_angry |
| gemini-3.8-flash-tts, gemini-3.8-flash-lite-tts | Kore | Zephyr, Puck, Charon, Kore, Fenrir, Leda, Orus, Aoede, Callirrhoe, Autonoe, Enceladus, Iapetus, Umbriel, Algieba, Despina, Erinome, Algenib, Rasalgethi, Laomedeia, Achernar, Alnilam, Schedar, Gacrux, Pulcherrima, Achird, Zubenelgenubi, Vindemiatrix, Sadachbia, Sadaltager, Sulafat |
轉錄
Voxtral 3 模型為 voxtral-small-transcribe-3.0 與 voxtral-mini-transcribe-3.0。Voxtral 3 語音與轉錄使用端對端 ZDR 路由。較早的 Voxtral Mini Transcribe 與 Mini TTS 模型已移除。gemini-3.5-transcribe 仍可使用,具 SilentAPI 受保護的隱私。
POST /v1/audio/transcriptions 在每個語音轉文字模型上接受以下所有 response_format,SilentAPI 會依模型輸出組出請求的結構。
| response_format | 結果 |
|---|---|
| json | 預設值。含 text 與費用欄位的 JSON。 |
| text | 純文字 |
| verbose_json | JSON,包含 task、已知時的 language、duration、text 和 segments。模型提供字詞時間時會出現 words。 |
| srt | SubRip 字幕 |
| vtt | WebVTT 字幕 |
模型有提供分段時間即會採用。GPT 轉錄僅提供文字。模型未提供時間時,SilentAPI 會為整段音訊回傳一個分段或一條字幕,結束時間即音訊長度;WAV 檔的長度精確,其他格式由檔案大小估算。
text、srt 與 vtt 格式不回傳 JSON,請在 X-SilentAPI-Cost 標頭中查看費用。未知的 response_format 會回傳 json;當您傳送 language、prompt 與 temperature 時,SilentAPI 會將其轉交給模型。
curl https://api.silentapi.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@recording.mp3" \
-F "model=voxtral-mini-transcribe-3.0" \
-F "response_format=srt"
圖片產生
POST /v1/images/generations 與 POST /v1/images/edits 會調整以下選項以符合模型:
| 選項 | 處理方式 |
|---|---|
| size | SilentAPI 會使用模型支援的最接近長寬比與圖片大小,例如 1792x1024 會變為 16:9(1.5K,於 grok-imagine-image-2.0 上)。 |
| aspect_ratio | 模型支援時使用,否則 SilentAPI 使用最接近的支援比例。aspect_ratio 優先於 size。 |
| image_size 或解析度 | 0.5K、1K、1.5K、2K 或 4K。SilentAPI 會使用模型支援的最接近大小,優先於 size 中的大小。 |
| n | 1 至 4。每次呼叫產生一張圖片的模型,每張圖片各呼叫一次。若後續呼叫失敗,你會取得已產生的圖片,且僅支付這些圖片的費用。 |
| response_format | b64_json 為預設值。使用 url 會取得 data URL,例如 data:image/png;base64,...,因為模型回傳的是圖片資料而非連結。 |
| output_format | png、jpeg 或 webp。模型回傳其他格式時,SilentAPI 會轉換圖片,每張轉換的圖片加收圖片轉換費用。output_compression 設定 jpeg 與 webp 的品質。轉換失敗時你會取得原始圖片,mime_type 顯示實際格式。 |
| 品質、背景、樣式 | 不支援這些控制的模型會忽略此選項。 |
| 模型 | 長寬比 | 圖像尺寸 |
|---|---|---|
| gemini-nano-banana-2.1 | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 | 1K, 2K, 4K |
| gemini-3.1-flash-image | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 4:1, 1:8, 8:1 | 0.5K, 1K, 2K, 4K |
| gemini-3.1-flash-lite-image | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 | 1K |
| grok-imagine-image-2.0 | 1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1 | 1K, 1.5K, 2K |
Nano Banana 2.1、Nano Banana 2 與 Nano Banana 2 Lite 使用端到端零資料保留路由。
Grok Imagine Image 2 在低品質下預設為 1K,僅支援低與中品質,費用依所選品質與解析度計算,每張成功生成的圖像會再次計收各輸入圖像的費用,失敗的生成不收費。
GPT 圖像模型會在一次呼叫中產生全部 n 張圖像,並調整以下選項:
| 選項 | 處理方式 |
|---|---|
| size | 像素尺寸(例如 1536x1024)會原樣傳送至模型,模型會採用其支援的最接近尺寸;尺寸等級(例如 2K)則直接設定圖像尺寸。 |
| aspect_ratio、image_size 或 resolution | 若同時傳送其中之一與像素尺寸,SilentAPI 會傳送最接近的長寬比與最接近的圖像尺寸(512、768、1K、1.5K、2K 或 4K),而非像素尺寸。 |
| quality | auto, low, medium, or high. standard becomes medium. hd, xhigh, and max become high. |
| background | 自動、透明或不透明。透明背景請使用 png 或 webp。 |
| output_format | 模型可直接產生 png、jpeg 與 webp,不另收費,其他格式則使用上述轉換流程。 |
| output_compression | 0 至 100,適用於 jpeg 與 webp |
| seed | 整數;相同的 seed 與選項會產生相似的圖像,但結果仍可能變化。 |
| 輸入圖像 | 最多 16 張圖像,可來自 image、images、image_url 或上傳的檔案,用以引導新圖像的產生。 |
音樂
| response_format | 結果 |
|---|---|
| wav | WAV audio |
| pcm | 從 WAV 輸出擷取的原始 PCM。mime_type 提供取樣率與聲道資訊。 |
| flac | WAV 音訊,最接近的無損格式 |
| mp3, opus, aac, or absent | 模型預設格式,通常為 mp3 |
X-SilentAPI-Format 標頭與 mime_type 會顯示實際格式。音樂模型不支援控制長度,因此 SilentAPI 不會傳送 duration 或 seconds。Lyria 3 Clip 會產生短片段。使用 Lyria 3 Pro 時,請在提示詞中註明所需長度。
影片
grok-imagine-video-1.5-lite 在 480p、720p 或 1080p 下支援 1 至 15 秒,較早的 grok-imagine-video 仍可在 480p 與 720p 使用,兩者均受 SilentAPI 保護,價格依解析度與輸入圖像而定。
不支援影片與音訊輸入檔案;包含影片或音訊輸入的請求會在送達模型前傳回 HTTP 400。對於支援的輸出選項,SilentAPI 會採用最接近的支援值:
duration(或seconds)會轉為模型範圍內的整數秒數,例如在允許 1 至 15 秒 的模型上,30 會變為 15。resolution(或size,格式為WIDTHxHEIGHT)會採用最接近的支援解析度,例如在最高支援 720p 的模型上,1080p 會變為 720p。aspect_ratio會採用最接近的支援比例;size(例如1080x1920)同時會設定比例。- 額度預扣與實際扣款均採用相同的調整後數值,您只需為實際取得的影片付費。
Webhook
影片任務可能需要數分鐘;與其輪詢 GET /v1/videos/{id},不如在送出任務時一併傳送 webhook_url,任務完成或失敗時我們會向該位址傳送 POST。該位址必須是公開的 https 網址,其他位址會在任務開始前傳回 HTTP 400。
內文與 GET /v1/videos/{id} 傳回的 JSON 物件相同;X-SilentAPI-Event 標頭為 video.completed 或 video.failed。您的伺服器有 15 秒 的時間回應,傳送失敗不會重試,因此重要任務仍請以輪詢作為備援。
curl https://api.silentapi.com/v1/videos \
-H "Authorization: Bearer $SILENTAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "veo-3.1-fast", "prompt": "A quiet lake at dawn", "duration": 6, "webhook_url": "https://example.com/hooks/video"}'
嵌入
POST /v1/embeddings 在所有模型上接受 encoding_format 的 float(預設)或 base64 格式;SilentAPI 會取得 float 向量並自行產生 base64 字串,該字串包含 32 位元浮點數,採小端序,與 OpenAI API 的排列方式相同。
| 模型 | 完整尺寸 | dimensions |
|---|---|---|
| text-embedding-3-small | 1,536 | 原樣傳送至模型 |
| text-embedding-3-large | 3,072 | 原樣傳送至模型 |
| gemini-embedding-2 | 3,072 | 原樣傳送至模型 |
| qwen3-embedding-8b | 4,096 | 原樣傳送至模型 |
| codestral-embed-2505 | 1,536 | SilentAPI 保留前面的數值並將向量縮放至長度 1,此為該模型家族的縮短方式。 |
| mistral-embed-2312 | 1,024 | 不支援,您將取得完整向量。 |
dimensions 等於或大於完整尺寸時會傳回完整向量;非大於 0 的整數的值會被忽略。