> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crun.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Crun Models APIs

> Access a comprehensive collection of state-of-the-art AI models through our unified API platform. Choose from the latest image generation, video creation, and audio models to power your applications.

## Welcome to the Crun Models APIs

Explore and integrate cutting-edge AI models for image generation, video creation, and audio processing through unified APIs.

## Image Models

Comprehensive collection of AI models for image generation, editing, and enhancement.

<CardGroup cols={2}>
  <Card title="Google" icon="image" href="/models/google/nano-banana-pro">
    Google gemini image series (Nano Banana), supporting high-quality image generation and editing with strong realism and semantic understanding.
  </Card>

  <Card title="Seedream" icon="image" href="/models/seedream/seedream-5">
    Seedream 5 and 4.x image model series, supporting text-to-image generation with strong detail rendering and style consistency.
  </Card>

  <Card title="Flux" icon="image" href="/models/flux/flux-2-pro">
    Flux 2, Flux Kontext and Flux Pro image models, supporting text-to-image and image-to-image generation with advanced composition control.
  </Card>

  <Card title="Qwen" icon="image" href="/models/qwen/qwen-image-2">
    Qwen-Image and Qwen-Image-edit possess powerful general capabilities in image generation and editing, and perform exceptionally well in text rendering, especially for Chinese text.
  </Card>

  <Card title="OpenAI" icon="image" href="/models/openai/gpt-image-2">
    gpt-image-2 models for image generation and editing, featuring strong semantic understanding and high-quality output.
  </Card>

  <Card title="Grok Imagine" icon="image" href="/models/grok-imagine/text-to-image">
    High-quality photorealistic images, text-to-image, and greater creativity.
  </Card>
</CardGroup>

## Video Models

Advanced AI models for video creation, editing, and transformation from text and images.

<CardGroup cols={2}>
  <Card title="Bytedance" icon="video" href="/models/seedance/2-0/image-to-video">
    Seedance 2.0 and Seedance 2.0 Fast, developed by ByteDance's Seed team, support text-to-video, image-to-video, and reference-to-video generation with flexible 4-15s duration, audio generation, and strong subject consistency.
  </Card>

  <Card title="Google" icon="video" href="/models/google/veo-3-1-image-to-video">
    Google's most powerful video generation model series, Veo, features natively synchronized audio, leverages 3 reference images to ensure consistency, and supports a 1080p output resolution.
  </Card>

  <Card title="Wan" icon="video" href="/models/wan/2-6-image-to-video">
    Alibaba Wan series of AI video generation models allows creators to produce high-quality, lip-synced 1080p videos from text, audio, images, or reference clips.
  </Card>

  <Card title="Sora2" icon="video" href="/models/sora2/sora-2-pro">
    Sora is OpenAI’s newest frontier in generative media – a state-of-the-art video model capable of creating richly detailed, dynamic clips with audio from natural language or images.
  </Card>

  <Card title="Vidu" icon="video" href="/models/vidu/q3-pro/image-to-video">
    Vidu Q series video model boasts powerful image-to-video capabilities, supporting video generation from a single image, start and end frame images, and multiple reference images.
  </Card>

  <Card title="Grok Imagine Video" icon="video" href="/models/grok-imagine/image-to-video">
    Grok Imagine powered by xAI's Aurora engine, supports generating 6-30s videos with sound from images and text, with multiple modes for greater creativity.
  </Card>
</CardGroup>

## Language Models

OpenAI-compatible large language models for chat, reasoning, coding, and text generation.

<CardGroup cols={2}>
  <Card title="OpenAI-Compatible LLM" icon="message" href="/models/llm/quickstart">
    Connect CRUN language models through the OpenAI SDK or any client that already supports `/chat/completions`.
  </Card>

  <Card title="Chat Completions API" icon="message" href="/models/llm/chat-completions">
    Full API reference for the OpenAI-compatible `/chat/completions` endpoint, including request parameters and streaming.
  </Card>

  <Card title="Responses API" icon="sparkles" href="/models/llm/responses">
    OpenAI-compatible `/responses` endpoint for flexible input, structured outputs, streaming, and tool-ready workflows.
  </Card>

  <Card title="Anthropic Messages API" icon="message" href="/models/llm/messages">
    Anthropic-compatible `/messages` endpoint for Claude-style clients, system prompts, vision, tools, thinking, and streaming.
  </Card>
