零度API 文档

Replicate 平台兼容接入教程

Replicate 平台兼容

零度API 兼容 Replicate 平台 API 格式,支持通过 Replicate 风格的接口调用各类开源模型。


接入方式

将 Replicate 的 API 地址替换为零度API:

原地址 替换后
https://api.replicate.com https://api000.com/replicate

请求示例

import replicate

# 配置使用零度API
client = replicate.Client(
    api_token="sk-xxxxxxxxxxxxxxxx",
    base_url="https://api000.com/replicate"
)

# 调用 FLUX.1 Dev
output = client.run(
    "black-forest-labs/flux-dev",
    input={
        "prompt": "A photorealistic cat sitting on a windowsill",
        "num_inference_steps": 28
    }
)
print(output[0])  # 图片 URL

支持的主要模型

模型 说明
black-forest-labs/flux-1.1-pro FLUX 1.1 Pro 旗舰
black-forest-labs/flux-dev FLUX Dev 版本
black-forest-labs/flux-schnell FLUX 极速版
black-forest-labs/flux-kontext-pro FLUX Kontext Pro 图生图
stability-ai/sdxl Stable Diffusion XL
recraft-ai/recraft-v3 Recraft v3
minimax/video-01 MiniMax 视频生成

异步任务流程

import replicate
import time

# 提交任务(predictions 接口)
prediction = client.predictions.create(
    version="your-model-version-id",
    input={"prompt": "A beautiful landscape"}
)

# 等待完成
while prediction.status not in ("succeeded", "failed"):
    prediction = client.predictions.get(prediction.id)
    time.sleep(1)

print(prediction.output)
零度API 文档