Max Router
    English
    • 简体中文
    • English
    • Getting started
    • Authentication and base URL
    • Chat quickstart
    • Callbacks and polling
    • Image, video, and audio tasks
    • Errors and troubleshooting
    • Model selection and billing
    • Export specifications and SDKs
    • API reference
      • Model discovery
        • List available models
      • Generation tasks
        • Create a generation task
        • Query a generation task
        • Create an audio resource
        • Create a character resource
      • Chat
        • Create a chat completion
        • Create a response
        • Create an Anthropic-compatible message
        • Generate Gemini content
    • Model APIs
      • Image generation
        • OpenAI
          • GPT Image 2.5 text to image
          • 4o Image
          • gpt-image-2-5-flare-image-to-image
          • gpt-image-2-5-sunburst-image-to-image
          • gpt-image-2-5-sunburst-text-to-image
          • gpt-image-2-image-to-image
          • gpt-image-2-text-to-image
          • gpt-image/1.5-image-to-image
          • gpt-image/1.5-text-to-image
        • Google
          • Nano Banana 2
          • google/imagen4
          • google/imagen4-fast
          • google/imagen4-ultra
          • google/nano-banana
          • google/nano-banana-edit
          • nano-banana-2-1
          • nano-banana-2-lite
          • nano-banana-pro
        • Black Forest Labs
          • flux-2/flex-image-to-image
          • flux-2/flex-text-to-image
          • flux-2/pro-image-to-image
          • flux-2/pro-text-to-image
          • flux-3/klein-edit-image
          • flux-3/klein-text-to-image
          • flux1-kontext
        • ByteDance
          • bytedance/seedream
          • bytedance/seedream-v4-edit
          • bytedance/seedream-v4-text-to-image
          • omnihuman-1-5/human-identification
          • omnihuman-1-5/subject-detection
          • seedream/4.5-edit
          • seedream/4.5-text-to-image
          • seedream/5-flash-image-to-image
          • seedream/5-flash-layer-decomposition
          • seedream/5-flash-text-to-image
          • seedream/5-lite-image-to-image
          • seedream/5-lite-text-to-image
          • seedream/5-pro-image-to-image
          • seedream/5-pro-layer-decomposition
          • seedream/5-pro-text-to-image
        • Grok
          • grok-imagine-image-2-0/image-edit
          • grok-imagine-image-2-0/segment-edit
          • grok-imagine-image-2-0/segment-map
          • grok-imagine-image-2-0/text-to-image
          • grok-imagine/image-to-image
          • grok-imagine/text-to-image
        • Ideogram
          • ideogram/character
          • ideogram/character-edit
          • ideogram/character-remix
          • ideogram/v3-edit
          • ideogram/v3-remix
          • ideogram/v3-text-to-image
        • Qwen
          • qwen/image-edit
          • qwen/image-to-image
          • qwen/text-to-image
          • qwen2-1/image-to-image
          • qwen2-1/text-to-image
          • qwen2/image-edit
          • qwen2/text-to-image
          • qwen3/image-to-image
          • qwen3/pro-image-to-image
          • qwen3/pro-text-to-image
          • qwen3/text-to-image
          • z-image
        • Recraft
          • recraft/crisp-upscale
          • recraft/remove-background
        • Suno
          • Suno · Generate Music Cover
        • Wan
          • wan/2-7-image
          • wan/2-7-image-pro
      • Video generation
        • Alibaba
          • happyhorse-1-1/image-to-video
          • happyhorse-1-1/reference-to-video
          • happyhorse-1-1/text-to-video
          • happyhorse/image-to-video
          • happyhorse/reference-to-video
          • happyhorse/text-to-video
          • happyhorse/video-edit
        • ByteDance
          • bytedance/seedance-2
          • bytedance/seedance-2-5
          • bytedance/seedance-2-5-draft
          • bytedance/seedance-2-fast
          • bytedance/seedance-2-mini
          • bytedance/v1-lite-image-to-video
          • bytedance/v1-lite-text-to-video
          • bytedance/v1-pro-fast-image-to-video
          • bytedance/v1-pro-image-to-video
          • bytedance/v1-pro-text-to-video
          • omnihuman-1-5
          • omnihuman-2-0
          • volcengine/video-to-video-lip-sync
        • Google
          • gemini-omni-character
          • gemini-omni-video
          • google/gemini-omni-flash-1-1
          • veo-3-1
          • veo/extend
          • veo/get-1080p-video
          • veo/get-4k-video
        • Grok
          • grok-imagine-video-1-5-preview
          • grok-imagine/extend
          • grok-imagine/image-to-video
          • grok-imagine/text-to-video
          • grok-imagine/upscale
        • Hailuo
          • hailuo/02-image-to-video-pro
          • hailuo/02-image-to-video-standard
          • hailuo/02-text-to-video-pro
          • hailuo/02-text-to-video-standard
          • hailuo/2-3-image-to-video-pro
          • hailuo/2-3-image-to-video-standard
          • minimax-h3/image-to-video
          • minimax-h3/reference-to-video
          • minimax-h3/text-to-video
        • Kling
          • kling-2.6/image-to-video
          • kling-2.6/motion-control
          • kling-2.6/text-to-video
          • kling-3.0-omni/image-to-video
          • kling-3.0-omni/reference-to-video
          • kling-3.0-omni/text-to-video
          • kling-3.0-omni/transformation
          • kling-3.0/motion-control
          • kling-3.0/video
          • kling-4.0/keyframe-to-video
          • kling-4.0/reference-to-video
          • kling/ai-avatar-pro
          • kling/ai-avatar-standard
          • kling/v2-1-master-image-to-video
          • kling/v2-1-master-text-to-video
          • kling/v2-1-pro
          • kling/v2-1-standard
          • kling/v2-5-turbo-image-to-video-pro
          • kling/v2-5-turbo-text-to-video-pro
          • kling/v3-turbo-image-to-video
          • kling/v3-turbo-text-to-video
        • MeiGen
          • infinitalk/from-audio
        • Pixverse
          • pixverse-v6-max/image-to-video
          • pixverse-v6-max/text-to-video
          • pixverse-v6/extend
          • pixverse-v6/image-to-video
          • pixverse-v6/reference-to-video
          • pixverse-v6/text-to-video
          • pixverse-v6/transition
        • Runway
          • runway
          • runway/extend-ai-video
        • Suno
          • Suno · Create Music Video
        • Vidu
          • vidu-q4/image-to-video
          • vidu-q4/reference-to-video
        • Wan
          • wan/2-2-a14b-speech-to-video-turbo
          • wan/2-2-animate-move
          • wan/2-2-animate-replace
          • wan/2-5-image-to-video
          • wan/2-5-text-to-video
          • wan/2-6-flash-image-to-video
          • wan/2-6-flash-video-to-video
          • wan/2-6-image-to-video
          • wan/2-6-text-to-video
          • wan/2-6-video-to-video
          • wan/2-7-image-to-video
          • wan/2-7-r2v
          • wan/2-7-text-to-video
          • wan/2-7-videoedit
          • wan/3-0-video
          • wan/3-0-video-prime
      • Audio and music
        • Elevenlabs
          • elevenlabs/text-to-dialogue-v3
          • elevenlabs/text-to-speech-multilingual-v2
          • elevenlabs/text-to-speech-turbo-2-5
        • Google
          • gemini-omni-audio
        • Suno
          • Suno · Add Instrumental
          • Suno · Add Vocals
          • Suno · Boost Music Style
          • Suno · Check Voice
          • Suno · Convert to WAV
          • Suno · Create Voice
          • Suno · Extend Music
          • Suno · Generate Lyrics
          • Suno · Generate MIDI from Audio
          • Suno · Generate Music
          • Suno · Generate Persona
          • Suno · Generate Sounds
          • Suno · Generate Verification Phrase
          • Suno · Mashup
          • Suno · Recover Audio
          • Suno · Regenerate Verification Phrase
          • Suno · Replace Music Section
          • Suno · Separate Vocals
          • Suno · Timestamped Lyrics
          • Suno · Upload and Cover Audio
          • Suno · Upload and Extend Audio
      • Chat models
        • Anthropic
          • claude-fable-5
          • claude-haiku-4-5
          • claude-haiku-5-5
          • claude-opus-4-5
          • claude-opus-4-6
          • claude-opus-4-7
          • claude-opus-4-8
          • claude-opus-5
          • claude-opus-5-5
          • claude-sonnet-4-5
          • claude-sonnet-4-6
          • claude-sonnet-5
          • claude-sonnet-5-5
        • DeepSeek
          • deepseek-v4-1-flash
        • Google
          • gemini-3-6-flash
          • gemini-3-8-flash
          • gemini-3-8-flash-openai
          • gemini-3-pro
          • gemini-3.1-pro
          • gemini-4-argon
          • gemini-4-argon-openai
        • Grok
          • grok-4-5
          • grok-4-6
          • grok-4-7
        • Moonshot
          • kimi-k3
        • OpenAI
          • gpt-5-2
          • gpt-5-5
          • gpt-5-6-luna
          • gpt-5-6-sol
          • gpt-5-6-terra
          • gpt-6-1-sol
          • gpt-6-1-terra
          • gpt-6-astra
          • gpt-6-luna
          • gpt-6-sol

    Callbacks and polling

    For asynchronous tasks that support callbacks, set the top-level callBackUrl to your application's publicly reachable HTTPS endpoint. Do not use localhost, a private-network address, or a URL containing credentials. Without a public endpoint, query the task instead.
    {
      "model": "gpt-image-2-5-flare-text-to-image",
      "input": {"prompt": "An orange cat", "resolution": "1K", "aspect_ratio": "1:1"},
      "callBackUrl": "https://your-app.example.com/callback"
    }

    When notifications are sent#

    The platform sends an application/json POST when the task succeeds or fails. Store the platform task ID from the creation response; the callback uses the same ID in data.taskId. Result fields vary by model. This example shows an image task:
    {
      "code": 200,
      "msg": "success",
      "data": {
        "taskId": "task_example",
        "state": "success",
        "resultJson": "{\"resultUrls\":[\"https://example.com/result.png\"]}"
      }
    }
    Example failure notification:
    {
      "code": 501,
      "msg": "Task failed",
      "data": {"taskId": "task_example", "state": "fail", "failMsg": "Task failed"}
    }
    resultJson is a JSON string. Other models may return output in response or other fields; use the task query result for the model's actual shape. Replace the example URLs and IDs.

    Verify notifications and handle duplicates#

    1.
    Confirm that data.taskId belongs to a task your application created and recorded. Do not update business state for an unknown task.
    2.
    Query the task with your platform API key to confirm its status and result. Do not put the API key in the callback URL.
    3.
    Process the task ID and terminal state idempotently so repeated messages do not trigger duplicate fulfillment, charges, or other actions.
    4.
    Persist the notification securely and promptly return HTTP 2xx. Perform slower queries and business work in a background queue.
    Some deployments may send signature headers, but the platform does not currently provide separate callback-signing key management for developers. Do not trust headers or the callback body alone; confirm the result through the authenticated task query. If enabled, a signature covers only the task ID and timestamp, not the entire body.

    Timeouts, retries and polling#

    The receiver should respond within 10 seconds. The platform does not follow callback redirects. A non-2xx response, timeout, or connection failure is attempted at most six times, with delays of 15 seconds, 1 minute, 5 minutes, 15 minutes, and 1 hour after successive failures. Duplicates or network failures can occur, so retain polling as a fallback.
    Set BASE_URL, MAXROUTERAI_API_KEY, and the creation response's TASK_ID before running the example. Use an account and token authorized to access the task. Some synchronous operations return a result directly and do not issue an asynchronous callback.
    修改于 2026-11-05 06:26:02
    上一页
    Chat quickstart
    下一页
    Image, video, and audio tasks
    Built with