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

# Krea API 简介

> 使用 Krea API 和 ByteDance Seedance 2.5 等模型生成图像和视频。了解 API 密钥、REST 端点、SDK 示例和定价。

Krea API 通过 `https://api.krea.ai` 提供对 AI 图像和视频生成的编程访问。使用 ByteDance 的 [Krea 上的 Seedance API](https://www.krea.ai/docs/cn/developers/seedance.md) 进行文本生成视频、图生视频以及参考引导的视频生成。同一个 Krea API token 也适用于 [API 参考](https://www.krea.ai/docs/api-reference/introduction.md) 中列出的其他模型。![一位铂金色头发随风飘扬、戴着橙色镜片护目镜、身穿黑色羊毛大衣的模特，由 Krea 3 生成](https://optim-images.krea.ai/https---s-krea-ai-k3-landing-final-hero-windcoat-base-webp-2048.webp)# [Krea 3](https://www.krea.ai/docs/cn/developers/krea-3/overview.md)我们全新的图像编辑模型。用自然语言描述你想要的修改——大多数编辑在 8 秒内完成，原生 2K 分辨率。开始使用> [!NOTE]
>
> **开始之前**，请在 [krea.ai/settings/api-tokens](https://www.krea.ai/settings/api-tokens) 生成 API token。参见 [API Keys & Billing](https://www.krea.ai/docs/developers/api-keys-and-billing.md) 获取帮助。## 热门模型从下面挑选一个模型进行快速上手，或在 [Model APIs](https://www.krea.ai/docs/api-reference/introduction.md) 中浏览所有可用端点。### 图像生成

\\<details>

\\<summary>krea
            
          
        Krea 3 — 我们最新的图像模型</summary>
      Provider

Krea

Type

image

Pricing

From \\\\$0.03

Estimated Time

大多数编辑在 8 秒内完成

Endpoint

\\`/generate/image/krea/krea-3`

从文本生成或使用图像参考进行编辑。基础定价为 1K 分辨率 \\\\$0.03 或 2K 分辨率 \\\\$0.06，使用参考图和 `high` 思考模式需额外收费。`fast` 与 `high` 思考模式对所有工作区开放。有关参数、定价和编辑示例，请参阅 [Krea 3 API 概览](https://www.krea.ai/docs/developers/krea-3/overview.md)。

\\**示例用法：**

\\```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"vesper"}}
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const result = await krea.subscribe("image/krea/krea-3", {
  input: {
    prompt: "A cinematic product photo of a glass lamp on a marble table",
    aspect_ratio: "16:9",
    resolution: "2K",
    thinking_mode: "fast"
  },
});

console.log(result.data?.urls[0]);
\\```

\\```bash cURL theme={"theme":{"light":"github-light-default","dark":"vesper"}}
curl -X POST https://api.krea.ai/generate/image/krea/krea-3 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A cinematic product photo of a glass lamp on a marble table",
    "aspect_ratio": "16:9",
    "resolution": "2K",
    "thinking_mode": "fast"
  }'
\\```

\\```python Python theme={"theme":{"light":"github-light-default","dark":"vesper"}}
import requests

API_BASE = "https://api.krea.ai"
API_TOKEN = "your-token-secret"

response = requests.post(
    f"{API_BASE}/generate/image/krea/krea-3",
    headers={
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "A cinematic product photo of a glass lamp on a marble table",
        "aspect_ratio": "16:9",
        "resolution": "2K",
        "thinking_mode": "fast"
    }
)

job = response.json()
print(f"Job ID: {job['job_id']}")
\\```

\\```go Go theme={"theme":{"light":"github-light-default","dark":"vesper"}}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    apiBase := "https://api.krea.ai"
    apiToken := "your-token-secret"

    payload := map[string]interface{}{
        "prompt":        "A cinematic product photo of a glass lamp on a marble table",
        "aspect_ratio":  "16:9",
        "resolution":    "2K",
        "thinking_mode": "fast",
    }

    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", apiBase+"/generate/image/krea/krea-3", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    var job map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&job)
    fmt.Printf("Job ID: %s\n", job["job_id"])
}
\\```

轮询响应中的 `GET /jobs/{job_id}` 直至任务完成，然后读取 `result.urls[0]`。

\\</details>



\\<details>

\\<summary>deepmind
            
          
        Nano Banana Pro - 出色的排版和照片级细节</summary>
      Provider

Google

Type

image

Pricing

From \\\\$0.15

Estimated Time

\\\\~24 seconds

Endpoint

\\`/generate/image/google/nano-banana-pro`

\\**示例用法：**

\\```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"vesper"}}
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const job = await krea.image("google/nano-banana-pro", {
  prompt: "a futuristic cityscape with neon lights at night, in the style of a graphic novel",
  aspect_ratio: "1:1",
  resolution: "1K"
});

console.log(`Job ID: ${job.job_id}`);
\\```

\\```bash cURL theme={"theme":{"light":"github-light-default","dark":"vesper"}}
curl -X POST https://api.krea.ai/generate/image/google/nano-banana-pro \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a futuristic cityscape with neon lights at night, in the style of a graphic novel",
    "aspect_ratio": "1:1",
    "resolution": "1K"
  }'
\\```

\\```python Python theme={"theme":{"light":"github-light-default","dark":"vesper"}}
import requests

API_BASE = "https://api.krea.ai"
API_TOKEN = "your-token-secret"

response = requests.post(
    f"{API_BASE}/generate/image/google/nano-banana-pro",
    headers={
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "a futuristic cityscape with neon lights at night, in the style of a graphic novel",
        "aspect_ratio": "1:1",
        "resolution": "1K"
    }
)

job = response.json()
print(f"Job ID: {job['job_id']}")
\\```

\\```go Go theme={"theme":{"light":"github-light-default","dark":"vesper"}}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    apiBase := "https://api.krea.ai"
    apiToken := "your-token-secret"

    payload := map[string]interface{}{
        "prompt": "a futuristic cityscape with neon lights at night, in the style of a graphic novel",
        "aspect_ratio": "1:1",
        "resolution": "1K",
    }

    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", apiBase+"/generate/image/google/nano-banana-pro", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    var job map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&job)
    fmt.Printf("Job ID: %s\n", job["job_id"])
}
\\```

\\</details>



\\<details>

\\<summary>bytedance
            
          
        Seedream 4 - 用于照片级真实感和文字渲染的高质量模型</summary>
      Provider

ByteDance

Type

image

Pricing

\\\\$0.0315

Estimated Time

\\\\~20 seconds

Endpoint

\\`/generate/image/bytedance/seedream-4`

\\**示例用法：**

\\```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"vesper"}}
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const job = await krea.image("bytedance/seedream-4", {
  prompt: "a photorealistic portrait of a person reading in a cozy library",
  width: 1024,
  height: 1024
});

console.log(`Job ID: ${job.job_id}`);
\\```

\\```bash cURL theme={"theme":{"light":"github-light-default","dark":"vesper"}}
curl -X POST https://api.krea.ai/generate/image/bytedance/seedream-4 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a photorealistic portrait of a person reading in a cozy library",
    "width": 1024,
    "height": 1024
  }'
\\```

\\```python Python theme={"theme":{"light":"github-light-default","dark":"vesper"}}
import requests

API_BASE = "https://api.krea.ai"
API_TOKEN = "your-token-secret"

response = requests.post(
    f"{API_BASE}/generate/image/bytedance/seedream-4",
    headers={
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "a photorealistic portrait of a person reading in a cozy library",
        "width": 1024,
        "height": 1024
    }
)

job = response.json()
print(f"Job ID: {job['job_id']}")
\\```

\\```go Go theme={"theme":{"light":"github-light-default","dark":"vesper"}}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    apiBase := "https://api.krea.ai"
    apiToken := "your-token-secret"

    payload := map[string]interface{}{
        "prompt": "a photorealistic portrait of a person reading in a cozy library",
        "width": 1024,
        "height": 1024,
    }

    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", apiBase+"/generate/image/bytedance/seedream-4", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    var job map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&job)
    fmt.Printf("Job ID: %s\n", job["job_id"])
}
\\```

\\</details>



\\<details>

\\<summary>openai
            
          
        GPT Image 2 - 高质量生成与编辑，具有强大的提示词遵循能力</summary>
      Provider

OpenAI

Type

image

Pricing

From \\\\$0.009

Estimated Time

\\\\~55 seconds

Endpoint

\\`/generate/image/openai/gpt-image-2`

\\**示例用法：**

\\```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"vesper"}}
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const job = await krea.image("openai/gpt-image-2", {
  prompt: "an intricate steampunk airship flying through clouds at golden hour",
  aspect_ratio: "1:1",
  resolution: "1K"
});

console.log(`Job ID: ${job.job_id}`);
\\```

\\```bash cURL theme={"theme":{"light":"github-light-default","dark":"vesper"}}
curl -X POST https://api.krea.ai/generate/image/openai/gpt-image-2 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "an intricate steampunk airship flying through clouds at golden hour",
    "aspect_ratio": "1:1",
    "resolution": "1K"
  }'
\\```

\\```python Python theme={"theme":{"light":"github-light-default","dark":"vesper"}}
import requests

API_BASE = "https://api.krea.ai"
API_TOKEN = "your-token-secret"

response = requests.post(
    f"{API_BASE}/generate/image/openai/gpt-image-2",
    headers={
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "an intricate steampunk airship flying through clouds at golden hour",
        "aspect_ratio": "1:1",
        "resolution": "1K"
    }
)

job = response.json()
print(f"Job ID: {job['job_id']}")
\\```

\\```go Go theme={"theme":{"light":"github-light-default","dark":"vesper"}}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    apiBase := "https://api.krea.ai"
    apiToken := "your-token-secret"

    payload := map[string]interface{}{
        "prompt": "an intricate steampunk airship flying through clouds at golden hour",
        "aspect_ratio": "1:1",
        "resolution": "1K",
    }

    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", apiBase+"/generate/image/openai/gpt-image-2", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    var job map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&job)
    fmt.Printf("Job ID: %s\n", job["job_id"])
}
\\```

\\</details>

### 视频生成

\\<details>

\\<summary>deepmind
            
          
        Veo 3.1 - Google 最新的视频生成模型</summary>
      Provider

Google

Type

video

Pricing

From \\\\$0.20/sec

Estimated Time

\\\\~5 minutes

Endpoint

\\`/generate/video/google/veo-3.1`

\\**示例用法：**

\\```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"vesper"}}
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const job = await krea.video("google/veo-3.1", {
  prompt: "a time-lapse of a bustling city street from day to night",
  aspect_ratio: "16:9",
  duration: 6,
  resolution: "720p"
});

console.log(`Job ID: ${job.job_id}`);
\\```

\\```bash cURL theme={"theme":{"light":"github-light-default","dark":"vesper"}}
curl -X POST https://api.krea.ai/generate/video/google/veo-3.1 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a time-lapse of a bustling city street from day to night",
    "aspect_ratio": "16:9",
    "duration": 6,
    "resolution": "720p"
  }'
\\```

\\```python Python theme={"theme":{"light":"github-light-default","dark":"vesper"}}
import requests

API_BASE = "https://api.krea.ai"
API_TOKEN = "your-token-secret"

response = requests.post(
    f"{API_BASE}/generate/video/google/veo-3.1",
    headers={
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "a time-lapse of a bustling city street from day to night",
        "aspect_ratio": "16:9",
        "duration": 6,
        "resolution": "720p"
    }
)

job = response.json()
print(f"Job ID: {job['job_id']}")
\\```

\\```go Go theme={"theme":{"light":"github-light-default","dark":"vesper"}}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    apiBase := "https://api.krea.ai"
    apiToken := "your-token-secret"

    payload := map[string]interface{}{
        "prompt": "a time-lapse of a bustling city street from day to night",
        "aspect_ratio": "16:9",
        "duration": 6,
        "resolution": "720p",
    }

    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", apiBase+"/generate/video/google/veo-3.1", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    var job map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&job)
    fmt.Printf("Job ID: %s\n", job["job_id"])
}
\\```

\\</details>



\\<details>

\\<summary>kling
            
          
        Kling 3.0 - Kling 最新的前沿模型</summary>
      Provider

Kling

Type

video

Pricing

From \\\\$0.17/sec

Estimated Time

\\\\~3 minutes

Endpoint

\\`/generate/video/kling/kling-3.0`

\\**示例用法：**

\\```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"vesper"}}
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const job = await krea.video("kling/kling-3.0", {
  prompt: "a cinematic tracking shot through a lantern-lit market at night",
  aspect_ratio: "16:9",
  duration: 5,
  mode: "std"
});

console.log(`Job ID: ${job.job_id}`);
\\```

\\```bash cURL theme={"theme":{"light":"github-light-default","dark":"vesper"}}
curl -X POST https://api.krea.ai/generate/video/kling/kling-3.0 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a cinematic tracking shot through a lantern-lit market at night",
    "aspect_ratio": "16:9",
    "duration": 5,
    "mode": "std"
  }'
\\```

\\```python Python theme={"theme":{"light":"github-light-default","dark":"vesper"}}
import requests

API_BASE = "https://api.krea.ai"
API_TOKEN = "your-token-secret"

response = requests.post(
    f"{API_BASE}/generate/video/kling/kling-3.0",
    headers={
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "a cinematic tracking shot through a lantern-lit market at night",
        "aspect_ratio": "16:9",
        "duration": 5,
        "mode": "std"
    }
)

job = response.json()
print(f"Job ID: {job['job_id']}")
\\```

\\```go Go theme={"theme":{"light":"github-light-default","dark":"vesper"}}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    apiBase := "https://api.krea.ai"
    apiToken := "your-token-secret"

    payload := map[string]interface{}{
        "prompt": "a cinematic tracking shot through a lantern-lit market at night",
        "aspect_ratio": "16:9",
        "duration": 5,
        "mode": "std",
    }

    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", apiBase+"/generate/video/kling/kling-3.0", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    var job map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&job)
    fmt.Printf("Job ID: %s\n", job["job_id"])
}
\\```

\\</details>



\\<details>

\\<summary>qwen
            
          
        Wan 2.5 - 阿里巴巴出品的快速高质量模型</summary>
      Provider

Alibaba

Type

video

Pricing

From \\\\$0.0525/sec

Estimated Time

\\\\~3 minutes

Endpoint

\\`/generate/video/alibaba/wan-2.5`

\\**示例用法：**

\\```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"vesper"}}
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const job = await krea.video("alibaba/wan-2.5", {
  prompt: "a drone flying over a tropical beach at sunset",
  duration: 5
});

console.log(`Job ID: ${job.job_id}`);
\\```

\\```bash cURL theme={"theme":{"light":"github-light-default","dark":"vesper"}}
curl -X POST https://api.krea.ai/generate/video/alibaba/wan-2.5 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a drone flying over a tropical beach at sunset",
    "duration": 5
  }'
\\```

\\```python Python theme={"theme":{"light":"github-light-default","dark":"vesper"}}
import requests

API_BASE = "https://api.krea.ai"
API_TOKEN = "your-token-secret"

response = requests.post(
    f"{API_BASE}/generate/video/alibaba/wan-2.5",
    headers={
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "a drone flying over a tropical beach at sunset",
        "duration": 5
    }
)

job = response.json()
print(f"Job ID: {job['job_id']}")
\\```

\\```go Go theme={"theme":{"light":"github-light-default","dark":"vesper"}}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    apiBase := "https://api.krea.ai"
    apiToken := "your-token-secret"

    payload := map[string]interface{}{
        "prompt": "a drone flying over a tropical beach at sunset",
        "duration": 5,
    }

    jsonData, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", apiBase+"/generate/video/alibaba/wan-2.5", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer "+apiToken)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    var job map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&job)
    fmt.Printf("Job ID: %s\n", job["job_id"])
}
\\```

\\</details>

## 更多模型要查看所有可用模型的完整列表，请访问 [Model APIs](https://www.krea.ai/docs/api-reference/introduction.md) 页面。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.