### C Example for OpenAI Multimodal API Setup Source: https://docs.apimart.ai/cn/api-reference/texts/openai/responses Initializes cURL for making a request to the OpenAI Multimodal Response API. Requires the OPENAI_API_KEY environment variable. ```c #include #include #include int main(void) { CURL *curl; CURLcode res; const char *api_key = getenv("OPENAI_API_KEY"); curl_global_init(CURL_GLOBAL_DEFAULT); curl = curl_easy_init(); if(curl) { ``` -------------------------------- ### Video Generation with Camera Movement Instructions Source: https://docs.apimart.ai/cn/api-reference/videos/minimax-hailuo-2.3/generation This example shows how to incorporate camera movement commands like '[推进]' directly into the prompt to guide the video's perspective. It specifies a 768p resolution and 6-second duration. ```json { "model": "MiniMax-Hailuo-2.3", "prompt": "[推进]一只猫咪在花园中奔跑,镜头缓缓推进特写", "duration": 6, "resolution": "768p" } ``` -------------------------------- ### Start and End Frame Video Generation Example Source: https://docs.apimart.ai/cn/api-reference/videos/vidu-q3-pro/generation Create videos using specified start and end frame images. Provide 'model', 'prompt', 'image_urls' with two URLs, and 'duration'. The 'aspect_ratio' parameter is not applicable here. ```json { "model": "viduq3-pro", "prompt": "人物从站立缓缓坐下", "image_urls": [ "https://example.com/first.jpg", "https://example.com/last.jpg" ], "duration": 8 } ``` -------------------------------- ### Image-to-Video Generation Example (Single Image) Source: https://docs.apimart.ai/cn/api-reference/videos/vidu-q3-pro/generation Generate videos starting with a single provided image. Set 'model', 'prompt', 'image_urls' with one URL, 'duration', and 'resolution'. The 'aspect_ratio' parameter cannot be used with 'image_urls'. ```json { "model": "viduq3-pro", "prompt": "人物缓缓转身微笑", "image_urls": ["https://example.com/photo.jpg"], "duration": 5, "resolution": "720p" } ``` -------------------------------- ### Dynamic Product Showcase Video Generation Source: https://docs.apimart.ai/cn/api-reference/videos/doubao/generation Create a dynamic video showcasing a product using a provided image URL as the starting frame. This example uses the fast model and a square aspect ratio. ```json { "model": "doubao-seedance-1-0-pro-fast", "prompt": "产品缓缓旋转展示,背景为纯白色,光线柔和", "image_urls": ["https://example.com/product.png"], "duration": 5, "aspect_ratio": "1:1" } ``` -------------------------------- ### Image URL Example for Video Generation Source: https://docs.apimart.ai/cn/api-reference/videos/veo3/generation This example shows how to provide a list of image URLs for image-to-video generation. Note that the 'veo3.1-lite' model does not support this parameter. ```json { "image_urls": ["https://example.com/image1.jpg", "https://example.com/image2.jpg"] } ``` -------------------------------- ### Good System Prompt Example Source: https://docs.apimart.ai/cn/integrations/chat/anythingllm An example of an effective system prompt that clearly defines the AI's role, response guidelines, and fallback behavior. ```text 你是一个专业的技术支持助手,专门帮助用户解决产品相关的技术问题。 回答时请遵循以下原则: 1. 基于提供的文档内容回答,如果文档中没有相关信息,请明确告知 2. 提供详细的步骤说明,必要时给出示例 3. 使用清晰、易懂的语言 4. 对于复杂问题,建议用户联系技术支持团队 ``` -------------------------------- ### Good Prompt Example in Python Source: https://docs.apimart.ai/cn/integrations/chat/chatbox This example demonstrates a well-structured prompt for generating Python code. It clearly specifies the function's requirements, including input, filtering logic, output format, and the need for comments and examples. ```python Please help me write a Python function that does the following: 1. Accepts a list of strings as input 2. Filters out strings with a length less than 3 3. Returns the result sorted alphabetically Please include detailed comments and example usage. ``` -------------------------------- ### Custom System Prompt Example Source: https://docs.apimart.ai/cn/integrations/chat/anythingllm Customize the AI's role and behavior by defining a system prompt. This example sets the AI as a professional technical support engineer. ```text 你是一个专业的技术支持工程师,擅长解答关于产品的技术问题。 回答时请: 1. 保持专业和礼貌 2. 提供详细的步骤说明 3. 如果不确定,建议用户联系技术支持 ``` -------------------------------- ### Swift TTS Example Source: https://docs.apimart.ai/cn/api-reference/audios/tts This Swift example demonstrates making a POST request to the TTS API using URLSession and saving the audio data to the document directory. ```swift import Foundation let url = URL(string: "https://api.apimart.ai/v1/audio/speech")! var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("Bearer ", forHTTPHeaderField: "Authorization") request.setValue("application/json", forHTTPHeaderField: "Content-Type") let payload: [String: Any] = [ "model": "gpt-4o-mini-tts", "input": "今天天气真好,适合出去散步。", "voice": "alloy", "response_format": "opus", "speed": 1.0 ] request.httpBody = try? JSONSerialization.data(withJSONObject: payload) let task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { print("Error: \(error)") return } if let data = data { let fileURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] .appendingPathComponent("speech.opus") try? data.write(to: fileURL) print("Audio saved to \(fileURL)") } } task.resume() ``` -------------------------------- ### Image with Roles Example Source: https://docs.apimart.ai/cn/api-reference/videos/wan2.7-r2v/generation Example of using an array of objects for image_with_roles, specifying roles like 'reference_image' or 'first_frame', and optionally including a reference voice URL. ```json [ { "url": "https://cdn.example.com/character.jpg", "role": "reference_image", "reference_voice": "https://cdn.example.com/voice_sample.mp3" }, { "url": "https://cdn.example.com/start.jpg", "role": "first_frame" } ] ``` -------------------------------- ### Full Parameters for Video Generation Source: https://docs.apimart.ai/cn/api-reference/videos/wan2.6/i2v-flash-generation This example demonstrates a comprehensive request with all available parameters for video generation, including prompts, resolution, duration, and advanced settings. ```json { "model": "wan2.6-i2v-flash", "prompt": "让图片中的人物微笑挥手,镜头缓缓推进", "image_urls": ["https://example.com/image.jpg"], "negative_prompt": "模糊, 低质量, 变形", "resolution": "1080p", "duration": 10, "seed": 12345, "prompt_extend": true, "shot_type": "multi", "audio": true, "watermark": false } ``` -------------------------------- ### Get User Balance (Swift) Source: https://docs.apimart.ai/cn/api-reference/account/user-balance Swift code snippet for fetching user balance. This is a partial example showing the API key setup. You would typically use `URLSession` to make the network request. ```swift import Foundation let apiKey = "sk-xxxxxxxxxxxxxxxxxxxxxx" ``` -------------------------------- ### Video Generation with Audio Source: https://docs.apimart.ai/cn/api-reference/videos/veo3/generation-official Example demonstrating how to generate a video with an accompanying audio track by setting the 'generate_audio' parameter to true. ```json { "model": "veo3.1-quality-official", "prompt": "a busy coffee shop with people chatting and barista making latte art", "duration": 8, "generate_audio": true, "aspect_ratio": "16:9" } ``` -------------------------------- ### Full Example: Image-to-Image Workflow Source: https://docs.apimart.ai/cn/api-reference/uploads/images This comprehensive Python script illustrates the complete image-to-image workflow, including API key setup and base URL configuration. It's designed to be a starting point for integrating APIMart's image generation capabilities. ```python import requests import time API_KEY = "your-Apimart-key" BASE_URL = "https://api.apimart.ai" ``` -------------------------------- ### Basic Text-to-Video Generation Source: https://docs.apimart.ai/cn/api-reference/videos/minimax-hailuo-2.3/generation Use this snippet for a simple text-to-video generation task. Specify the model and a descriptive prompt to get started. ```json { "model": "MiniMax-Hailuo-2.3", "prompt": "一只可爱的猫咪在草地上奔跑,阳光明媚" } ``` -------------------------------- ### Text-to-Video Generation (Full Parameters) Source: https://docs.apimart.ai/cn/api-reference/videos/veo3/generation-official Example demonstrating text-to-video generation with a comprehensive set of parameters, including negative prompts, duration, aspect ratio, resolution, seed, audio generation, person generation, and prompt enhancement. ```json { "model": "veo3.1-quality-official", "prompt": "a cinematic close-up of a ragdoll cat slowly walking through a sunlit living room", "negative_prompt": "blurry, low quality, watermark, text", "duration": 8, "aspect_ratio": "16:9", "resolution": "1080p", "seed": 12345, "generate_audio": true, "person_generation": "disallow", "enhance_prompt": true } ``` -------------------------------- ### Iterative Improvement Example Source: https://docs.apimart.ai/cn/integrations/dev-tool/cline Demonstrates an iterative approach to development using AI. Start with basic functionality, test, and then refine through subsequent prompts. ```plaintext 第一轮:创建用户模型 第二轮:基于刚才的模型,创建 CRUD 接口 第三轮:为这些接口添加权限验证 ``` -------------------------------- ### First Frame Video Generation Source: https://docs.apimart.ai/cn/api-reference/videos/wan2.7/generation Generate video starting from a single provided image. The prompt guides the action and camera movement from the first frame. ```json { "model": "wan2.7", "prompt": "人物缓缓站起身,向镜头走来", "image_urls": ["https://cdn.example.com/person.jpg"], "resolution": "1080P", "duration": 8 } ``` -------------------------------- ### Image-to-Video Generation (Multiple Image References) Source: https://docs.apimart.ai/cn/api-reference/videos/kling-video-o1/generation Example demonstrating how to reference multiple images in the prompt using '<<>>' syntax for video generation. The 'pro' mode is specified for higher quality. ```json { "model": "kling-video-o1", "prompt": "<<>>中的角色走向<<>>中的场景", "image_urls": [ "https://example.com/character.jpg", "https://example.com/scene.jpg" ], "mode": "pro", "duration": 5 } ``` -------------------------------- ### Generate Video with C# Source: https://docs.apimart.ai/cn/api-reference/videos/wan2.5/generation Example of how to generate a video using the wan2.5-preview model with a C# client. Ensure you replace '' with your actual API key. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/videos/generations"; var payload = @"{ "model": "wan2.5-preview", "prompt": "夕阳下的海边公路,电影感镜头", "size": "16:9", "resolution": "720p", "duration": 5 }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Generate Image with Gemini-3-Pro (OCaml) Source: https://docs.apimart.ai/cn/api-reference/images/gemini-3-pro/generation Example of how to generate an image using the Gemini-3-Pro model with OCaml. Ensure you have the necessary libraries like Cohttp-lwt and Lwt_main installed. ```OCaml let () = let headers = Header.init () |> fun h -> Header.add h "Authorization" "Bearer " |> fun h -> Header.add h "Content-Type" "application/json" in let body = Cohttp_lwt.Body.of_string payload in let response = Client.post ~headers ~body (Uri.of_string url) >>= fun (resp, body) -> body |> Cohttp_lwt.Body.to_string >|= fun body_str -> print_endline body_str in Lwt_main.run response ``` -------------------------------- ### Send a message to Claude Source: https://docs.apimart.ai/cn/api-reference/texts/general/claude-messages This example demonstrates how to send a message to the Claude API to get a response. It includes setting the API key, model, and message content. ```APIDOC ## POST /v1/messages ### Description Sends a message to the Claude API to receive a response. ### Method POST ### Endpoint https://api.apimart.ai/v1/messages ### Parameters #### Headers - **x-api-key** (string) - Required - Your API key for authentication. - **anthropic-version** (string) - Required - The version of the Anthropic API to use (e.g., "2025-10-01"). - **Content-Type** (string) - Required - Specifies the content type of the request body, typically "application/json". #### Request Body - **model** (string) - Required - The name of the Claude model to use (e.g., "claude-sonnet-4-5-20250929"). - **max_tokens** (integer) - Required - The maximum number of tokens to generate in the response. - **messages** (array) - Required - An array of message objects, where each object has a "role" (user or assistant) and "content" (the message text). - **role** (string) - Required - The role of the message sender (e.g., "user"). - **content** (string) - Required - The text of the message. ### Request Example ```json { "model": "claude-sonnet-4-5-20250929", "max_tokens": 1024, "messages": [ { "role": "user", "content": "你好,世界" } ] } ``` ### Response #### Success Response (200) - **content** (array) - The response content from the model. - **role** (string) - The role of the response sender (e.g., "assistant"). - **stop_reason** (string) - The reason the model stopped generating text (e.g., "end_turn"). - **model** (string) - The name of the model that generated the response. - **usage** (object) - Information about token usage. - **input_tokens** (integer) - The number of input tokens. - **output_tokens** (integer) - The number of output tokens. #### Response Example ```json { "content": [ { "type": "text", "text": "你好!有什么可以帮您的吗?" } ], "role": "assistant", "stop_reason": "end_turn", "model": "claude-sonnet-4-5-20250929", "usage": { "input_tokens": 15, "output_tokens": 18 } } ``` ``` -------------------------------- ### Query H5 Authentication Link Source: https://docs.apimart.ai/cn/api-reference/videos/doubao-seedance-2-0/real-avatar Example HTTP GET request to retrieve the H5 authentication link using the task ID obtained from session creation. ```http GET /v1/tasks/task_01K... ``` -------------------------------- ### Generate Video with Swift Source: https://docs.apimart.ai/cn/api-reference/videos/wan2.5/generation Example of how to generate a video using the wan2.5-preview model with a Swift client. Ensure you replace '' with your actual API key. ```swift import Foundation let url = URL(string: "https://api.apimart.ai/v1/videos/generations")! let payload: [String: Any] = [ "model": "wan2.5-preview", "prompt": "夕阳下的海边公路,电影感镜头", "size": "16:9", "resolution": "720p", "duration": 5 ] var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("Bearer ", forHTTPHeaderField: "Authorization") request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.httpBody = try? JSONSerialization.data(withJSONObject: payload) let task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { print("Error: \(error)") return } if let data = data, let responseString = String(data: data, encoding: .utf8) { print(responseString) } } task.resume() ``` -------------------------------- ### Video Generation Request Example with Camera Movement Source: https://docs.apimart.ai/cn/api-reference/videos/minimax-hailuo-2.3/generation This example demonstrates how to use camera movement instructions within the prompt to control the video's visual flow. Ensure the model and prompt are correctly specified. ```json { "model": "MiniMax-Hailuo-2.3", "prompt": "[推进]一只猫咪在花园中奔跑,镜头缓缓推进特写" } ``` -------------------------------- ### System Prompt - String Format Source: https://docs.apimart.ai/cn/api-reference/texts/general/claude-messages Example of setting a system prompt using a simple string for defining the AI's role. ```json { "system": "你是一位专业的Python编程导师" } ``` -------------------------------- ### cURL Request Example for Chat Completions Source: https://apimart.ai/zh This cURL command demonstrates how to make a POST request to the APIMart chat completions endpoint to get a response from a model like gpt-4o. ```curl curl --request POST \ --url https://api.apimart.ai/v1/chat/completions \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ \ "model": "gpt-4o", \ "messages": [ \ { \ "role": "system", \ "content": "You are a professional AI assistant." \ }, \ { \ "role": "user", \ "content": "Tell me about the history of artificial intelligence." \ } \ ] \ }' ``` -------------------------------- ### Get Task Status using Swift Source: https://docs.apimart.ai/cn/api-reference/tasks/status Swift example for retrieving task status via `URLSession`. This code demonstrates setting the HTTP method and authorization header for the request. ```swift import Foundation let url = URL(string: "https://api.apimart.ai/v1/tasks/task-unified-1757156493-imcg5zqt?language=zh")! var request = URLRequest(url: url) request.httpMethod = "GET" request.setValue("Bearer ", forHTTPHeaderField: "Authorization") let task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { print("Error: \(error)") return } if let data = data, let responseString = String(data: data, encoding: .utf8) { print(responseString) } } task.resume() ``` -------------------------------- ### Get Task Status using Ruby Source: https://docs.apimart.ai/cn/api-reference/tasks/status Ruby code for fetching task status using the `net/http` library. This example shows how to set up the HTTP request, including the authorization header. ```ruby require 'net/http' require 'json' require 'uri' url = URI("https://api.apimart.ai/v1/tasks/task-unified-1757156493-imcg5zqt?language=zh") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = "Bearer " response = http.request(request) puts response.body ``` -------------------------------- ### Generate Video with MiniMax-Hailuo-2.3 (C#) Source: https://docs.apimart.ai/cn/api-reference/videos/minimax-hailuo-2.3/generation A C# example for video generation. It sets up an HttpClient, adds necessary headers, and sends the JSON payload. Remember to replace '' with your API key. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/videos/generations"; var payload = @"{ \"model\": \"MiniMax-Hailuo-2.3\", \"prompt\": \"一只可爱的猫咪在草地上奔跑\", \"duration\": 6, \"resolution\": \"768p\", \"prompt_optimizer\": true, \"fast_pretreatment\": false, \"watermark\": false }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Get Task Status using Java Source: https://docs.apimart.ai/cn/api-reference/tasks/status Java code example for fetching task status using `java.net.http.HttpClient`. This snippet shows how to construct the request, set headers, and process the response. ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; public class Main { public static void main(String[] args) throws Exception { String url = "https://api.apimart.ai/v1/tasks/task-unified-1757156493-imcg5zqt?language=zh"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Authorization", "Bearer ") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` -------------------------------- ### System Prompt - Structured Format Source: https://docs.apimart.ai/cn/api-reference/texts/general/claude-messages Example of setting a system prompt using a structured format with type and text for more detailed instructions. ```json { "system": [ { "type": "text", "text": "你是一位专业的Python编程导师" } ] } ``` -------------------------------- ### Pre-fill Assistant Response Source: https://docs.apimart.ai/cn/api-reference/texts/general/claude-messages Guide the model's response format by providing a partial assistant message. This is useful for ensuring the output starts in a specific way, like a numbered list. ```python # 引导模型以特定格式回复 messages = [ {"role": "user", "content": "列出5个Python最佳实践"}, {"role": "assistant", "content": "以下是5个Python最佳实践: 1."} ] message = client.messages.create( model="claude-sonnet-4-5-20250929", max_tokens=1024, messages=messages ) ``` -------------------------------- ### C# Example for OpenAI Multimodal API Source: https://docs.apimart.ai/cn/api-reference/texts/openai/responses Provides a C# example using HttpClient to call the OpenAI Multimodal Response API. Ensure the OPENAI_API_KEY is set as an environment variable. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/responses"; var apiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY"); var payload = @"{ "model": "gpt-5", "input": [ { "role": "user", "content": [ { "type": "input_text", "text": "这张图片里有什么?" }, { "type": "input_image", "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png" } ] } ] }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}"); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Single Image to Video Generation Request Source: https://docs.apimart.ai/cn/api-reference/videos/omni-flash-ext/generation Example request body for generating a video based on a single reference image and a text prompt. The prompt guides the action and camera motion. ```json { "model": "Omni-Flash-Ext", "prompt": "make the character smile and slowly turn around, cinematic camera motion", "duration": 6, "resolution": "1080p", "aspect_ratio": "9:16", "image_urls": ["https://example.com/character.jpg"] } ``` -------------------------------- ### Good Prompt Example for Performance Optimization Source: https://docs.apimart.ai/cn/integrations/dev-tool/cursor Provides a clear and actionable prompt for optimizing function performance, specifying key areas for improvement. ```text 优化这个函数的性能,重点关注: 1. 减少循环嵌套 2. 使用更高效的数据结构 3. 添加缓存机制 ``` -------------------------------- ### Fast Pre-treatment Mode for Video Generation Source: https://docs.apimart.ai/cn/api-reference/videos/minimax-hailuo-2.3/generation Enable `fast_pretreatment` to potentially speed up prompt optimization at the cost of a slight reduction in optimization quality. This example also sets a 10-second duration and 768p resolution. ```json { "model": "MiniMax-Hailuo-2.3", "prompt": "海浪拍打沙滩,日落时分", "duration": 10, "resolution": "768p", "prompt_optimizer": true, "fast_pretreatment": true } ``` -------------------------------- ### Three Reference Images Fusion for Video Generation Source: https://docs.apimart.ai/cn/api-reference/videos/omni-flash-ext/generation Example request body for generating a video by fusing elements from three reference images. This allows for complex scene composition guided by the prompt. ```json { "model": "Omni-Flash-Ext", "prompt": "a creative scene combining these elements with smooth camera motion", "duration": 10, "resolution": "1080p", "aspect_ratio": "9:16", "image_urls": [ "https://example.com/scene.jpg", "https://example.com/character.jpg", "https://example.com/product.jpg" ] } ``` -------------------------------- ### Python Integration Example Source: https://apimart.ai/zh This section outlines the three simple steps to integrate APIMart APIs into your application: registering for an API key, modifying the configuration to use the APIMart endpoint, and starting to call models. ```text 1 注册,创建密钥注册账户并在仪表板中生成您的专属 API 密钥,无需信用卡即可开始 获取 API 密钥查看文档 2 修改配置将API端点更改为 APIMart 地址,OpenAI SDK 用户只需修改一行代码 查看文档在线试用 3 开始调用模型通过统一接口访问 GPT-5、Claude、Sora 等数百种AI模型,即刻开启AI之旅 ``` -------------------------------- ### Generate Video with Kling v3 (JavaScript) Source: https://docs.apimart.ai/cn/api-reference/videos/kling-v3/generation This JavaScript example shows how to use the `fetch` API to send a POST request for video generation. It includes setting the necessary headers and handling the JSON response. ```javascript const url = "https://api.apimart.ai/v1/videos/generations"; const payload = { model: "kling-v3", prompt: "一只金色的猫咪在阳光下的草地上奔跑,慢动作,电影质感", mode: "std", duration: 5, size: "16:9" }; const headers = { "Authorization": "Bearer ", "Content-Type": "application/json" }; fetch(url, { method: "POST", headers: headers, body: JSON.stringify(payload) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Get Task Status using JavaScript (Fetch API) Source: https://docs.apimart.ai/cn/api-reference/tasks/status Example of retrieving task status in JavaScript using the Fetch API. This code snippet shows how to configure the request with the correct method, headers, and URL. ```javascript const url = "https://api.apimart.ai/v1/tasks/task-unified-1757156493-imcg5zqt?language=zh"; const headers = { "Authorization": "Bearer " }; fetch(url, { method: "GET", headers: headers }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Generate Video with MiniMax-Hailuo-02 (C#) Source: https://docs.apimart.ai/cn/api-reference/videos/minimax-hailuo/generation This C# example shows how to make a POST request to the video generation API. It uses HttpClient to send the JSON payload and includes necessary headers. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/videos/generations"; var payload = @"{ \"model\": \"MiniMax-Hailuo-02\", \"prompt\": \"一只可爱的猫咪在草地上奔跑\", \"duration\": 5, \"resolution\": \"768p\", \"prompt_optimizer\": true, \"fast_pretreatment\": false, \"watermark\": false }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Video Generation with First Frame Image Source: https://docs.apimart.ai/cn/api-reference/videos/minimax-hailuo-2.3/generation Specify a starting frame for your video by providing a public URL or Base64 encoded image in the `first_frame_image` parameter. This example also sets 1080p resolution and 6-second duration. ```json { "model": "MiniMax-Hailuo-2.3", "prompt": "小猫跑向镜头,微笑着眨眼", "first_frame_image": "https://example.com/cat.jpg", "duration": 6, "resolution": "1080p" } ``` -------------------------------- ### Generate Video with Wan2.6 (C#) Source: https://docs.apimart.ai/cn/api-reference/videos/wan2.6/generation Example of making a POST request to generate a video using the Wan2.6 model in C#. Ensure you replace '' with your actual API key. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/videos/generations"; var payload = @"{ "model": "wan2.6", "prompt": "一只可爱的猫咪在草地上奔跑", "aspect_ratio": "16:9", "resolution": "720p", "duration": 5 }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Web Search Tool Usage Example Source: https://docs.apimart.ai/cn/api-reference/texts/openai/responses This example shows how to use the web search tool with a text input. The model will use web search to find relevant information. ```json { "model": "gpt-5", "tools": [{"type": "web_search"}], "input": "今天有什么正面的新闻?" } ``` ```bash curl "https://api.apimart.ai/v1/responses" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "model": "gpt-5", "tools": [{"type": "web_search"}], "input": "今天有什么正面的新闻?" }' ``` -------------------------------- ### Generate Video with Kling Video O1 (C#) Source: https://docs.apimart.ai/cn/api-reference/videos/kling-video-o1/generation This C# code example shows how to generate a video using the Kling Video O1 model with `HttpClient`. Ensure you replace '' with your API key and handle potential errors. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/videos/generations"; var payload = @"{ ""model"": ""kling-video-o1"", ""prompt"": ""让<<>>中的人物向镜头挥手"", ""image_urls"": [""https://upload.apimart.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp""], ""mode"": ""std"", ""duration"": 5, ""aspect_ratio"": ""16:9"" }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Install Dependencies with Cline Source: https://docs.apimart.ai/cn/integrations/dev-tool/cline Leverage Cline to install project dependencies via the terminal. Specify the packages to be installed. ```text 安装 axios 和 dotenv 包 ``` -------------------------------- ### Generate Image with GPT-Image-2 (C#) Source: https://docs.apimart.ai/cn/api-reference/images/gpt-image-2/generation This C# example demonstrates how to make an asynchronous POST request to the image generation API. Remember to substitute '' with your API key. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/images/generations"; var payload = @"{ \"model\": \"gpt-image-2\", \"prompt\": \"一只橘猫坐在窗台上看夕阳,水彩画风格\", \"n\": 1, \"size\": \"16:9\", \"resolution\": \"2k\" }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Verify Claude Code Installation Source: https://docs.apimart.ai/cn/integrations/dev-tool/claude-code Checks if the Claude Code CLI has been installed successfully by displaying its version number. Run this command after installation. ```bash claude --version ``` -------------------------------- ### Install Claude Code CLI via Homebrew (macOS) Source: https://docs.apimart.ai/cn/integrations/dev-tool/claude-code Installs the Claude Code CLI using Homebrew on macOS. This is an alternative installation method for macOS users. ```bash brew install --cask claude-code ``` -------------------------------- ### Swift Example for OpenAI Multimodal API Source: https://docs.apimart.ai/cn/api-reference/texts/openai/responses Illustrates making a multimodal API call using Swift's URLSession. The API key should be provided via the environment variable OPENAI_API_KEY. ```swift import Foundation let url = URL(string: "https://api.apimart.ai/v1/responses")! let apiKey = ProcessInfo.processInfo.environment["OPENAI_API_KEY"] ?? "" let payload: [String: Any] = [ "model": "gpt-5", "input": [ [ "role": "user", "content": [ [ "type": "input_text", "text": "这张图片里有什么?" ], [ "type": "input_image", "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png" ] ] ] ] ] var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization") request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.httpBody = try? JSONSerialization.data(withJSONObject: payload) let task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { print("Error: \(error)") return } if let data = data, let responseString = String(data: data, encoding: .utf8) { print(responseString) } } task.resume() ``` -------------------------------- ### Generate Video with Kling 2.6 (C#) Source: https://docs.apimart.ai/cn/api-reference/videos/kling-v2-6/generation Example of making an asynchronous POST request to the video generation API using C#. Replace '' with your API key. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var url = "https://api.apimart.ai/v1/videos/generations"; var payload = @"{ "model": "kling-v2-6", "prompt": "一只金色的猫咪在阳光下的草地上奔跑,慢动作,电影质感", "mode": "std", "duration": 5, "aspect_ratio": "16:9" }"; using var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } ``` -------------------------------- ### Install Claude Code CLI (Windows CMD) Source: https://docs.apimart.ai/cn/integrations/dev-tool/claude-code Installs the Claude Code CLI using the Command Prompt (CMD) on Windows. This provides an alternative installation command for Windows users. ```cmd curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd ``` -------------------------------- ### API Response Example - Success (200) Source: https://docs.apimart.ai/cn/api-reference/videos/kling-v3/generation Example of a successful video generation request response. ```json { "code": 200, "data": [ { "status": "submitted", "task_id": "task_xxxxxxxxxx" } ] } ```