</CardGroup>

## Audio Models

AI-powered audio processing including music generation, speech synthesis, recognition, and effects.

<CardGroup cols={2}>
  <Card title="Qwen3 TTS" icon="waveform-lines" href="/models/qwen/qwen-tts">
    A unified Text-to-Speech demo featuring three powerful modes: Voice, Clone and Design.
  </Card>

  <Card title="Suno Music API" icon="music" href="/suno-api/quickstart">
    Supports multiple music models, including the latest Suno V5 model.
  </Card>
</CardGroup>

## Getting Started

<Steps>
  <Step title="Choose Your Model">
    Select the AI model that best fits your use case from the categories above.
  </Step>

  <Step title="Get API Key">
    Visit the [API Key Management Page](https://crun.ai/user-api-key) to obtain your API credentials.
  </Step>

  <Step title="Integrate">
    Follow the model-specific documentation to integrate the API into your application.
  </Step>

  <Step title="Start Creating">
    Begin generating content using your chosen AI model through simple API calls.
  </Step>
</Steps>

## Best Practices

All models follow a consistent API structure for ease of integration and invocation.

### Authentication

All API requests need to include the API key in the request header.

```bash theme={null} theme={null}
X-API-KEY: YOUR_API_KEY
```

<Warning>
  Keep your API key secure. Never expose it in client-side code or public repositories.
</Warning>

### Create Task

All task creation requests follow a unified outer structure. Only the `input` field varies by model.

<Warning>
  Success is only achieved when both the HTTP status code and the business status code are 200.
</Warning>

<CodeGroup>
  ```curl cURL theme={null} theme={null}
    curl -X POST "https://api.crun.ai/api/v1/client/job/CreateTask" \
    -H "Content-Type: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -d '{
      "model": "google/veo3-1-t2v",
      "callback_url": "",
      "input": {
        "...": "model-specific fields"
      }
    }'

  ```

  ```python Python theme={null} theme={null}
  import requests

  API_KEY = "YOUR_API_KEY"
  CREATE_TASK_URL = "https://api.crun.ai/api/v1/client/job/CreateTask"

  payload = {
      "model": "google/veo3-1-t2v",
      "callback_url": "https://your.domain/api/v1/callback/task", # Use Callback Notifications
      # "callback_url": "",
      "input": {
          "...": "model-specific fields"
      }
  }
  headers = {
      "X-API-KEY": API_KEY,
      "Content-Type": "application/json"
  }
  try:
      response = requests.post(CREATE_TASK_URL, json=payload, headers=headers)
      resp_json = response.json()
      # Success requires both HTTP status code and business code to be 200
      if response.status_code == 200 and resp_json.get("code") == 200:
          # success logic
          pass
      else:
          # business error handling
          pass

  except Exception as e:
      print(f"exception occurred while creating a task: {str(e)}", )   
  ```

  ```javascript Node.js theme={null} theme={null}
  import axios from "axios";

  const API_KEY = "YOUR_API_KEY";
  const CREATE_TASK_URL = "https://api.crun.ai/api/v1/client/job/CreateTask";

  async function createTask() {
    const payload = {
      model: "google/veo3-1-t2v",
      callback_url: "https://your.domain/callback/task", // Use Callback Notifications
      // callback_url: "",
      input: {
        "...": "model-specific fields"
      }
    };

    try {
      const response = await axios.post(CREATE_TASK_URL, payload, {
        headers: {
          "X-API-KEY": API_KEY,
          "Content-Type": "application/json"
        }
      });

      const respJson = response.data;

      // Success requires both HTTP status code and business code to be 200
      if (response.status === 200 && respJson.code === 200) {
        // success logic
      } else {
        // business error handling
      }
    } catch (error) {
      console.error(
        "exception occurred while creating a task:",
        error.response?.data || error.message
      );
    }
  }

  createTask();

  ```
</CodeGroup>

#### Response Example

<CodeGroup>
  ```json 200 theme={null} theme={null}
  {
    "code": 200,
    "message": "success",
    "data": {
    	"task_id": "xxxx-xxxx"
    }
  }
  ```

  ```json 4xx theme={null} theme={null}
  {
    "code": 422,
    "message": "Missing Params or Type Error"
  }
  ```

  ```json 5xx theme={null} theme={null}
  {
    "code": 500,
    "message": "Internal Service Error"
  }
  ```
</CodeGroup>

### Polling Task Status

<Tip>
  Polling interval is recommended to be between 15 and 30 seconds. For production environments, we recommend webhook callbacks.
</Tip>

<CodeGroup>
  ```curl cURL theme={null} theme={null}
  curl -X GET "https://api.crun.ai/api/v1/client/job/TaskInfo?task_id=xxxx-xxxx" \
    -H "Content-Type: application/json" \
    -H "X-API-KEY: YOUR_API_KEY"
  ```

  ```python Python theme={null} theme={null}
  import time
  import requests

  API_KEY = "YOUR_API_KEY"
  GET_TASK_STATUS_URL = "https://api.crun.ai/api/v1/client/job/TaskInfo"

  poll_interval = 15

  headers = {
      "X-API-KEY": API_KEY,
      "Content-Type": "application/json"
  }

  params = {
      "task_id": "xxxx-xxxx",
  }

  while True:
      response = requests.get(GET_TASK_STATUS_URL, headers=headers, params=params)
      resp_json = response.json()

      task_status = resp_json["data"]["status"]
      print(f"Task status: {task_status}")

      if task_status == "success":
          # Business success logic
          break
      elif task_status == "failed":
          # Business failure logic
          break
      else:
          # Task status is pending or running
          time.sleep(poll_interval)

  ```

  ```javascript Node.js theme={null} theme={null}
  import axios from "axios";

  const API_KEY = "YOUR_API_KEY";
  const GET_TASK_STATUS_URL = "https://api.crun.ai/api/v1/client/job/TaskInfo";

  const poll_interval = 15;

  const headers = {
    "X-API-KEY": API_KEY,
    "Content-Type": "application/json"
  };

  const params = {
    task_id: "xxxx-xxxx",
  };

  async function pollTaskStatus() {
    while (true) {
      const response = await axios.get(GET_TASK_STATUS_URL, {
        headers,
        params
      });

      const resp_json = response.data;

      const task_status = resp_json.data.status;
      console.log(`Task status: ${task_status}`);

      if (task_status === "success") {
        // Business success logic
        break;
      } else if (task_status === "failed") {
        // Business failure logic
        break;
      } else {
        // Task status is pending or running
        await new Promise((resolve) => setTimeout(resolve, poll_interval * 1000));
      }
    }
  }

  pollTaskStatus();
  ```
</CodeGroup>

#### Response Example

<CodeGroup>
  ```json task processing theme={null} theme={null}
  {
    "code": 200,
    "message": "success",
    "data": {
    	"task_id": "3f8e4789-29df-4793-89cc-acb71a1b79d9",
    	"provider": "Google",
    	"model_version": "veo3.1",
    	"status": "running",
    	"param": {
    		"model": "google/veo3-1-t2v",
    		"callback_url": "https://your.domain/api/v1/callback/task",
    		"input": {
    			"...": "model-specific fields"
    		}
    	},
    	"create_at": 1768450365,
    	"result": null,
    	"duration_s": null,
    	"complete_at": null
    }
  }
  ```

  ```json task success theme={null} theme={null}
  {
    "code": 200,
    "message": "success",
    "data": {
    	"task_id": "3f8e4789-29df-4793-89cc-acb71a1b79d9",
    	"provider": "Google",
    	"model_version": "veo3.1",
    	"status": "success",
    	"param": {
    		"model": "google/veo3-1-t2v",
    		"callback_url": "https://your.domain/api/v1/callback/task",
    		"input": {
    			"...": "model-specific fields"
    		}
    	},
    	"create_at": 1768450365,
    	"result": {
    		"cdoe": 200,
    		"message": "generation success",
    		"media_urls": [
    			"..."
    		] 
    	},
    	"duration_s": 104,
    	"complete_at": 1768450469
    }
  }
  ```

  ```json task failed theme={null} theme={null}
    {
    "code": 200,
    "message": "success",
    "data": {
    	"task_id": "3f8e4789-29df-4793-89cc-acb71a1b79d9",
    	"provider": "Google",
    	"model_version": "veo3.1",
    	"status": "failed",
    	"param": {
    		"model": "google/veo3-1-t2v",
    		"callback_url": "https://your.domain/api/v1/callback/task",
    		"input": {
    			"...": "model-specific fields"
    		}
    	},
    	"create_at": 1768450365,
    	"result": {
    		"cdoe": 501,
    		"message": "error message"
    	},
    	"duration_s": 104,
    	"complete_at": 1768450469
    }
  }
  ```
</CodeGroup>

<Tip>
  1. The task status is determined by the `status` field in the response `data` object.
  2. When `status` is `success`, retrieve the generated media URLs from `data.result.media_urls`.
  3. When `status` is `failed`, check the error code and message in `data.result` for details.
</Tip>

### Callback Notifications

Although polling is supported, webhook callbacks are strongly recommended for production systems., When providing `callback_url` in the task creation request, ensure the following:

* The endpoint is publicly accessible over HTTPS.
* It responds quickly (recommended \< 3 seconds) to avoid retries.
* It returns an HTTP 200 status code upon successful receipt.
* It is idempotent. Callback notifications may be delivered more than once.

Callback payloads use the same structure as the task status query API, allowing a single unified parsing logic.

<Tip>
  When the task status changes, we will notify you of the result via a POST request.
  The payload structure is consistent with the `data` object returned by the task status query.
  For production environments, we strongly recommend using callback notifications to retrieve task results.
</Tip>

## Credits and Pricing

Different models consume different amounts of credits based on their computational requirements:

* **Image Models**: Typically 10-50 credits per generation
* **Video Models**: Typically 100-500 credits per generation
* **Language Models**: Charged per token usage

Visit the [pricing](https://crun.ai/pricing) page to view detailed pricing for each of our models.

Check your remaining credits:

<CodeGroup>
  ```curl cURL theme={null} theme={null}
  curl -X POST "https://api.crun.ai/api/v1/client/account/balance" \
    -H "Content-Type: application/json" \
    -H "X-API-KEY: YOUR_API_KEY"
  ```

  ```python Python theme={null} theme={null}
  import requests

  API_KEY = "YOUR_API_KEY"
  GET_BALANCE_URL = "https://api.crun.ai/api/v1/client/account/balance"

  headers = {"X-API-KEY": API_KEY, "Content-Type": "application/json"}
  response = requests.post(GET_BALANCE_URL, headers=headers)

  print(response.json())
  ```

  ```javascript Node.js theme={null} theme={null}
  import axios from "axios";

  const API_KEY = "YOUR_API_KEY";
  const GET_BALANCE_URL = "https://api.crun.ai/api/v1/client/account/balance";

  const headers = {
    "X-API-KEY": API_KEY,
    "Content-Type": "application/json"
  };

  axios
    .post(GET_BALANCE_URL, null, { headers })
    .then((response) => {
      console.log(response.data);
    })
    .catch((error) => {
      console.error(error.response?.data || error.message);
    });
  ```
</CodeGroup>

## Support

Need help choosing the right model or integrating our APIs?

* Email: [support@crun.ai](mailto:support@crun.ai)
* Documentation: Browse model-specific guides in the navigation
