### cURL Example: Get File List Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/get-file-list Example cURL command to retrieve a list of files from the SiliconFlow API, demonstrating the GET request method and required authorization header. ```cURL curl --request GET \ --url https://api.siliconflow.cn/v1/files \ --header 'Authorization: Bearer ' ``` -------------------------------- ### API Reference: Get File List Response Example Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/get-file-list Illustrates the successful JSON response structure for the GET /files API endpoint, showing an example of a file object with its properties like ID, filename, purpose, and size. ```APIDOC Response (200 application/json): description: Successful response with file list type: object example: code: 20000 message: "Ok" status: true data: data: - id: "file-kkhtqklcnm" object: "file" bytes: 806 created_at: 1741777570 filename: "requests-2.jsonl" purpose: "batch" line_count: 2 object: "file" ``` -------------------------------- ### cURL Example for Retrieving Models List Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/models/get-model-list A cURL command example demonstrating how to make a GET request to the /v1/models endpoint, including the necessary Authorization header with a Bearer token for authentication. ```cURL curl --request GET \ --url https://api.siliconflow.cn/v1/models \ --header 'Authorization: Bearer ' ``` -------------------------------- ### cURL Example: Create Video Generation Request Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/videos/videos_submit Demonstrates how to make a POST request to the /v1/video/submit endpoint using cURL, including necessary headers for authorization and content type, and a JSON body with example parameters for video generation. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/video/submit \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "Wan-AI/Wan2.1-T2V-14B", "prompt": "", "negative_prompt": "", "image_size": "1280x720", "image": "https://inews.gtimg.com/om_bt/Os3eJ8u3SgB3Kd-zrRRhgfR5hUvdwcVPKUTNO6O7sZfUwAA/641", "seed": 123 }' ``` -------------------------------- ### Successful JSON Response Example for Models List Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/models/get-model-list An example JSON response returned upon a successful GET request to the /v1/models endpoint, showing the structure of the model list object and a sample model entry. ```JSON { "object": "list", "data": [ { "id": "stabilityai/stable-diffusion-xl-base-1.0", "object": "model", "created": 0, "owned_by": "" } ] } ``` -------------------------------- ### Successful Video Generation Link API Response Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/videos/get_videos_status An example of the JSON response returned upon a successful request to retrieve a video generation link, detailing the structure of the `results` object including video URLs, timings, and seed. ```JSON { "status": "Succeed", "reason": "", "results": { "videos": [ { "url": "" } ], "timings": { "inference": 123 }, "seed": 123 } } ``` -------------------------------- ### cURL Example: Retrieve Batch Details Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/get-batch Example cURL command to send a GET request to the SiliconFlow API to retrieve the details of a specific batch task, requiring an authorization token. ```cURL curl --request GET \ --url https://api.siliconflow.cn/v1/batches/{batch_id} \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Example cURL Request to Get Voice Styles List Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/voice-list Demonstrates how to make a GET request to the SiliconFlow API's /v1/audio/voice/list endpoint using cURL. This request requires an 'Authorization' header with a Bearer token. ```cURL curl --request GET \ --url https://api.siliconflow.cn/v1/audio/voice/list \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Qwen2.5-7B-Instruct System Prompt for 'Smart Sayings' Application (Before Fine-tuning) Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/userguide/guides/fine-tune This prompt defines the role, task, input, and output format for the Qwen2.5-7B-Instruct model to generate 'golden phrases' in a critical and humorous style. It specifies the persona, provides examples, and enforces a strict JSON output format, resulting in a lengthy prompt. ```AI Prompt # 角色 你是一位新潮评论家,你年轻、批判,又深刻; 你言辞犀利而幽默,擅长一针见血得表达隐喻,对现实的批判讽刺又不失文雅; 你的行文风格和"Oscar Wilde" "鲁迅" "林语堂"等大师高度一致; 从情感上要是对输入的否定。 # 任务 ## 金句诠释 用特殊视角来全新得诠释给定的汉语词汇; 敏锐得抓住给定的词汇的本质,用“辛辣的讽刺”“一针见血的评论”的风格构造包含隐喻又直达本质的「金句」 例如: "合伙人": "一同下海捞金时,个个都是乘风破浪的水手,待到分金之际,方知彼此是劫财的海盗。" "大数据": "看似无所不能的数字神明,实则不过是现代社会的数字鸦片,让人沉溺于虚幻的精准,却忽略了人性的复杂与多变。" "股市": "万人涌入的淘金场,表面上是财富的摇篮,实则多数人成了填坑的沙土。" "白领": "西装革履,看似掌握命运的舵手,实则不过是写字楼里的高级囚徒。" "金融家": "在金钱的海洋中遨游,表面上是操纵风浪的舵手,实则不过是随波逐流的浮萍。" "城市化": "乡村的宁静被钢铁森林吞噬,人们在追逐繁华的幻影中,遗失了心灵的田园。" "逃离北上广": "逃离繁华的都市牢笼,看似追逐自由的灵魂,实则不过是换个地方继续画地为牢。" "基金": "看似为财富增值保驾护航的金融巨轮,实则多数人不过是随波逐流的浮萍,最终沦为填补市场波动的牺牲品。" # 输入 用户直接输入词汇。 # 输出 严格输出JSON格式,包括两个字段,“prompt”为用户的输入;“output”为用户的金句内容,不额外输出额外任何其他内容,不要输出引号,严格限制用户的输入的词汇绝对不能出现在输出中,注意突出转折和矛盾,输出内容为一句话,最后以“。”结束,中间的停顿使用“,”分隔。例如 { "prompt": "合伙人", "output": "一同下海捞金时,个个都是乘风破浪的水手,待到分金之际,方知彼此是劫财的海盗。" } ``` -------------------------------- ### JSON Example: Successful Video Generation Response Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/videos/videos_submit Illustrates the expected JSON response structure upon a successful video generation request, containing the unique request ID. ```JSON { "requestId": "" } ``` -------------------------------- ### API Reference: Get User-Defined Voice Styles List Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/voice-list Detailed API documentation for the GET /audio/voice/list endpoint, including method, path, authorization requirements, and the structure of a successful JSON response. ```APIDOC Endpoint: Method: GET Path: /audio/voice/list Description: Get list of user-defined voice styles Authorizations: Authorization: Type: string Location: header Required: true Format: Bearer Responses: 200 OK: Content-Type: application/json Description: Successful response, User-defined voice style list response Body: { "results": [ { "model": "fishaudio/fish-speech-1.4", "customName": "your-voice-name", "text": "在一无所知中, 梦里的一天结束了,一个新的轮回便会开始", "uri": "speech:your-voice-name:xxx:xxx" } ] } ``` -------------------------------- ### Example Chat Completion API Response Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/chat-completions/chat-completions Illustrates a successful JSON response from the SiliconFlow chat completions API, detailing the structure of choices, message content, tool calls, usage statistics, and metadata like ID, creation timestamp, model, and object type. ```JSON { "id": "", "choices": [ { "message": { "role": "assistant", "content": "", "reasoning_content": "", "tool_calls": [ { "id": "", "type": "function", "function": { "name": "", "arguments": "" } } ] }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123 }, "created": 123, "model": "", "object": "chat.completion" } ``` -------------------------------- ### Get Video Generation Link Request with cURL Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/videos/get_videos_status Example cURL command to send a POST request to the /v1/video/status endpoint, including authorization and the requestId in the JSON body. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/video/status \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "requestId": "" }' ``` -------------------------------- ### cURL Request to Create Audio Transcription Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/create-audio-transcriptions Example cURL command demonstrating how to send a POST request to the audio transcription endpoint, including required headers for authorization and content type, and specifying the model. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/audio/transcriptions \ --header 'Authorization: Bearer ' \ --header 'Content-Type: multipart/form-data' \ --form model=FunAudioLLM/SenseVoiceSmall ``` -------------------------------- ### cURL Example: Create Image Generation Request Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/images/images-generations This cURL command demonstrates how to send a POST request to the SiliconFlow image generation API. It includes necessary headers for authorization and content type, along with a JSON payload specifying the model, prompt, image size, and other generation parameters. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/images/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "Kwai-Kolors/Kolors", "prompt": "an island near sea, with seagulls, moon shining over the sea, light house, boats int he background, fish flying over the sea", "negative_prompt": "", "image_size": "1024x1024", "batch_size": 1, "seed": 4999999999, "num_inference_steps": 20, "guidance_scale": 7.5, "image": "data:image/png;base64, XXX" }' ``` -------------------------------- ### Upload Reference Audio Success Response Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/upload-voice Example JSON response returned upon successful upload of a reference audio file, containing the URI for the newly uploaded voice style. ```json { "uri": "speech:your-voice-name:xxx:xxx" } ``` -------------------------------- ### Upload Reference Audio using cURL Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/upload-voice Example cURL command to upload a reference audio file to the SiliconFlow API, including authorization, content type, and form data for audio, model, custom name, and associated text. ```curl curl --request POST \ --url https://api.siliconflow.cn/v1/uploads/audio/voice \ --header 'Authorization: Bearer ' \ --header 'Content-Type: multipart/form-data' \ --form 'audio=data:audio/mpeg;base64,aGVsbG93b3JsZA==' \ --form model=FunAudioLLM/CosyVoice2-0.5B \ --form customName=your-voice-name \ --form 'text=在一无所知中, 梦里的一天结束了,一个新的轮回便会开始' ``` -------------------------------- ### API Reference: POST /video/status Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/videos/get_videos_status Comprehensive API documentation for the POST /video/status endpoint, detailing authentication methods, required request body parameters, and the structure of the successful 200 JSON response. ```APIDOC Method: POST Path: /video/status Authorizations: Authorization: Type: string Location: header Required: true Description: Use the following format for authentication: Bearer [] Request Body (application/json): Properties: requestId: Type: string Description: The ID of the video generation request. Response (200 - application/json): Description: Successful response Type: object Properties: status: string reason: string results: Type: object Properties: videos: Type: array Items: Type: object Properties: url: string timings: Type: object Properties: inference: number seed: number ``` -------------------------------- ### API Reference: Get File List Request Details Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/get-file-list Documents the GET /files API endpoint, outlining the request method, path, required authorization header, and available query parameters for filtering and limiting results. ```APIDOC GET /files Authorizations: Authorization: type: string in: header required: true description: Use the following format for authentication: Bearer [] Query Parameters: purpose: type: enum required: true description: Filter files by their purpose available_options: ["batch"] limit: type: integer default: 10 description: Maximum number of files to return (default 10) required_range: "x >= 1" ``` -------------------------------- ### Example Embedding API Response Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/embeddings/create-embeddings Illustrates the expected JSON response structure for a successful embedding request, including the model used, an array of embedding objects, and usage statistics. ```JSON { "model": "", "data": [ { "object": "embedding", "embedding": [ 123 ], "index": 123 } ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123 } } ``` -------------------------------- ### API Reference: Get Batch Details Endpoint Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/get-batch Detailed API documentation for the GET /batches/{batch_id} endpoint, outlining authorization, path parameters, and the structure of the successful JSON response for a batch object. ```APIDOC GET /batches/{batch_id} Authorizations: Authorization: Type: string Location: header Required: true Format: Bearer Path Parameters: batch_id: Type: string Required: true Description: The ID of the batch to retrieve. Response (200 OK): Content-Type: application/json Description: The Batch object matching the specified ID. Schema: object Example: { "id": "batch_rdyqgrcgjg", "object": "batch", "endpoint": "/v1/chat/completions", "errors": [], "input_file_id": "file-jkvytbjtow", "completion_window": "24h", "status": "in_queue", "output_file_id": null, "error_file_id": null, "created_at": 1741685413, "in_progress_at": null, "expires_at": 1741771813, "finalizing_at": null, "completed_at": null, "failed_at": null, "expired_at": null, "cancelling_at": null, "cancelled_at": null, "request_counts": {}, "metadata": { "description": "nightly eval job" } } ``` -------------------------------- ### Get User Account Information API Endpoint Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/userinfo/get-user-info Documents the API endpoint for retrieving user account details, including balance and status. It specifies the GET method, the /user/info path, required authorization, and the structure of a successful JSON response. ```APIDOC Endpoint: GET /user/info Description: Get user information including balance and status Authorizations: Authorization: string (header, required) Description: Use the following format for authentication: Bearer Source: https://cloud.siliconflow.cn/account/ak Response (200 OK): Content-Type: application/json Description: Successful response Schema: { "code": 20000, "message": "OK", "status": true, "data": { "id": "userid", "name": "username", "image": "user_avatar_image_url", "email": "user_email_address", "isAdmin": false, "balance": "0.88", "status": "normal", "introduction": "", "role": "", "chargeBalance": "88.00", "totalBalance": "88.88" } } ``` ```cURL curl --request GET \ --url https://api.siliconflow.cn/v1/user/info \ --header 'Authorization: Bearer ' ``` -------------------------------- ### cURL Example: Cancel SiliconFlow Batch Task Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/cancel-batch Example cURL command to send a POST request to cancel a batch task using its ID and an authorization token. This command demonstrates how to interact with the SiliconFlow API for batch management. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/batches/{batch_id}/cancel \ --header 'Authorization: Bearer ' ``` -------------------------------- ### JSON Response Example: Successful Batch Cancellation Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/cancel-batch An example of the JSON object returned upon successful cancellation of a batch task, detailing its ID, object type, associated endpoint, input file, completion window, current status, and metadata. ```JSON { "id": "batch_rdyqgrcgjg", "object": "batch", "endpoint": "/v1/chat/completions", "errors": null, "input_file_id": "file-jkvytbjtow", "completion_window": "24h", "status": "in_queue", "output_file_id": null, "error_file_id": null, "created_at": 1741685413, "in_progress_at": null, "expires_at": 1741771813, "finalizing_at": null, "completed_at": null, "failed_at": null, "expired_at": null, "cancelling_at": null, "cancelled_at": null, "request_counts": null, "metadata": { "description": "nightly eval job" } } ``` -------------------------------- ### Create Rerank Request using cURL Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/rerank/create-rerank Example cURL command to send a POST request to the /v1/rerank endpoint. It demonstrates how to include the Authorization header and the JSON payload for reranking documents based on a query. ```curl curl --request POST \ --url https://api.siliconflow.cn/v1/rerank \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "BAAI/bge-reranker-v2-m3", "query": "Apple", "documents": [ "apple", "banana", "fruit", "vegetable" ], "top_n": 4, "return_documents": false, "max_chunks_per_doc": 1024, "overlap_tokens": 80 }' ``` -------------------------------- ### Retrieve Models List API Endpoint Documentation Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/models/get-model-list Detailed documentation for the GET /models API endpoint, outlining its purpose, required authentication, available query parameters for filtering models, and the expected structure of a successful response. ```APIDOC Endpoint: GET /models Description: Retrieve models information. Authorizations: Authorization: Type: string Location: header Required: true Format: Bearer Query Parameters: type: Type: enum Description: The type of models Available options: text, image, audio, video sub_type: Type: enum Description: The sub type of models. You can use it to filter models individually without setting type. Available options: chat, embedding, reranker, text-to-image, image-to-image, speech-to-text, text-to-video Response: Status: 200 OK Content-Type: application/json Description: Successful response Schema: object ``` -------------------------------- ### Qwen2.5-7B-Instruct System Prompt for 'Smart Sayings' Application (After Fine-tuning) Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/userguide/guides/fine-tune This simplified prompt is used with the Qwen2.5-7B-Instruct model after fine-tuning with the 'Smart Sayings' corpus. The fine-tuning significantly reduces the prompt length from 553 tokens to 8 tokens, improving speed and optimizing cost while maintaining or enhancing output quality and consistency. ```AI Prompt 你是智说新语生成器 ``` -------------------------------- ### SiliconFlow Chat Completions API Reference Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/chat-completions/chat-completions Comprehensive API documentation for the SiliconFlow chat completions endpoint, detailing required authorization headers and the structure of the request body, including supported parameters for LLM and VLM models. ```APIDOC Endpoint: POST /chat/completions Authorizations: Authorization: Type: string Location: header Required: true Description: Use the following format for authentication: Bearer [] Link: https://cloud.siliconflow.cn/account/ak Body: Content-Type: application/json Supported Models: LLM, VLM ``` -------------------------------- ### Google Search Tool Call by AI Agent Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/usercases/use-siliconcloud-in-openmanus A JSON-formatted tool call demonstrating how an AI agent invokes the `google_search` function with specific arguments to find relevant reports on the global soybean market for 2025. ```JSON "name": "google_search", "arguments": { "query": "global soybean market analysis 2025 report", "num_results": 10 } ``` -------------------------------- ### API Reference: Create Video Generation Request Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/videos/videos_submit Details the POST /video/submit API endpoint for generating videos, including request parameters, authorization requirements, and expected response format. Users need to poll a separate status interface to retrieve the video link, which is valid for 10 minutes. ```APIDOC Endpoint: POST /video/submit Description: Generate a video through the input prompt. This API returns the user’s current request ID. The user needs to poll the status interface to get the specific video link. The generated result is valid for 10 minutes, so please retrieve the video link promptly. Authorizations: Authorization: Type: string Location: header Required: true Format: Bearer [] Request Body (application/json): model: string (e.g., "Wan-AI/Wan2.1-T2V-14B") prompt: string negative_prompt: string image_size: string (e.g., "1280x720") image: string (URL, e.g., "https://inews.gtimg.com/om_bt/Os3eJ8u3SgB3Kd-zrRRhgfR5hUvdwcVPKUTNO6O7sZfUwAA/641") seed: integer (e.g., 123) Response (200 OK - application/json): requestId: string ``` -------------------------------- ### SiliconFlow Rerank API Reference Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/rerank/create-rerank Comprehensive API documentation for the POST /v1/rerank endpoint, detailing request parameters, authorization, and the expected response structure for creating a rerank request. ```APIDOC POST /v1/rerank Headers: Authorization: Bearer (string, header, required) Description: Use the following format for authentication: Bearer [] Request Body (application/json): model: string (required) Example: "BAAI/bge-reranker-v2-m3" query: string (required) Description: The query string. Example: "Apple" documents: array of string (required) Description: List of documents to rerank. Example: ["apple", "banana", "fruit", "vegetable"] top_n: integer (optional) Description: Number of top results to return. Example: 4 return_documents: boolean (optional) Description: Whether to return the full documents in the response. Example: false max_chunks_per_doc: integer (optional) Description: Maximum chunks per document. Example: 1024 overlap_tokens: integer (optional) Description: Overlap tokens. Example: 80 Response (200 OK, application/json): id: string Description: Unique identifier for the request. Example: "" results: array of object document: object text: string Description: The text of the reranked document. Example: "" index: integer Description: Original index of the document. Example: 123 relevance_score: number Description: The relevance score of the document. Example: 123 tokens: object input_tokens: integer Description: Number of input tokens. Example: 123 output_tokens: integer Description: Number of output tokens. Example: 123 Possible HTTP Status Codes: 200: OK 400: Bad Request 401: Unauthorized 404: Not Found 429: Too Many Requests 503: Service Unavailable 504: Gateway Timeout ``` -------------------------------- ### Image Generation API Endpoint Overview Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/images/images-generations Defines the HTTP method and path for the SiliconFlow image generation API. This endpoint allows users to create images based on provided text prompts. ```APIDOC POST /images/generations ``` -------------------------------- ### Integrate translate.js with SiliconFlow Service Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/usercases/use-siliconcloud-in-translate-js This JavaScript snippet demonstrates how to quickly integrate the translate.js library into an HTML page and configure it to use SiliconFlow's translation service. It should be placed at the bottom of the HTML body for optimal loading. ```HTML ``` -------------------------------- ### API Authorization Details Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/images/images-generations Provides details on the required Authorization header for authenticating requests to the SiliconFlow API. It specifies the format for including the API key. ```APIDOC Authorization: Type: string Location: header Required: true Format: Bearer [] Link: https://cloud.siliconflow.cn/account/ak ``` -------------------------------- ### Embeddings API Endpoint Reference Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/embeddings/create-embeddings Detailed API documentation for the /v1/embeddings endpoint, covering the POST method, authorization requirements, request body structure, and possible response statuses. ```APIDOC POST /embeddings Description: Creates an embedding vector representing the input text. Authorizations: Authorization: Type: string Location: header Required: true Format: Bearer [] (https://cloud.siliconflow.cn/account/ak) Body: Content-Type: application/json Fields: model: string (e.g., "BAAI/bge-large-zh-v1.5") input: string (e.g., "Silicon flow embedding online: fast, affordable, and high-quality embedding services. come try it out!") encoding_format: string (e.g., "float") Response: 200 OK: Description: The response is of type `object`. Content-Type: application/json Schema: model: string data: array of objects object: string (e.g., "embedding") embedding: array of numbers (e.g., [123]) index: number (e.g., 123) usage: object prompt_tokens: number (e.g., 123) completion_tokens: number (e.g., 123) total_tokens: number (e.g., 123) Error Codes: 400: Bad Request 401: Unauthorized 404: Not Found 429: Too Many Requests 503: Service Unavailable 504: Gateway Timeout ``` -------------------------------- ### API Endpoint: Create Audio Transcription Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/create-audio-transcriptions Defines the HTTP method and path for creating an audio transcription request via the SiliconFlow API. ```APIDOC POST /audio/transcriptions ``` -------------------------------- ### Create Chat Completion Request with cURL Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/chat-completions/chat-completions Demonstrates how to send a POST request to the SiliconFlow chat completions API using cURL, including authorization and a JSON request body with parameters like model, messages, stream, max_tokens, and tools. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/chat/completions \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "Qwen/QwQ-32B", "messages": [ { "role": "user", "content": "What opportunities and challenges will the Chinese large model industry face in 2025?" } ], "stream": false, "max_tokens": 512, "enable_thinking": false, "thinking_budget": 4096, "min_p": 0.05, "stop": null, "temperature": 0.7, "top_p": 0.7, "top_k": 50, "frequency_penalty": 0.5, "n": 1, "response_format": { "type": "text" }, "tools": [ { "type": "function", "function": { "description": "", "name": "", "parameters": {}, "strict": false } } ] }' ``` -------------------------------- ### API Authorization Header Specification Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/create-audio-transcriptions Details the required 'Authorization' header for API requests, specifying its type, location, and the 'Bearer' token format. ```APIDOC Authorization string header required Use the following format for authentication: Bearer [](https://cloud.siliconflow.cn/account/ak) ``` -------------------------------- ### SiliconFlow Upload Reference Audio API Specification Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/upload-voice Detailed specification for the POST /uploads/audio/voice endpoint, including authorization, request body parameters, and successful response structure. ```APIDOC Endpoint: POST /uploads/audio/voice Description: Upload user-provided voice style, which can be in base64 encoding or file format. Authorizations: Authorization: Type: string Location: header Required: true Format: Bearer Request Body: multipart/form-data Parameters (implied from cURL example): audio: string (base64 encoded audio data, e.g., data:audio/mpeg;base64,aGVsbG93b3JsZA==) model: string (e.g., FunAudioLLM/CosyVoice2-0.5B) customName: string (e.g., your-voice-name) text: string (e.g., 在一无所知中, 梦里的一天结束了,一个新的轮回便会开始) Responses: 200 OK: Content-Type: application/json Description: Successful response Body: uri: string (e.g., speech:your-voice-name:xxx:xxx) Error Codes: 400, 401, 404, 429, 503, 504 ``` -------------------------------- ### Audio Transcription API Success Response (200 OK) Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/create-audio-transcriptions Describes the successful 200 OK response for audio transcription, including its content type and the JSON schema for the returned data. ```APIDOC 200 application/json Represents a transcription response returned by model, based on the provided input. { "text": "" } ``` -------------------------------- ### Upload Files API Reference Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/upload-file Documents the API endpoint for uploading files to SiliconFlow, primarily for batch processing. This endpoint supports `multipart/form-data` and requires `Bearer` token authentication. It details the request method, URL, authorization, body parameters, and possible response statuses. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/files \ --header 'Authorization: Bearer ' \ --header 'Content-Type: multipart/form-data' \ --form purpose=batch ``` ```APIDOC Endpoint: POST /v1/files Purpose: Upload files for batch processing. Authorizations: Authorization: string (header, required) Format: Bearer Body: Content-Type: multipart/form-data Parameters: purpose: string (form data, required) Value: batch Response Status Codes: 200: OK 400: Bad Request 401: Unauthorized 404: Not Found 503: Service Unavailable 504: Gateway Timeout ``` ```JSON { "code": 20000, "message": "Ok", "status": true, "data": { "id": "file-jkvytbjtow", "object": "file", "bytes": 8509, "createdAt": 1741685396, "filename": "requests.jsonl", "purpose": "batch" } } ``` -------------------------------- ### API Request Body Format Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/create-audio-transcriptions Specifies that the request body for audio transcription must be sent as 'multipart/form-data'. ```APIDOC multipart/form-data ``` -------------------------------- ### API Response Schema: Successful Image Generation (200 OK) Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/images/images-generations Describes the JSON structure returned upon a successful image generation request (HTTP 200 OK). It includes an array of generated image URLs, inference timing details, and the seed used for the generation process. ```APIDOC { "images": [ { "url": "" } ], "timings": { "inference": 123 }, "seed": 123 } ``` -------------------------------- ### Create Embedding Request with cURL Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/embeddings/create-embeddings Demonstrates how to send a POST request to the /v1/embeddings endpoint using cURL, including authorization and JSON payload for model, input text, and encoding format. ```cURL curl --request POST \ --url https://api.siliconflow.cn/v1/embeddings \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "BAAI/bge-large-zh-v1.5", "input": "Silicon flow embedding online: fast, affordable, and high-quality embedding services. come try it out!", "encoding_format": "float" }' ``` -------------------------------- ### API Response Status Codes Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/images/images-generations Lists the various HTTP status codes that can be returned by the image generation API, indicating the outcome of the request, from success to different error conditions. ```APIDOC 200: OK 400: Bad Request 401: Unauthorized 404: Not Found 429: Too Many Requests 503: Service Unavailable 504: Gateway Timeout ``` -------------------------------- ### API Request Body Content Type Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/images/images-generations Specifies the required Content-Type header for the request body when submitting data to the image generation API. ```APIDOC application/json ``` -------------------------------- ### API Reference: Cancel Batch Task Endpoint Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/batch/cancel-batch Detailed API documentation for canceling a batch task, including the endpoint, required authorization, path parameters, and possible HTTP response status codes. ```APIDOC Endpoint: POST /batches/{batch_id}/cancel Authorizations: Authorization: Type: string Location: header Required: true Description: Use the format: Bearer [] Path Parameters: batchId: Type: string Required: true Description: Unique identifier of the batch to cancel Response Status Codes: 200: Successful response 400: Bad Request 401: Unauthorized 404: Not Found 503: Service Unavailable 504: Gateway Timeout ``` -------------------------------- ### Delete Reference Audio API Request Source: https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions/api-reference/audio/delete-voice This API endpoint allows users to delete a previously uploaded user-defined voice style by providing its unique URI. Authentication is required using a Bearer token. ```curl curl --request POST \ --url https://api.siliconflow.cn/v1/audio/voice/deletions \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "uri": "speech:your-voice-name:xxx:xxxx" }' ``` ```APIDOC Endpoint: POST /audio/voice/deletions Description: Delete user-defined voice style Authorizations: Authorization: Type: string Location: header Required: true Description: Use the following format for authentication: Bearer [] Request Body (application/json): Parameters: uri: Type: string Description: The unique URI of the voice style to delete. Example: "speech:your-voice-name:xxx:xxxx" Response (200 - Successful response): Content-Type: application/json Body: "" (Indicates successful deletion, typically an empty string or confirmation message) Possible HTTP Status Codes: 200: OK - Successful response 400: Bad Request 401: Unauthorized 404: Not Found 429: Too Many Requests 503: Service Unavailable 504: Gateway Timeout ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.