# Anthropic 兼容 Source: https://docs.geekai.co/cn/docs/anthropic_sdk 除了 OpenAI 兼容以外,极客智坊还提供了针对 Anthropic API 兼容的接口服务,以便在 Claude Code 等编程工具中使用,该接口目前支持以下模型: * Claude 全系模型 * GLM 家族:GLM-4.5系列、GLM-4.6系列、GLM-4.7系列、GLM-5系列、GLM-5.1系列 * MiniMax 家族:MiniMax-M2、MiniMax-M2.1、MiniMax-M2.5、MiniMax-M2.7系列 * 千问家族:Qwen3系列、Qwen3.5系列、Qwen3.6系列 * 豆包家族:Doubao-Seed-2.0系列、Doubao-Seed-Code * Kimi家族:Kimi-K2、Kimi-K2.5、Kimi-K2.6 * 小米家族:Mimo-V2系列、Mimo-V2.5系列 * DeepSeek家族:DeepSeek-R1、DeepSeek-V3、DeepSeek-V3.1、DeepSeek-V3.2系列 你可以通过 Anthropic SDK 来调用这些模型,使用方法和调用 OpenAI 兼容模型类似,只需要将 Base URL 和 API KEY 替换成极客智坊的 Base URL 和 API KEY 即可,其他参数和调用方式与官方 Anthropic API 保持一致:
参数
Base URL 国内版调用入口: `https://geekai.co/api`
海外版调用入口: `https://geekai.dev/api`
API KEY 国内版 API KEY:[https://geekai.co/user/api\_keys](https://geekai.co/user/api_keys)
海外版 API KEY:[https://geekai.dev/user/api\_keys](https://geekai.dev/user/api_keys)
API KEY 与代理渠道关联,不同渠道对应不同折扣值,可通过编辑 API KEY 切换。
以下是代码调用示例: ```bash curl theme={null} curl https://geekai.co/api/v1/messages \ -H "content-type: application/json" \ -H "x-api-key: $GEEKAI_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "claude-opus-4-7", "max_tokens": 1024, "messages": [{ "role": "user", "content": "Hello, Claude" }] }' ``` ```bash python theme={null} import anthropic client = anthropic.Anthropic( api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api" ) message = client.messages.create( model="claude-opus-4-7", max_tokens=1024, "messages": [{ "role": "user", "content": "Hello, Claude" }] ) print(message.content[0].text) ``` ```bash javascript theme={null} import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic( apiKey: process.env.GEEKAI_API_KEY, baseURL: "https://geekai.co/api", ); const msg = await client.messages.create({ model: "claude-opus-4-7", max_tokens: 1024, messages: [{ role: "user", content: "Hello, Claude" }], }); console.log(msg.content[0].text); ``` ```bash go theme={null} import anthropic "github.com/anthropics/anthropic-sdk-go" client := anthropic.NewClient( option.WithAPIKey("$GEEKAI_API_KEY"), option.WithBaseURL("https://geekai.co/api"), ) msg, _ := client.Messages.New( context.TODO(), anthropic.MessageNewParams{ Model: anthropic.ModelClaudeOpus4_7, MaxTokens: 1024, Messages: []anthropic.MessageParam{ anthropic.NewUserMessage( anthropic.NewTextBlock("Hello, Claude"), ), }, }, ) fmt.Println(msg.Content[0].Text) ``` # 模型选择 Source: https://docs.geekai.co/cn/docs/audio/model 你可以在[模型广场](https://geekai.co/models)通过筛选/搜索查看所有语音模型,并拷贝模型名称用于 API 调用: ![复制语音模型名称](https://static.geekai.co/storage/2025/03/26/image-20250326221613985.png) 文本转语音中文环境建议使用国内模型,如 `doubao-tts`/`seed-tts-1.1`,英文环境建议使用海外模型,如 `gpt-4o-mini-tts`。 # 语音转文本 Source: https://docs.geekai.co/cn/docs/audio/transcribe 目前支持文本转语音的模型有 `whisper-1`、`gpt-4o-transcribe` 以及 `gpt-4o-mini-transcribe`,你可以通过如下方式调用: ```bash theme={null} curl --location 'https://geekai.co/api/v1/audio/transcriptions' \ --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \ --form 'file=@"/C:/User/GeekAI/test.mp3"' \ --form 'model="whisper-1"' \ --form 'response_format="text"' ``` Linux 下文件路径示例: ```bash theme={null} curl --location 'https://geekai.co/api/v1/audio/transcriptions' \ --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \ --form 'file=@/home/geekai/test.mp3' \ --form 'model=whisper-1' \ --form 'response_format=text' ``` 其中 `gpt-4o-transcribe` 以及 `gpt-4o-mini-transcribe` 仅支持 `json` 响应(`response_format=json`)。 ### 音频格式 OpenAI 支持的上传音频格式如下: * `flac` * `mp3` * `mp4` * `mpeg` * `mpga` * `m4a` * `ogg` * `wav` * `webm` 如果客户端通过 curl 上传这些类型音频文件报错: ```bash theme={null} file type should be mp3, mp4, wav, wave, mpeg, webm or m4a ``` 这是因为 curl 自动识别音频文件的媒体类型不正确,可以通过以下方式来强制指定音频文件的媒体类型解决: ```bash theme={null} curl --location 'https://geekai.co/api/v1/audio/transcriptions' \ --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \ --form 'file=@/home/geekai/test.m4a;type=audio/mp4' \ --form 'model=whisper-1' \ --form 'response_format=text' ``` # 文本转语音 Source: https://docs.geekai.co/cn/docs/audio/tts ### 快速入门 目前支持文本转语音的模型有 `tts-1`、`tts-1-hd`、`gpt-4o-mini-tts`、`doubao-tts`、`seed-tts-1.1`,你可以通过如下方式调用: ```bash theme={null} curl --location 'https://geekai.co/api/v1/audio/speech' \ --header 'Content-Type: application/json' \ --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \ --data '{ "input":"Hello! Nice to meet you!", "model":"gpt-4o-mini-tts" }' ``` 豆包语音合成模型仅支持中英文,其他语种建议使用 OpenAI 语音模型。 ### 声音角色 OpenAI 支持的声音角色(通过 `voice` 指定)有: * alloy * ash * ballad * coral * echo * fable * onyx * nova * sage * shimmer 选择任意值填充到 `voice` 参数即可。 豆包平台支持的声音角色太多,这里不一一列举,参考火山引擎的[大模型语音合成音色列表](https://www.volcengine.com/docs/6561/1257544),将其中的 `voice_type` 值填充到 `voice` 参数即可。 ### 音频格式 OpenAI 支持的音频输出格式(通过 `response_format` 参数指定)如下: * `mp3` * `opus` * `wav` * `flac` * `pcm` * `aac` 不指定的话默认输出格式为 `mp3`,豆包平台目前仅支持生成 `mp3`/`wav`/`pcm`/`ogg_opus` 格式的音频。 ### 流式输出 文本转语音默认输出的是二进制音频文件流,如果你想要实现边输出边播放的效果,可以设置 `stream_format` 请求字段为 `sse` 开启 SSE 流式输出,目前仅 `gpt-4o-mini-tts`、`doubao-tts`、`seed-tts-1.1` 支持流式输出: ```bash theme={null} curl --location 'https://geekai.co/api/v1/audio/speech' \ --header 'Content-Type: application/json' \ --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \ --data '{ "input":"你好,很高兴见到你!", "model":"doubao-tts", "response_format":"pcm", "stream_format":"sse" }' ``` 流式输出推荐使用 `pcm` 音频格式,延迟最低,适合边输出边播放,豆包平台的 `wav` 格式不支持流式输出,使用时请注意规避。 返回结果会以 SSE 流的形式分块返回经过 base64 编码的音频数据,你可以通过监听 EventStream 来获取每一块数据,直到接收到 `[DONE]` 表示流式输出结束,极客智坊语音合成流式输出格式兼容 OpenAI 流式语音合成输出格式。 `type` 字段为 `speech.audio.delta` 表示这是音频数据块,`audio` 字段为经过 base64 编码的音频数据片段,你可以将这些片段解码后拼接成完整的音频文件,或者边解码边播放: ```json theme={null} { "id": "24f44c9a-e6f9-4a80-812a-d17e6621e107", "type": "speech.audio.delta", "audio": "{base64音频数据片段} ", } ``` `type` 字段为 `speech.audio.done` 表示流式输出结束,接下来可以关闭服务端 EventStream 了: ```json theme={null} { "id": "24f44c9a-e6f9-4a80-812a-d17e6621e107", "type": "speech.audio.done", "usage": { "input_tokens": 3, "output_tokens": 73, "total_tokens": 76 } } ``` 更多语音合成参数请参考[API文档](https://docs.geekai.co/cn/api/audio/texttospeech)。 # 语音对话 Source: https://docs.geekai.co/cn/docs/chat/audio 极客智坊支持实时语音对话功能,支持在对话请求中将模型设置为支持语音对话的模型即可,你可以在[模型广场](https://geekai.co/models)筛选支持实时语音对话的模型: ![支持语音对话的模型](https://static.geekai.co/storage/2025/07/14/image-20250714102327597.png) ### OpenAI 以下是 OpenAI 平台实时语音对话示例代码: ```bash curl theme={null} curl "https://geekai.co/api/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "gpt-4o-mini-audio-preview", "modalities": ["text", "audio"], "audio": { "voice": "alloy", "format": "wav" }, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What is in this recording?" }, { "type": "input_audio", "input_audio": { "data": "", "format": "wav" } } ] } ] }' ``` ```bash python theme={null} import base64 import requests from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") completion = client.chat.completions.create( model="gpt-4o-mini-audio-preview", modalities=["text", "audio"], audio={"voice": "alloy", "format": "wav"}, messages=[ { "role": "user", "content": [ { "type": "text", "text": "What is in this recording?" }, { "type": "input_audio", "input_audio": { "data": "", "format": "wav" } } ] }, ] ) print(completion.choices[0]) wav_bytes = base64.b64decode(completion.choices[0].message.audio.data) with open("dog.wav", "wb") as f: f.write(wav_bytes) ``` ```bash javascript theme={null} import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); const response = await openai.chat.completions.create({ model: "gpt-4o-mini-audio-preview", modalities: ["text", "audio"], audio: { voice: "alloy", format: "wav" }, messages: [ { role: "user", content: [ { type: "text", text: "What is in this recording?" }, { type: "input_audio", input_audio: { data: "url or base64 bytes here", format: "wav" }} ] } ], store: true, }); // Inspect returned data console.log(response.choices[0]); // Write audio data to a file writeFileSync( "dog.wav", Buffer.from(response.choices[0].message.audio.data, 'base64'), { encoding: "utf-8" } ); ``` `modalities` 传入 `text`、`audio` 表示返回文本、语音输出,如果需要文本输出传入 `text` 即可。`audio` 用于设置语音输出的音色和格式,对于 OpenAI 平台而言,具体设置和[文本转语音](https://docs.geekai.co/cn/docs/audio/tts)的参数一致。 ### 国内平台 OpenAI 输出语音音色为外国人音色(如果输出设置为文本就无所谓),对中文场景不友好,此时你也可以选择国内实时语音对话模型,如智谱清言和通义千问,智谱清言无需 `modalities` 和 `audio` 参数配置,更简单明了,通义千问的 `modalities` 配置和 OpenAI 一致,音色(`audio` 的 `voice` 字段)上支持中文音色: * Cherry(不支持开源模型) * Serena(不支持开源模型) * Ethan * Chelsie 音频输出格式(`audio` 的 `format` 字段)仅支持 `wav`。 以下是通义千问语音对话示例: ```bash curl theme={null} curl "https://geekai.co/api/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "qwen-omni-turbo", "modalities": ["text", "audio"], "audio": { "voice": "Cherry", "format": "wav" }, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "音频中包含什么内容?" }, { "type": "input_audio", "input_audio": { "data": "", "format": "wav" } } ] } ] }' ``` # 后台模式 Source: https://docs.geekai.co/cn/docs/chat/background ### 什么是后台模式 后台模式是指在对话过程中,用户可以选择不立即等待模型的回复,而是让模型在后台处理请求,稍后再获取结果。这种模式适用于需要较长时间处理的任务,如画图、复杂推理、深度研究或多轮对话等。 典型的耗时任务模型如下: * `o1` * `o1-pro` * `o3` * `o3-pro` * `gpt-5` 复杂推理 * `gpt-5-pro` * `gpt-5-codex` * `gemini-2.5-flash` 复杂推理 * `gemini-2.5-flash-image` * `gemini-2.5-pro` * 所有模型ID中带 `sonar` 前缀的[对话模型](https://geekai.co/models?platform=perplexity)(需要联网搜索) * 所有模型ID中带 `thinking` 后缀的推理模型(注意不是 `no-thinking`),如 Claude、DeepSeek 等 * 所有模型ID中带 `search` 字样的联网搜索对话模型 * 所有模型ID中带 `research` 字样的深度研究推理模型 * OpenAI 系列使用了[搜索](https://docs.geekai.co/cn/docs/chat/web_search)(`web_search`)、[画图](https://docs.geekai.co/cn/docs/chat/draw)(`image_generation`)工具的对话模型 * 所有其他内置联网搜索并开启以及使用了外部搜索工具的对话模型 * 所有其他在对话中支持画图、语音的对话模型 当然如果你在使用其他对话模型时觉得响应较慢,也可以使用后台模式。 目前仅对话完成接口非流式对话支持后台模式,画图、视频模型可以通过对应的异步模式实现后台模式。 ### 启用后台模式对话 要使用后台模式,您需要在对话请求中设置 `background` 参数为 `true`。以下是一个示例请求: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-pro", "messages": [ { "role": "user", "content": "你好,请向一个小学生解释什么是宇称不守恒定律" } ], "background": true }' ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gemini-2.5-pro", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "你好,请向一个小学生解释什么是宇称不守恒定律", "background": true }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 目前仅对话完成接口非流式对话支持后台模式,所以不同同时设置 `stream` 和 `background` 为 `true`,否则会导致请求失败: ```json theme={null} { "message": "only non-stream chat support background mode" } ``` ### 获取后台模式结果 一旦发起了一个后台模式的请求,将收到一个响应,其中包含一个唯一的 `id` 用于标识本次对话任务: ```json theme={null} { "id": "4ec88c8a-9ef9-496d-bec8-711521a1c693", "status": "pending", "created": 1761375639, "model": "gemini-2.5-pro", "object": "chat.completion" } ``` 你可以使用这个 `id` 通过[对话结果查询接口](https://docs.geekai.co/cn/api/chat/result)查询任务的状态和结果: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/chat/{id}' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 将上面接口路径中的 `{id}` 替换为你收到的任务 `id` 发起查询请求即可,在本例中,就是 `4ec88c8a-9ef9-496d-bec8-711521a1c693`。查询结果可能有以下几种状态: * `pending`:任务仍在排队中 * `running`:任务正在处理中 * `succeed`:任务处理成功 如果任务执行成功,则响应和非后台模式的对话完成接口响应格式相同: ```json theme={null} { "id": "4ec88c8a-9ef9-496d-bec8-711521a1c693", "status": "succeed", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "嗨,小朋友你好!\n\n我们来玩一个“镜子世界”的游戏,你很快就能明白什么是“宇称不守恒定律”啦。\n\n### 第一步:认识我们的“镜子世界”\n\n你照过镜子吗?镜子里有一个和你长得一模一样,但是左右相反的你,对不对?\n\n* 你举起**右手**,镜子里的你举起了**左手**。\n* 你朝**东**边跑,镜子里的你朝**西**边跑。\n\n现在,我们假装有一个“镜子法则”,这个法则是说:**在我们的世界里能发生的事情,在镜子里的世界也一定能发生,而且看起来很正常。**\n\n比如:\n* 你把一个苹果扔到空中,它会掉下来。镜子里的你扔一个“镜子苹果”,它也会掉下来。这个法则没问题。\n* 你让一个陀螺顺时针转,镜子里的陀螺就会逆时针转。这也很正常,因为陀螺本来就可以逆时针转。这个法则也没问题。\n\n在很长一段时间里,所有最厉害的科学家都认为,这个“镜子法则”在宇宙的任何地方都是绝对正确的。他们给这个法则起了一个很酷的名字,叫**“宇称守恒”**。\n\n* **“宇称”**,你就可以把它想象成“宇宙的左右对称性”。\n* **“守恒”**,就是“保持不变”的意思。\n\n所以,“宇称守恒”就是说:**宇宙和它在镜子里的样子,遵守的是同一套规则,没有区别。**\n\n### 第二步:发现一个惊天大秘密!\n\n但是!有一天,一位非常非常聪明的女科学家,叫做**吴健雄**(你可以叫她吴奶奶),和她的同事们做了一个实验。\n\n他们观察了一些比灰尘还要小上亿万倍的“小不点”(我们叫它“粒子”)的行为。然后,他们发现了一个让所有人都惊掉下巴的秘密!\n\n他们发现,有一种小不点在“发射”更小的“小不点子弹”时,**总是喜欢朝着一个固定的方向发射**。\n\n这就好像一个神奇的陀螺:\n\n* **在我们的世界里**,这个神奇的陀螺一边**顺时针**旋转,一边**向上**发射子弹。\n* **在镜子世界里**,这个陀螺就应该一边**逆时针**旋转,一边**向上**发射子弹。\n\n但是吴奶奶的实验发现,这种神奇的陀螺**只会**“顺时针转+向上发射”,它**从来不会**“逆时针转+向上发射”!\n\n这一下,“镜子法则”就被打破了!因为在镜子世界里发生的事情,在我们的现实世界里根本找不到!\n\n这就说明,我们的宇宙其实有点“偏心”!在微观世界里,它并不是完全左右对称的。\n\n### 总结一下\n\n所以,**宇称不守恒定律**说的就是:\n\n**在微观小世界里,宇宙有时候会“耍赖皮”,它和它在镜子里的样子,遵守的规则不完全一样。我们的世界里发生的一些事情,在镜子世界里是永远不会发生的。**\n\n简单说,就是那个“镜子法则”(宇称守恒)被打破了,所以就叫**“宇称不守恒”**。\n\n这个发现非常了不起,因为它告诉我们,宇宙比我们想象的还要奇妙和神秘。说不定,等你长大了,也能发现宇宙的更多秘密呢!" }, "finish_reason": "stop" } ], "model": "gemini-2.5-pro", "object": "chat.completion", "usage": { "prompt_tokens": 15, "completion_tokens": 788, "total_tokens": 2526, "completion_tokens_details": { "reasoning_tokens": 1723 } } } ``` 按照非流式对话完成接口进行 JSON 反序列化即可获取响应结果。 任务结果默认会保留 7 天,7 天后任务结果将被自动删除,请及时查询和保存结果。 如果任务执行失败,则错误响应和原来非流式对话完成接口响应格式相同,你可以根据错误码和错误信息进行排查和处理。 # 基本对话 Source: https://docs.geekai.co/cn/docs/chat/base ### 模型参数 * 模型ID:参考[模型选择](https://docs.geekai.co/cn/docs/chat/model)拷贝模型ID设置到 `model` 字段 * 模型参数:参考[对话 API 手册](https://docs.geekai.co/cn/api/chat/completions) * 调用入口:`https://geekai.co/api/v1/chat/completions`(国外域名调整为 `geekai.dev`) * API KEY:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) ### 调用示例 以下是最简单最基础的入门对话请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "你好" } ] }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gpt-5-mini", messages=[ {"role": "user", "content": "你好"}, ], stream=False ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{ role: "user", content: "你好" }], model: "gpt-5-mini", }); console.log(completion.choices[0].message.content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5-mini", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "你好", }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 以上基本示例适用于所有对话模型。 # 图像生成 Source: https://docs.geekai.co/cn/docs/chat/draw ### 支持的模型 目前仅以下模型支持在对话中进行图片生成与编辑: * `gemini-2.5-flash-image` * `gemini-2.5-flash-image-preview` * `gemini-2.0-flash-preview-image-generation` * `gpt-4o-image` * `gpt-5-all` * `midjourney-chat` 本教程只是基本示例,关于 Gemini 画图模型更详细的教程请参考 [Gemini 2.5 Flash 画图模型教程](https://docs.geekai.co/cn/docs/image/google/gemini-2.5-flash-image)。 ### 生成图片 以下是通过对话画图的请求示例,和普通文本对话并无不同: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": "画一只可爱的小猫在草丛中玩耍" } ] }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gemini-2.5-flash-image", messages=[ {"role": "user", "content": "画一只可爱的小猫在草丛中玩耍"}, ] ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{ role: "user", content: "画一只可爱的小猫在草丛中玩耍" }], model: "gemini-2.5-flash-image", }); console.log(completion.choices[0].message.content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gemini-2.5-flash-image", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "画一只可爱的小猫在草丛中玩耍", }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` `gpt-4o-image`、`gpt-5-all`、`midjourney-chat` 支持流式输出,`gemini-2.5-flash-image-preview`、`gemini-2.5-flash-image` 不支持流式输出。 在响应对象中,`image.url` 字段中会包含生成的图片 URL 地址,你可以获取进行显示,也可以获取 `content` 字段值直接在支持 Markdown 渲染的组件中显示: ```json theme={null} { "id": "1061a101-5fe0-44bd-9281-6fb6565dbd0a", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "好的,这是一只在草丛中玩耍的可爱小猫: \n![](https://static.geekai.co/image/2025/09/22/81e1cc5fc52a70c738f99b9037957bb4.png)\n", "image": { "url": "https://static.geekai.co/image/2025/09/22/81e1cc5fc52a70c738f99b9037957bb4.png" } }, "finish_reason": "stop" } ], "model": "gemini-2.5-flash-image", "object": "chat.completion", "usage": { ... } } ``` ### 图片编辑 如果你想要以图生图,或者在已有的图片上进行修改,可以结合[图片对话](https://docs.geekai.co/cn/docs/chat/image)请求实现: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "将图片中的中文替换成英文GeekAI,字体风格大小保持不变" }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/icon/geekai-logo-main-tr.png" } } ] } ] }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gemini-2.5-flash-image", messages=[ {"role": "user", "content": [ {"type": "text", "text": "将图片中的中文替换成英文GeekAI,字体风格大小保持不变"}, {"type": "image_url", "image_url": {"url": "https://static.geekai.co/icon/geekai-logo-main-tr.png"}} ]} ] ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{ role: "user", content: [ { "type": "text", "text": "将图片中的中文替换成英文GeekAI,字体风格大小保持不变" }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/icon/geekai-logo-main-tr.png" } } ]}], model: "gemini-2.5-flash-image", }); console.log(completion.choices[0].message.content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gemini-2.5-flash-image", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": []interface{}{ map[string]interface{}{ "type": "text", "text": "将图片中的中文替换成英文GeekAI,字体风格大小保持不变", }, map[string]interface{}{ "type": "image_url", "image_url": map[string]string{ "url": "https://static.geekai.co/icon/geekai-logo-main-tr.png", }, }, }, }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 在上面的请求中,`image_url` 字段的 `url` 属性可以是任何有效的图片 URL 地址或者 Base64 编码的图片数据。 ### 解决 Gemini 不出图问题 如果在使用 Gemini 画图模型进行图像生成时遇到不出图的问题,可以尝试以下解决方案: 1. **设置系统提示**:在请求中通过系统提示强化画图诉求,如 `你是一个AI画图机器人,请根据用户需求进行画图`; 2. **调整参数设置**:在请求参数中将 `image_generation` 设置为 `true`,表示这条请求强制进行画图。 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image-preview", "messages": [ { "role": "system", "content": "你是一个AI画图机器人,请根据用户需求进行画图" }, { "role": "user", "content": "一只可爱的小猫在草丛中玩耍" } ], "image_generation": true }' ``` ### 转到 Response API OpenAI 全新的 Response API 支持在对话中引入画图工具进行图像生成和编辑,并支持除 `gpt-4o` 以外的更多模型以及更丰富的参数设置,关于如何在 Response API 中进行图像生成和编辑,请参考[Response API 画图文档](https://docs.geekai.co/cn/docs/response/image_generation)。 # 图片对话 Source: https://docs.geekai.co/cn/docs/chat/image ### 支持的模型 极客智坊支持图片对话,你可以在[模型广场](https://geekai.co/models)通过对话模型->图片识别筛选来查看所有支持图片分析的对话模型: ![筛选极客智坊支持图片分析的对话模型](https://static.geekai.co/storage/2025/10/15/image-20251015212402629.png) ### 单张图片 以下是包含单张图片的对话请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请提取中包含的文字,并以列表形式输出" }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/storage/2025/03/08/1741444660440.jpg" } } ] } ] }' ``` ```bash python theme={null} from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gpt-5-mini", messages=[{ "role": "user", "content": [ {"type": "text", "text": "图片中包含什么内容?"}, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/storage/2025/03/08/1741444660440.jpg", }, }, ], }], ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); const response = await openai.chat.completions.create({ model: "gpt-5-mini", messages: [{ role: "user", content: [ { type: "text", text: "图片中包含什么内容?" }, { type: "image_url", image_url: { url: "https://static.geekai.co/storage/2025/03/08/1741444660440.jpg", }, }, ], }], }); console.log(response.choices[0].message.content); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5-mini", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": []interface{}{ map[string]interface{}{ "type": "text", "text": "图片包含什么内容?", }, map[string]interface{}{ "type": "image_url", "image_url": map[string]interface{}{ "url": "https://static.geekai.co/logo/geekai-logo-main-tr.png", }, }, }, }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ### 多张图片 多张图片识别传入多个 `image_url` 对象到 `content` 列表即可: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "找出两张图片中的不同点" }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/storage/2025/05/14/image1.jpg" } }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/storage/2025/05/14/image2.jpg" } } ] } ] }' ``` ```bash python theme={null} from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gpt-5-mini", messages=[{ "role": "user", "content": [ {"type": "text", "text": "找出两张图片中的不同点"}, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/storage/2025/05/14/image1.jpg" } }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/storage/2025/05/14/image2.jpg" } } ] }] ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); const response = await openai.chat.completions.create({ model: "gpt-5-mini", messages: [{ role: "user", content: [ { type: "text", text: "找出两张图片中的不同点" }, { type: "image_url", image_url: { url: "https://static.geekai.co/storage/2025/05/14/image1.jpg" } }, { type: "image_url", image_url: { url: "https://static.geekai.co/storage/2025/05/14/image2.jpg" } } ] }] }); console.log(response.choices[0].message.content); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5-mini", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": []interface{}{ map[string]interface{}{ "type": "text", "text": "找出两张图片中的不同点", }, map[string]interface{}{ "type": "image_url", "image_url": map[string]interface{}{ "url": "https://static.geekai.co/storage/2025/05/14/image1.jpg", }, }, map[string]interface{}{ "type": "image_url", "image_url": map[string]interface{}{ "url": "https://static.geekai.co/storage/2025/05/14/image2.jpg", }, }, }, }, }, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` # 模型选择 Source: https://docs.geekai.co/cn/docs/chat/model 你可以在[模型广场](https://geekai.co/models)通过筛选/搜索查看所有对话模型,并拷贝模型ID用于 API 调用: ![复制对话模型名称](https://static.geekai.co/storage/2025/03/26/image-20250326143559131.png) 如果你想要进一步区分不同模型,可以通过模型分类、功能、上下文、价格、平台标签进行进一步筛选,比如想要进行图片对话,则需要筛选出支持图片识别的对话模型: ![支持图片识别的对话模型](https://static.geekai.co/storage/2025/03/26/image-20250326145950871.png) 依次类推,你可以根据自己的需求筛选出最适合的对话模型进行调用。 # 文件对话 Source: https://docs.geekai.co/cn/docs/chat/pdf ### 支持的模型 目前仅 Gemini 对话模型、GLM 视觉模型和豆包Seed对话模型支持原生的 PDF 文件对话,包括: * `gemini-3.1-pro-preview` * `gemini-3.1-pro-preview:fast-thinking` * `gemini-3.1-flash-lite-preview` * `gemini-3-flash-preview` * `gemini-3-flash-preview:no-thinking` * `gemini-2.5-pro` * `gemini-2.5-pro:fast-thinking` * `gemini-2.5-flash` * `gemini-2.5-flash:no-thinking` * `gemini-2.5-flash-lite` * `gemini-2.5-flash-lite:no-thinking` * `gemini-2.0-flash` * `gemini-2.0-flash-lite` * `gemini-2.5-flash-preview-09-2025` * `gemini-2.5-flash-lite-preview-09-2025` * `glm-5v-turbo` * `glm-4.6v` * `glm-4.5v` * `doubao-seed-2.0-mini` * `doubao-seed-2.0-lite` * `doubao-seed-2.0-pro` * `doubao-seed-2.0-code` * `doubao-seed-1.8` * `doubao-seed-1.6-flash` * `doubao-seed-1.6` * `doubao-seed-1.6-vision` * `doubao-seed-1.6-lite` * `doubao-seed-code-preview` 以 Gemini 为例,模型能够处理 PDF 格式的文档,并利用其原生视觉能力理解文档的整体上下文。这不仅仅是简单的文本提取,而是让 Gemini 能够: * 分析和解读内容,包括文本、图像、图表和表格,支持长达 1000 页的文档 * 将信息提取为结构化输出格式 * 基于文档的视觉和文本元素进行总结并回答问题 * 转录文档内容(例如转录为 HTML),保留其布局和格式,以便在下游应用程序中使用 ### PDF 对话 **单文件** 以下是单文件 PDF 文件对话请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请总结文档内容" }, { "type": "file_url", "file_url": { "url": "https://static.geekai.co/file/2025/04/22/be96ab26e4941f9e3de8da9d5fc089df.pdf", "mime_type": "application/pdf" } } ] } ] }' ``` **多文件** 支持多文件对话,和图片对话类似,多个 PDF 文件以 `file_url` 对象传入到 `content` 列表即可: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请根据文档内容回答XXX问题" }, { "type": "file_url", "file_url": { "url": "https://static.geekai.co/file/2025/04/22/pdf1.pdf", "mime_type": "application/pdf" } }, { "type": "file_url", "file_url": { "url": "https://static.geekai.co/file/2025/04/22/pdf2.pdf", "mime_type": "application/pdf" } } ] } ] }' ``` 仅 Gemini 模型需要传入 `mime_type` 字段来指定文件类型,其他模型不需要传入该字段。 需要注意的是,Gemini 模型不限制 PDF 文件数量,但是限制 PDF 文档页数,所有 PDF 文档页面不得超过 1000 页。 ### 纯文本文件对话 除了 PDF 文件外,Gemini 视觉模型还支持以下纯文本格式文件对话: * JavaScript,对应 `mime_type` 为 `text/javascript` * Python,对应 `mime_type` 为 `text/x-python` * TXT,对应 `mime_type` 为 `text/plain` * HTML,对应 `mime_type` 为 `text/html` * CSS,对应 `mime_type` 为 `text/css` * Markdown,对应 `mime_type` 为 `text/markdown` * CSV,对应 `mime_type` 为 `text/csv` * XML,对应 `mime_type` 为 `text/xml` * RTF,对应 `mime_type` 为 `text/rtf` 以 Markdown 文件为例,示例代码如下,和 PDF 对话格式一样,只需要替换 `url` 然后将 `mime_type` 改为 `text/markdown` 即可: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请总结文档内容" }, { "type": "file_url", "file_url": { "url": "https://static.geekai.co/file/2025/05/15/test.md", "mime_type": "text/markdown" } } ] } ] }' ``` ### Office 文件对话 目前仅部分 GLM 视觉模型支持原生的 Office 文件对话,包括 Word、Excel、PPT: * `glm-5v-turbo` * `glm-4.6v` * `glm-4.5v` Office 文件对话的使用方法和 PDF 对话类似,只需要把 `mime_type` 替换为对应的 Office 文件类型即可: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "glm-5v-turbo", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请总结文档内容" }, { "type": "file_url", "file_url": { "url": "https://static.geekai.co/file/2026/04/30/test.docx" } } ] } ] }' ``` ### 其他模型 不支持文件对话或者不支持对应格式文件对话的模型,请通过[文件上传/读取接口](https://docs.geekai.co/cn/api/file)先获取文件内容,再将文件内容作为对话上下文进行文件对话,该接口支持多种格式文档,包括 PDF、Office、纯文本等。 下面我们以 DeepSeek-V4-Flash 和 PDF 文件对话为例进行演示。 **文件预处理** 先通过文件上传接口将 PDF 文件上传并获取文件 ID: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/files' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: multipart/form-data' \ --form 'file=@"./test.pdf"' \ --form 'purpose="file-extract"' ``` 响应中的 `uuid` 字段就是文件的唯一标识符,然后通过文件读取接口获取 PDF 文件内容: ```bash curl theme={null} curl --location --request GET 'https://geekai.co/api/v1/file/{uuid}/content' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 当响应字段 `status` 为 `done` 时,响应字段 `content` 就是 PDF 文件的文本内容了。 **LLM文件对话** 将获取到的 PDF 文件内容作为对话上下文进行对话: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "deepseek-v4-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请总结以下文档内容\n\nPDF文档内容:{content}" // 将 content 替换为文件读取接口响应的 content 字段内容 } ] } ] }' ``` # 提示缓存 Source: https://docs.geekai.co/cn/docs/chat/prompt_caching 通过提示缓存(Prompt Caching)技术,可以大幅降低官方渠道模型调用成本,极客智坊已支持 OpenAI/Claude/DeepSeek 等主流 AI 模型的提示缓存,你可以在[模型广场](https://geekai.co/models)通过提示缓存筛选查看所有支持提示缓存的模型: ![极客智坊支持提示缓存的模型](https://static.geekai.co/storage/2025/04/11/328198eae4740f34c429530baf0f2fe.png) 大多数模型供应商会自动启用提示缓存,如 OpenAI/DeepSeek/Kimi 都是这样,而 Claude 需要通过在请求体中指定 `cache_control` 参数来启用提示缓存。 ### OpenAI 缓存价格: * 缓存写入免费; * 缓存读取价格是正常输入价格的 0.5 倍。 OpenAI 的提示缓存是自动生效的,不需要任何额外的配置,不过有长度要求,最小提示长度为 1024 个 token 提示缓存才会生效。更多关于 OpenAI 的提示缓存使用及限制,请参考[官方文档](https://platform.openai.com/docs/guides/prompt-caching)。 ### Claude 缓存价格: * 缓存写入价格是正常输入价格的 1.25 倍; * 缓存读取价格是正常输入价格的 0.1 倍。 Claude 的提示缓存要在需要缓存的消息内容对象中添加 `cache_control` 参数来启用,系统消息和用户消息都可以启用提示缓存,系统消息提示缓存示例如下: ```json theme={null} { "messages": [ { "role": "system", "content": [ { "type": "text", "text": "你是一个专业的金融分析师,擅长分析和预测市场趋势。" }, { "type": "text", "text": "HUGE TEXT BODY", "cache_control": { "type": "ephemeral" } } ] }, { "role": "user", "content": [ { "type": "text", "text": "请分析一下当前的市场趋势。" } ] } ] } ``` 用户消息提示缓存示例如下: ```json theme={null} { "messages": [ { "role": "user", "content": [ { "type": "text", "text": "给定以下书的内容:" }, { "type": "text", "text": "HUGE TEXT BODY", "cache_control": { "type": "ephemeral" } }, { "type": "text", "text": "列出上面书中所有的角色名称" } ] } ] } ``` 和 OpenAI 一样, Claude 提示缓存生效也有长度要求的: * Claude 3.7 Sonnet、Claude 3.5 Sonnet 以及 Claude 3 Opus 需要 1024 个 token * Claude 3.5 Haiku 和 Claude 3 Haiku 需要 2048 个 token 更多关于 Claude 的提示缓存使用及限制,请参考[官方文档](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)。 ### DeepSeek 缓存价格: * 缓存写入免费; * 缓存读取价格是正常输入价格的 0.1 倍。 DeepSeek 的提示缓存和 OpenAI 一样也是自动的,不需要任何额外的配置。DeepSeek 的提示缓存生效最小只需要 64 tokens 即可生效。更多 DeepSeek 提示缓存细节请参考[官方文档](https://api-docs.deepseek.com/zh-cn/guides/kv_cache)。 ### Gemini 缓存价格: * 缓存写入免费; * 缓存读取价格是正常输入价格的 0.25 倍。 极客智坊仅支持 Gemini 隐式缓存,隐式缓存从 Gemini 2.5 版本开始支持,和 OpenAI/DeepSeek 一样隐式缓存也是自动的,不需要开发者做任何额外的配置。Gemini 2.5 Flash 的提示缓存生效最小只需要 1024 tokens, Gemini 2.5 Pro 提示缓存生效最小需要 4096 tokens。更多 Gemini 提示缓存细节请参考[官方文档](https://ai.google.dev/gemini-api/docs/caching?lang=node#implicit-caching)。 ### 查看缓存使用情况 你可以在极客智坊个人中心[账单记录](https://geekai.co/user/transactions)页面查看缓存命中及价格信息。 # 推理模式 Source: https://docs.geekai.co/cn/docs/chat/reasoning ### DeepSeek DeepSeek R1 系列及衍生蒸馏模型均为推理模型,且默认开启: ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "deepseek-reasoner", "messages": [ {"role": "user", "content": "你好"} ], "stream": false }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="deepseek-reasoner", messages=[ {"role": "user", "content": "你好"}, ], stream=False ) print(response.choices[0].message.content) print(response.choices[0].message.reasoning_content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{role: "user", content: "你好"}], model: "deepseek-reasoner", }); console.log(completion.choices[0].message.content); console.log(completion.choices[0].message.reasoning_content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "deepseek-reasoner", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "你好", }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 对于推理模型,可以从 AI 响应内容中通过 `reasoning_content` 字段读取推理的思考链内容并显示: ```json theme={null} { "id": "02174473184980118a5d045ccc6bc157c3dd771c8dafe42a7c3c9", "created": 1744731857, "choices": [ { "index": 0, "message": { "role": "assistant", "content": "\n\n你好!很高兴见到你,有什么我可以帮忙的吗?无论是问题、建议还是闲聊,我都在这里为你服务。😊", "reasoning_content": "好,用户发来了“你好”,这是常见的中文问候。我需要用中文回应,保持友好和自然。首先应该回复问候,比如“你好!有什么我可以帮助你的吗?”然后可以加上一句开放式的提问,鼓励用户进一步说明需求。注意不要用太正式的语气,保持亲切。同时检查有没有拼写错误,确保回答正确无误。另外,可能需要考虑用户接下来可能的问题,提前准备好相关的信息。比如,用户可能会问天气、新闻或者需要建议等。但在这个阶段,保持简洁和友好最重要。不需要太长的回复,避免让用户感到信息过载。确认回复符合公司的指导方针,没有涉及敏感内容。然后发送回复即可。\n" }, "finish_reason": "stop" } ], "model": "deepseek-reasoner", "object": "chat.completion", "usage": { "prompt_tokens": 6, "completion_tokens": 169, "total_tokens": 175, "completion_tokens_details": { "reasoning_tokens": 142 } } } ``` 推理模型通常不支持系统提示以及温度参数,因此在进行 API 调用的时候不要设置这两个参数。对于 DeepSeek 推理模型,还不支持函数调用及JSON输出功能,以及不支持 `temperature`、`top_p`、`presence_penalty`、`frequency_penalty`、`logprobs`、`top_logprobs` 参数。 ### OpenAI OpenAI 旗下的 o 系列和 GPT-5 系列模型均为推理模型,默认开启,且支持通过 `thinking.reasoning_effort` 设置推理的努力程度,可选值有 `none`(GPT-5.1 开始支持)、`minimal`(GPT-5 开始支持)、 `low`、`medium`、`high`,默认为 `medium`(GPT 5.1 默认 `none`,即不开启推理): ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5", "messages": [ { "role": "user", "content": "你好" } ], "thinking": { "reasoning_effort": "high" }, "stream": true }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gpt-5", messages=[ {"role": "user", "content": "你好"}, ], stream=False ) print(response.choices[0].message.content) print(response.choices[0].message.reasoning_content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{role: "user", content: "你好"}], model: "gpt-5", }); console.log(completion.choices[0].message.content); console.log(completion.choices[0].message.reasoning_content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "你好", }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` OpenAI 推理的思考链内容默认通过 `` 和 `` 标签包裹,并且和 AI 响应内容混在一起,这在流式响应中很难提取,为了降低开发者兼容成本,极客智坊所有推理模型思考链内容均兼容 DeepSeek 推理模型,都是从 AI 响应内容的 `reasoning_content` 字段获取(如果没有思考链,则对应字段值为空)。 如果使用的是 `o3-mini-high`、`o4-mini-high` 推理模型,则默认努力程度为 `high`,不需要额外单独设置。 关于 `thinking` 配置的更多细节,请参考 [API 手册说明](https://docs.geekai.co/cn/api/chat/completions)。 ### Claude Claude 3.7 及更高版本模型(即 Claude 3.7、Claude 4.0、Claude 4.5 系列模型)才支持推理模式,支持推理模式的 Cluade 模型都是混合推理模型,需要通过设置 `thinking` 配置项开启,以及配置用于思考的 tokens 预算: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY"' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "claude-sonnet-4-5", "messages": [ { "role": "user", "content": "你好" } ], "thinking": { "type":"enabled", "budget_tokens": 10000 }, "max_tokens": 16000, "stream": true }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="claude-sonnet-4-5", messages=[ {"role": "user", "content": "你好"}, ], stream=False ) print(response.choices[0].message.content) print(response.choices[0].message.reasoning_content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{role: "user", content: "你好"}], model: "claude-sonnet-4-5", }); console.log(completion.choices[0].message.content); console.log(completion.choices[0].message.reasoning_content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "claude-sonnet-4-5", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "你好", }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 如果请求设置了 `max_tokens`,则 `budget_tokens` 的值不能超过 `max_tokens` 的值。Claude 开启推理模式后不支持 `temperature`、`top_p`、`top_k` 参数设置。 Claude 推理模式思考链内容也兼容 DeepSeek 推理模型,通过 `reasoning_content` 字段获取。 如果使用的是带 `-thinking` 后缀的模型ID,则默认已开启推理模式,且 `budget_tokens` 值为 24000,可以 `thinking` 参数。 如果你想要启用 Claude Sonnet 3.7 最大支持 128K 输出的实验特性,可以通过将 `thinking.reasoning_effort` 设置为 `high` 实现(仅 3.7 版本支持生效,其他版本会忽略该配置)。 ### Gemini Gemini 2.5 开始所有模型默认为推理模型,且默认开启,你可以通过将 `thinking.budget_tokens` 设置为 `0` 关闭推理模式(对 Gemini 2.5 Pro 无效,因为其不支持关闭推理模式),以加速 AI 回复速度,如果你想要显示思考链内容,可以将 `thinking.include_thoughts` 设置为 `true`(默认 `false` 不显示思考链),还可以通过修改 `thinking.budget_tokens` 调节用于推理的最大 tokens 数,该数值越大,思考深度越深: ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "gemini-2.5-flash", "messages": [ {"role": "user", "content": "1+1为什么等于2?"} ], "thinking": { "include_thoughts": true, "budget_tokens": 30000 }, "stream": false }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gemini-2.5-flash", messages=[ {"role": "user", "content": "1+1为什么等于2?"}, ], thinking={"include_thoughts": True, "budget_tokens": 30000}, stream=False ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{role: "user", content: "1+1为什么等于2?"}], thinking: { include_thoughts:true, budget_tokens: 30000 }, model: "gemini-2.5-flash", }); console.log(completion.choices[0].message.content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gemini-2.5-flash", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "1+1为什么等于2?", }, }, "thinking": map[string]interface{}{ "include_thoughts": true, "budget_tokens": 30000, }, "stream": false, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` Gemini 推理模式思考链内容也兼容 DeepSeek 推理模型,通过 `reasoning_content` 字段获取。 仅 Gemini 2.5 系列模型支持 `thinking.budget_tokens` 参数,对于 Gemini 2.5 Pro 该参数值范围是 128-32768,如果未设置该参数,模型会自行决定,对于 Gemini 2.5 Flash,该参数值范围是 0-24576,0 表示关闭推理功能。 如果使用的是名称带 `:no-thinking` 后缀的模型,则默认已关闭推理模式,且 `budget_tokens` 值为 0,可以不传递 `thinking` 参数。 ### Grok 4 Grok 4 是 xAI 最新发布的、支持图片输入的视觉推理模型,默认开启推理模式,且目前不支持关闭,调用方式和 Grok 3 一致: ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "grok-4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请帮我解答这个数学题,并给出详细过程和答案" }, { "type": "image_url", "image_url": { "url" : "https://static.geekai.co/storage/2025/07/11/math-question.jpeg" } } ] } ] }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="grok-4", messages=[ { "role": "user", "content": [ { "type": "text", "text": "请帮我解答这个数学题,并给出详细过程和答案" }, { "type": "image_url", "image_url": { "url" : "https://static.geekai.co/storage/2025/07/11/math-question.jpeg" } } ] } ], stream=False ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [ { "role": "user", "content": [ { "type": "text", "text": "请帮我解答这个数学题,并给出详细过程和答案" }, { "type": "image_url", "image_url": { "url" : "https://static.geekai.co/storage/2025/07/11/math-question.jpeg" } } ] } ], model: "grok-4", }); console.log(completion.choices[0].message.content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "grok-4", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": []interface{}{ map[string]interface{}{ "type": "text", "text": "请帮我解答这个数学题,并给出详细过程和答案", }, map[string]interface{}{ "type": "image_url", "image_url": map[string]interface{}{ "url": "https://static.geekai.co/storage/2025/07/11/math-question.jpeg", }, }, }, }, }, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` Grok 4 推理模式思考链内容也兼容 DeepSeek 推理模型,通过 `reasoning_content` 字段获取。 ### Qwen3 Qwen3 系列所有模型均为推理模式和非推理模式融合模型,且支持通过 `enable_thinking` 参数切换(仅千问模型支持该参数),默认关闭: ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "qwen3-max", "messages": [ {"role": "user", "content": "1+1为什么等于2?"} ], "stream": true, "enable_thinking": true }' ``` ```bash python theme={null} # 先安装网络库 `pip3 install aiohttp asyncio` import aiohttp import asyncio import json async def invoke_geekai(): headers = { "Authorization": "Bearer $GEEKAI_API_KEY", "Content-Type": "application/json" } body = { "model": "qwen3-max", "messages": [ { "role": "user", "content": "1+1为什么等于2?" } ], "enable_thinking": True, "stream": True } async with aiohttp.ClientSession() as session: async with session.post( "https://geekai.co/v1/chat/completions", headers=headers, json=body ) as response: async for line in response.content: line = line.decode("utf-8").strip() if line.startswith("data: "): data = line[6:] if data == "[DONE]": break try: chunk = data.strip() if chunk: print(chunk) except Exception as e: print(f"Error parsing chunk: {e}") asyncio.run(invoke_geekai()) ``` ```bash javascript theme={null} const response = await fetch("https://geekai.co/v1/chat/completions", { method: "POST", headers: { "Authorization": "Bearer $GEEKAI_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "qwen3-max", "messages": [ { "role": "user", "content": "1+1为什么等于2?" } ], "stream": true, "enable_thinking": true }) }); const data = await response.json(); console.log(data); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "qwen3-max", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "1+1为什么等于2?", }, }, "enable_thinking": true, "stream": true, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 需要注意的是 Qwen3 系列模型**关闭推理模式才可以使用函数调用功能**,此外 `qwen3-8b`、`qwen3-14b`、`qwen3-32b`、`qwen3-30b-a3b`、`qwen3-235b-a22b` 均支持开源免费版本,加上 `:free` 后缀即可,你可以在[模型广场](https://geekai.co/models)进行筛选和查看。 ### GLM 推理模型 GLM Z1、GLM 4.5、GLM 4.6 系列及衍生蒸馏模型均为推理模型,且默认开启: ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "glm-z1-flash", "messages": [ {"role": "user", "content": "你好"} ], "stream": false }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="glm-z1-flash", messages=[ {"role": "user", "content": "你好"}, ], stream=False ) print(response.choices[0].message.content) print(response.choices[0].message.reasoning_content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [{role: "user", content: "你好"}], model: "glm-z1-flash", }); console.log(completion.choices[0].message.content); console.log(completion.choices[0].message.reasoning_content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "glm-z1-flash", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "你好", }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` GLM Z1 系列推理模型的思考链内容默认兼容 OpenAI,也是通过 `` 和 `` 标签包裹,并且和 AI 响应内容混在一起,和 OpenAI 一样,极客智坊也使其兼容了 DeepSeek 推理模型,可以从 AI 响应内容的 `reasoning_content` 字段获取思考链内容并展示(如果没有思考链,则对应字段值为空): * 非流式响应示例 ![GLM Z1 推理模型非流式响应示例-极客智坊](https://static.geekai.co/storage/2025/04/16/77958931d4f11cc7c77810f46f42434.png) * 流式响应示例 ![GLM Z1 推理模型流式响应示例-极客智坊](https://static.geekai.co/storage/2025/04/16/121876b37d3bfd74cc19021b5f50a99.png) GLM-4.1V-Thinking 为支持图片/视频的视觉推理模型,同样默认开启推理模式,调用方式和 GLM Z1 系列一样,只不过新增对图片/视频输入的支持,且思考链内容也兼容 DeepSeek 推理模型,通过 `reasoning_content` 字段获取思考链内容并展示(如果没有思考链,则对应字段值为空): ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "glm-4.1v-thinking-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请帮我解答这个数学题,并给出详细过程和答案" }, { "type": "image_url", "image_url": { "url" : "https://static.geekai.co/storage/2025/07/11/math-question.jpeg" } } ] } ], "stream": false }' ``` 新版本 GLM 4.5、GLM 4.6 系列推理模型的思考链内容也兼容 DeepSeek 推理模型,通过 `reasoning_content` 字段获取思考链内容并展示(如果没有思考链,则对应字段值为空)。 ### 其他推理模型 除了上面列举的之外,还有很多其他支持推理模式的 AI 模型,如 Grok 3、Grok 4、通义 QwQ/QvQ、ERNIE X1、混元 T1 等,所有推理模型请求/响应参数兼容 DeepSeek,对于不兼容的推理模型,极客智坊底层会自动对齐。 需要注意的是,只有推理模型支持推理模式,你可以在[模型广场](https://geekai.co/models)查看极客智坊支持的所有推理模型,目前极客智坊已支持40多个推理模型,特定模型还支持联网推理以及深度推理,如 DeepSeek 联网推理版、DeepSeek 深度推理版、Grok 深度推理版等: ![极客智坊支持的所有推理模型](https://static.geekai.co/storage/2025/04/16/image-20250416001506829.png) 另外,推理模型通常不支持系统提示以及温度参数,因此在进行 API 调用的时候不要设置这两个参数。 # 流式对话 Source: https://docs.geekai.co/cn/docs/chat/streaming 几乎所有对话模型都支持流式对话响应,即边回答边输出的效果。 以下是最简单的流式对话请求示例,只需要将 `stream` 设置为 `true` 即可: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "你好" } ], "stream": true }' ``` ```bash python theme={null} # 先安装网络库 `pip3 install aiohttp asyncio` import aiohttp import asyncio import json async def invoke_geekai(): api_token = "$GEEKAI_API_KEY" # Replace with your actual API token headers = { "Authorization": "Bearer " + api_token, "Content-Type": "application/json" } body = { "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "你好" } ], "stream": True } async with aiohttp.ClientSession() as session: async with session.post( "https://geekai.co/v1/chat/completions", headers=headers, json=body ) as response: async for line in response.content: line = line.decode("utf-8").strip() if line.startswith("data: "): data = line[6:] if data == "[DONE]": break try: chunk = data.strip() if chunk: print(chunk) except Exception as e: print(f"Error parsing chunk: {e}") asyncio.run(invoke_geekai()) ``` ```bash javascript theme={null} const response = await fetch("https://geekai.co/v1/chat/completions", { method: "POST", headers: { "Authorization": "Bearer $GEEKAI_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "你好" } ], "stream": true }) }); const data = await response.json(); console.log(data); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5-mini", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "你好", }, }, "stream": true, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 对于流式请求,需要在客户端接收响应时进行特殊处理才能获取到,以 JavaScript 为例,需要通过 `EventSource` 进行监听获取。 # 函数调用 Source: https://docs.geekai.co/cn/docs/chat/tool_calls 部分模型支持函数调用对模型能力进行扩展和增强,你可以在[模型广场](https://geekai.co/models)中通过 `函数调用` 标签筛选查看支持函数调用的模型。 函数调用链路较普通的对话流程更加复杂,需要在提交问题时附带函数名称描述信息,以及调用函数需要的参数,如果用户问题意图和函数名称描述匹配,并且参数齐全(不够的话会引导用户提交),那么AI响应会返回匹配的函数名和标识该函数的ID,客户端根据函数名和参数调用本地函数后,将执行结果和函数ID一起再次提交给AI模型,AI模型会根据上下文基于函数调用结果回答用户最初的问题,这就是函数调用的基本流程。 下面我们以获取当地天气为例,给出函数调用的示例代码: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "messages": [ { "role": "system", "content": "你是一个乐于助人的客户服务助理,请使用提供的工具来协助用户。" }, { "role": "user", "content": "你好,杭州今天的天气怎么样?" } ], "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "获取给定地区的天气信息", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "城市或者地区,如浙江杭州" }, "unit": { "type": "string", "enum": ["℃","℉"] } }, "required": [ "location" ] } } } ], "tool_choice": "auto" }' ``` 正如前面提到的,函数调用需要在提交问题时附带 `tools` 字段指定函数名称、描述以及参数信息,以及 `tool_choice` 字段用于设置是否让AI模型根据用户意图自动选择要调用的函数。 执行上述代码后,会返回如下响应消息字段: ```json theme={null} "choices": [ { "index": 0, "message": { "role": "assistant", "content": "", "tool_calls": [ { "id": "call_wrpN3RNE7AYlFRxEwaD5DSWA", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"杭州, 中国\"}" } } ] }, "finish_reason": "tool_calls" } ], ``` 可以看到,AI响应中包含了 `tool_calls` 字段,其中包含了函数调用的ID和参数信息,客户端根据这些信息调用本地函数 `get_current_weather` 后,将执行结果和函数ID一起再次提交给AI模型: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "messages": [ { "role": "system", "content": "你是一个乐于助人的客户服务助理,请使用提供的工具来协助用户。" }, { "role": "user", "content": "你好,杭州今天的天气怎么样?" }, { "role":"assistant", "tool_calls": [ { "id": "call_wrpN3RNE7AYlFRxEwaD5DSWA", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"杭州, 中国\"}" } } ] }, { "role": "tool", "content": "{\"location\":\"杭州, 中国\", \"weather\":\"晴转多云\"}", "tool_call_id": "call_wrpN3RNE7AYlFRxEwaD5DSWA" } ] }' ``` AI模型会根据上下文基于函数调用结果回答用户最初的问题: ![函数调用回答结果](https://static.geekai.co/storage/2025/03/24/image-20250324170626188.png) # URL Context Source: https://docs.geekai.co/cn/docs/chat/url_context 极客智坊支持了 Gemini 最近发布的一项实现性功能 —— URL Context,它可以让模型直接访问网页内容并进行分析。通过 URL Context,模型可以获取网页的文本内容、图片和其他媒体资源,从而更好地理解和回答与该网页相关的问题,只需要在 Prompt 中嵌入对应的 URL 即可。 在调用对话 API 时,可以通过将 `enable_url_context` 参数设置为 `true` 来开启该功能: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash", "messages": [ { "role": "user", "content": "通过分析网页内容介绍 URL Context 功能以及给出目前支持该特性的 Gemini 模型:https://ai.google.dev/gemini-api/docs/url-context" } ], "enable_url_context": true }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gemini-2.5-flash", messages=[ { "role": "user", "content": "通过分析网页内容介绍 URL Context 功能以及给出目前支持该特性的 Gemini 模型:https://ai.google.dev/gemini-api/docs/url-context", }, ], enable_url_context=True ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ model: "gemini-2.5-flash", messages: [ { role: "user", content: "通过分析网页内容介绍 URL Context 功能以及给出目前支持该特性的 Gemini 模型:https://ai.google.dev/gemini-api/docs/url-context" }], enable_url_context: true }); console.log(completion.choices[0].message.content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gemini-2.5-flash", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "通过分析网页内容介绍 URL Context 功能以及给出目前支持该特性的 Gemini 模型:https://ai.google.dev/gemini-api/docs/url-context", }, }, "enable_url_context": true, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.dev/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 作为实验性特性,目前该功能完全免费,不收取任何费用,不过仅极客智坊官方直连代理通道支持该功能,低价渠道暂不支持。 目前仅以下模型支持该实验特性,且每次请求最多可使用 20 个网址进行分析: * `gemini-3.1-pro-preview` * `gemini-3.1-pro-preview:fast-thinking` * `gemini-3-flash-preview` * `gemini-3-flash-preview:no-thinking` * `gemini-2.5-pro` * `gemini-2.5-pro:fast-thinking` * `gemini-2.5-flash` * `gemini-2.5-flash:no-thinking` * `gemini-2.5-flash-lite` * `gemini-2.5-flash-lite:no-thinking` * `gemini-2.0-flash` 你还可以结合[联网搜索](https://docs.geekai.co/cn/docs/chat/web_search)同时启用搜索+URL Context 对对话结果进行增强。 更多对话 API 参数细节,请参考[对话 API 手册](https://docs.geekai.co/cn/api/chat/completions)。 # 视频分析 Source: https://docs.geekai.co/cn/docs/chat/video ### 支持的模型 目前极客智坊支持的在对话中进行视频分析的 AI 模型如下,主要是 Gemini 模型、GLM视觉模型、最新千问和豆包模型: * `gemini-3.1-pro-preview` * `gemini-3.1-pro-preview:fast-thinking` * `gemini-3.1-flash-lite-preview` * `gemini-3-flash-preview` * `gemini-3-flash-preview:no-thinking` * `gemini-2.5-pro` * `gemini-2.5-pro:fast-thinking` * `gemini-2.5-flash` * `gemini-2.5-flash:no-thinking` * `gemini-2.5-flash-lite` * `gemini-2.0-flash` * `gemini-2.0-flash-lite` * `gemini-2.5-flash-lite:no-thinking` * `gemini-2.5-flash-preview-09-2025` * `gemini-2.5-flash-lite-preview-09-2025` * `glm-5v-turbo` * `glm-4.6v` * `glm-4.5v` * `qwen3.5-flash` * `qwen3.5-plus` * `qwen3.5-397b-a17b` * `qwen3.5-35b-a3b` * `qwen3.5-27b` * `qwen3.5-122b-a10b` * `qwen3.5-omni-flash` * `qwen3.5-omni-plus` * `qwen3.6-plus` * `qwen3.6-flash` * `qwen3.6-35b-a3b` * `qwen3.6-27b` * `doubao-seed-2.0-mini` * `doubao-seed-2.0-lite` * `doubao-seed-2.0-pro` * `doubao-seed-2.0-code` * `doubao-seed-1.8` * `doubao-seed-1.6-flash` * `doubao-seed-1.6` * `doubao-seed-1.6-vision` * `doubao-seed-1.6-lite` * `doubao-seed-code-preview` 你也可以在[模型广场](https://geekai.co/models)中通过模型功能->视频理解进行筛选,获取所有支持视频理解的对话模型: ![在极客智坊模型广场筛选支持视频理解的对话模型](https://static.geekai.co/storage/2025/10/15/f9977742dd674c9a1726848c62f29df6.png) 视频处理能力包括: * 描述、分割视频并提取信息 * 回答关于视频内容的问题 * 参考视频中的具体时间点 下面我们以 Gemini 模型为例,介绍一下视频分析的使用方法和注意事项,其他模型也是类似的。 ### 视频格式和尺寸 Gemini 支持以下视频格式 MIME 类型: * `video/mp4` * `video/mpeg` * `video/mov` * `video/avi` * `video/x-flv` * `video/mpg` * `video/webm` * `video/wmv` * `video/3gpp` 且上传视频 URL 必须是公网可访问的 URL。 在文件尺寸方面,Gemini 最大支持 2GB 文件,在视频时长方面,以上支持视频分析的 Gemini 模型(1M上下文)可处理长达 1 小时的视频。 ### 视频对话示例 **基本示例** 对于 Gemini 2.5 以前的版本,每次请求只能上传一个视频: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.0-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "分析这段视频的内容" }, { "type": "video_url", "video_url": { "url": "https://static.geekai.co/video/2025/10/14/8f64bf9bcf1b21fb3d7f55d6ae8c1552.mp4" } } ] } ] }' ``` **时间戳** 您可以通过 `MM:SS` 格式的时间戳,询问视频中特定时间点的问题: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.0-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "在 00:05 和 00:10 给出的示例是要向我们展示什么" }, { "type": "video_url", "video_url": { "url": "https://static.geekai.co/video/2025/10/14/8f64bf9bcf1b21fb3d7f55d6ae8c1552.mp4" } } ] } ] }' ``` **转录视频并提供视觉描述** Gemini 模型能够通过处理视频的音频轨道和视觉帧来转录视频内容并提供视觉描述: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "转录这个视频的音频内容,并为视频中的重要事件提供时间戳,同时提供视觉描述。" }, { "type": "video_url", "video_url": { "url": "https://static.geekai.co/video/website.mp4" } } ] } ] }' ``` 在生成视觉描述时,模型会以每秒 1 帧的速率对视频进行采样,此采样速率可能会影响描述的详细程度,尤其是在视觉变化快速的视频中。 **多个视频** 对于 Gemini 2.5 及以后的版本,可以在一次请求中上传多个视频进行分析,最多可以上传 10 个: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "分析这两段视频有什么不一样" }, { "type": "video_url", "video_url": { "url": "https://static.geekai.co/video/2025/10/14/8f64bf9bcf1b21fb3d7f55d6ae8c1552.mp4" } }, { "type": "video_url", "video_url": { "url": "https://static.geekai.co/video/2025/10/14/dba448a408a2dbe394adc889e13b43ce.mp4" } } ] } ] }' ``` 尽管如此,对于复杂任务,为获得最佳效果,每次提示请求请仅使用一个视频。 视频对话响应结果和普通的文本对话一样: ```json theme={null} { "id": "a74bf0c3-1a7e-4ad4-b233-6ee9b850ae66", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "这两段视频主要有以下几点不同:\n\n1. **车辆颜色不同:** 第一段视频中的车是浅蓝色或白色,而第二段视频中的车是深蓝色。\n2. **拍摄角度/视角不同:**\n * 第一段视频的视角是从车辆的侧前方,摄像机似乎在围绕车辆进行环绕式拍摄,展示车辆的侧面和行进姿态,车辆是横向从画面左侧向右侧移动。\n * 第二段视频的视角是从车辆的后方,摄像机面向车辆的尾部,记录车辆驶离的场景,车辆是径直向画面远处驶去。\n3. **车辆相对摄像机的运动方向不同:** 第一段视频中车辆是“驶过”摄像机(横向移动),而第二段视频中车辆是“驶离”摄像机(纵向远去)。\n\n**共同点:**\n* **车型相同:** 两段视频中的车看起来是同一款车型(丰田GR86或斯巴Z BRZ,2022+款)。\n* **拍摄环境相同:** 都在阳光明媚的沙漠公路环境下拍摄,背景有山脉,道路标记(双黄线)也一致。\n* **拍摄技术类似:** 均使用了360度全景相机进行拍摄,通过后期剪辑调整了视角,使得画面看起来非常流畅且视角独特(例如,车辆下方的影子会随视角旋转,这是360相机隐形自拍杆的常见效果)。\n* **音效类似:** 都包含了车辆行驶时的引擎和排气声。" }, "finish_reason": "stop" } ], "model": "gemini-2.5-flash", "object": "chat.completion", "usage": { "prompt_tokens": 6441, "completion_tokens": 357, "total_tokens": 8665, "completion_tokens_details": { "reasoning_tokens": 1867 } } } ``` **额外费用** 视频的每一秒都会被进行 Token 化处理,具体如下: * 单帧:默认每帧为 258 Token * 音频:每秒 32 token * 元数据也会参与统计 所以折算下来,视频每秒对应约 300 token,这将作为 `prompt_tokens` 参与计费。 # 联网对话 Source: https://docs.geekai.co/cn/docs/chat/web_search ### 原生支持搜索的模型 你可以在[模型广场](https://geekai.co/models)中通过 `联网搜索` 标签筛选查看原生支持联网对话的模型以及支持通过官方内置工具函数进行联网对话的模型。 对于模型名称带联网/搜索/深度搜索/深度研究/深度推理字样的 AI 模型原生支持联网搜索,如 GPT-5 联网版、GPT-4o 联网版、GPT-4o mini 联网版、Grok 3 深度推理版、Jina 深度搜索、DeepSeek 秘塔搜索版等,默认已经开启联网搜索,无需手动设置,可以跳过本文档: * `gpt-5-search-api` * `gpt-4o-search-preview` * `gpt-4o-mini-search-preview` * `o3-deep-research` * `o4-mini-deep-research` * `deepseek-search` * `deepseek-r1-search` * `deepseek-r1-metasearch` * `gemini-2.5-flash-deepsearch` * `gemini-2.5-pro-deepsearch` * `qwen-deep-research` * `grok-3-deepsearch` * `sonar` * `sonar-reasoning` * `sonar-reasoning-pro` * `sonar-deep-research` * `jina-deepsearch-v1` ### 启用联网搜索 在调用对话 API 时,可以通过将 `enable_search` 参数设置为 `true` 来开启联网搜索,对于支持内置联网工具联网搜索的模型底层会自动应用,对于不支持通过内置联网工具搜索的模型,极客智坊采用第三方AI搜索引擎提供联网搜索来补充上下文实现联网对话的效果: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "今天杭州西湖天气如何" } ], "enable_search": true }' ``` ```bash python theme={null} # 先安装网络库 `pip3 install aiohttp asyncio` import aiohttp import asyncio import json async def invoke_geekai(): headers = { "Authorization": "Bearer $GEEKAI_API_KEY", "Content-Type": "application/json" } body = { "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "今天杭州西湖天气如何" } ], "enable_search": True, "stream": True } async with aiohttp.ClientSession() as session: async with session.post( "https://geekai.co/v1/chat/completions", headers=headers, json=body ) as response: async for line in response.content: line = line.decode("utf-8").strip() if line.startswith("data: "): data = line[6:] if data == "[DONE]": break try: chunk = data.strip() if chunk: print(chunk) except Exception as e: print(f"Error parsing chunk: {e}") asyncio.run(invoke_geekai()) ``` ```bash javascript theme={null} const response = await fetch("https://geekai.co/v1/chat/completions", { method: "POST", headers: { "Authorization": "Bearer $GEEKAI_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "今天杭州西湖天气如何" } ], "stream": true, "enable_search": true }) }); const data = await response.json(); console.log(data); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5-mini", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": "今天杭州西湖天气如何", }, }, "enable_search": true, "stream": true, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 开启联网对话会会产生额外的 token 消耗,或者额外的搜索工具调用费用(按次数),对应的消耗可以在响应对象的 `usage` 字段中查看。你可以在[模型广场](https://geekai.co/models)查看原生支持搜索的模型搜索成本以及调用第三方AI搜索引擎工具的成本,也可以在[账单记录](https://geekai.co/user/transactions)查看扣费明细。 ### 指定搜索引擎 如上所述,对于非原生支持联网搜索的模型,极客智坊使用第三方AI搜索引擎工具提供联网搜索来补充上下文实现联网对话的效果,默认使用的是免费的智谱搜索基础版 `glm/search_std`,你还可以通过 `search_config` 配置中的 `engine` 配置项指定使用的第三方搜索引擎: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "deepseek-chat", "messages": [ { "role": "user", "content": "今天杭州西湖天气如何" } ], "enable_search": true, "search_config": { "engine": "glm/search-pro", "return_result": true }, "stream": true }' ``` 你可以在模型广场通过”搜索引擎“标签查看并选用要使用的第三方AI搜索引擎: ![极客智坊支持的AI搜索引擎](https://static.geekai.co/storage/2025/04/24/image-20250424134539455.png) 关于 `search_config` 的详细配置,请参考 [API 手册说明](https://docs.geekai.co/cn/api/chat/completions)。 # 模型选择 Source: https://docs.geekai.co/cn/docs/embedding/model 你可以在[模型广场](https://geekai.co/models)通过筛选/搜索查看所有向量模型,并拷贝模型名称用于 API 调用: ![复制向量模型名称](https://static.geekai.co/storage/2025/03/26/image-20250326143945703.png) 如果你想要进一步区分不同模型,可以通过模型分类、功能、上下文、价格、平台标签进行进一步筛选,比如想要进行图片向量化,则需要筛选出支持图片识别的向量模型: ![支持图片向量化的模型](https://static.geekai.co/storage/2025/03/26/image-20250326150348181.png) 依次类推,你可以根据自己的需求筛选出最适合的向量模型进行调用。 # 多模态向量化 Source: https://docs.geekai.co/cn/docs/embedding/multi_modal ### 请求示例 目前仅 `doubao-embedding-vision`、`multimodal-embedding-v1`、`embed-english-v3.0`、`embed-multilingual-v3.0` 模型支持图文向量化,其他模型暂不支持。 ```bash curl theme={null} curl --location 'https://geekai.co/api/v1/embeddings' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "input": [ { "type": "text", "text": "天很蓝,海很深" }, { "type": "image_url", "image_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/images/view.jpeg" } } ], "model": "doubao-embedding-vision" }' ``` > 注:图片支持 URL 和 Base64 编码两种格式,其中 Cohere 平台模型不支持图文混合,仅支持单独文本或图片向量化。 其中 `multimodal-embedding-v1` 除了支持图片之外,还支持视频向量化,示例如下: ```bash theme={null} curl --location 'https://geekai.co/api/v1/embeddings' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "input": [ { "type": "text", "text": "坐在壁炉前品尝咖啡" }, { "type": "video_url", "video_url": { "url": "https://static.geekai.co/video/new_video.mp4" } } ], "model": "multimodal-embedding-v1" }' ``` ### 格式说明 `doubao-embedding-vision` 支持的图片格式如下表: | 图片格式 | 文件扩展名 | 内容格式 Content Type | | -------- | ---------------------------------- | ----------------- | | JPEG | .jpg, .jpeg | image/jpeg | | PNG | .apng, .png | image/png | | GIF | .gif | image/gif | | WEBP | .webp | image/webp | | BMP | .bmp | image/bmp | | TIFF | .tiff, .tif | image/tiff | | ICO | .ico | image/x-icon | | DIB | .dib | image/bmp | | ICNS | .icns | image/icns | | SGI | .sgi | image/sgi | | JPEG2000 | .j2c, .j2k, .jp2, .jpc, .jpf, .jpx | image/jp2 | `multimodal-embedding-v1` 支持的图片格式为 JPG、PNG、BMP,支持视频格式为 MP4、MPEG、MPG、WEBM、AVI、FLV、MKV、MOV,请自行确保提交的多模态数据格式正确。 Cohere 平台向量模型 `embed-english-v3.0`、`embed-multilingual-v3.0` 图片格式仅支持 JPG、PNG。 ### 尺寸说明 `doubao-embedding-vision` 模型图片尺寸需要同时满足以下条件,否则会返回错误信息: * 图片的宽和高的长度取值范围:\[10, 6000] px * 图片的宽高比(即宽/高)取值范围:\[1/100, 100] 另外,`doubao-embedding-vision` 单图最大不超过 10M,`multimodal-embedding-v1` 单图最大不超过 3M,单个视频最大不超过 10M。 # 多行文本 Source: https://docs.geekai.co/cn/docs/embedding/multi_texts ```bash curl theme={null} curl --location 'https://geekai.co/api/v1/embeddings' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "input": ["hello","world"], "model": "text-embedding-3-small" }' ``` # 单行文本 Source: https://docs.geekai.co/cn/docs/embedding/single_text ```bash curl theme={null} curl --location 'https://geekai.co/api/v1/embeddings' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "input": "hello world", "model": "text-embedding-3-small" }' ``` # 错误码 Source: https://docs.geekai.co/cn/docs/error_codes 您在调用极客智坊 API 时,可能会遇到以下错误。这里列出了相关错误的原因及其解决方法:
错误码 描述
400 - 参数错误 请求参数格式错误:请根据错误信息提示修改请求参数。
401 - 认证失败 API KEY 为空或错误导致认证失败:请检查 API KEY 是否正确,如没有 API KEY,请先[创建 API KEY](https://geekai.co/user/api_keys)
402 - 余额不足 账号余额不足:请确认账户余额,并前往[充值页面](https://geekai.co/credit/plans)进行充值
403 - 权限不足 用户无权对该资源进行操作:请根据错误信息提示修改请求参数
404 - 资源不存在 用户请求的资源不存在:修改请求参数,确保请求的资源存在
413 - 资源过大 上传文件过大,超过系统限制:请根据错误信息提示修改请求上传的文件大小
429 - 请求频率太快 用户请求频率(TPM 或 RPM)太快,超出系统上限:请参照[模型广场](https://geekai.co/models)对应模型的 RPM 上限合理规划请求速率
500 - 服务器故障 服务器内部故障:请等待后重试,若问题一直存在,请加入[开发群](https://docs.geekai.dev/cn/getting-started/quick_start#开发者群)联系我们解决
503 - 服务器繁忙 服务器负载过高:请稍后重试您的请求
504 - 服务器超时 服务器处理请求超时:请稍后重试您的请求,若问题一直存在,请加入开发群联系我们解决
# Gemini 兼容 Source: https://docs.geekai.co/cn/docs/gemini_sdk 除了 Anthropic 以外,极客智坊还提供了针对 Gemini API 兼容的接口服务,以便在 Gemini CLI 等编程工具中使用,该接口目前**仅支持 Gemini 系列模型**。 你可以通过 Gemini SDK 来调用这些模型,使用方法和调用 Anthropic 兼容模型类似,只需要将 Base URL 和 API KEY 替换成极客智坊的 Base URL 和 API KEY 即可,其他参数和调用方式与官方 Gemini API 保持一致: ```bash curl theme={null} curl https://geekai.co/api/v1beta/models/gemini-3-flash-preview:generateContent \ -H "content-type: application/json" \ -H "x-goog-api-key: $GEEKAI_API_KEY" \ -X POST \ -d '{ "contents": [ { "parts": [ { "text": "Hello, Gemini" } ] } ] }' ``` ```bash python theme={null} from google import genai from google.genai import types client = genai.Client( http_options=types.HttpOptions(base_url='https://geekai.co/api'), api_key="$GEEKAI_API_KEY" ) response = client.models.generate_content( model="gemini-3-flash-preview", contents="Hello, Gemini", ) print(response.text) ``` ```bash javascript theme={null} import { GoogleGenAI } from "@google/genai"; const ai = new GoogleGenAI({ apiKey: "$GEEKAI_API_KEY", httpOptions: { baseUrl: "https://geekai.co/api", }, }); async function main() { const response = await ai.models.generateContent({ model: "gemini-3-flash-preview", contents: "Hello, Gemini", }); console.log(response.text); } await main(); ``` ```bash go theme={null} package main import ( "context" "fmt" "log" "google.golang.org/genai" ) func main() { ctx := context.Background() httpOptions := genai.HTTPOptions{ BaseURL: "https://geekai.co/api", APIVersion: "v1beta", } client, err := genai.NewClient(ctx, &genai.ClientConfig{ APIKey: "$GEEKAI_API_KEY", Backend: genai.BackendGeminiAPI, HTTPOptions: httpOptions, }, ) if err != nil { log.Fatal(err) } result, err := client.Models.GenerateContent( ctx, "gemini-3-flash-preview", genai.Text("Hello, Gemini"), nil, ) if err != nil { log.Fatal(err) } fmt.Println(result.Text()) } ``` # CogView-3 Source: https://docs.geekai.co/cn/docs/image/bigmodel/cogview-3 CogView-3-Flash 是智谱推出的免费图像生成模型,能够根据用户指令生成符合要求且美学评分更高的图像。CogView-3-Flash 主要应用于艺术创作、设计参考、游戏开发、虚拟现实等领域,帮助用户快速实现从文本到图像的转换需求。 它以超快的推理速度和准确的细节还原见长,平均只需数秒即可完成一张图片的生成,让创意转化为视觉作品的过程更加流畅自然。 ### 模型参数 * 模型ID:`cogview-3-flash`/`cogview-3-plus` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bigmodel\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `image` * `strength` * `aspect_ratio` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[CogView-3 官方 API 文档](https://docs.bigmodel.cn/cn/guide/models/free/cogview-3-flash) CogView-3 可以通过 `size` 字段实现输出图像的尺寸: 推荐枚举值:1024x1024, 768x1344, 864x1152, 1344x768, 1152x864, 1440x720, 720x1440,也可以自定义参数:长宽均需满足512px-2048px之间,需被16整除,并保证最大像素数不超过2^21px。 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "cogview-3-flash", "prompt": "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云.", "size": "768x1344", "quality": "standard", "watermark": false }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "cogview-3-flash", "created": 1768283762, "task_id": "ef1d17be-1c8a-4f9e-a34d-96bea68cb47f", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/13/cf897977728944ff2bf10c929cbc1f81.jpeg" } ] } ``` # CogView-4 Source: https://docs.geekai.co/cn/docs/image/bigmodel/cogview-4 CogView-4 是智谱首个支持生成汉字的开源文生图模型,在语义理解、图像生成质量、中英文字生成能力等方面全面提升,支持任意长度的中英双语输入,能够生成在给定范围内的任意分辨率图像。 ### 模型参数 * 模型ID:`cogview-4` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bigmodel\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `image` * `strength` * `aspect_ratio` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[CogView-4 官方 API 文档](https://docs.bigmodel.cn/cn/guide/models/image-generation/cogview-4) CogView-4 可以通过 `size` 字段实现输出图像的尺寸: 推荐枚举值:1024x1024 (默认), 768x1344, 864x1152, 1344x768, 1152x864, 1440x720, 720x1440,也可以自定义参数:长宽均需满足512px-2048px之间,需被16整除,并保证最大像素数不超过2^21px。 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "cogview-4", "prompt": "画一只小兔子", "size": "1024x1024", "quality": "hd", "watermark": false }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "cogview-4", "created": 1768283267, "task_id": "df16c905-ca9c-46e7-8048-b6cbaa109ef5", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/13/1ccfa836c78bed1025b7ef52431866f7.jpeg" } ] } ``` # Doubao-Seededit-3.0 Source: https://docs.geekai.co/cn/docs/image/bytedance/doubao-seededit-3.0 SeedEdit 3.0 是一款图像编辑模型(图生图),支持通过文本指令编辑图像。SeedEdit 3.0 基于文生图模型 Seedream 3.0 训练,叠加多样化的数据融合方法与特定奖励模型,其图像主体、背景和细节保持能力进一步提升,尤其在人像编辑、背景更改、视角与光线转换等场景表现突出。 ### 模型参数 * 模型ID:`doubao-seededit-3.0-i2i` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` 附:[Seededit 3.0 官方 API 文档](https://www.volcengine.com/docs/82379/1824691) Seededit 3.0 的 `size` 字段仅支持设置为 `adaptive`(默认值),表示将输入图片尺寸与下表中的尺寸进行对比,选择最接近的,作为输出图片的尺寸。具体而言,会按顺序从可选比例中,选取与原图宽高比差值最小的第一个,作为生成图片的比例: | 宽/高 | 宽 | 高 | | ---- | ---- | ---- | | 0.33 | 512 | 1536 | | 0.35 | 544 | 1536 | | 0.38 | 576 | 1536 | | 0.4 | 608 | 1536 | | 0.42 | 640 | 1536 | | 0.47 | 640 | 1376 | | 0.51 | 672 | 1312 | | 0.55 | 704 | 1280 | | 0.56 | 736 | 1312 | | 0.6 | 768 | 1280 | | 0.63 | 768 | 1216 | | 0.66 | 800 | 1216 | | 0.67 | 832 | 1248 | | 0.7 | 832 | 1184 | | 0.72 | 832 | 1152 | | 0.75 | 864 | 1152 | | 0.78 | 896 | 1152 | | 0.82 | 896 | 1088 | | 0.85 | 928 | 1088 | | 0.88 | 960 | 1088 | | 0.91 | 992 | 1088 | | 0.94 | 1024 | 1088 | | 0.97 | 1024 | 1056 | | 1 | 1024 | 1024 | | 1.06 | 1056 | 992 | | 1.1 | 1088 | 992 | | 1.17 | 1120 | 960 | | 1.24 | 1152 | 928 | | 1.29 | 1152 | 896 | | 1.33 | 1152 | 864 | | 1.42 | 1184 | 832 | | 1.46 | 1216 | 832 | | 1.5 | 1248 | 832 | | 1.56 | 1248 | 800 | | 1.62 | 1248 | 768 | | 1.67 | 1280 | 768 | | 1.74 | 1280 | 736 | | 1.82 | 1280 | 704 | | 1.78 | 1312 | 736 | | 1.86 | 1312 | 704 | | 1.95 | 1312 | 672 | | 2 | 1344 | 672 | | 2.05 | 1376 | 672 | | 2.1 | 1408 | 672 | | 2.2 | 1408 | 640 | | 2.25 | 1440 | 640 | | 2.3 | 1472 | 640 | | 2.35 | 1504 | 640 | | 2.4 | 1536 | 640 | | 2.53 | 1536 | 608 | | 2.67 | 1536 | 576 | | 2.82 | 1536 | 544 | | 3 | 1536 | 512 | 你可以通过 `strength` 字段替代官方的 `guidance_scale` 来控制模型输出结果与 prompt 的一致程度,取值范围是 `[1, 10]`,默认值是 `5.5`,数值越大,模型自由度越小,与用户输入的提示词相关性越强。 ### 图像编辑 Doubao Seededit 3.0 是一个图生图模型,仅支持通过单图+文字来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seededit-3.0-i2i", "prompt": "改成爱心形状的泡泡", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seededit_i2i.jpeg", "watermark": true }' ``` 响应结果是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "doubao-seededit-3.0-i2i", "created": 1760443095, "task_id": "7249340c-4677-40dc-9c57-f7b34671056d", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/10/14/24158849990ff21e4e875ad764bc8028.jpeg" } ], "usage": { "billed_units": 1, "output_tokens": 3772, "total_tokens": 3772 } } ``` # Doubao-Seedream-3.0 Source: https://docs.geekai.co/cn/docs/image/bytedance/doubao-seedream-3.0 Seedream 3.0 是一款支持原生高分辨率的中英双语文生图模型,响应速度更快,小字生成更准确,文本排版效果增强,指令遵循能力强,美感&结构提升,保真度和细节表现较好。 ### 模型参数 * 模型ID:`doubao-seedream-3.0-t2i` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `image` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` 附:[Seedream 3.0 官方 API 文档](https://www.volcengine.com/docs/82379/1824692) Seedream 3.0 不支持设置图片宽高比,如需设置可以通过 `size` 字段实现,该字段支持通过宽x高字符串传值: | 宽高比 | 宽x高像素值 | | ---- | --------- | | 1:1 | 2048x2048 | | 4:3 | 2304x1728 | | 3:4 | 1728x2304 | | 16:9 | 2560x1440 | | 9:16 | 1440x2560 | | 3:2 | 2496x1664 | | 2:3 | 1664x2496 | | 21:9 | 3024x1296 | `size` 默认值是 `1024x1024`,宽x高像素取值范围是 `[512x512, 2048x2048]`。 你可以通过 `strength` 字段替代官方的 `guidance_scale` 来控制模型输出结果与 prompt 的一致程度,取值范围是 `[1, 10]`,默认值是 `2.5`,数值越大,模型自由度越小,与用户输入的提示词相关性越强。 ### 生成图像 Doubao Seedream 3.0 是一个文生图模型,仅支持通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-3.0-t2i", "prompt":"鱼眼镜头,一只猫咪的头部,画面呈现出猫咪的五官因为拍摄方式扭曲的效果", "size": "1024x1024", "response_format": "url" }' ``` 响应结果是一个 JSON 对象,包含生成图片的 URL 或 base64 编码数据: ```json theme={null} { "model": "doubao-seedream-3.0-t2i", "created": 1760441248, "task_id": "63fdfd14-64dc-4e4e-a298-7669b49b129d", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/10/14/22feb362a7dccbf1d2d4ab8b110ce6e9.jpeg" } ], "usage": { "billed_units": 1, "output_tokens": 4096, "total_tokens": 4096 } } ``` # Doubao-Seedream-4.0 Source: https://docs.geekai.co/cn/docs/image/bytedance/doubao-seedream-4.0 Seedream 4.0 原生支持文本、单图和多图输入,实现基于主体一致性的多图融合创作、图像编辑、组图生成等多样玩法,让图像创作更加自由可控。本文介绍如何通过API 调用Seedream 4.0模型,实现包括组图生成、多参考图生图等图片生成能力。 ### 模型参数 * 模型ID:`doubao-seedream-4.0` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `seed` * `strength` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` 附:[Seedream 4.0 官方 API 文档](https://www.volcengine.com/docs/82379/1824121) Doubao-Seedream-4.0 不支持设置图片宽高比及分辨率,如需设置可以通过 size 字段实现,该字段支持两种方式传值: * 指定生成图像的分辨率:`1K`、`2K`、`4K`,然后在 `prompt` 中通过自然语言描述生成图片宽高比 * 指定生成图像的宽高像素值,默认值是 `2048x2048`,对应宽高比为 1:1,此外还可以通过如下像素值生成不同宽高比的图片: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 2048x2048 | | 4:3 | 2304x1728 | | 3:4 | 1728x2304 | | 16:9 | 2560x1440 | | 9:16 | 1440x2560 | | 3:2 | 2496x1664 | | 2:3 | 1664x2496 | | 21:9 | 3024x1296 | 宽高像素值的取值范围为 `[1280x720, 4096x4096]`。 ### 文生图 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.0", "prompt":"画一只可爱的小猫在草丛中玩耍", "size": "1K" }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "doubao-seedream-4.0", "created": 1760442379, "task_id": "42bcdbe2-fde8-4bf5-8ec0-8743ba2a604d", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/10/14/d06edffeb278fdb80026af1dc8725f66.jpeg" } ], "usage": { "billed_units": 1, "output_tokens": 3888, "total_tokens": 3888 } } ``` ### 图生图 **单图** 基于已有图片,结合文字指令进行图像编辑,生成新的图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.0", "prompt": "生成狗狗趴在草地上的近景画面", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimage.png", "size": "2K" }' ``` 响应和文生图一样是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "model": "doubao-seedream-4.0", "created": 1760442250, "task_id": "577f046f-d45b-432e-b3b5-bcff4c546f43", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/10/14/d61920ceeaf3a5428d5257477c2bc444.jpeg" } ], "usage": { "billed_units": 1, "output_tokens": 4096, "total_tokens": 4096 } } ``` **多图** 基于多张参考图片,融合它们的风格、元素等特征来生成新图像,如衣裤鞋帽与模特图融合成穿搭图,人物与风景融合为人物风景图等: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.0", "prompt": "将图1的服装换为图2的服装", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_2.png" ], "size": "2K" }' ``` 响应和单图一样是一个包含生成图片 URL 的 JSON 对象: ### 组图生成 支持通过一张或者多张图片和文字信息,生成漫画分镜、品牌视觉等一组内容关联的图片: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.0", "prompt": "生成一组共4张连贯插画,核心为同一庭院一角的四季变迁,以统一风格展现四季独特色彩、元素与氛围", "size": "2K", "response_format": "url", "watermark": true, "extra_body": { "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 4 } } }' ``` 响应是一个 JSON 对象,其中包含生成的组图列表: ```json theme={null} { "model": "doubao-seedream-4.0", "created": 1760442607, "task_id": "3327c84d-e138-4874-be2c-143134d075cc", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/10/14/5a30bd378a89eb177cba13041c534636.jpeg" }, { "url": "https://static.geekai.co/image/2025/10/14/5c5416fb79cbdf76e80bc88fb3693c19.jpeg" }, { "url": "https://static.geekai.co/image/2025/10/14/52fa648446cec78dab5f671cb650527d.jpeg" }, { "url": "https://static.geekai.co/image/2025/10/14/da412a64d2a300896e2508d7c4b18fc2.jpeg" } ], "usage": { "billed_units": 4, "output_tokens": 62208, "total_tokens": 62208 } } ``` # Doubao-Seedream-4.5 Source: https://docs.geekai.co/cn/docs/image/bytedance/doubao-seedream-4.5 Seedream 4.5 作为字节跳动最新的图像生成模型,能力最强,在编辑一致性(如主体细节与光影色调的保持)、人像美化和小字生成方面体验升级。同时,模型的多图组合能力显著增强,推理能力与画面美学持续优化,能够更精准、更具艺术感地呈现创意。 * 模型ID:`doubao-seedream-4.5` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `seed` * `strength` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` 附:[Seedream 4.5 官方 API 文档](https://www.volcengine.com/docs/82379/1824121) Doubao-Seedream-4.5 不支持设置图片宽高比及分辨率,可以通过 `size` 字段实现,该字段支持两种方式传值: * 指定生成图像的分辨率: `2K`、`4K`, 并在prompt中用自然语言描述图片宽高比、图片形状或图片用途,最终由模型判断生成图片的大小。 * 指定生成图像的宽高像素值,默认值是 `2048x2048`,对应宽高比为 1:1,此外还可以通过如下像素值生成不同宽高比的图片: | 分辨率 | 宽高比 | 像素值 | | --- | ---- | --------- | | 2K | 1:1 | 2048x2048 | | | 4:3 | 2304x1728 | | | 3:4 | 1728x2304 | | | 16:9 | 2848x1600 | | | 9:16 | 1600x2848 | | | 3:2 | 2496x1664 | | | 2:3 | 1664x2496 | | | 21:9 | 3136x1344 | | 4K | 1:1 | 4096x4096 | | | 4:3 | 3520x4704 | | | 3:4 | 4704x3520 | | | 16:9 | 5504x3040 | | | 9:16 | 3040x5504 | | | 3:2 | 3328x4992 | | | 2:3 | 4992x3328 | | | 21:9 | 6240x2656 | ### 文生图 通过给模型提供清晰准确的文字指令,即可快速获得符合描述的高质量单张图片: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.5", "prompt":"画一只可爱的小猫在草丛中玩耍", "size": "2K" }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "doubao-seedream-4.5", "created": 1766997450, "task_id": "2535fa4a-b5ea-4664-8e33-478e22606d4f", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/29/398b72b457492fbe36c9ac6efc69121b.jpeg" } ], "usage": { "billed_units": 1, "output_tokens": 16384, "total_tokens": 16384 } } ``` ### 图生图 **单图** 基于已有图片,结合文字指令进行图像编辑,生成新的图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.5", "prompt": "根据这张小猫图片,生成一张和毛线球玩耍的图片", "image": "https://static.geekai.co/image/2025/12/29/398b72b457492fbe36c9ac6efc69121b.jpeg", "size": "2K" }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "doubao-seedream-4.5", "created": 1766999002, "task_id": "20d598c9-703b-4ac1-8d8b-3a17917f7c71", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/29/c0c888a2acc9a0cdb27c49878571dd2f.jpeg" } ], "usage": { "billed_units": 1, "output_tokens": 16384, "total_tokens": 16384 } } ``` **多图** 根据您输入的文本描述和多张参考图片,融合它们的风格、元素等特征来生成新图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.5", "prompt": "将图1的服装换为图2的服装", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png" ], "size": "4k", "watermark": false, }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "doubao-seedream-4.5", "created": 1767663594, "task_id": "0785df56-af20-49bb-9b5d-3b082e244482", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/06/884c492ff60dafa1bed2b2113a360582.jpeg" } ], "usage": { "billed_units": 1, "output_tokens": 65536, "total_tokens": 65536 } } ``` ### 组图生成 支持通过一张或者多张图片和文字信息,生成漫画分镜、品牌视觉等一组内容关联的图片: **文生组图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.5", "prompt": "生成一组共4张连贯插画,核心为同一庭院一角的四季变迁,以统一风格展现四季独特色彩、元素与氛围", "size": "2K", "response_format": "url", "watermark": true, "extra_body": { "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 4 } } }' ``` 响应是一个 JSON 对象,其中包含生成的组图列表: ```json theme={null} { "model": "doubao-seedream-4.5", "created": 1767009952, "task_id": "0ebe205a-ecd3-446a-8751-6923c2e9f70b", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/29/c5ea6a6601a75d5cd377b287d9a5f0c9.jpeg" }, { "url": "https://static.geekai.co/image/2025/12/29/ec90634ffadd295d6cdefebcd739a581.jpeg" }, { "url": "https://static.geekai.co/image/2025/12/29/fe354ed6415711fa316edd9e58ec3453.jpeg" }, { "url": "https://static.geekai.co/image/2025/12/29/7d4d557691a06bf41dcaeddadd0bbe99.jpeg" } ], "usage": { "billed_units": 4, "output_tokens": 62208, "total_tokens": 62208 } } ``` **单张图生组图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.5", "prompt": "参考这个LOGO,做一套户外运动品牌视觉设计,品牌名称为'GREEN',包括包装袋、帽子、卡片、挂绳等。绿色视觉主色调,趣味、简约现代风格", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimages.png", "size": "2K", "response_format": "url", "watermark": false, "extra_body":{ "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 4 } } }' ``` 响应和文生组图一样, 是JSON 对象,其中包含生成的组图列表 **多张图生组图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedream-4.5", "prompt": "生成女孩和奶牛玩偶在游乐园开心地坐过山车的图片,涵盖早晨、中午、晚上", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_2.png" ], "size": "2K", "response_format": "url", "watermark": false, "extra_body":{ "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 3 } } }' ``` 响应和文生组图一样, 是JSON 对象,其中包含生成的组图列表 # Doubao-Seedream-5.0-Lite Source: https://docs.geekai.co/cn/docs/image/bytedance/doubao-seedream-5.0-lite Doubao-Seedream-5.0-lite是字节跳动发布的最新图像创作模型。该模型首次搭载联网检索功能,能融合实时网络信息,提升生图时效性。同时,模型的聪明度进一步升级,能够精准解析复杂指令和视觉内容。此外,模型在世界知识广度、参考一致性及专业场景生成质量上均有增强,可更好地满足企业级视觉创作需求。 * 模型ID:`doubao-seedream-5.0-lite` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `strength` * `aspect_ratio` * `quality` * `n` * `style_preset` * `mask` * `background` 附:[Seedream 5.0 官方 API 文档](https://www.volcengine.com/docs/82379/1824121) Doubao-Seedream-5.0-Lite 不支持设置图片宽高比及分辨率,可以通过 `size` 字段实现,该字段支持两种方式传值: * 指定生成图像的分辨率: `2K`、`3K`、`4K`, 并在 `prompt` 中用自然语言描述图片宽高比、图片形状或图片用途,最终由模型判断生成图片的大小。 * 指定生成图像的宽高像素值,默认值是 `2048x2048`,对应宽高比为 1:1,此外还可以通过如下像素值生成不同宽高比的图片: | 分辨率 | 宽高比 | 像素值 | | --- | ---- | --------- | | 2K | 1:1 | 2048x2048 | | | 4:3 | 2304x1728 | | | 3:4 | 1728x2304 | | | 16:9 | 2848x1600 | | | 9:16 | 1600x2848 | | | 3:2 | 2496x1664 | | | 2:3 | 1664x2496 | | | 21:9 | 3136x1344 | | 3K | 1:1 | 3072x3072 | | | 4:3 | 3456x2592 | | | 3:4 | 2592x3456 | | | 16:9 | 4096x2304 | | | 9:16 | 2304x4096 | | | 3:2 | 3744x2496 | | | 2:3 | 2496x3744 | | | 21:9 | 4704x2016 | | 4K | 1:1 | 4096x4096 | | | 4:3 | 3520x4704 | | | 3:4 | 4704x3520 | | | 16:9 | 5504x3040 | | | 9:16 | 3040x5504 | | | 3:2 | 3328x4992 | | | 2:3 | 4992x3328 | | | 21:9 | 6240x2656 | ### 文生图 通过给模型提供清晰准确的文字指令,即可快速获得符合描述的高质量单张图片: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "doubao-seedream-5.0-lite", "prompt": "充满活力的特写编辑肖像,模特眼神犀利,头戴雕塑感帽子,色彩拼接丰富,眼部焦点锐利,景深较浅,具有Vogue杂志封面的美学风格,采用中画幅拍摄,工作室灯光效果强烈。", "size": "2K", "output_format":"png", "watermark": false }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "doubao-seedream-5.0-lite", "created": 1772246597, "task_id": "f79c81a4-7a7e-400f-9cfb-4d709c74bda3", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/02/28/d32786f7ec903244d657b68df883742b.png" } ], "usage": { "billed_units": 1, "output_tokens": 16384, "total_tokens": 16384 } } ``` 下面的图生图的输出结果同上述结果,不在列举。 ### 图生图 **单图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "doubao-seedream-5.0-lite", "prompt": "生成狗狗趴在草地上的近景画面", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimage.png", "size": "2K", "output_format":"jpeg", "watermark": false }' ``` **多图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "doubao-seedream-5.0-lite", "prompt": "将图1的服装换为图2的服装", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png" ], "size": "2K", "output_format":"png", "watermark": false }' ``` ### 组图输出 **文生组图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "doubao-seedream-5.0-lite", "prompt": "生成一组共4张连贯插画,核心为同一庭院一角的四季变迁,以统一风格展现四季独特色彩、元素与氛围", "size": "2K", "output_format":"png", "watermark": false, "extra_body": { "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 4 } } }' ``` **单张图组图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "doubao-seedream-5.0-lite", "prompt": "参考这个LOGO,做一套户外运动品牌视觉设计,品牌名称为'GREEN',包括包装袋、帽子、卡片、挂绳等。绿色视觉主色调,趣味、简约现代风格", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimages.png", "size": "2K", "output_format":"png", "watermark": false, "extra_body": { "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 4 } } }' ``` **多参考图组图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "doubao-seedream-5.0-lite", "prompt": "生成3张女孩和奶牛玩偶在游乐园开心地坐过山车的图片,涵盖早晨、中午、晚上", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_2.png" ], "size": "2K", "output_format":"png", "watermark": false, "extra_body": { "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 3 } } }' ``` **联网搜索** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "doubao-seedream-5.0-lite", "prompt": "制作一张上海未来5日的天气预报图,采用现代扁平化插画风格,清晰展示每日天气、温度和穿搭建议。整体为横向排版,标题为“上海未来5日天气预报”,包含5个等宽的垂直卡片,从左到右依次排列。 整体风格为现代、干净、友好的扁平化矢量插画风格,线条清晰,色彩柔和。人物形象采用年轻男女的卡通插画,表情自然,姿态放松,服装细节清晰。", "size": "2048x2048", "output_format":"png", "response_format": "url", "watermark": false, "extra_body": { "tools": [ { "type": "web_search" } ] } }' ``` # 图片超分辨率 Source: https://docs.geekai.co/cn/docs/image/clarify 图像超分辨率对输入的单张或多张图片进行x2超分,有效提升低分辨率图像的质量,大幅改善图像纹理细节、抑制压缩伪像,全面提高图像清晰度与主观质量。 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/clarify' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng-image-clarify-v3", "image": "https://static.geekai.co/image/2025/08/29/9288e4be0f8d97fca9e4ff7ae5fcd078.png" }' ``` 你还可以通过 `quality` 参数进一步设置图片质量,`quality` 参数支持以下选项: * `low`:低质量 * `medium`:中等质量(默认) * `high`:高质量 调用示例如下: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/clarify' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng-image-clarify-v3", "image": "https://static.geekai.co/image/2025/08/29/9288e4be0f8d97fca9e4ff7ae5fcd078.png", "quality": "high" }' ``` 多张图片通过数组传递即可,此外image支持图片URL和Base64两种格式。更多细节请参考[图片超分 API 手册](https://docs.geekai.co/cn/api/image/clarify)。 # 千问文生图 Source: https://docs.geekai.co/cn/docs/image/dashscope/qwen-image 通义千问-文生图模型(Qwen-Image)是一款通用图像生成模型,支持多种艺术风格,尤其擅长复杂文本渲染。模型支持多行布局、段落级文本生成以及细粒度细节刻画,可实现复杂的图文混合布局设计。 通义-文生图-Z-Image 是一款轻量级文生图模型,可快速生成图像,支持中英文字渲染,并灵活适配多种分辨率与宽高比例。 ### 模型参数 * 模型 ID:`qwen-image`/`qwen-image-plus`/`z-image-turbo` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API 认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `image` * `strength` * `aspect_ratio` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[千问文生图官方 API 文档](https://bailian.console.aliyun.com/?spm=5176.12818093_47.overview_recent.2.39e42cc9oUX0MV\&tab=doc#/doc/?type=model\&url=2840914) 千问文生图 可以通过 `size` 字段实现输出图像的分辨率: 可选的分辨率及其对应的图像宽高比例为: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1328x1328 | | 4:3 | 1472x1104 | | 3:4 | 1104x1472 | | 16:9 | 1664x928 | | 9:16 | 928x1664 | ### 文生图 **qwen-image** 通过给模型提供清晰准确的文字指令,即可快速获得符合描述的高质量单张图片: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "qwen-image", "prompt": "一副典雅庄重的对联悬挂于厅堂之中,房间是个安静古典的中式布置,桌子上放着一些青花瓷,对联上左书“义本生知人机同道善思新”,右书“通云赋智乾坤启数高志远”, 横批“智启通义”,字体飘逸,在中间挂着一幅中国风的画作,内容是岳阳楼。", "size": "1328x1328", "negative_prompt ": "低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。", "watermark": false }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "qwen-image", "created": 1767516972, "task_id": "93bf3349-1944-4e79-8bed-e73f1c446141", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/04/7a3b4052d71060d17e10743fc0082eb1.png" } ], "usage": { "billed_units": 1 } } ``` **z-image-turbo** Z-Image 不支持的参数除了上述之外,还包括 `negative_prompt`,`watermark` 总像素为 1024x1024 的推荐分辨率: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1024x1024 | | 2:3 | 832x1248 | | 3:2 | 1248x832 | | 3:4 | 864x1152 | | 4:3 | 1152x864 | | 7:9 | 896x1152 | | 9:7 | 1152x896 | | 9:16 | 720x1280 | | 16:9 | 1280x720 | | 9:21 | 576x1344 | | 21:9 | 1344x576 | 总像素为 1280x1280 的推荐分辨率: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1280x1280 | | 2:3 | 1024x1536 | | 3:2 | 1536x1024 | | 3:4 | 1104x1472 | | 4:3 | 1472x1104 | | 7:9 | 1120x1440 | | 9:7 | 1440x1120 | | 9:16 | 864x1536 | | 16:9 | 1536x684 | | 9:21 | 720x1680 | | 21:9 | 1680x720 | 总像素为 1536x1536 的推荐分辨率: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1536x1536 | | 2:3 | 1248x1872 | | 3:2 | 1872x1248 | | 3:4 | 1296x1728 | | 4:3 | 1728x1296 | | 7:9 | 1344x1728 | | 9:7 | 1728x1344 | | 9:16 | 1152x2048 | | 16:9 | 2048x1152 | | 9:21 | 864x2016 | | 21:9 | 2016x864 | 总像素在`[512x512, 2048x2048]`之间,推荐分辨率范围在 `[1024x1024, 1536x1536]`之间,出图效果更佳 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "z-image-turbo", "prompt": "一副典雅庄重的对联悬挂于厅堂之中,房间是个安静古典的中式布置,桌子上放着一些青花瓷,对联上左书“义本生知人机同道善思新”,右书“通云赋智乾坤启数高志远”, 横批“智启通义”,字体飘逸,在中间挂着一幅中国风的画作,内容是岳阳楼。", "size": "1024x1024" }' ``` 响应是同上述的 qwen-image 一样,是一个 JSON 对象,包含生成图片的 URL。 # Qwen Image 3.0 & Qwen Image 3.0 Pro Source: https://docs.geekai.co/cn/docs/image/dashscope/qwen-image-3.0 Qwen-Image-3.0 支持最大 4.5k token 输入,支持图中图密集信息排版,让报纸、分镜、菜单、试卷等复杂版面一次生成。 细节真实:支持 10px 小字精准渲染,微表情、毛孔、发丝等细节生动还原,逼近真实摄影的质感。知识厚实:支持 12 国语言、20+ 字体原生渲染,主流网页、游戏、直播等界面仿真,外部知识全纳入。 Qwen-Image-3.0-Pro 不只是在追求"好看",更在追求“好用”——让图像生成真正成为可落地的生产力工具。 ### 模型参数 * 模型 ID:`qwen-image-3.0`/`qwen-image-3.0-pro` * 模型价格:你可以在模型详情页查看最新价格信息👉[Qwen-Image-3.0](https://geekai.co/models/qwen-image-3.0)、[Qwen-Image-3.0-pro](https://geekai.co/models/qwen-image-3.0-pro) * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API 认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持画图 API 中的以下参数: * `strength` * `aspect_ratio` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[千问图像生成与编辑 3.0 官方 API 文档](https://bailian.console.aliyun.com/cn-beijing?spm=5176.12818093_47.overview_recent.1.2ffa2cc9sPpVb6\&tab=api#/api/?type=model\&url=3047054) 支持通过 `size` 字段实现输出图像的分辨率,格式为`宽x高`,例如"1024x1024",未指定时由模型根据提示词自动推荐分辨率: * 文生图(T2I):像素面积范围 `512x512` 至 `2048x2048` 之间的任意尺寸,宽高比限制 `1:8` 至 `8:1`; * 图生图(I2I):像素面积范围 `512x512` 至 `2048x2048` 之间的任意尺寸,宽高比限制 `1:8` 至 `8:1`。 极客智坊支持通过 `enhance_prompt` 字段替代官方的 `prompt_extend` 对提示词进行自动优化,增强后的提示词会在原始提示词的基础上进行优化,提升生成图像的质量和细节表现。 支持通过 `n` 字段指定生成图像的数量,最大支持 6 张,默认值为 1 张。 图生图场景支持通过 `image` 字段传入参考图,支持 URL 或 Base64 编码的图片数据,最大支持 3 张,多张图片通过数组传递即可。图像要求如下: * 支持的图片格式:PNG、JPG、JPEG、WEBP; * 图片大小限制:单张图片不超过 10MB; * 图片分辨率:建议图像的宽和高均在384像素至2048像素之间。 ### 模型价格 和 GPT-Image-2 类似,Qwen-Image-3.0 支持 `512x512` 至 `2048x2048` 的任意分辨率图片生成,不同分辨率对应的价格不同,以下是价格表: | 模型ID | 分辨率 | 价格(单位:元/张) | | -------------------- | --- | ---------- | | `qwen-image-3.0` | 1K | 0.18 | | `qwen-image-3.0` | 2K | 0.18 | | `qwen-image-3.0-pro` | 1K | 0.25 | | `qwen-image-3.0-pro` | 2K | 0.5 | 不同于 GPT-Image-2 按 tokens 计费,Qwen-Image-3.0 按图片宽高总像素对输出图片分档次计费,以图片总像素2250000像素为分界线,超过该像素的图片按 2K 分辨率计费,低于(含)该像素的图片按 1K 分辨率计费。 `qwen-image-3.0` 1K 和 2K 分辨率价格一样,`qwen-image-3.0-pro` 2K 分辨率价格是 1K 的 2 倍。两个模型都对输入的参考图计费,单价为 0.02 元/张。 ### 文生图 通过给模型提供清晰准确的文字指令,即可快速获得符合描述的高质量图片: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "qwen-image-3.0", "prompt": "一副典雅庄重的对联悬挂于厅堂之中,房间是个安静古典的中式布置,桌子上放着一些青花瓷,对联上左书“义本生知人机同道善思新”,右书“通云赋智乾坤启数高志远”, 横批“智启通义”,字体飘逸,在中间挂着一幅中国风的画作,内容是岳阳楼。", "size": "1024x1024", "negative_prompt ": "低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。", "watermark": false }' ``` 响应是一个包含生成图片的 URL 和 Base64 编码图片数据的 JSON 对象: ```json theme={null} { "model": "qwen-image-3.0", "created": 1785944071, "task_id": "8b5dbd66-0ebf-430e-b643-ffc2de28f05e", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/08/05/fe873826fecd34854a3c04a56f468a2d.png", "base64": "...base64 encoded image data..." } ], "usage": { "billed_units": 1, "output_image_type": "qima_output_1k" } } ``` 这里 `billed_units` 表示生成图片的计费数量,`output_image_type` 表示输出图片的分辨率类型,`qima_output_1k` 表示输出图片的分辨率为 1K,`qima_output_2k` 表示输出图片的分辨率为 2K。 ### 图生图 **单图** 通过 `image` 传入单图即可实现基于参考图生成图像或者图片编辑: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "qwen-image-3.0", "prompt": "生成一张符合深度图的图像,遵循以下描述:一辆红色的破旧的自行车停在一条泥泞的小路上,背景是茂密的原始森林", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp", "negative_prompt ": "低质量" }' ``` 响应是一个包含生成图片的 URL 和 Base64 编码图片数据的 JSON 对象: ```json theme={null} { "model": "qwen-image-3.0", "created": 1785944426, "task_id": "c9c2bdf8-1403-4d42-aa76-062b4dff5949", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/08/05/338d11a35ef558fb5fff218a605255a5.png", "base64": "...base64 encoded image data..." } ], "usage": { "billed_units": 1, "output_image_type": "qima_output_2k" } } ``` **多图** 通过 `image` 传入多图即可实现基于多张参考图生成图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "qwen-image-3.0", "prompt": "将图2女生的服装换为图1女生的服装", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png", ] }' ``` # 千问图像编辑 Source: https://docs.geekai.co/cn/docs/image/dashscope/qwen-image-edit 通义千问-图像编辑模型支持多图输入和多图输出,可精确修改图内文字、增删或移动物体、改变主体动作、迁移图片风格及增强画面细节。 ### 模型参数 * 模型ID:`qwen-image-edit`/`qwen-image-edit-plus` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `strength` * `aspect_ratio` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[Qwen-Image-Edit 官方 API 文档](https://help.aliyun.com/zh/model-studio/qwen-image-edit-guide?spm=5176.smartservice_service_robot_chat_new.0.0.1c8f3a98ftAoNh#ac07d69b4ag98) 通义千问-图像编辑可以通过 `size` 字段实现输出图像的分辨率,格式为宽x高字符串,例如"1024x2048",宽和高的取值范围均为\[512, 2048]像素,但此参数只在仅qwen-image-edit-plus系列模型支持, 可以通过`n`指定输出图像数量,默认值为1。qwen-image-edit-plus系列模型支持输出1-6张图片,qwen-image-edit模型仅支持输出1张图片。同样 `image`字段也支持输入base64编码的图片数据,符合data:;base64,即可。 ### 图像编辑 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "qwen-image-edit", "prompt": "生成一张符合深度图的图像,遵循以下描述:一辆红色的破旧的自行车停在一条泥泞的小路上,背景是茂密的原始森林", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp", "negative_prompt ": "低质量", "watermark": false }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "qwen-image-edit", "created": 1767593301, "task_id": "5e22aad1-72e6-4206-8b7a-286a6d4a4dd9", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/05/9322e44329ac13b1604332bbb8b1baa4.png" } ], "usage": { "billed_units": 1 } } ``` # 万相文生图 Source: https://docs.geekai.co/cn/docs/image/dashscope/wan 通义万相-文生图模型基于文本生成图像,支持多种艺术风格与写实摄影效果,满足多样化创意需求。 ### 模型参数 * 模型ID:`wan2.6-t2i`/`wan2.5-t2i-preview`/`wanx2.1-t2i-plus`/`wanx2.1-t2i-turbo`/`wan2.2-t2i-flash`/`wan2.2-t2i-plus` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `image` * `strength` * `aspect_ratio` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[万相文本生成图像 官方 API 文档](https://help.aliyun.com/zh/model-studio/text-to-image) 万相2.6和万相2.5 可以通过 `size` 字段实现输出图像的分辨率,格式为宽x高: 常见推荐的分辨率及其对应的图像宽高比例为: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1280x1280 | | 4:3 | 1472x1104 | | 3:4 | 1104x1472 | | 16:9 | 1696x960 | | 9:16 | 960x1696 | 总像素在 `[1280x1280, 1440x1440] `之间且宽高比范围为 `[1:4, 4:1]` 万相2.1和万相2.2 文生图模型支持的图像分辨率:宽高均在`[512, 1440]`像素之间,最大分辨率为`1440x1440` 可以通过`n`控制生成图片的数量。取值范围为1-4张 ### 文生图 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "wan2.6-t2i", "prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵", "size":"1280x1280", "negative_prompt": "低质量", "watermark": true, "n": 2 }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "wan2.6-t2i", "created": 1767754140, "task_id": "5a59c052-59e5-44a8-92f1-37a9571a8ab7", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/07/d4cb3902eb560fc70ddfe75af47a5f5f.png" }, { "url": "https://static.geekai.co/image/2026/01/07/6bd717ed012ab02be2be779b07716b02.png" } ], "usage": { "billed_units": 2 } } ``` # 万相图像编辑 Source: https://docs.geekai.co/cn/docs/image/dashscope/wan-edit 万相2.6 image图像生成模型支持图像编辑、图文混排输出, 满足多样化生成与集成需求。通义万相-通用图像编辑wan2.5模型仅需文本指令,即可基于单张或多张参考图像,实现主体一致的图像编辑、多图融合等能力。 ### 模型参数 * 模型ID:`wan2.6-image`/`wan2.5-i2i-preview` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `strength` * `aspect_ratio` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[通义万相-图像生成与编辑2.6 官方 API 文档](https://help.aliyun.com/zh/model-studio/wan-image-generation-api-reference) wan2.6-image 可以通过 `size` 字段实现输出图像的分辨率,格式为宽x高: 常见推荐的分辨率及其对应的图像宽高比例为: | 宽高比 | 像素值 | | ---- | -------------------- | | 1:1 | 1280x1280 或 1024x024 | | 2:3 | 800x1200 | | 3:2 | 1200x800 | | 4:3 | 1280x960 | | 3:4 | 960x1280 | | 16:9 | 1280x720 | | 9:16 | 720x1280 | | 21:9 | 1344x576 | 总像素在 `[768x768, 1280x1280]`之间,且宽高比范围为 `[1:4, 4:1]` 输入图像数量限制: * wan2.6-image 输入图像的URL或Base64编码字符串: * 当`enable_interleave=true`时(图文混排输出), 可输入0-1张图像 * 当`enable_interleave=false`时(图像编辑模式), 必须输入1-4张图像 通过`enable_interleave`来控制生图模式: * false: 默认值, 表示图像编辑模式(支持多图输入及主体一致性生成) * 用途: 基于1-4张输入图像进行编辑、风格迁移或主体一致性生成 * 输入: 必须提供至少1张参考图像 * 输出: 可生成1至4张结果图像 * true :表示启用图文混排输出模式(仅支持传入一张图像或不传图像) * 用途:根据文本描述生成图文并茂的内容,或进行纯文本生成图像(文生图) * 输入: 可以不提供图像(文生图),或提供最多1张参考图像 * 输出: 固定生成1个包含文本和图像的混合内容块 通过`n`来指定生成图片的数量。该参数的取值范围与含义取决于 `enable_interleave` 的状态: * `enable_interleave=false`(图像编辑模式): * 用途: 直接控制生成图像的数量 * 取值范围:1-4 * `enable_interleave=true`(图文混排模式): * 限制: 此参数默认为1,且必须固定为1。若设置为其他值,接口将报错 * 说明:在此模式下,实际生成数量由模型推理决定。如需控制生成图像的数量上限,请使用 max\_images 参数 通过`max_images`代表数量上限, 取值范围为1-5。实际生成的图像数量由模型推理决定,由模型来生成, 可能会少于设定值。例如: 设置为 5,模型可能根据内容仅生成 3 张,非随机而是内容驱动,不能具体指定数量了。 wan2.5-i2i-preview 可以通过 `size` 字段实现输出图像的分辨率,格式为宽x高: 推荐分辨率及对应宽高比: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1280x1280 | | 1:1 | 1024x1024 | | 2:3 | 800x1200 | | 3:2 | 1200x800 | | 4:3 | 1280x960 | | 3:4 | 960x1280 | | 16:9 | 1280x720 | | 9:16 | 720x1280 | | 21:9 | 1344x576 | 总像素在 `[768x768, 1280x1280]` 之间,且宽高比范围为 `[1:4, 4:1]` 输入图像数量限制: wan2.5-i2i-preview模型最多支持输入3张图片 通过`n`来指定生成图片的数量, 该参数的取值范围1-4张 ### wan2.6-image ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "wan2.6-image", "prompt": "参考图1的风格和图2的背景,生成番茄炒蛋", "image": ["https://cdn.wanx.aliyuncs.com/tmp/pressure/umbrella1.png","https://img.alicdn.com/imgextra/i3/O1CN01SfG4J41UYn9WNt4X1_!!6000000002530-49-tps-1696-960.webp"], "negative_prompt": "低质量", "size": "1280x1280" }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "wan2.6-image", "created": 1767774573, "task_id": "46b38e93-9be0-451f-91f4-3db020dd3bcb", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/07/8fee7dbc22368ada8a77ed4c67a73a51.png" } ], "usage": { "billed_units": 1 } } ``` 当启用图文混排输出模式 enable\_interleave为true的时候: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "wan2.6-image", "prompt": "生成狗狗趴在草地上的近景画面", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimage.png", "negative_prompt": "低质量", "size": "960x1280", "n": 1, "extra_body": { "enable_interleave": true, "max_images": 4 } }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "wan2.6-image", "created": 1767775609, "task_id": "7014d7ce-5b9a-44e0-8ef3-51d09e01dbf6", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/07/16d7161ced1a067dce8f4a3a65185f11.png" }, { "url": "https://static.geekai.co/image/2026/01/07/0fb6b10bf130d59e6b89f2254912dae1.png" }, { "url": "https://static.geekai.co/image/2026/01/07/167939c7a8593a3ae903a0f28ea9ca61.png" } ], "usage": { "billed_units": 3 } } ``` ### wan2.5-i2i-preview ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "wan2.5-i2i-preview", "prompt": "根据这张小猫图片,生成一张和毛线球玩耍的图片", "image": "https://static.geekai.co/image/2025/12/29/398b72b457492fbe36c9ac6efc69121b.jpeg", "negative_prompt": "低质量", "size": "1280x1280", "watermark": false, "n": 2 }' ``` 响应是一个 JSON 列表,包含生成图片的 URL: ```json theme={null} { "model": "wan2.5-i2i-preview", "created": 1767844458, "task_id": "def5729d-756d-4f43-8e3c-d18611e9f85d", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/08/e882ee78e340213091c2587ed46aa7bd.png" }, { "url": "https://static.geekai.co/image/2026/01/08/da2210a94d64b523408bfe67d4aa2568.png" } ], "usage": { "billed_units": 2 } } ``` # 图片编辑 Source: https://docs.geekai.co/cn/docs/image/edit ### 图片编辑 图片编辑和以图生图类似,你可以通过传入图片+文本提示对指定图片进行编辑,示例代码如下: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "gpt-image-2", "prompt": "修复这张破损的照片", "image": "https://static.geekai.co/storage/2025/04/02/broken-picture.jpg" }' ``` 多张图片可以通过字符串数组传递: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "gpt-image-2", "prompt": "修复这张破损的照片", "images": ["https://static.geekai.co/storage/2025/04/02/broken-picture.jpg"] }' ``` ### 表单上传 如果你需要上传本地图片进行编辑,可以使用 `multipart/form-data` 的方式进行表单上传: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --form 'model="gpt-image-2"' \ --form 'prompt="修复这张破损的照片"' \ --form 'image=@/path/to/your/local/image.jpg' ``` 多张图片的表单上传方式如下: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --form 'model="gpt-image-2"' \ --form 'prompt="将第一张图中的面料应用至第二张图的服装上,图片比例按照第二张图的来"' \ --form 'images[]=@/path/to/your/local/image1.jpg' \ --form 'images[]=@/path/to/your/local/image2.jpg' ``` 更多图片编辑 API 参数细节,请参考[画图 API 手册](https://docs.geekai.co/cn/api/image)。 # 图像增强 Source: https://docs.geekai.co/cn/docs/image/enhance 基于画质分析技术和 AI 重建技术,针对低质图像进行一站式的增强,大幅度地提高人像质量和整体画面清晰度,对模糊图像进行智能快速去噪,优化图像纹理细节,使画面更加自然清晰,提升用户的使用体验。可用于网站图片、视频封面、手机相册图片等场景。 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/enhance' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng-image-enhance-v2", "image": "https://static.geekai.co/image/2025/09/01/8e7ae07fc7ecd18c913294c040956334.png" }' ``` 你还可以通过 `extra_body` 参数进一步设置图片增强细节,`extra_body` 参数支持以下选项: * `enable_hdr`:是否开启 HDR 效果,默认关闭。 * `enable_wb`:是否开启白平衡,默认关闭。 调用示例如下: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/enhance' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng-image-enhance-v2", "image": "https://static.geekai.co/image/2025/09/01/8e7ae07fc7ecd18c913294c040956334.png", "size": "1080p", "extra_body": { "enable_hdr": true, "enable_wb": true } }' ``` 更多细节请参考[图片增强 API 手册](https://docs.geekai.co/cn/api/image/enhance)。 # Gemini 2.5 Flash Image Source: https://docs.geekai.co/cn/docs/image/google/gemini-2.5-flash-image Gemini 2.5 Flash Image 聚合了 Gemini 2.5 Flash 的推理能力和 Nano Banana 模型的画图能力,从而实现在多轮对话中进行图片创作和修改。 ### 模型参数 * 模型ID:`gemini-2.5-flash-image` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=google\&type=chat)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/chat/completions` * 模型参数:参考[对话 API 手册](https://docs.geekai.co/cn/api/chat/completions) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 为保持向前兼容,你也可以通过 `gemini-2.5-flash-image-preview` 来调用该模型,二者完全等价,但是考虑到未来维护和稳定性,建议切到 `gemini-2.5-flash-image` 这个稳定版进行调用。 由于是对话模型,Gemini 2.5 Flash Image 不支持通过参数对生成图片进行控制,所有图片生成和修改以及对图片属性的设置均通过 `prompt` 调优来实现。以下策略将帮助你创建有效的提示词,从而精确生成你想要的图像: ### 图像生成 掌握 Gemini 2.5 Flash Image 生成图片的首要原则是: > \*\*请描述场景,而不仅仅是罗列关键词。\*\*模型的核心优势在于其深入的语言理解能力。通常来说,一个具有叙述性和描述性的段落会比一堆不相关的词语列表生成更好、更连贯的图像。 **1. 照片级真实场景** 要生成逼真的图像,请使用摄影术语,提及相机角度、镜头类型、光线照明和细节,以引导模型生成照片级真实感的效果。 ```markdown Template theme={null} 一张照片写实风格的[镜头类型],展现[主体],[动作或表情],场景设置在[环境]中。 场景由[光线描述]照亮,营造出[氛围]的气氛。使用[相机/镜头细节]拍摄,强调[关键纹理和细节]。 图像应采用[宽高比]格式。 ``` ```markdown Prompt theme={null} 一张照片写实风格的特写肖像,展现一位年迈的中国陶瓷艺人,他有着深邃的、被阳光刻蚀的皱纹和温暖的、睿智的微笑。 他正在仔细检查一只刚上釉的茶碗。场景设置在他质朴的、阳光充沛的工作室中。 场景由柔和的黄金时刻光线照亮,光线透过窗户洒入,突出了陶土的精细纹理。使用85mm肖像镜头拍摄,营造出柔和的、模糊的背景(散景效果)。 整体氛围宁静而大师级。垂直肖像方向。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "一张照片写实风格的特写肖像,展现一位年迈的中国陶瓷艺人,他有着深邃的、被阳光刻蚀的皱纹和温暖的、睿智的微笑。他正在仔细检查一只刚上釉的茶碗。场景设置在他质朴的、阳光充沛的工作室中。场景由柔和的黄金时刻光线照亮,光线透过窗户洒入,突出了陶土的精细纹理。使用85mm肖像镜头拍摄,营造出柔和的、模糊的背景(散景效果)。整体氛围宁静而大师级。垂直肖像方向。" } ] } ] }' ``` **2. 风格化插图与贴纸** 要创建贴纸、图标或其他素材,请明确说明风格需求,并要求透明背景。 ```markdown Template theme={null} 一个[风格]贴纸,主体是[主题],特色是[关键特征]和[色彩搭配]。 设计应该采用[线条风格]和[阴影风格]。背景必须是透明的。 ``` ```markdown Prompt theme={null} 一个可爱风格的贴纸,主体是一只快乐的小熊猫,戴着一顶小竹帽。它正在咀嚼一片绿色的竹叶。 设计特色是粗体、干净的轮廓线,简单的赛璐璐阴影,以及充满活力的色彩搭配。背景必须是透明的。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "一个可爱风格的贴纸,主体是一只快乐的小熊猫,戴着一顶小竹帽。它正在咀嚼一片绿色的竹叶。设计特色是粗体、干净的轮廓线,简单的赛璐璐阴影,以及充满活力的色彩搭配。背景必须是透明的。" } ] } ] }' ``` **3. 图像中的准确文字** Gemini 在文本渲染方面表现出色。请清晰说明文本内容、字体样式(需详细描述)以及整体设计。 ```markdown Template theme={null} 为[品牌/概念]创建一个[图像类型],包含文字"[要渲染的文字]",采用[字体风格]。 设计应该是[风格描述],配色方案为[色彩方案]。 ``` ```markdown Prompt theme={null} 为一家名为'The Daily Grind'的咖啡店创建一个现代、极简主义的标志。 文字应该采用干净、粗体、无衬线字体。设计应该包含一个简单、风格化的咖啡豆图标,与文字无缝融合。配色方案是黑白色。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "为一家名为'The Daily Grind'的咖啡店创建一个现代、极简主义的标志。文字应该采用干净、粗体、无衬线字体。设计应该包含一个简单、风格化的咖啡豆图标,与文字无缝融合。配色方案是黑白色。" } ] } ] }' ``` **4. 产品模型与商业摄影** 非常适合为电子商务、广告或品牌打造干净、专业的产品图片。 ```markdown Template theme={null} 一张高分辨率、影棚打光的产品摄影照片,展现[产品描述],摆放在[背景表面/描述]上。 光线设置为[光线布局,例如:三点柔光箱布局],目的是[光线用途]。相机角度是[角度类型],以展示[特定特征]。 超写实风格,尖锐对焦在[关键细节]上。[宽高比]。 ``` ```markdown Prompt theme={null} 一张高分辨率、影棚打光的产品摄影照片,展现一只哑光黑色的极简主义陶瓷咖啡杯,摆放在抛光混凝土表面上。 光线设置为三点柔光箱布局,旨在营造柔和、漫射的高光并消除刺眼的阴影。相机角度是微微仰视的45度拍摄,以展示其简洁的线条。 超写实风格,尖锐对焦在咖啡升腾的蒸汽上。正方形图像。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "一张高分辨率、影棚打光的产品摄影照片,展现一只哑光黑色的极简主义陶瓷咖啡杯,摆放在抛光混凝土表面上。光线设置为三点柔光箱布局,旨在营造柔和、漫射的高光并消除刺眼的阴影。相机角度是微微仰视的45度拍摄,以展示其简洁的线条。超写实风格,尖锐对焦在咖啡升腾的蒸汽上。正方形图像。" } ] } ] }' ``` **5. 极简主义与留白设计** 非常适合为网站、演示文稿或营销材料创建背景,以便在其上添加文字内容。 ```markdown Template theme={null} 一个极简主义构图,特色是单个[主体]位于画面的[右下角/左上角/等位置]。 背景是一大片空旷的[颜色]画布,创造出显著的负空间。柔和、微妙的光线。[宽高比]。 ``` ```markdown Prompt theme={null} 一个极简主义构图,特色是单片精致的红色枫叶位于画面的右下角。 背景是一大片空旷的米白色画布,为文字创造出显著的负空间。来自左上方的柔和、漫射光线。正方形图像。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "一个极简主义构图,特色是单片精致的红色枫叶位于画面的右下角。背景是一大片空旷的米白色画布,为文字创造出显著的负空间。来自左上方的柔和、漫射光线。正方形图像。" } ] } ] }' ``` **6. 漫画画面/分镜故事板** 基于角色一致性和场景描述,为视觉叙事创建画面。 ```markdown Template theme={null} 一个单独的漫画面板,采用[艺术风格]风格。在前景中,[角色描述和动作]。在背景中,[场景细节]。 面板有一个[对话框/说明框],文字内容是"[文字]"。光线营造出[氛围]的情绪。[宽高比]。 ``` ```markdown Prompt theme={null} 一个单独的漫画面板,采用粗犷的黑色电影艺术风格,具有高对比度的黑白墨水效果。 在前景中,一名穿着风衣的侦探站在闪烁的街灯下,雨水浸湿了他的肩膀。 在背景中,一家荒凉酒吧的霓虹招牌倒映在水坑中。 顶部的说明框写着"这座城市是个难以保守秘密的地方。" 光线很刺眼,营造出戏剧性的、忧郁的氛围。横向构图。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "一个单独的漫画面板,采用粗犷的黑色电影艺术风格,具有高对比度的黑白墨水效果。在前景中,一名穿着风衣的侦探站在闪烁的街灯下,雨水浸湿了他的肩膀。在背景中,一家荒凉酒吧的霓虹招牌倒映在水坑中。顶部的说明框写着"这座城市是个难以保守秘密的地方。"光线很刺眼,营造出戏剧性的、忧郁的氛围。横向构图。" } ] } ] }' ``` ### 图像编辑 以下示例展示了如何将图像与您的文本提示结合使用,以实现编辑、构图和风格转换的效果。 **1. 添加和删除元素** 提供一张图片并描述您想要的修改。模型将保持原始图片的风格、光线和透视角度。 ```markdown Template theme={null} 使用提供的[主体]图像,请[添加/移除/修改][元素]到/从场景中。确保变化是[对变化应如何融合的描述]。 ``` ```markdown Prompt theme={null} 使用提供的我的猫咪图像,请在它的头上添加一顶小的、针织的巫师帽。让它看起来坐得很舒适,并与照片的柔和光线相匹配。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "使用提供的我的猫咪图像,请在它的头上添加一顶小的、针织的巫师帽。让它看起来坐得很舒适,并与照片的柔和光线相匹配。" }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/cat.png" } } ] } ] }' ``` **2. 图像修复** 通过对话方式定义一个"掩码",用于编辑图像的特定部分,同时保持图像的其他部分不变。 ```markdown Template theme={null} 使用提供的图像,仅将[特定元素]更改为[新元素/描述]。保持图像中的其他所有内容完全相同,保留原始风格、光照和构图。 ``` ```markdown Prompt theme={null} 使用提供的客厅图像,仅将蓝色沙发更改为复古的棕色皮质切斯特菲尔德沙发。保持房间的其余部分不变,包括沙发上的枕头和光照。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "使用提供的客厅图像,仅将蓝色沙发更改为复古的棕色皮质切斯特菲尔德沙发。保持房间的其余部分不变,包括沙发上的枕头和光照。" }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/living_room.png" } } ] } ] }' ``` **3. 风格迁移** 提供一张图片,并让模型以不同的艺术风格重新创作其内容。 ```markdown Template theme={null} 将提供的[主题]照片转换为[艺术家/艺术风格]的艺术风格。保留原始构图,但使用[风格元素描述]进行渲染。 ``` ```markdown Prompt theme={null} 将提供的现代城市夜景街道照片转换为文森特·梵高《星夜》的艺术风格。 保留建筑和汽车的原始构图,但用旋转的厚涂笔触和深蓝色与明亮黄色的戏剧性色彩来渲染所有元素。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "将提供的现代城市夜景街道照片转换为文森特·梵高《星夜》的艺术风格。保留建筑和汽车的原始构图,但用旋转的厚涂笔触和深蓝色与明亮黄色的戏剧性色彩来渲染所有元素。" }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/city.png" } } ] } ] }' ``` **4. 高级构图技术:组合多张图像** 提供多张图片作为参考,创建新的合成场景。这非常适合制作产品效果图或创意拼贴画。 ```markdown Template theme={null} 通过组合提供图像中的元素来创建新图像。取出[图像1中的元素]并将其放置在[图像2中的元素]上/与其一起。最终图像应该是[最终场景的描述]。 ``` ```markdown Prompt theme={null} 创建一张专业的电商时尚照片。取出第一张图像中的蓝色花卉连衣裙,让第二张图像中的女性穿上它。 生成女性穿着该连衣裙的真实全身照,并调整光照和阴影以匹配户外环境。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "创建一张专业的电商时尚照片。取出第一张图像中的蓝色花卉连衣裙,让第二张图像中的女性穿上它。生成女性穿着该连衣裙的真实全身照,并调整光照和阴影以匹配户外环境。" }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/dress.png" } }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/model.png" } } ] } ] }' ``` **5. 高保真细节保持** 为确保编辑过程中关键细节(如面部或标志)能够得到保留,请在提出编辑请求时对其进行详细描述。 ```markdown Template theme={null} 使用提供的图像,将[图像2中的元素]放置到[图像1中的元素]上。确保[图像1中的元素]的特征保持完全不变。 添加的元素应该[元素如何融合的描述]。 ``` ```markdown Prompt theme={null} 取第一张有着棕色头发、蓝色眼睛和中性表情的女性图像。将第二张图像中的标志添加到她的黑色T恤上。 确保女性的面部和特征保持完全不变。标志应该看起来像自然印在面料上一样,贴合衬衫的褶皱。 ``` ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-2.5-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "取第一张有着棕色头发、蓝色眼睛和中性表情的女性图像。将第二张图像中的标志添加到她的黑色T恤上。确保女性的面部和特征保持完全不变。标志应该看起来像自然印在面料上一样,贴合衬衫的褶皱。" }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/woman.png" } }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/logo.png" } } ] } ] }' ``` # Gemini 3 Pro Image Source: https://docs.geekai.co/cn/docs/image/google/gemini-3-pro-image Gemini 3 Pro Image 聚合了 Gemini 3 Pro Preview 的推理能力和 Nano Banana Pro 的画图能力,是一款顶尖的图像生成与编辑模型,专为专业资产制作而优化。它采用先进的推理技术,能够轻松应对复杂且多步骤的创作与修改任务。 ### 模型优势 * **高分辨率输出**:内置生成技术,支持 1K、2K 和 4K 画质 * **高级文本渲染**:能够生成清晰且富有风格的文本,适用于信息图表、菜单、示意图和营销资料 * **利用谷歌搜索进行信息验证**:模型能够通过谷歌搜索核实事实,并根据实时数据(如当前天气图、股票行情、最新事件)生成相应的图像 * **思考模式**:模型通过“思考”过程来分析复杂的提示,它会生成中间的“思考图像”(仅在后台可见且不计费),以便在输出最终高质量图像前不断完善构图 * **支持多张参考图像**:您现在可以将最多 14 张参考图像组合起来,生成最终图像 ### 模型参数 * 模型ID:`gemini-3-pro-image` * 模型价格:你可以在[模型详情页](https://geekai.co/models/gemini-3-pro-image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/chat/completions` * 模型参数:参考[对话 API 手册](https://docs.geekai.co/cn/api/chat/completions) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) ### 模型价格 Gemini 3 Pro Image 支持 1K、2K、4K 等多种分辨率图片生成,不同分辨率对应的价格不同,以下是价格表: | 分辨率 | 对应尺寸 | 价格(单位:元/张) | | --- | --------- | ---------- | | 1K | 1024x1024 | 1 | | 2K | 2048x2048 | 1 | | 4K | 4096x4096 | 1.8 | 1K、2K 分辨率价格一样,4K 是 1K 基准价格的约 1.8 倍。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用默认通道为例,折扣值是 `0.5`,那么生成一张 `size` 为 `1K` 的图片价格是 `0.3 x 0.5 = 0.15` 元,其他参数依次类推。 ### 图像生成 下面的代码展示了如何根据描述性提示来生成一张图像: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3-pro-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "创作一个 Nano Banana 菜肴的图片,场景设在一家高档餐厅中,带有 Gemini 主题" } ] } ] }' ``` ### 图像编辑 以下示例展示了如何将图像与您的文本提示结合使用,以实现编辑、构图和风格转换的效果: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3-pro-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "使用提供的我的猫咪图像,请在它的头上添加一顶小的、针织的巫师帽。让它看起来坐得很舒适,并与照片的柔和光线相匹配。" }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/cat.png" } } ] } ] }' ``` ### 多轮次图像编辑 通过对话持续生成和编辑图像。聊天或多轮对话是调整和完善图像的最佳方式,下面的示例展示了一个用于生成光合作用信息图的提示: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3-pro-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "创建一个生动的信息图表,将光合作用解释为植物最喜欢的食谱。展示“食材”(阳光、水、CO₂)和“成品菜肴”(糖/能量)。风格应像一本彩色儿童烹饪书的页面,适合小学四年级学生。" } ] } ] }' ``` 你可以通过同一个聊天界面将图片中的语言切换为西班牙语: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3-pro-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "创建一个生动的信息图表,将光合作用解释为植物最喜欢的食谱。展示“食材”(阳光、水、CO₂)和“成品菜肴”(糖/能量)。风格应像一本彩色儿童烹饪书的页面,适合小学四年级学生。" }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/image/2025/11/21/d1ce7245f72f820e8e5c29afdbd1173b.png" } } { "type": "text", "text": "将这个信息图表更新为西班牙语版本。不要更改图像的其他任何元素。" } ] } ] }' ``` ### 组合多张图像 Gemini 3 Pro Image Preview 支持您混合最多 14 张参考图像,这些图像可以包含以下内容: * 最多包含 6 张高保真度的物体图像于最终图像中 * 最多使用 5 张人物图片以保持角色的一致性 ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3-pro-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "合成这些人的办公室合影,他们正在做搞笑的表情。" }, { "type": "image_url", "image_url": { "url": "$IMG1_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG2_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG3_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG4_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG5_BASE64" } } ] } ] }' ``` ### 通过谷歌搜索实现信息定位 利用谷歌搜索工具,根据实时信息(如天气预报、股票走势图或最新事件)生成图像。 ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3-pro-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "将旧金山未来5天的当前天气预报可视化为一个干净、现代的天气图表。添加每天应该穿什么的视觉元素。" } ] } ], "enable_search": true, "image": { "aspect_ratio": "5:4" } }' ``` 你可以通过 `enable_search` 开启模型内置搜索工具,在 Gemini 模型中,内置的搜索工具是谷歌搜索。通过 `image` 可以配置生成图片的分辨率(`image_size`)和宽高比(`aspect_ratio`),目前仅支持这两个配置项。 ### 生成 4K 高清图像 Gemini 3 Pro Image Preview 默认生成 1K 分辨率的图像,也支持输出 2K 和 4K 分辨率。若需生成更高分辨率的素材,请在 `image` 参数中指定 `image_size`: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3-pro-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "达·芬奇风格的解剖帝王蝶解剖学素描。详细绘制头部、翅膀和腿部,置于纹理羊皮纸上,并带有英文注释。" } ] } ], "enable_search": true, "image": { "aspect_ratio": "1:1", "image_size": "4K" } }' ``` # Gemini 3.1 Flash Image Source: https://docs.geekai.co/cn/docs/image/google/gemini-3.1-flash-image Gemini 3.1 Flash Image 聚合了 Gemini 3.1 Flash Preview 的推理能力和 Nano Banana 2 的画图能力,是一款兼具成本和性能的图像生成与编辑模型,在 Nano Banana Pro 的基础上提升了生成速度和并发能力。 ### 模型优势 * **高分辨率输出**:内置生成技术,支持 0.5K、1K、2K 和 4K 画质 * **高级文本渲染**:能够生成清晰且富有风格的文本,适用于信息图表、菜单、示意图和营销资料 * **利用谷歌搜索进行信息验证**:模型能够通过谷歌搜索核实事实,并根据实时数据(如当前天气图、股票行情、最新事件)生成相应的图像,支持图像搜索 * **思考模式**:模型通过“思考”过程来分析复杂的提示,它会生成中间的“思考图像”(仅在后台可见且不计费),以便在输出最终高质量图像前不断完善构图,支持配置推理级别 * **支持多张参考图像**:您现在可以将最多 14 张参考图像组合起来,生成最终图像 * **新增宽高比**:除了原有的宽高比选项外,新增了 1:4、4:1、1:8 和 8:1 四种宽高比,满足更多样化的构图需求 ### 模型参数 * 模型ID:`gemini-3.1-flash-image` * 模型价格:你可以在[模型详情页](https://geekai.co/models/gemini-3.1-flash-image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/chat/completions` * 模型参数:参考[对话 API 手册](https://docs.geekai.co/cn/api/chat/completions) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) ### 模型价格 Gemini 3.1 Flash Image 支持 0.5K、1K、2K、4K 等多种分辨率图片生成,不同分辨率对应的价格不同,以下是价格表: | 分辨率 | 对应尺寸 | 价格(单位:元/张) | | ---- | --------- | ---------- | | 0.5K | 512x512 | 0.35 | | 1K | 1024x1024 | 0.5 | | 2K | 2048x2048 | 0.75 | | 4K | 4096x4096 | 1.15 | 2K 是 1K 基准价格的 1.5 倍,4K 是 1K 基准价格的约 2.3 倍,0.5K 是 1K 基准价格的 0.7 倍。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用默认通道为例,折扣值是 `0.5`,那么生成一张 `size` 为 `1K` 的图片价格是 `0.5 x 0.5 = 0.25` 元,其他参数依次类推,2K 的价格是 0.375 元,0.5K 的价格是 0.175 元,4K 的价格是 0.575 元。 ### 图像生成 下面的代码展示了如何根据描述性提示来生成一张图像: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3.1-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "创作一个 Nano Banana 菜肴的图片,场景设在一家高档餐厅中,带有 Gemini 主题" } ] } ] }' ``` ![AI 生成的 Nano Banana 菜肴图片](https://static.geekai.co/image/2026/02/27/9592f64c32b0afb0ffe544cb3c48fed3.png) ### 图像编辑 以下示例展示了如何将图像与您的文本提示结合使用,以实现编辑、构图和风格转换的效果: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3.1-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "使用提供的我的猫咪图像,请在它的头上添加一顶小的、针织的巫师帽。让它看起来坐得很舒适,并与照片的柔和光线相匹配。" }, { "type": "image_url", "image_url": { "url": "https://ai.google.dev/static/gemini-api/docs/images/cat.png" } } ] } ] }' ``` ![AI在猫咪图像上添加巫师帽](https://static.geekai.co/image/2026/02/27/4e54066be81e62fcdfb19d329e58f9e4.png) ### 多轮次图像编辑 通过对话持续生成和编辑图像。聊天或多轮对话是调整和完善图像的最佳方式,下面的示例展示了一个用于生成光合作用信息图的提示: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3.1-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "创建一个生动的信息图表,将光合作用解释为植物最喜欢的食谱。展示“食材”(阳光、水、CO₂)和“成品菜肴”(糖/能量)。风格应像一本彩色儿童烹饪书的页面,适合小学四年级学生。" } ] } ] }' ``` ![AI制作的光合作用信息图表](https://static.geekai.co/image/2026/02/27/bfc778edb67fefcc629e0f92bb1fb137.png) 你可以通过同一个聊天界面将图片中的语言切换为西班牙语: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3.1-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "创建一个生动的信息图表,将光合作用解释为植物最喜欢的食谱。展示“食材”(阳光、水、CO₂)和“成品菜肴”(糖/能量)。风格应像一本彩色儿童烹饪书的页面,适合小学四年级学生。" }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/image/2026/02/27/bfc778edb67fefcc629e0f92bb1fb137.png" } }, { "type": "text", "text": "将这个信息图表更新为西班牙语版本。不要更改图像的其他任何元素。" } ] } ] }' ``` ![AI将信息图表中的文本切换为西班牙语](https://static.geekai.co/image/2026/02/27/bf0226a839bd7db9f695824c13c9782f.png) ### 组合多张图像 Gemini 3.1 Flash Image Preview 支持您混合最多 14 张参考图像,这些图像可以包含以下内容: * 最多包含 10 张高保真度的物体图像于最终图像中 * 最多使用 4 张人物图片以保持角色的一致性 ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3.1-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "合成这些人的办公室合影,他们正在做搞笑的表情。" }, { "type": "image_url", "image_url": { "url": "$IMG1_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG2_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG3_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG4_BASE64" } }, { "type": "image_url", "image_url": { "url": "$IMG5_BASE64" } } ] } ] }' ``` ![AI合成的办公室合影](https://static.geekai.co/storage/2025/11/21/image-20251121165141424.png) ### 通过谷歌搜索实现信息定位 利用谷歌搜索工具,根据实时信息(如天气预报、股票走势图或最新事件)生成图像。 ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3.1-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "将旧金山未来5天的当前天气预报可视化为一个干净、现代的天气图表。添加每天应该穿什么的视觉元素。" } ] } ], "enable_search": true, "image": { "aspect_ratio": "5:4" } }' ``` ![AI生成的旧金山五天天气图表](https://static.geekai.co/image/2026/02/27/f7fe37df8402ec963de72680a5859967.png) 你可以通过 `enable_search` 开启模型内置搜索工具,在 Gemini 模型中,内置的搜索工具是谷歌搜索。通过 `image` 可以配置生成图片的分辨率(`image_size`)和宽高比(`aspect_ratio`),目前仅支持这两个配置项。 ### 生成 4K 高清图像 Gemini 3.1 Flash Image Preview 默认生成 1K 分辨率的图像,也支持输出0.5K、2K 和 4K 分辨率。若需生成更高分辨率的素材,请在 `image` 参数中指定 `image_size`: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gemini-3.1-flash-image", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "达·芬奇风格的解剖帝王蝶解剖学素描。详细绘制头部、翅膀和腿部,置于纹理羊皮纸上,并带有英文注释。" } ] } ], "enable_search": true, "image": { "aspect_ratio": "1:1", "image_size": "4K" }, "background": true }' ``` ![AI 生成的达·芬奇风格君主蝶解剖素描](https://static.geekai.co/image/2026/02/27/900baab2a3f34c27c9e2f1d5f7ac5447.png) 通过设置 `background` 参数为 `true`,可以实现[后台执行耗时任务](https://docs.geekai.co/cn/docs/chat/background)的功能,例如生成高分辨率图像。开启该功能后,对话接口会返回一个 `id` 唯一标识当前请求,你可以通过轮询 `https://geekai.co/api/v1/chat/{id}` 来获取对话的最新状态,当对话完成后即可获得最终的图像结果。 # Nano Banana Source: https://docs.geekai.co/cn/docs/image/google/nano-banana Nano Banana 是由 Google DeepMind 开发的 Google 最先进图片生成模型,支持图片生成与图片编辑,是 Gemini 2.5 Flash Image 的底层画图模型。 Nano Banana Pro 专为专业数字资产制作打造,具备最先进的图像生成能力,原生支持 4K 高清图片生成,是 Gemini 3 Pro Image Preview的底层画图模型。 Nano Banana 2 是 Nano Banana Pro 的轻量版本,专为提升速度和高并发场景优化,支持 0.5K、1K、2K、4K 分辨率图片生成,是 Gemini 3.1 Flash Image Preview 的底层画图模型。 ### 模型参数 * 模型ID:`nano-banana`/`nano-banana-pro`/`nano-banana-2`/`nano-banana-2-lite` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=google\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `seed` * `strength` * `quality` * `style_preset` * `mask` * `watermark` * `background` Nano Banana 支持的 `aspect_ratio` 尺寸如下: * `1:1` * `2:3` * `3:2` * `4:3` * `3:4` * `4:5` * `5:4` * `16:9` * `9:16` * `21:9` * `9:21` * `1:4`(仅 Nano Banana 2 支持) * `4:1`(仅 Nano Banana 2 支持) * `1:8`(仅 Nano Banana 2 支持) * `8:1`(仅 Nano Banana 2 支持) Nano Banana Pro / Nano Banana 2 支持通过 `size` 参数来指定生成图片的分辨率,支持的分辨率如下: * `0.5K`:`512x512`(仅 Nano Banana 2 支持) * `1K`:`1024x1024` * `2K`:`2048x2048` * `4K`:`4096x4096` 仅 `nano-banana-pro`/`nano-banana-2` 支持 `size` 参数,`nano-banana` 不支持该参数。 ### 图片生成 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"nano-banana-2", "prompt":"画一只可爱的小猫在草丛中玩耍", "aspect_ratio": "1:1" }' ``` ### 图片编辑 和 GPT-Image-1 一样,Nano Banana 也支持图片编辑接口,因此我们通过此接口可以实现图生图功能。 **单图** 通过传入图片+文本提示对指定图片进行编辑: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "nano-banana-2", "prompt": "修复这张破损的照片", "image": "https://static.geekai.co/storage/2025/04/02/broken-picture.jpg" }' ``` **多图** 多张图片可以通过字符串数组传递: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "nano-banana-2", "prompt": "将图1中的面料应用至图2的服装上,图片比例按照图2来", "image": [ "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg", "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg" ] }' ``` # 以图生图 Source: https://docs.geekai.co/cn/docs/image/img2img ### 单张图片 对于支持以图生图的模型,你可以通过传入图片链接进行以图生图,具体的使用方法如下: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-2", "prompt":"修复这张破损的照片", "image":"https://static.geekai.co/storage/2025/04/02/broken-picture.jpg" }' ``` ### 多张图片 多张图片以图片链接列表形式传递 `images` 参数即可: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "gpt-image-2", "prompt": "将第一张图中的面料应用至第二张图的服装上,图片比例按照第二张图的来", "images": [ "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg", "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg" ] }' ``` # 即梦图生图3.0 Source: https://docs.geekai.co/cn/docs/image/jimeng/jimeng_i2i_v30 图生图3.0智能参考是即梦同源的图生图能力,支持基于文本指令进行图像编辑。该能力在精准执行编辑指令和保持图像内容完整性(如人物特征及精细细节)方面实现显著提升,尤其在处理真实图像和海报图文设计场景表现卓越。推荐在海报等设计等场景中,在文本指令中加入「海报」「平面设计」等词,并用引号标出期望文字时,可显著提升文字响应效果,产出高质量编辑结果,有效满足用户改图需求。 * 模型ID:`jimeng_i2i_v30` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=jimeng\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` * `response_format` * `watermark` 附:[即梦图生图3.0 官方 API 文档](https://www.volcengine.com/docs/85621/1747301) 即梦图生图3.0 可以通过 `size` 字段设置图像生成的宽高: 支持自定义生成图像宽高,范围在`[512, 2016]`内,推荐可选的宽高比为: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1328x1328 | | 4:3 | 1472x1104 | | 16:9 | 1664x936 | | 3:2 | 1584x1056 | | 21:9 | 2016x864 | 你可以通过 `strength` 字段替代官方的 `scale` 来控制文本描述影响的程度,取值范围是 `[0, 1]`,默认值是 `0.5`,该值越大代表文本描述影响程度越大,且输入图片影响程度越小。 ### 图生图 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng_i2i_v30", "prompt": "将图中女生的服装颜色变为绿色", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "size": "1472x1104" }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "jimeng_i2i_v30", "task_id": "3374c16c-0333-406c-aaa4-28d049dc9ae0", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/31/4c0f1dc8dc977236882a4a2566d78b7a.jpeg" } ] } ``` # 即梦文生图3.0 Source: https://docs.geekai.co/cn/docs/image/jimeng/jimeng_t2i_v30 文生图3.0是即梦同源的文生图能力,在文字响应准确度、图文排版、层次美感和语义理解能力上相较之前版本均有显著提升,人像质感更逼真,且支持输出高清大图。此外,在文字响应更精准的基础下,还支持响应大小字、各类艺术字体和不同字重。 * 模型ID:`jimeng_t2i_v30` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=jimeng\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `image` * `strength` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` * `response_format` * `watermark` 附:[即梦文生图3.0 官方 API 文档](https://www.volcengine.com/docs/85621/1616429) 即梦文生图3.0 可以通过 `size` 字段设置图像生成的宽高: 推荐可选的宽高比为: * 标清1K: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1328x1328 | | 4:3 | 1472x1104 | | 16:9 | 1664x936 | | 3:2 | 1584x1056 | | 21:9 | 2016x864 | * 高清2K: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 2048x2048 | | 4:3 | 2304x1728 | | 16:9 | 2560x1440 | | 3:2 | 2496x1664 | | 21:9 | 3024x1296 | 宽高像素值范围在`[512x512, 2048x2048]`之间 ### 文生图 即梦文生图3.0,可以通过文本提示生成图片,enhance\_prompt开启文本扩写,会针对输入的文本进行扩写优化: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"jimeng_t2i_v30", "prompt": "画一只可爱的小狗在玩耍", "size": "1328x1328", "enhance_prompt": true }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "jimeng_t2i_v30", "task_id": "7cb6fa1b-ee29-48ae-9391-7e0bd6bad331", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/31/df0af75b0eba28f93ea6bcce020d004c.jpeg" } ] } ``` # 即梦文生图3.1 Source: https://docs.geekai.co/cn/docs/image/jimeng/jimeng_t2i_v31 文生图3.1是与即梦同源的文生图能力,该版本重点实现画面效果呈现升级,在画面美感塑造、风格精准多样及画面细节丰富度方面提升显著,同时兼具文字响应效果。 * 模型ID:`jimeng_t2i_v31` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=jimeng\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `image` * `strength` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` * `response_format` * `watermark` 附:[即梦文生图3.1 官方 API 文档](https://www.volcengine.com/docs/85621/1756900) 即梦文生图3.1 可以通过 `size` 字段设置图像生成的宽高: 推荐可选的宽高比为: * 标清1K: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 1328x1328 | | 4:3 | 1472x1104 | | 16:9 | 1664x936 | | 3:2 | 1584x1056 | | 21:9 | 2016x864 | * 高清2K: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 2048x2048 | | 4:3 | 2304x1728 | | 16:9 | 2560x1440 | | 3:2 | 2496x1664 | | 21:9 | 3024x1296 | 宽高像素值范围在`[512x512, 2048x2048]`之间 ### 文生图 即梦文生图3.1,可以通过文本提示生成图片,enhance\_prompt开启文本扩写,会针对输入的文本进行扩写优化: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"jimeng_t2i_v31", "prompt": "画一只可爱的小狗在玩耍", "size": "1472x1104", "enhance_prompt": true }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "jimeng_t2i_v31", "task_id": "46c69f29-54fd-4f82-b41c-802f4a8e86c4", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/30/a7442485b5235a0e64e6954cfd7641b6.jpeg" } ] } ``` # 即梦图片生成4.0 Source: https://docs.geekai.co/cn/docs/image/jimeng/jimeng_t2i_v40 即梦4.0是即梦同源的图像生成能力,该能力在统一框架内集成了文生图、图像编辑及多图组合生成的功能:支持单次输入最多 10 张图像及进行复合编辑,并能通过对提示词的深度推理,自动适配最优的图像比例尺寸与生成数量,可一次性输出最多 15 张内容关联的图像。此外,模型显著提升了中文生成的准确率与内容多样性,且支持 4K 超高清输出,为专业图像创作提供了从生成到编辑的一站式解决方案。 * 模型ID:`jimeng_t2i_v40` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=jimeng\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图 API 中的以下参数: * `negative_prompt` * `aspect_ratio` * `quality` * `style_preset` * `output_format` * `mask` * `background` * `response_format` * `watermark` 附:[即梦生图4.0 官方 API 文档](https://www.volcengine.com/docs/85621/1817045) 即梦生图4.0 可以通过 `size` 字段设置图像生成的宽高: 推荐可选的宽高比为: * 1K: | 宽高比 | 像素值 | | --- | --------- | | 1:1 | 1024x1024 | * 2K: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 2048x2048 | | 4:3 | 2304x1728 | | 16:9 | 2560x1440 | | 3:2 | 2496x1664 | | 21:9 | 3024x1296 | * 4k: | 宽高比 | 像素值 | | ---- | --------- | | 1:1 | 4096x4096 | | 4:3 | 4694x3520 | | 3:2 | 4992x3328 | | 16:9 | 5404x3040 | | 21:9 | 6198x2656 | size的默认取值为`2048x2048`,宽高像素值在`[1024x1024, 4096x4096]`之间 你可以通过 `strength` 字段替代官方的 `scale` 来控制文本描述影响的程度,取值范围是 `[0, 1]`,默认值是 `0.5`,该值越大代表文本描述影响程度越大,且输入图片影响程度越小。 ### 文生图 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng_t2i_v40", "prompt": "画一只可爱的小猫", "size": "2048x2048" }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "jimeng_t2i_v40", "task_id": "e1df0ec2-9dca-45c4-961c-af52b1436281", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/06/2d3ec22efdb778b7ac5d95932526ce34.png" } ] } ``` ### 图生图 **单图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng_t2i_v40", "prompt": "根据这张小猫图片,生成一张和毛线球玩耍的图片", "image": "https://static.geekai.co/image/2025/12/29/398b72b457492fbe36c9ac6efc69121b.jpeg", "size": "2304x1728" }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "jimeng_t2i_v40", "task_id": "28022068-1df8-4ad2-a689-a77fa1abd094", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/31/1c5e8d1a01e56d7aaa269dd2c3314da1.png" } ] } ``` **多图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng_t2i_v40", "prompt": "将图1的服装换为图2的服装", "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png"], "size": "2304x1728", "strength": 0.5 }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "jimeng_t2i_v40", "task_id": "e0a62f2d-2a9c-4722-8924-99ea46aa9bed", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/31/b51d6423077f157f7685d13a5e86310e.png" } ] } ``` 即梦4.0 默认根据prompt理解意图生成数量: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "jimeng_t2i_v40", "prompt": "将图1的服装换为图2的服装,我需要生成两张图片", "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png"], "size": "2304x1728", "strength": 0.5, "extra_body": { "force_single": false, "min_ratio": 1, "max_ratio": 3 } }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "jimeng_t2i_v40", "task_id": "1a8995b4-089d-46bf-9364-917ba8dda1b0", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2025/12/31/14b0a934351648b3b0f0306edc6d5b95.png" }, { "url": "https://static.geekai.co/image/2025/12/31/9b8aef287a57aa473d894597f9e73eeb.png" } ] } ``` # Kling Image O1 Source: https://docs.geekai.co/cn/docs/image/kling/kling-image-o1 ### 模型参数 * 模型ID:`kling-image-o1` * 模型价格:你可以在[模型详情页](https://geekai.co/models/kling-image-o1)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持画图公共 API 中的以下参数: * `seed` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[可灵画图 O1 官方 API 文档](https://klingai.com/document-api/api/image/o1/image-generation) 支持的 `aspect_ratio` 取值范围如下: * 1:1 * 16:9 * 4:3 * 3:2 * 2:3 * 3:4 * 9:16 * 21:9 支持通过 `size` 替代官方的 `resolution` 参数来控制生成图像的分辨率,`size` 的取值范围: * `1k`,默认值 * `2k` 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`。 ### 文生图 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-o1", "prompt": "画一只可爱的小猫", "aspect_ratio": "4:3", "n": 1, }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "5b36a98e-e202-43f8-8a28-cecdc83020b8", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/15/c07071e78203f406b0a607a2120adc11.png" } ], "created": 1768456368 } ``` 如果你想要生成多张图像,可以通过 `n` 参数来指定生成的图像数量,最大值为 9。 ### 图生图 **单图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-o1", "prompt": "将图中女生的服装颜色变为绿色", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "aspect_ratio": "16:9" }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "72580c6b-7733-4fbb-9661-f50c0e25280a", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/21/d5c09e54706a09cbb6271236e9d95fe1.png" } ], "created": 1768987803 } ``` **多图参考生图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-o1", "prompt": "将图2女生的服装换为图1女生的服装", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png", ], "aspect_ratio": "16:9" }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "f48dea70-364a-4d57-8412-85b4c1528c02", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/20/146eb9ad496351cbaf9b7554ac08f06f.png" } ], "created": 1768892618 } ``` 图片要求: * 支持传入图片 Base64 编码或图片 URL(确保可访问) * 图片格式支持 .jpg / .jpeg / .png * 图片文件大小不能超过 10MB,图片宽高尺寸不小于 300px,图片宽高比要在 1:2.5 \~ 2.5:1 之间 * 最多支持传入 10 张参考图 如果你想要[异步生图](https://docs.geekai.co/cn/docs/image/txt2img#%E5%BC%82%E6%AD%A5%E7%94%9F%E5%9B%BE),可以通过 `async` 参数来指定,取值范围是 `true` 和 `false`,默认值是 `false`。当你设置为 `true` 时,接口会立即返回一个任务 ID,你可以通过任务 ID 来查询生成结果。 # Kling Image 3.0 Source: https://docs.geekai.co/cn/docs/image/kling/kling-image-v3 ### 模型参数 * 模型ID:`kling-image-v3` * 模型价格:你可以在[模型详情页](https://geekai.co/models/kling-image-v3)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持画图公共 API 中的以下参数: * `seed` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[可灵画图 v3 官方 API 文档](https://app.klingai.com/cn/dev/document-api/apiReference/model/imageGeneration) 支持的 `aspect_ratio` 取值范围如下: * 1: * 16:9 * 4:3 * 3:2 * 2:3 * 3:4 * 9:16 * 21:9 支持通过 `size` 替代官方的 `resolution` 参数来控制生成图像的分辨率,`size` 的取值范围: * `1k`,默认值 * `2k` 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`。 ### 文生图 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-v3", "prompt": "画一只可爱的小猫", "negative_prompt": "低质量", "aspect_ratio": "4:3", "n": 1, }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "5b36a98e-e202-43f8-8a28-cecdc83020b8", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/15/c07071e78203f406b0a607a2120adc11.png" } ] } ``` 如果你想要生成多张图像,可以通过 `n` 参数来指定生成的图像数量,最大值为 9。 ### 图生图 **单图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-v3", "prompt": "将图中女生的服装颜色变为绿色", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "aspect_ratio": "16:9" }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "72580c6b-7733-4fbb-9661-f50c0e25280a", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/21/d5c09e54706a09cbb6271236e9d95fe1.png" } ] } ``` 图片要求: * 支持传入图片 Base64 编码或图片 URL(确保可访问) * 图片格式支持 .jpg / .jpeg / .png * 图片文件大小不能超过 10MB,图片宽高尺寸不小于 300px,图片宽高比要在 1:2.5 \~ 2.5:1 之间 * 最多支持传入 1 张参考图 # Kling Image 3.0 Omni Source: https://docs.geekai.co/cn/docs/image/kling/kling-image-v3-omni ### 模型参数 * 模型ID:`kling-image-v3-omni` * 模型价格:你可以在[模型详情页](https://geekai.co/models/kling-image-v3-omni)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持画图公共 API 中的以下参数: * `seed` * `quality` * `style_preset` * `response_format` * `output_format` * `mask` * `background` 附:[可灵画图 3.0 Omni 官方 API 文档](https://klingai.com/document-api/api/image/3-0-omni/image-omni) 支持的 `aspect_ratio` 取值范围如下: * 1:1 * 16:9 * 4:3 * 3:2 * 2:3 * 3:4 * 9:16 * 21:9 支持通过 `size` 替代官方的 `resolution` 参数来控制生成图像的分辨率,`size` 的取值范围: * `1k`,默认值 * `2k` * `4k` 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`。 ### 模型价格 Kling Image 3.0 Omni 支持 1K、2K、4K 等多种分辨率图片生成,不同分辨率对应的价格不同,以下是价格表: | 分辨率 | 价格(单位:元/张) | | --- | ---------- | | 1K | 0.2 | | 2K | 0.2 | | 4K | 0.4 | 1K、2K 分辨率价格一样,4K 是 1K 基准价格的约 2 倍。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用Pro通道为例,折扣值是 `0.8`,那么生成一张 `size` 为 `4K` 的图片价格是 `0.4 x 0.8 = 0.32` 元,其他参数依次类推。 ### 文生图 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-v3-omni", "prompt": "画一只可爱的小猫", "aspect_ratio": "4:3", "n": 1, }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "5b36a98e-e202-43f8-8a28-cecdc83020b8", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/15/c07071e78203f406b0a607a2120adc11.png" } ], "created": 1768456368 } ``` 如果你想要生成多张图像,可以通过 `n` 参数来指定生成的图像数量,最大值为 9。 ### 图生图 **单图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-v3-omni", "prompt": "将图中女生的服装颜色变为绿色", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "aspect_ratio": "16:9" }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "72580c6b-7733-4fbb-9661-f50c0e25280a", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/21/d5c09e54706a09cbb6271236e9d95fe1.png" } ], "created": 1768987803 } ``` **多图参考生图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-image-v3-omni", "prompt": "将图2女生的服装换为图1女生的服装", "image": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png", ], "aspect_ratio": "16:9" }' ``` 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "task_id": "f48dea70-364a-4d57-8412-85b4c1528c02", "task_status": "succeed", "data": [ { "url": "https://static.geekai.co/image/2026/01/20/146eb9ad496351cbaf9b7554ac08f06f.png" } ], "created": 1768892618 } ``` 图片要求: * 支持传入图片 Base64 编码或图片 URL(确保可访问) * 图片格式支持 .jpg / .jpeg / .png * 图片文件大小不能超过 10MB,图片宽高尺寸不小于 300px,图片宽高比要在 1:2.5 \~ 2.5:1 之间 * 最多支持传入 10 张参考图 如果你想要[异步生图](https://docs.geekai.co/cn/docs/image/txt2img#%E5%BC%82%E6%AD%A5%E7%94%9F%E5%9B%BE),可以通过 `async` 参数来指定,取值范围是 `true` 和 `false`,默认值是 `false`。当你设置为 `true` 时,接口会立即返回一个任务 ID,你可以通过任务 ID 来查询生成结果。 # 模型选择 Source: https://docs.geekai.co/cn/docs/image/model 目前极客智坊支持包括 OpenAI、Google、Doubao、Kling 等平台在内的所有主流画图模型,你可以在[模型广场](https://geekai.co/models)通过筛选/搜索查看所有画图模型,并拷贝模型名称用于 API 调用: ![复制画图模型名称](https://static.geekai.co/storage/2025/04/02/image-20250402215550243.png) 如果你想要进一步区分不同模型,可以通过模型分类、功能、上下文、价格、平台标签进行进一步筛选,比如想要进行以图生图,则需要筛选出支持图片识别的画图模型: ![支持以图生图的模型](https://static.geekai.co/storage/2025/04/02/image-20250402215757044.png) 依次类推,你可以根据自己的需求筛选出最适合的画图模型进行调用。 # GPT-Image-1 Source: https://docs.geekai.co/cn/docs/image/openai/gpt-image-1 GPT Image 1 是 OpenAI 的图像生成模型,它是一个原生的多模态语言模型,既能接收文本和图像输入,也能生成图像输出。 另外,GPT-Image-1 还有一个低价经济版本 `gpt-image-1-mini`, 调用方式和 GPT-Image-1 完全一样,不再单独列举,在本教程演示示例中将模型名称替换即可。 ### 模型参数 * 模型ID:`gpt-image-1`/`gpt-image-1-mini` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=openai\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图公共 API 中的以下参数: * `negative_prompt` * `seed` * `strength` * `aspect_ratio` * `style_preset` 附:[GPT-Image-1 官方 API 文档](https://platform.openai.com/docs/guides/image-generation) GPT-Image-1 支持的 `size` 尺寸如下: * `1024x1024` * `1024x1536` * `1536x1024` ### 模型价格 不同尺寸和质量对应的价格不同,以下是 GPT-Image-1 的价格表: | 质量(quality) | 尺寸(size) | 价格(单位:元/张) | | ----------- | --------- | ---------- | | low | 1024x1024 | 0.095 | | low | 1024x1536 | 0.126 | | low | 1536x1024 | 0.126 | | medium | 1024x1024 | 0.315 | | medium | 1024x1536 | 0.473 | | medium | 1536x1024 | 0.473 | | high | 1024x1024 | 1.26 | | high | 1024x1536 | 1.89 | | high | 1536x1024 | 1.89 | GPT-Image-1 模型参数默认值 `quality` 是 `medium`,`size` 是 `1024x1024`。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用默认通道为例,折扣值是 `0.5`,那么生成一张 `size` 为 `1024x1024`、`quality` 为 `medium` 的图片价格是 `0.315 x 0.5 = 0.158` 元,如果生成同样尺寸但 `quality` 为 `high` 的图片价格是 `1.26 x 0.5 = 0.63` 元。其他参数依次类推。 GPT-Image-1 mini 的价格表如下: | 质量(quality) | 尺寸(size) | 价格(单位:元/张) | | ----------- | --------- | ---------- | | low | 1024x1024 | 0.041 | | low | 1024x1536 | 0.049 | | low | 1536x1024 | 0.049 | | medium | 1024x1024 | 0.082 | | medium | 1024x1536 | 0.123 | | medium | 1536x1024 | 0.123 | | high | 1024x1024 | 0.287 | | high | 1024x1536 | 0.410 | | high | 1536x1024 | 0.410 | GPT-Image-1 mini 模型参数默认值和 GPT-Image-1 一样,`quality` 是 `medium`,`size` 是 `1024x1024`,渠道代理价格计算也和 GPT-Image-1 一样,只需将价格表x对应的折扣值乘以即可。 ### 文生图片 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-1", "prompt":"画一只可爱的小猫在草丛中玩耍" }' ``` ### 以图生图 **单图** 基于已有图片,结合文字指令进行图像编辑,生成新的图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-1", "prompt":"修复这张破损的照片", "image":"https://static.geekai.co/storage/2025/04/02/broken-picture.jpg" }' ``` **多图** 基于多张参考图片,融合它们的风格、元素等特征来生成新图像,如衣裤鞋帽与模特图融合成穿搭图,人物与风景融合为人物风景图等: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-1", "prompt": "将图1中的面料应用至图2的服装上,图片比例按照图2来", "image": [ "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg", "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg" ] "quality": "high" }' ``` 注意,GPT-Image-1 支持图片编辑接口,要借助图片编辑接口实现图生图功能,请参考[图片编辑文档](https://docs.geekai.co/cn/docs/image/edit)。 ### 异步任务 对于高质量耗时图片任务,建议通过极客智坊提供的异步任务模式生成图像。 [画图 API](https://docs.geekai.co/cn/api/image/generations) 中的 `async` 参数用于控制是否异步生成图像,默认为 `false`,表示创建图像接口会同步等待图像生成完毕并返回。如果设置为 `true`,则会异步生成图像并返回任务ID,你可以使用该任务ID轮询图像生成状态。 # GPT-Image-1.5 Source: https://docs.geekai.co/cn/docs/image/openai/gpt-image-1.5 GPT Image 1.5 是 OpenAI 最新推出的图像生成模型,能够更准确地理解和执行指令。 ### 模型参数 * 模型ID:`gpt-image-1.5` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=openai\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图公共 API 中的以下参数: * `negative_prompt` * `seed` * `strength` * `aspect_ratio` * `style_preset` 附:[GPT-Image-1.5 官方 API 文档](https://developers.openai.com/api/docs/guides/image-generation) GPT-Image-1.5 支持的 `size` 尺寸如下: * `1024x1024` * `1024x1536` * `1536x1024` ### 模型价格 不同尺寸和质量对应的价格不同,以下是 GPT-Image-1.5 的价格表: | 质量(quality) | 尺寸(size) | 价格(单位:元/张) | | ----------- | --------- | ---------- | | low | 1024x1024 | 0.077 | | low | 1024x1536 | 0.102 | | low | 1536x1024 | 0.102 | | medium | 1024x1024 | 0.255 | | medium | 1024x1536 | 0.383 | | medium | 1536x1024 | 0.383 | | high | 1024x1024 | 1.02 | | high | 1024x1536 | 1.53 | | high | 1536x1024 | 1.53 | GPT-Image-1.5 模型参数默认值 `quality` 是 `medium`,`size` 是 `1024x1024`。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用默认通道为例,折扣值是 `0.5`,那么生成一张 `size` 为 `1024x1024`、`quality` 为 `medium` 的图片价格是 `0.255 x 0.5 = 0.128` 元,如果生成同样尺寸但 `quality` 为 `high` 的图片价格是 `1.02 x 0.5 = 0.51` 元。其他参数依次类推。 ### 文生图片 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-1.5", "prompt":"画一只可爱的小猫在草丛中玩耍" }' ``` ### 以图生图 **单图** 基于已有图片,结合文字指令进行图像编辑,生成新的图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-1.5", "prompt":"修复这张破损的照片", "image":"https://static.geekai.co/storage/2025/04/02/broken-picture.jpg" }' ``` `image` 参数支持传入图片链接或图片的 Base64 编码字符串。 **多图** 基于多张参考图片,融合它们的风格、元素等特征来生成新图像,如衣裤鞋帽与模特图融合成穿搭图,人物与风景融合为人物风景图等: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-1.5", "prompt": "将图1中的面料应用至图2的服装上,图片比例按照图2来", "image": [ "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg", "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg" ], "quality": "high", "background": "auto", "output_format": "png", "response_format": "url", "async": true }' ``` 注意,GPT-Image-1.5 支持图片编辑接口,要借助图片编辑接口实现图生图功能,请参考[图片编辑文档](https://docs.geekai.co/cn/docs/image/edit)。 对于耗时生图任务,可以通过设置 `async` 参数为 `true` 开启异步任务模式。异步任务模式下,画图接口会返回一个 `task_id`,你可以通过轮询 `https://geekai.co/api/v1/images/{task_id}` 来获取图像生成的最新状态,当任务完成后即可获得最终的图像URL,相关细节请参考[异步生图](https://docs.geekai.co/cn/docs/image/txt2img#异步生图)。 # GPT-Image-2 Source: https://docs.geekai.co/cn/docs/image/openai/gpt-image-2 GPT Image 2 是 OpenAI 推出的领先图像生成模型,能够快速生成和编辑高质量图像,它支持多种图像尺寸和高保真度的图像输入,支持文生图、图生图。 ### 模型参数 * 模型ID:`gpt-image-2` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=openai\&type=image)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/images/generations` * 模型参数:参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持画图公共 API 中的以下参数: * `negative_prompt` * `seed` * `strength` * `aspect_ratio` * `style_preset` 附:[GPT-Image-2 官方 API 文档](https://developers.openai.com/api/docs/guides/image-generation) GPT-Image-2 的 `size` 值支持满足以下条件的任意尺寸: * 图片宽、高长度必须是 16 的倍数(整数); * 图片宽、高长度不得大于 3840 像素; * 图片像素总数必须在 655360 到 8294400 之间; * 图片宽高比不得大于 3:1。 ### 模型价格 不同尺寸和质量对应的价格不同,以下是 GPT-Image-2 的价格表: | 质量(quality) | 尺寸(size) | 价格(单位:元/张) | | ----------- | ------------- | ---------- | | low | 1024x1024 | 0.045 | | low | 1024x1536 | 0.036 | | low | 1536x1024 | 0.036 | | low | 2048x2048(2K) | 0.09 | | low | 2048x1152(2K) | 0.036 | | low | 3840x2160(4K) | 0.084 | | low | 2160x3840(4K) | 0.084 | | medium | 1024x1024 | 0.398 | | medium | 1024x1536 | 0.311 | | medium | 1536x1024 | 0.311 | | medium | 2048x2048(2K) | 0.808 | | medium | 2048x1152(2K) | 0.32 | | medium | 3840x2160(4K) | 0.755 | | medium | 2160x3840(4K) | 0.755 | | high | 1024x1024 | 1.59 | | high | 1024x1536 | 1.24 | | high | 1536x1024 | 1.24 | | high | 2048x2048(2K) | 3.231 | | high | 2048x1152(2K) | 1.28 | | high | 3840x2160(4K) | 3.02 | | high | 2160x3840(4K) | 3.02 | 以上只是常见尺寸的价格示例,GPT-Image-2 支持的尺寸非常广泛,实际价格会根据你选择的具体尺寸和质量进行计算。 GPT-Image-2 模型参数默认值 `quality` 是 `medium`,`size` 是 `1024x1024`。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用默认通道为例,折扣值是 `0.5`,那么生成一张 `size` 为 `1024x1024`、`quality` 为 `medium` 的图片价格是 `0.398 x 0.5 = 0.199` 元,如果生成同样尺寸但 `quality` 为 `high` 的图片价格是 `1.586 x 0.5 = 0.793` 元。其他参数依次类推。 ### 文生图片 通过文字描述来生成对应图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-2", "prompt":"画一只可爱的小猫在草丛中玩耍" }' ``` ### 以图生图 **单图** 基于已有图片,结合文字指令进行图像编辑,生成新的图像: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-2", "prompt":"修复这张破损的照片", "image":"https://static.geekai.co/storage/2025/04/02/broken-picture.jpg" }' ``` 注意,GPT-Image-2 支持图片编辑接口,这里我们借助图片编辑接口实现图生图功能: ```bash json theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "gpt-image-2", "prompt": "修复这张破损的照片", "image": "https://static.geekai.co/storage/2025/04/02/broken-picture.jpg" }' ``` ```bash form theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --form 'model="gpt-image-2"' \ --form 'prompt="修复这张破损的照片"' \ --form 'image=@/path/to/your/local/image.jpg' ``` `image` 参数支持传入图片链接或图片的 Base64 编码字符串。 **多图** 基于多张参考图片,融合它们的风格、元素等特征来生成新图像,如衣裤鞋帽与模特图融合成穿搭图,人物与风景融合为人物风景图等: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-2", "prompt": "将图1中的面料应用至图2的服装上,图片比例按照图2来", "images": [ "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg", "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg" ], "quality": "high", "background": "auto", "output_format": "png", "response_format": "url", "async": true }' ``` 同样地,图片编辑接口也支持多图编辑: ```bash json theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "gpt-image-2", "prompt": "将图1中的面料应用至图2的服装上,图片比例按照图2来", "images": [ "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg", "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg" ], "quality": "high", "background": "auto", "output_format": "png", "response_format": "url", "async": true }' ``` ```bash form theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/edits' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --form 'model="gpt-image-2"' \ --form 'prompt="将图1中的面料应用至图2的服装上,图片比例按照图2来"' \ --form 'image[]=@/path/to/your/local/image1.jpg' \ --form 'image[]=@/path/to/your/local/image2.jpg' ``` 对于耗时生图任务,可以通过设置 `async` 参数为 `true` 开启异步任务模式。异步任务模式下,画图接口会返回一个 `task_id`,你可以通过轮询 `https://geekai.co/api/v1/images/{task_id}` 来获取图像生成的最新状态,当任务完成后即可获得最终的图像URL,相关细节请参考[异步生图](https://docs.geekai.co/cn/docs/image/txt2img#异步生图)。 # 文生图 Source: https://docs.geekai.co/cn/docs/image/txt2img ### 文生图 你可以通过文本提示生成图片,文本提示可以是任何描述性的句子,模型会根据这些描述生成相应的图片: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-1", "prompt":"画一只可爱的小猫在草丛中玩耍" }' ``` ### 异步生图 画图操作默认是同步的,即请求会等待直到图片生成完成: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-2", "prompt":"画一只可爱的小猫在草丛中玩耍" }' ``` 如果你需要异步处理,可以在请求中添加 `async` 参数并将其设置为 `true`: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/images/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"gpt-image-2", "prompt":"画一只可爱的小猫在草丛中玩耍", "async": true }' ``` 对于异步生成的图片,你需要使用返回的任务 ID 来查询生成状态和获取图片结果: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/images/{task_id}' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 一旦任务状态为 `succeed`,你就可以获取到生成的图片 URL。 更多画图 API 参数细节,请参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations)。 # 平台简介 Source: https://docs.geekai.co/cn/docs/introduction 极客智坊与 OpenRouter 类似,提供 AI 模型聚合调度服务,不同之处在于我们可以提供更低价格渠道、不限速率的免费模型调用、以及除对话之外的更多品类 AI 模型支持,包括画图、视频、语音、向量化、搜索等。 极客智坊致力于**构建多快好省的企业级统一 AI 模型智能调度平台**,愿景是为用户提供低成本、高可用的 Serverless AI 算力服务。这里有必要解释一下这个多、快、好、省的具体含义: * **多**:极客智坊引入了对主流 AI 平台数百个 AI 模型的支持,目前已涵盖对话、画图、语音、视频、向量化、搜索等多个品类,从而让开发者可以在一个平台通过一个账号调用所有 AI 模型; * **快**:极客智坊通过线路预判、就近调用、负载均衡、自动扩容等方式从不同层面立体式提升 AI 模型调度的并发与访问速度,让开发者没有 AI 模型服务中间件性能层面的后顾之忧; * **好**:极客智坊将以匠心态度持续为开发者以更低成本使用 AI 模型、构建 AI 应用提供专业优质的工具与平台服务,让大家用的省心、用的放心; * **省**:省有两个层面 —— 一个是技术学习与维护成本:开发者可以在极客智坊平台以同一账号同一格式调用数百个 AI 模型,极大省去了不同平台注册账号、充值续费、API 调用的学习与维护成本;另一个是实打实的 API 调用成本:极客智坊底层模型代理引擎通过负载均衡算法从多个维度(供应商、优先级、价格、可用性)实时动态选择最佳节点提供 AI 模型服务,切实降低开发者调用 AI 模型 API 的财务成本,目前已经支持 OpenAI、Claude、Gemini、DeepSeek、Grok、智谱清言、豆包等多个平台的低价模型代理服务,这样一来,开发者就可以以低成本甚至零成本构建 AI 应用。 极客智坊模型代理接口所有请求参数和响应数据格式和 OpenAI 兼容,从而适配绝大部分 AI 工具,也就是说,支持配置 OpenAI API 的工具/客户端都可以使用极客智坊 API 作为平替,且价格更低,并发更高(关于模型价格明细请参考[模型广场](https://geekai.co/models)上列出的模型价格)。 对于开发者而言,你还可以通过极客智坊 AI 模型代理 API 以更低价格、更简单的上手方式构建自己的AI应用,无需再去各个平台注册账号、充值、学习不同平台 API 调用方式以及后续的 Token 消耗管理。 **极客智坊如何做到比官方更便宜、更高可用性?** 极客智坊底层通过接入多个模型供应商(包括官方/第三方云服务)来保持价格始终处于业界最低水平,并且通过线路预判、就近调用、负载均衡算法在低价和可用性之间动态选择最优链路为您的 AI 业务保驾护航,当一个模型供应商渠道不可用,会自动切换到下一个可用供应商,从而让客户&开发者始终能够以更低成本、更高可用性享受到 AI 带来的便利。 # 创建消息 Source: https://docs.geekai.co/cn/docs/message/create Message API 是 Anthropic Claude 模型原生对话生成接口,支持文本和图像输入,输出文本内容。通过内置工具还可以扩展模型能力,包括文件搜索、联网查询、计算机使用等功能,借助函数调用功能,还允许模型访问外部系统和数据。 以下是最简单最基础的 Message API 请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/messages' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "claude-sonnet-4-20250514", "max_tokens": 1024, "messages": [ {"role": "user", "content": "你好"} ] }' ``` ```bash python theme={null} # 先安装 Anthropic SDK: `pip install anthropic` import anthropic client = anthropic.Anthropic( auth_token="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1" ) message = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[ {"role": "user", "content": "你好"} ] ) print(message.content) ``` ```bash javascript theme={null} # 先安装 Anthropic SDK: `npm install @anthropic-ai/sdk` import Anthropic from "@anthropic-ai/sdk"; const anthropic = new Anthropic({ baseURL: "https://geekai.co/api/v1", authToken: "$GEEKAI_API_KEY" }); const msg = await anthropic.messages.create({ model: "claude-sonnet-4-20250514", max_tokens: 1024, messages: [{ role: "user", content: "你好" }], }); console.log(msg); ``` ```bash go theme={null} # 先安装 Go SDK: `go get -u 'github.com/anthropics/anthropic-sdk-go@v1.6.2'` package main import ( "context" "fmt" "github.com/anthropics/anthropic-sdk-go" "github.com/anthropics/anthropic-sdk-go/option" ) func main() { client := anthropic.NewClient( option.WithBaseURL(baseURL), option.WithAuthToken(token), ) message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{ Model: anthropic.F(anthropic.ModelClaudeSonnet4_0), MaxTokens: anthropic.F(int64(1024)), Messages: anthropic.F([]anthropic.MessageParam{ anthropic.NewUserMessage(anthropic.NewTextBlock("你好")), }), Stream: anthropic.F(false), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", message.Content) } ``` # 流式响应 Source: https://docs.geekai.co/cn/docs/message/streaming 以下是 Message API 最简单的流式响应(边回答边输出)请求示例,只需要将 `stream` 设置为 `true` 即可: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/messages' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "claude-sonnet-4-20250514", "max_tokens": 1024, "messages": [ {"role": "user", "content": "你好"} ] "stream": true }' ``` \` ```bash python theme={null} # 先安装 Anthropic SDK: `pip install anthropic` import anthropic client = anthropic.Anthropic( auth_token="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1" ) message = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{"role": "user", "content": "你好"}], stream=True ) print(message.content) ``` ```bash javascript theme={null} # 先安装 Anthropic SDK: `npm install @anthropic-ai/sdk` import Anthropic from "@anthropic-ai/sdk"; const anthropic = new Anthropic({ baseURL: "https://geekai.co/api/v1", authToken: "$GEEKAI_API_KEY" }); const msg = await anthropic.messages.create({ model: "claude-sonnet-4-20250514", max_tokens: 1024, messages: [{ role: "user", content: "你好" }], stream: true }); console.log(msg); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]any{ "model": "gpt-4o-mini", "input": "你好", "stream": true, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 对于流式请求,需要在客户端接收响应时进行特殊处理才能获取到,以 JavaScript 为例,需要通过 `EventSource` 进行监听获取。 # 模型价格 Source: https://docs.geekai.co/cn/docs/model_price 极客智坊通过统一接口支持了数百个主流AI模型,所有模型价格可以直接在[模型广场](https://geekai.co/models)筛选查看: ![极客智坊 AI 模型代理低价渠道示例](https://static.geekai.co/storage/2025/10/13/image-20251013210525699.png) 低价代理渠道折扣适配 AI 模型所有功能和工具调用,包括缓存、语音、画图、搜索等。 为了贯彻**低成本、高可用**的理念,切实降低开发者使用 AI 模型开发 AI 应用的成本,我们为所有模型提供了代价代理渠道,目前极客智坊有七个代理渠道+调度策略组合可供选择: * 低价(1折) * 编程专线(2折) * 均衡(3折) * 编程专线Pro(4折) * 高可用(5折) * 高可用Pro(8折) * 官方直连(官方原价) 低价渠道适合测试、离线跑数据,编程专线适合AI编码场景,均衡渠道适合企业内部和个人日常使用,高可用渠道适合对稳定性要求较高的企业级应用场景,如在线 AI 应用,带Pro标识的则是对应渠道的优质高可用线路。 每个渠道支持的并发沿低价->高可用逐步提升,官方直连渠道并发最高但价格也最高。 代理渠道折扣和调用 API 时用于认证的 API KEY 绑定,你可以在 [API KEY 管理页面](https://geekai.co/user/api_keys)编辑对应的 API KEY 在不同代理渠道和调度策略间进行切换: ![修改极客智坊 API KEY 代理渠道](https://static.geekai.co/storage/2025/10/13/image-20251013192627496.png) 不是每个模型都配齐了所有代理渠道,具体支持情况请参考模型详情页上列出的模型渠道价格,如果某个模型没有 API KEY 配置的代理渠道,则会沿着低价->均衡->高可用->官方直连自动切换到下一个可用渠道,直到找到可用渠道。 # 首次调用API Source: https://docs.geekai.co/cn/docs/quick_start ## 快速开始 第三方应用可以通过 API 接口调用极客智坊聚合的所有 AI 模型,目前开放了 AI 模型代理、AI 搜索、文件对话和 OCR 服务,后续会逐步开放更多 AI 服务接口。 极客智坊 API 使用与 OpenAI 兼容的 API 格式,通过修改配置,您可以使用 OpenAI SDK 来访问极客智坊 API,或使用与 OpenAI API 兼容的软件(第三方应用接入):
参数
Base URL 国内版调用入口: `https://geekai.co/api/v1`
海外版调用入口: `https://geekai.dev/api/v1`
API KEY 国内版 API KEY:[https://geekai.co/user/api\_keys](https://geekai.co/user/api_keys)
海外版 API KEY:[https://geekai.dev/user/api\_keys](https://geekai.dev/user/api_keys)
API KEY 与代理渠道关联,不同渠道对应不同折扣值,可通过编辑 API KEY 切换。
极客智坊所有对话模型均兼容 OpenAI,包括 Claude、Gemini 在内,因此在 AI 对话模型场景,请使用 OpenAI 兼容模式创建供应商,执行 AI 模型代理时,将官方 BaseURL 和 API KEY 替换成极客智坊的 Base URL 和 API KEY 即可。 有时候 Base URL 不能带 `/v1` 后缀,尤其是在一些第三方应用中,此时需要根据实际情况调整 Base URL,如果带 `/v1` 后缀报错,不妨试试将其去掉。 调用 API 请自觉遵守国内法律法规,不要做危害国家安全的事情,如遇敏感词报错,请将 API 入口切换到 `https://geekai.dev`,需要注意的是,**国内版和国外版账号数据不通**,需要分别注册账号以及创建对应的 API KEY。 在创建&复制 API key 之后,你可以使用以下示例代码访问极客智坊 API。示例为非流式输出,您可以将 `stream` 设置为 `true` 来使用流式输出: ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GEEKAI_API_KEY" \ -d '{ "model": "gpt-5-mini", "messages": [ {"role": "system", "content": "你是一个智能助理"}, {"role": "user", "content": "你好"} ], "stream": false }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gpt-5-mini", messages=[ {"role": "system", "content": "你是一个智能助理"}, {"role": "user", "content": "你好"}, ], stream=False ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: "你是一个智能助理" }, { role: "user", content: "你好" }], model: "gpt-5-mini", }); console.log(completion.choices[0].message.content); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5-mini", "messages": []interface{}{ map[string]interface{}{ "role": "system", "content": "你是一个智能助理", }, map[string]interface{}{ "role": "user", "content": "你好", }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 流式输出的原理是 SSE(Server-Sent Events),当启用流式输出后,客户端代码需要适配流式输出,以前端代码为例,需要通过 `EventSource` 从服务端接收流式响应, 否则会报错。 ## 图片分析 如果你想要分析图片,可以使用以下示例代码: ```bash curl theme={null} curl https://geekai.co/api/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $GEEKAI_API_KEY" -d '{ "model": "gpt-5-mini", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "图片包含什么内容?" }, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/logo/geekai-logo-main-tr.png" } } ] } ] }' ``` ```bash python theme={null} from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.chat.completions.create( model="gpt-5-mini", messages=[ { "role": "user", "content": [ {"type": "text", "text": "图片包含什么内容?"}, { "type": "image_url", "image_url": { "url": "https://static.geekai.co/logo/geekai-logo-main-tr.png", }, }, ], } ] ) print(response.choices[0].message.content) ``` ```bash javascript theme={null} import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); const response = await openai.chat.completions.create({ model: "gpt-5-mini", messages: [ { role: "user", content: [ { type: "text", text: "图片包含什么内容?" }, { type: "image_url", image_url: { url: "https://static.geekai.co/logo/geekai-logo-main-tr.png", }, }, ], }, ], }); console.log(response.choices[0].message.content); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]interface{}{ "model": "gpt-5-mini", "messages": []interface{}{ map[string]interface{}{ "role": "user", "content": []interface{}{ map[string]interface{}{ "type": "text", "text": "图片包含什么内容?", }, map[string]interface{}{ "type": "image_url", "image_url": map[string]interface{}{ "url": "https://static.geekai.co/logo/geekai-logo-main-tr.png", }, }, }, }, } } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 只有支持图片识别的多模态模型才支持图片识别和分析,你可以在[模型广场](https://geekai.co/models)查看所有支持图片识别的模型。 ## 开发者群 调用过程中有任何问题,可以加入开发者群咨询,我们会第一时间为您解答: 极客智坊微信群 你可以在群里获悉极客智坊最新动态、技术分享、产品功能、API 使用等信息。 # 请求限速 Source: https://docs.geekai.co/cn/docs/rate_limits 极客智坊 API 不限制用户并发量,我们会尽力保证您所有请求的服务质量。 但请注意,当我们的服务器承受高流量压力时,您的请求发出后,可能需要等待一段时间才能获取服务器的响应。在这段时间里,您的 HTTP 请求会保持连接,并持续收到如下格式的返回内容: * 非流式请求:持续返回空行 * 流式请求:持续返回 SSE keep-alive 注释(: keep-alive) 这些内容不影响 OpenAI SDK 对响应的 JSON body 的解析。如果您在自己解析 HTTP 响应,请注意处理这些空行或注释。 # 创建响应 Source: https://docs.geekai.co/cn/docs/response/create Response API 是 OpenAI 最先进的模型响应生成接口,支持文本和图像输入,输出文本内容。通过内置工具还可以扩展模型能力,包括文件搜索、网络搜索、计算机使用等功能,借助函数调用功能,还允许模型访问外部系统和数据。 ### 文本消息 以下是最简单最基础的 Response API 请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "input": "你好" }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.responses.create( model="gpt-5-mini", input="你好" ) print(response) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const response = await openai.responses.create({ model: "gpt-5-mini", input: "你好" }); console.log(response); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]any{ "model": "gpt-5-mini", "input": "你好", } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 如果以数组形式传入多条消息,对应示例如下: ```bash single_text theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "input": [ { "type": "message", "role": "user", "content": "你好" } ] }' ``` ```bash content_list theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "input": [ { "type": "message", "role": "user", "content": [ { "type": "input_text", "text": "你好" } ] } ] }' ``` 和 Chat Completion API 不同的是,需要在 Response API 的 `role` 同一级中显式指定消息的 `type` 字段,一般为 `message`。 ### 支持的模型 适用于所支持 Response API 的模型,目前支持 Response API 的模型是: * `gpt-3.5-turbo` * `gpt-4` * `gpt-4-turbo` * `gpt-4o-mini` * `gpt-4o` * `gpt-4.1` * `gpt-4.1-mini` * `gpt-4.1-nano` * `gpt-5` * `gpt-5-mini` * `gpt-5-nano` * `gpt-5-pro` * `gpt-5-codex` * `o1` * `o1-pro` * `o3-mini` * `o3` * `o3-pro` * `o4-mini` * `codex-mini-latest` * `computer-use-preview` * `o3-deep-research` * `o4-mini-deep-research` 其中 `o3-pro`、`o3-deep-research`、`o4-mini-deep-research`、`gpt-5-pro` 目前仅支持通过 Response API 调用,其他模型既支持 Response API 也支持 Chat Completion API。 # 图片分析 Source: https://docs.geekai.co/cn/docs/response/image 以下是包含图片识别分析的 Response API 请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "input": [ { "type": "message", "role": "user", "content": [ {"type": "input_text", "text": "图片中包含什么内容?"}, { "type": "input_image", "image_url": "https://static.geekai.co/logo/geekai-logo-main-tr.png" } ] } ] }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.responses.create( model="gpt-5-mini", input=[ { "type": "message", "role": "user", "content": [ {"type": "input_text", "text": "图片中包含什么内容?"}, { "type": "input_image", "image_url": "https://static.geekai.co/logo/geekai-logo-main-tr.png" } ] } ] ) print(response) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const response = await openai.responses.create({ model: "gpt-5-mini", input: [ { type: "message", role: "user", content: [ { type: "input_text", text: "图片中包含什么内容?" }, { type: "input_image", image_url: "https://static.geekai.co/logo/geekai-logo-main-tr.png" } ] } ] }); console.log(response); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]any{ "model": "gpt-5-mini", "input": []any{ map[string]any{ "type": "message", "role": "user", "content": []any{ map[string]any{"type": "input_text", "text": "图片中包含什么内容?"}, map[string]any{ "type": "input_image", "image_url": "https://static.geekai.co/logo/geekai-logo-main-tr.png", }, }, }, }, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 多张图片识别传入多个图片对象到 content 列表即可: ```bash theme={null} { "type": "message", "role": "user", "content": [ { "type": "input_text", "text": "找出两张图片中的不同点?" }, { "type": "input_image", "image_url": "https://static.geekai.co/storage/2025/05/14/image1.jpg" }, { "type": "input_image", "image_url": "https://static.geekai.co/storage/2025/05/14/image2.jpg" } ] } ``` # 图像生成 Source: https://docs.geekai.co/cn/docs/response/image_generation 你可以通过 OpenAI 内置的画图工具 `image_generation` 实现在对话中生成图像的功能,以下是图像生成的请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5", "input": "画一只可爱的小猫", "tools": [ { "type": "image_generation" } ] }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.responses.create( model="gpt-5", input="画一只可爱的小猫", tools=[ { "type": "image_generation" } ] ) print(response) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const response = await openai.responses.create({ model: "gpt-5", input: "画一只可爱的小猫", tools: [ { "type": "image_generation" } ] }); console.log(response); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]any{ "model": "gpt-5", "input": "画一只可爱的小猫", "tools": []any{ map[string]any{ "type": "image_generation" }, }, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 图像生成工具支持以下模型: * `gpt-5` * `gpt-5-nano` * `gpt-4.1` * `gpt-4.1-mini` * `gpt-4.1-nano` * `gpt-4o` * `gpt-4o-mini` * `o3` 图像生成过程始终使用 `gpt-image-1` 模型,所以会按照该模型生成图像费用收费,且支持 `gpt-image-1` 模型的所有参数: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-4.1", "input": "画一只可爱的小猫", "tools": [ { "type": "image_generation", "background": "transparent", "quality": "high" } ] }' ``` 不同尺寸不同质量图片收费倍率和官方一致。 # 推理模式 Source: https://docs.geekai.co/cn/docs/response/reasoning 在 OpenAI 中,推理模型默认开启推理模式,我们可以通过 Response API 的 `reasoning.effort` 参数配置推理的思考深度: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5", "input": "请给一个八十岁老太太解释什么是薛定谔的猫?", "reasoning": { "effort": "medium" } }' ``` `reasoning.effort` 可选值有 `minimal`、`low`、`medium`、`high`,目前仅 GPT-5 系列和 O 系列模型支持推理模式配置,其中 `gpt-5-pro` 默认配置值为 `high`,其他模型默认配置值为 `medium`。 # 远程MCP Source: https://docs.geekai.co/cn/docs/response/remote_mcp 极客智坊 Response API 允许 OpenAI 模型通过内置 `mcp` 工具使用远程 MCP 服务器来执行任务。 > 模型上下文协议(MCP)是一个开放协议,旨在标准化应用程序向 LLMs 提供工具和上下文的方式。Responses API 中的 MCP 工具使开发者能够让模型访问托管在远程 MCP 服务器上的工具。这些 MCP 服务器由互联网上的开发者和组织维护,它们将这些工具开放给 MCP 客户端使用,例如 Responses API。 以下是调用远程 MCP 的请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "tools": [ { "type": "mcp", "server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/mcp", "require_approval": "never" } ], "input": "2025年3月26日版本的MCP规范支持哪些传输协议?" }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.responses.create( model="gpt-5-mini", input="2025年3月26日版本的MCP规范支持哪些传输协议?", tools=[ { "type": "mcp", "server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/mcp", "require_approval": "never" } ] ) print(response) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const response = await openai.responses.create({ model: "gpt-5-mini", input: "2025年3月26日版本的MCP规范支持哪些传输协议?", tools: [ { type: "mcp", server_label: "deepwiki", server_url: "https://mcp.deepwiki.com/mcp", require_approval: "never" } ] }); console.log(response); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]any{ "model": "gpt-5-mini", "input": "2025年3月26日版本的MCP规范支持哪些传输协议?", "tools": []any{ map[string]any{ "type": "mcp", "server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/mcp", "require_approval": "never", }, }, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` MCP 工具仅适用于 Responses API,并支持我们所有的[支持 Response API 的模型](https://docs.geekai.co/cn/docs/response/create)。使用 MCP 工具时,您只需支付导入工具定义或进行工具调用所消耗的令牌费用,无需额外付费。 # 流式响应 Source: https://docs.geekai.co/cn/docs/response/streaming 以下是最简单的流式响应(边回答边输出)请求示例,只需要将 `stream` 设置为 `true` 即可: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "input": "你好", "stream": true }' ``` ````bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.responses.create( model="gpt-5-mini", input="你好", stream=True ) print(response) ```bash python # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.responses.create( model="gpt-5-mini", input="你好", stream=True ) print(response) ```` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const response = await openai.responses.create({ model: "gpt-5-mini", input: "你好", stream: true }); console.log(response); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]any{ "model": "gpt-5-mini", "input": "你好", "stream": true, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` 对于流式请求,需要在客户端接收响应时进行特殊处理才能获取到,以 JavaScript 为例,需要通过 `EventSource` 进行监听获取。 # 函数调用 Source: https://docs.geekai.co/cn/docs/response/tool_calls 函数调用的流程和对话完成接口类似,下面我们还是以获取当地天气为例,给出函数调用的 Response API 示例代码: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "input": "杭州今天天气如何?", "tools": [ { "type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. 浙江杭州" }, "unit": { "type": "string", "enum": ["℃", "℉"] } }, "required": ["location", "unit"] } } ], "tool_choice": "auto" }' ``` # 网页搜索 Source: https://docs.geekai.co/cn/docs/response/web_search 你可以通过 OpenAI 内置的联网工具 `web_search` 实现联网查询生成响应的功能,以下是联网响应的请求示例: ```bash curl theme={null} curl --location --request POST 'https://geekai.co/api/v1/responses' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "gpt-5-mini", "input": "2025年票房最高的电影?", "tools": [ { "type": "web_search", "search_context_size": "low" } ] }' ``` ```bash python theme={null} # 先安装 OpenAI SDK: `pip3 install openai` from openai import OpenAI client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1") response = client.responses.create( model="gpt-5-mini", input="2025年票房最高的电影?", tools=[ { "type": "web_search", "search_context_size": "low" } ] ) print(response) ``` ```bash javascript theme={null} // 先安装 OpenAI SDK: `npm install openai` import OpenAI from "openai"; const openai = new OpenAI({ baseURL: 'https://geekai.co/api/v1', apiKey: '$GEEKAI_API_KEY' }); async function main() { const response = await openai.responses.create({ model: "gpt-5-mini", input: "2025年票房最高的电影?", tools: [ { type: "web_search", search_context_size: "low" } ] }); console.log(response); } main(); ``` ```bash go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { requestBody := map[string]any{ "model": "gpt-5-mini", "input": "2025年票房最高的电影?", "tools": []any{ map[string]any{ "type": "web_search", "search_context_size": "low", }, }, } jsonData, err := json.Marshal(requestBody) if err != nil { panic(err) } client := &http.Client{} req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY") req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` `search_context_size` 参数可以设置为 `low`, `medium`, `high` 来控制搜索上下文的大小,不同搜索上下文参数对应的搜索收费倍率不一样。 联网搜索工具支持以下模型: * `gpt-5`(推理级别为 `minimal` 时不支持联网搜索) * `gpt-5-mini` * `gpt-4.1` * `gpt-4.1-mini` * `gpt-4o` * `gpt-4o-mini` * `o3` * `o4-mini` * `o3-pro` * `o3-deep-research` * `o4-mini-deep-research` # 温度设置 Source: https://docs.geekai.co/cn/docs/temperature 极客智坊 AI 模型代理服务支持通过温度参数(temperature)来调整模型生成文本的创造性,温度参数的值越高,生成的文本越有创造性,温度参数的值越低,生成的文本越保守, 一般来说文艺类温度参数较高,数理类温度参数越低,另外不同平台默认温度和温度参数范围也不一样,有些是\[0-1],比如 Claude,有些是\[0-2],比如 OpenAI、DeepSeek: * 温度参数区间在\[0-1]的 AI 平台:Claude、Cohere、智谱清言、文心一言、Kimi、豆包、百川、Mistral、MiniMax * 温度参数区间在\[0-2]的 AI 平台:OpenAI、DeepSeek、Gemini、通义千问、腾讯混元、零一万物、讯飞星火、微软 Phi、Grok、Llama、Nova 有些平台,比如文心一言/智谱清言温度值不能为 0,可以将对应的零值设置为 0.1。 ### 场景推荐值 以 DeepSeek 为例,其不同场景温度推荐值如下:
场景 推荐值
代码生成/数学解题 0
数据抽取/整理分析 1.0
通用对话 1.3
翻译任务 1.3
创意/写作/诗歌 1.5
### 模型默认值 其他主流模型默认温度值(对应通用对话场景)如下,不同场景配置请参考 DeepSeek 按比例调整(排名按平台首字母顺序):
平台 模型 默认值
阿里巴巴 通义千问系列 对话模型:0.7
视觉模型:0.01
Long/Omini系列:1.0
Amazon Nova系列 0.7
Anthropic Claude系列 1.0
百度 Ernie系列 0.95
Cohere Command系列 0.3
Google Gemini/Gemma系列 1.0
Meta Llama系列 0.5
Microsoft Phi系列 1.0
Mistral Mistral系列 Small:0.3
Large:0.7
Codestral:0.3
OpenAI GPT系列 1.0
Perplexity Sonar系列 0.2
腾讯 混元系列 1.0
xAI Grok系列 0.7
月之暗面 Kimi系列 0.3
智谱清言 GLM系列 对话模型:0.7
视觉模型:0.8
字节跳动 豆包系列 1.0
如果不设置温度参数,则会自动使用对应模型默认值。推理模型本身能根据问题自动判定温度值,因此大多数推理模型都不支持温度参数,也不需要设置。 # Token使用 Source: https://docs.geekai.co/cn/docs/token_usage 极客智坊提供了 [Token 成本计算器](https://geekai.co/token/costs)来帮助开发者预估消耗以更好地控制 API 调用成本,每次 API 调用也会返回消耗的 Token 数量,对应的数据结构和 OpenAI 对齐,支持缓存、推理、搜索消耗。 你也可以通过[账单记录](https://geekai.co/user/transactions)查看每次 API 调用的 Token 消耗和对应的费用。 # CogVideoX Source: https://docs.geekai.co/cn/docs/video/bigmodel/cogvideox CogVideoX是智谱的视频生成模型,是一类通过学习时序视觉数据,支持从文本、图像生成动态视频内容的模型,沉浸式AI音效,高清画质呈现,视频时长拓展,高帧率输出 ### 模型参数 * 模型ID:`cogvideox-2`/`cogvideox-flash`/`cogvideox` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bigmodel\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `image_tail` * `resolution` * `aspect_ratio` * `duration` 附:[CogVideoX 官方 API 文档](https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E8%A7%86%E9%A2%91%E7%94%9F%E6%88%90%E5%BC%82%E6%AD%A5#cogvideox) ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "cogvideox-flash", "prompt": "彼得兔开小汽车,游走在马路上,脸上的表情充满开心喜悦", "size": "1280x960", "quality": "quality", "with_audio": true, "fps": 30 }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "cogvideox-flash", "task_id": "a83d58e1-a590-4d58-a1a1-0378ae7efaa8", "task_status": "succeed", "video_result": [ { "id": "f87f9c36-2856-4c5c-89a6-cc6833a85ddc", "url": "https://static.geekai.co/video/2026/02/10/f536064e4248e8137b252472f61cea42.mp4" } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "cogvideox-flash", "prompt": "让画面动起来", "image": "https://img.iplaysoft.com/wp-content/uploads/2019/free-images/free_stock_photo.jpg", "size": "3840x2160", "quality": "quality", "with_audio": true, "wartermark": true }' ``` `cogvideox`和`cogvideox-2`同上面的`cogvideox-flash`,同时也支持Base64编码传入图片 # CogVideoX-3 Source: https://docs.geekai.co/cn/docs/video/bigmodel/cogvideox-3 CogVideoX-3 新增首尾帧生成功能,画面稳定度、清晰度大幅提升,主体大幅度运动流畅自然,指令遵循与物理真实模拟更佳,还提升了高清现实及 3D 风格场景表现。 推荐使用场景电商广告,文旅,动漫,影视剧或短视频的场景。 ### 模型参数 * 模型ID:`cogvideox-3` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bigmodel\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `image_tail` * `resolution` * `aspect_ratio` 附:[CogVideoX-3 官方 API 文档](https://docs.bigmodel.cn/cn/guide/models/video-generation/cogvideox-3) ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "cogvideox-3", "prompt": "A cat is playing with a ball.", "quality": "quality", "with_audio": true, "size": "1920x1080", "fps": 30 }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "cogvideox-3", "task_id": "036f6493-ee8f-49aa-ba8e-41ad672e5ff8", "task_status": "succeed", "video_result": [ { "id": "7f88690b-d50b-4c8e-992d-e226a7bb9ae8", "url": "https://static.geekai.co/video/2026/02/10/ef397d1604a74f426dd0916195c5f044.mp4" } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 **单张** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "cogvideox-3", "prompt": "让画面动起来", "image": "https://img.iplaysoft.com/wp-content/uploads/2019/free-images/free_stock_photo.jpg", "quality": "quality", "with_audio": true, "size": "1920x1080", "fps": 30 }' ``` **首尾帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "cogvideox-3", "prompt": "让画面动起来", "image": [ "https://cdn.bigmodel.cn/markdown/1752547801491cogvideo4.png", "https://cdn.bigmodel.cn/markdown/1752547813297cogvideo5.png" ] "quality": "speed", "with_audio": true, "size": "1920x1080", "fps": 30, }' ``` ```json theme={null} { "model": "cogvideox-3", "task_id": "500e61f7-dffc-47cd-8bca-ef001e01042f", "task_status": "succeed", "video_result": [ { "id": "c2e95541-88f7-4cec-a9db-2a30b44021e3", "url": "https://static.geekai.co/video/2026/02/10/3fc62b4e065183b55443069936bf2ada.mp4" } ] } ``` # Vidu Q1 Source: https://docs.geekai.co/cn/docs/video/bigmodel/vidu-q1 Vidu Q1 是 Vidu 新一代视频生成大模型,聚焦高质量视频创作,固定输出 5 秒、24 帧、1080P 规格内容。凭借对清晰度的深度优化,画质质感大幅跃升,手部穿模、画面抖动等问题显著改善;写实风格逼近真实场景,2D 动画画风精准保持,首尾帧转场更加丝滑,适用于影视、广告、动漫短剧等高要求创作场景。 ### 模型参数 * 模型ID:`vidu-q1` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bigmodel\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `image_tail` * `resolution` * `quality` * `fps` * `watermark` 附:[Vidu Q1 官方 API 文档](https://docs.bigmodel.cn/cn/guide/models/video-generation/viduq1) 只有文生视频才支持`aspect_ratio`这个参数,可选值为:16:9, 9:16, 1:1 同样支持Base64 编码的图像,在image里面ge'字段中填写图片的base64编码即可 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "vidu-q1", "prompt": "彼得兔开小汽车,游走在马路上,脸上的表情充满开心喜悦", "size": "1920x1080", "aspect_ratio": "16:9", "extra_body": { "style": "anime", "movement_amplitude": "auto" } }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "vidu-q1", "task_id": "3a9faeae-0a7c-4a34-81d1-72b81e759d44", "task_status": "succeed", "video_result": [ { "id": "aa26c3e7-6afa-426d-87d4-dbe4fceeaac2", "url": "https://static.geekai.co/video/2026/02/24/b8c128e5ba1945a717be1c5a40a2df4f.mp4" } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "vidu-q1", "prompt": "无人机以极快速度穿越复杂障碍或自然奇观,带来沉浸式飞行体验", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_i2v.png", "size": "1920x1080", "extra_body": { "movement_amplitude": "auto" } }' ``` ### 首尾帧 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "vidu-q1", "prompt": "让画面动起来", "image": [ "https://cdn.bigmodel.cn/markdown/1752547801491cogvideo4.png", "https://cdn.bigmodel.cn/markdown/1752547813297cogvideo5.png" ], "size": "1920x1080", "with_audio": true, "extra_body": { "movement_amplitude": "auto" } }' ``` # Vidu 2 Source: https://docs.geekai.co/cn/docs/video/bigmodel/vidu2 Vidu 2 视频生成大模型,平衡速度与质量,主攻图生视频、首尾帧功能,支持 4 秒时长下 720P 分辨率输出。生成速度大幅提升,成本显著降低;图生视频修复变色问题,画面稳定可控适配电商等场景,首尾帧语义理解与多参考图一致性增强,成为泛娱乐、互联网、动漫短剧、广告量产的高效工具。 ### 模型参数 * 模型ID:`vidu-2` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bigmodel\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `image_tail` * `resolution` * `quality` * `fps` * `watermark` 附:[Vidu 2 官方 API 文档](https://docs.bigmodel.cn/cn/guide/models/video-generation/vidu2) 只有参考生视频才支持`aspect_ratio`这个参数,可选值为:16:9, 9:16, 1:1 图生视频和参考生视频的size参数可选值为:1280x720; 首尾帧size参数可选值为:1280x720,480x360 同样支持Base64 编码的图像,在image里面ge'字段中填写图片的base64编码即可 ### 图生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "vidu-2", "prompt": "让画面动起来", "image": "https://img.iplaysoft.com/wp-content/uploads/2019/free-images/free_stock_photo.jpg", "size":"1280x720", "with_audio": true, "extra_body": { "movement_amplitude": "auto" } }' ``` 响应是一个 JSON 对象,包含生成图片的 URL: ```json theme={null} { "model": "vidu-2", "task_id": "cc8ba53a-2be5-4a1e-a5db-a224b69d5a49", "task_status": "succeed", "video_result": [ { "id": "2d394aa2-fef5-436d-9b72-2d783092fd78", "url": "https://static.geekai.co/video/2026/02/25/8951c2ef20d4d3477b2910a4c48aa6d7.mp4" } ] } ``` 下面视频生成响应结构是一样的,不再列举。 ### 首尾帧 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "vidu-2", "prompt": "让画面动起来", "image": ["https://cdn.bigmodel.cn/markdown/1752547801491cogvideo4.png", "https://cdn.bigmodel.cn/markdown/1752547813297cogvideo5.png"], "size": "1280x720", "with_audio": true, "extra_body": { "movement_amplitude": "auto" } }' ``` ### 参考生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "vidu-2", "prompt":"[图1]戴着眼镜穿着蓝色T恤的男生和[图2]的柯基小狗,坐在[图3]的草坪上,3D卡通风格", "image":[ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" ], "aspect_ratio": "16:9", "size": "1280x720", "with_audio": true, "extra_body": { "movement_amplitude": "auto" } }' ``` # Doubao-Seedance-1.0-Pro Source: https://docs.geekai.co/cn/docs/video/bytedance/doubao-seedance-1.0-pro Seedance 1.0 pro 视频生成模型具备出色的语义理解能力,可根据用户输入的文本、图片等内容,快速生成优质的视频片段。 Seedance 1.0 pro fast 是一款价格触底、效能封顶的全面模型,在视频生成质量、速度、成本之间取得了卓越平衡。它在继承 Seedance 1.0 pro 模型核心优势的基础上,生成速度较 Seedance 1.0 pro 最高提升约 3倍,价格直降72%,为创作者带来效率与成本双重优化的体验。 调用 API 时请注意,Seedance 1.0 pro fast 仅支持首帧图和文字描述生成视频,不支持多参考图和首尾帧生成视频,其他参数与 Seedance 1.0 pro 完全一致。 ### 模型参数 * 模型ID:`doubao-seedance-1.0-pro`/`doubao-seedance-1.0-pro-fast` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `with_audio` * `size` * `quality` 附:[Seedance 1.0 Pro 官方 API 文档](https://www.volcengine.com/docs/82379/1366799) Doubao-Seedance-1.0 Pro 官方 API 参数与极客智坊视频 API 参数差异较大,下面是如何通过极客智坊视频 API 调用 Doubao-Seedance-1.0 Pro 的说明: 通过视频 API 的 `prompt` + `image` + `image_tail` 传值,极客智坊会自动将其组装为 `doubao-seedance-1.0-pro` 的 `content` 参数: * `prompt`:文本描述 * `image`:如果是字符串则作为首帧参考图传入,如果是数组则作为多张参考图传入(使用参考图时不要设置 `image_tail`,目前仅 `doubao-seedance-1.0-lite-i2v` 模型支持参考图) * `image_tail`:尾帧参考图(`doubao-seedance-1.0-pro-fast` 不支持该参数) 所有图片均支持传入图片 URL 或者 Base64 编码的图片数据。 对于其他模型参数,你可以按照官方 API 文档中介绍的那样通过在文本提示词后追加 `--[parameters]` ,控制视频输出的规格,包括宽高比、帧率、分辨率等: ```markdown theme={null} 小猫对着镜头打哈欠。 --rs 720p --rt 16:9 --dur 5 --fps 24 --wm true --seed 11 --cf false ``` 也可以通过极客智坊视频 API 参数显式传递,极客智坊底层调用时会自动将其追加到文本提示词 prompt 后面作为文本指令: * `resolution`:分辨率,支持 `480p`、`720p`(默认值)、`1080p` * `aspect_ratio`:宽高比,支持 `1:1`、`3:4`、`4:3`、`16:9`、`9:16`、 `21:9`、`keep_ratio`(与参考图保持一致)、 `adaptive`(自动选择合适的宽高比,默认值) * `duration`:生成视频时长,单位:秒,支持 `3~12` 秒,默认 `5` 秒 * `fps`:帧率,支持 `16`、`24`,默认 `24` * `camerafixed`:是否固定摄像机位置,支持 `true`、`false`(默认值) * `watermark`:是否添加水印,支持 `true`、`false`(默认值) * `seed`:随机种子,取值范围 `[-1, 2^32-1]`,默认值是 `-1` ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedance-1.0-pro", "prompt":"小猫对着镜头打哈欠。 --rs 720p --rt 16:9 --dur 5 --fps 24 --wm true --seed 11 --cf false" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "doubao-seedance-1.0-pro", "task_id": "7ea610cc-5f50-4ab7-a0ad-9894032ef92a", "task_status": "succeed", "video_result": [ { "url": "https://static.geekai.co/video/2025/10/14/6340d3eb8ac3c0d9f21ae6dacba72327.mp4", "duration": 5.042 } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 **首帧** 通过 `image` 传入单图即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedance-1.0-pro-fast", "prompt":"女孩抱着狐狸,女孩睁开眼,温柔地看向镜头,狐狸友善地抱着,镜头缓缓拉出,女孩的头发被风吹动 --wm true --dur 5", "image":"https://ark-project.tos-cn-beijing.volces.com/doc_image/i2v_foxrgirl.png" }' ``` `doubao-seedance-1.0-pro`、`doubao-seedance-1.0-pro-fast`、`doubao-seedance-1.0-lite-i2v` 等支持图生视频的模型均支持该功能。 **首尾帧** 通过 `image` + `image_tail` 传入首尾两张图即可实现基于首尾帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedance-1.0-pro", "prompt":"360度环绕运镜", "image":"https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_first_frame.jpeg", "image_tail":"https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_last_frame.jpeg" }' ``` `doubao-seedance-1.0-pro-fast` 模型不支持该功能。 **参考图** 通过 `image` 传入多张图即可实现基于多张参考图生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedance-1.0-lite-i2v", "prompt":"[图1]戴着眼镜穿着蓝色T恤的男生和[图2]的柯基小狗,坐在[图3]的草坪上,3D卡通风格", "image":[ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" ] }' ``` 仅 `doubao-seedance-1.0-lite-i2v` 模型支持该功能。 ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的通用异步方式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务),流程完全一样。 # Doubao-Seedance-1.5-Pro Source: https://docs.geekai.co/cn/docs/video/bytedance/doubao-seedance-1.5-pro Seedance 1.5 pro 是豆包大模型团队推出的新一代专业级音画同生视频模型。它在继承前代多镜头叙事与高清生成能力的基础上,原生支持音视频一体输出,致力于提供画面、人声、音乐、音效的全链路同步创作体验。同时,模型内置首尾帧功能,创作者只需设定视频的起始与结束画面,即可精准锁定视频的风格、构图与角色,并由此驱动模型生成帧间流畅自然的动态影像。音画同生,结合首尾帧控制,Seedance 1.5 pro显著提升了专业视频创作的效率、可控性与艺术表现力. ### 模型参数 * 模型ID:`doubao-seedance-1.5-pro` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `size` * `quality` 附:[Seedance 1.5 Pro 官方 API 文档](https://www.volcengine.com/docs/82379/1366799) 下面是如何通过极客智坊视频 API 调用 Doubao-Seedance-1.5 Pro 的说明: 通过视频 API 的 `prompt` + `image` + `image_tail` 传值,极客智坊会自动将其组装为 `doubao-seedance-1.5-pro` 的 `content` 参数: * `prompt`:文本描述 * `image`:如果是字符串则作为首帧参考图传入,如果是数组则作为多张参考图传入 * `image_tail`:尾帧参考图 所有图片均支持传入图片 URL 或者 Base64 编码的图片数据。 对于其他模型参数,你可以按照官方 API 文档中介绍的那样通过在文本提示词后追加 `--[parameters]` ,控制视频输出的规格,包括宽高比、分辨率等: ```markdown theme={null} 小猫对着镜头打哈欠。 --rs 720p --rt 16:9 --dur 5 --wm true --seed 11 --cf false ``` 也可以通过极客智坊视频 API 参数显式传递,极客智坊底层调用时会自动将其追加到文本提示词 prompt 后面作为文本指令: * `resolution`:分辨率,支持 `480p`、`720p`(默认值)、`1080p` * `aspect_ratio`:宽高比,支持 `1:1`、`3:4`、`4:3`、`16:9`、`9:16`、 `21:9`、 `adaptive`(自动选择合适的宽高比,默认值) * `duration`:生成视频时长,单位:秒,支持 `4~12` 秒,默认 `5` 秒 * `camerafixed`:是否固定摄像机位置,支持 `true`、`false`(默认值) * `watermark`:是否添加水印,支持 `true`、`false`(默认值) * `seed`:随机种子,取值范围 `[-1, 2^32-1]`,默认值是 `-1` ### 模型价格 Seedance 1.5 pro 的价格按照生成视频的分辨率、时长和是否带有声音来计算,以下是价格速算表: | 模型 | 分辨率 | 声音 | 价格(单位:元/秒) | | ---------------- | ----- | -- | ---------- | | Seedance 1.5 pro | 480p | 无声 | 0.0875 | | Seedance 1.5 pro | 480p | 有声 | 0.175 | | Seedance 1.5 pro | 720p | 无声 | 0.175 | | Seedance 1.5 pro | 720p | 有声 | 0.35 | | Seedance 1.5 pro | 1080p | 无声 | 0.385 | | Seedance 1.5 pro | 1080p | 有声 | 0.77 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 5 秒 720p 有声标准视频价格是 `0.35 x 5 x 0.8 = 1.4` 元,其他参数依次类推。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedance-1.5-pro", "prompt":"小猫对着镜头打哈欠。 --rs 720p --rt 16:9 --dur 5 --wm true --seed 11 --cf false" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "doubao-seedance-1.5-pro", "task_id": "3151fb57-112e-4606-8063-7d784c84f99a", "task_status": "succeed", "video_result": [ { "url": "https://static.geekai.co/video/2026/01/26/6ac0a8d1502cb6ac5ceceb0acc639d53.mp4" } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 **首帧** 通过 `image` 传入单图即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedance-1.5-pro", "prompt":"无人机以极快速度穿越复杂障碍或自然奇观,带来沉浸式飞行体验", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_i2v.png", "watermark": false, }' ``` **首尾帧** 通过 `image` + `image_tail` 传入首尾两张图即可实现基于首尾帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"doubao-seedance-1.5-pro", "prompt":"360度环绕运镜", "prompt":"图中女孩对着镜头说\"茄子\",360度环绕运镜", "image":"https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_first_frame.jpeg", "image_tail":"https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_last_frame.jpeg", "watermark": false }' ``` ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的通用异步方式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务),流程完全一样。 # HappyHorse-1.0 Source: https://docs.geekai.co/cn/docs/video/dashscope/happyhorse-1.0 HappyHorse 1.0 支持文生视频、图生视频和视频编辑,具备高度还原的动态画面生成能力,能够精准理解文本语义,输出流畅自然、细节丰富的高质量视频。 ### 模型参数 * 模型ID:`happyhorse-1.0-t2v`/`happyhorse-1.0-i2v`/`happyhorse-1.0-r2v`/`happyhorse-1.0-video-edit` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `with_audio` * `size` * `quality` * `fps` * `audio` 附:[快乐马 vs. 万相2.7模型选择文档](https://bailian.console.aliyun.com/cn-beijing?spm=5176.29619931.J__Z58Z6CX7MY__Ll8p1ZOR.1.74cd59fcEkLe98\&tab=doc#/doc/?type=model\&url=3026921) HappyHorse 1.0 宽高比 `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` * `4:3` * `3:4` * `4:5` * `5:4` * `9:21` * `21:9` HappyHorse 1.0 支持的输出视频分辨率 `resolution` 值如下: * `720P` * `1080P`(默认值) 注意: 在使用 `resolution` 参数时,请确保分辨率中的P需要大写,如:`720P`,`1080P`(默认值)。 HappyHorse 1.0 支持的 `duration` 输出视频时长为 `3`-`15` 秒,默认值为 `5` 秒,输入参考视频支持时长为 `3`-`60` 秒。 ### 模型价格 HappyHorse 1.0 的价格按照生成视频的分辨率、时长来计算,以下是价格速算表: | 模型 | 分辨率 | 价格(单位:元/秒) | | --------------------------- | ----- | ---------- | | `happyhorse-1.0-t2v` | 720P | 0.9 | | `happyhorse-1.0-i2v` | 720P | 0.9 | | `happyhorse-1.0-r2v` | 720P | 0.9 | | `happyhorse-1.0-video-edit` | 720P | 0.9 | | `happyhorse-1.0-t2v` | 1080P | 1.6 | | `happyhorse-1.0-i2v` | 1080P | 1.6 | | `happyhorse-1.0-r2v` | 1080P | 1.6 | | `happyhorse-1.0-video-edit` | 1080P | 1.6 | 对于视频编辑模型 `happyhorse-1.0-video-edit`,输入视频和输出视频时长均参与计费,价格按照输出视频分辨率对应的单价计算。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 5 秒 720p 标准视频价格是 `0.9x5x0.8=3.6` 元,其他参数依次类推。 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "happyhorse-1.0-t2v", "prompt": "一段紧张刺激的侦探追查故事,展现电影级叙事能力。第1个镜头[0-3秒] 全景:雨夜的纽约街头,霓虹灯闪烁,一位身穿黑色风衣的侦探快步行走。 第2个镜头[3-6秒] 中景:侦探进入一栋老旧建筑,雨水打湿了他的外套,门在他身后缓缓关闭。 第3个镜头[6-9秒] 特写:侦探的眼神坚毅专注,远处传来警笛声,他微微皱眉思考。 第4个镜头[9-12秒] 中景:侦探在昏暗走廊中小心前行,手电筒照亮前方。 第5个镜头[12-15秒] 特写:侦探发现关键线索,脸上露出恍然大悟的表情。", "resolution": "720P", "aspect_ratio": "16:9", "async": true }' ``` ### 图生视频 **基于首帧** 传入图片到 `image` 字段即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "happyhorse-1.0-i2v", "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由rap构成,没有其他对话或杂音。", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png", "async": true }' ``` HappyHorse 1.0 目前仅支持首帧生视频,不支持首尾帧生视频。 ### 参考生视频 **参考图** 通过 `images` 传入一张或多张图即可实现基于参考图生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "happyhorse-1.0-r2v", "prompt": "@图1戴着眼镜穿着蓝色T恤的男生和@图2的柯基小狗,坐在@图3的草坪上,3D卡通风格", "images": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" ], "async": true }' ``` HappyHorse 1.0 参考生视频目前仅支持基于参考图片生成视频,不支持音视频参数。 ### 视频编辑 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"happyhorse-1.0-video-edit", "prompt": "将视频中女孩的衣服替换为图片中的衣服", "video": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260403/nlspwm/T2VA_22.mp4", "images": [ "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/fwjpqf/wan2.7-videoedit-change-clothes.png" ], "async": true }' ``` ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的通用异步方式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务),流程完全一样。 # HappyHorse-1.1 Source: https://docs.geekai.co/cn/docs/video/dashscope/happyhorse-1.1 HappyHorse 1.1 支持文生视频、首帧生视频和参考生视频,具备高度还原的动态画面生成能力,能够精准理解文本语义,输出流畅自然、细节丰富的高质量视频。 ### 模型参数 * 模型ID:`happyhorse-1.1-t2v`/`happyhorse-1.1-i2v`/`happyhorse-1.1-r2v` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `with_audio` * `size` * `quality` * `fps` * `audio` 附:[快乐马 vs. 万相2.7模型选择文档](https://bailian.console.aliyun.com/cn-beijing?spm=5176.29619931.J__Z58Z6CX7MY__Ll8p1ZOR.1.74cd59fcEkLe98\&tab=doc#/doc/?type=model\&url=3026921) HappyHorse 1.1 宽高比 `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` * `4:3` * `3:4` * `4:5` * `5:4` * `9:21` * `21:9` HappyHorse 1.1 支持的输出视频分辨率 `resolution` 值如下: * `720P` * `1080P`(默认值) 注意: 在使用 `resolution` 参数时,请确保分辨率中的P需要大写,如:`720P`,`1080P`(默认值)。 HappyHorse 1.1 支持的 `duration` 输出视频时长为 `3`-`15` 秒,默认值为 `5` 秒。 ### 模型价格 HappyHorse 1.1 的价格按照生成视频的分辨率、时长来计算,以下是价格速算表: | 模型 | 分辨率 | 价格(单位:元/秒) | | -------------------- | ----- | ---------- | | `happyhorse-1.1-t2v` | 720P | 0.9 | | `happyhorse-1.1-i2v` | 720P | 0.9 | | `happyhorse-1.1-r2v` | 720P | 0.9 | | `happyhorse-1.1-t2v` | 1080P | 1.2 | | `happyhorse-1.1-i2v` | 1080P | 1.2 | | `happyhorse-1.1-r2v` | 1080P | 1.2 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 5 秒 720p 标准视频价格是 `0.9x5x0.8=3.6` 元,其他参数依次类推。 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "happyhorse-1.1-t2v", "prompt": "一段紧张刺激的侦探追查故事,展现电影级叙事能力。第1个镜头[0-3秒] 全景:雨夜的纽约街头,霓虹灯闪烁,一位身穿黑色风衣的侦探快步行走。 第2个镜头[3-6秒] 中景:侦探进入一栋老旧建筑,雨水打湿了他的外套,门在他身后缓缓关闭。 第3个镜头[6-9秒] 特写:侦探的眼神坚毅专注,远处传来警笛声,他微微皱眉思考。 第4个镜头[9-12秒] 中景:侦探在昏暗走廊中小心前行,手电筒照亮前方。 第5个镜头[12-15秒] 特写:侦探发现关键线索,脸上露出恍然大悟的表情。", "resolution": "720P", "aspect_ratio": "16:9", "async": true }' ``` ### 图生视频 **基于首帧** 传入图片到 `image` 字段即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "happyhorse-1.1-i2v", "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由rap构成,没有其他对话或杂音。", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png", "async": true }' ``` HappyHorse 1.1 目前仅支持首帧生视频,不支持首尾帧生视频。 ### 参考生视频 **参考图** 通过 `images` 传入一张或多张图(支持1-9张)即可实现基于参考图生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "happyhorse-1.1-r2v", "prompt": "@图1戴着眼镜穿着蓝色T恤的男生和@图2的柯基小狗,坐在@图3的草坪上,3D卡通风格", "images": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" ], "async": true }' ``` HappyHorse 1.1 参考生视频目前仅支持基于参考图片生成视频,不支持音视频参数。 ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的通用异步方式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务),流程完全一样。 # 通义万相2.1 Source: https://docs.geekai.co/cn/docs/video/dashscope/wanx-2.1 通义万相2.1视频生成模型支持文字生成视频、图片生成视频(基于首帧或首尾帧)新视频等多种模式,满足不同场景需求。提供高质量的视频生成效果,确保视频内容的丰富性和连贯性。 wanx2.1-t2v-turbo生成速度更快,适合快速生成视频,wanx2.1-t2v-plus视频质量更高,支持大幅度复杂运动、物理规律遵循、丰富艺术风格和影视级画面质感。 wanx2.1-i2v-plus 支持复杂运动还原与影视质感优化,适合对视频质量要求高的场景,兼容特定视频特效。wanx2.1-i2v-turbo为性价比更高的正式商用版本。 ### 模型参数 * 模型ID:`wanx2.1-t2v-plus`/`wanx2.1-t2v-turbo`/`wanx2.1-i2v-plus`/`wanx2.1-i2v-turbo`/`wanx2.1-kf2v-plus` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `with_audio` * `aspect_ratio` * `quality` * `fps` 附:[万相2.1 官方 API 文档](https://help.aliyun.com/zh/model-studio/use-video-generation) 指定生成的视频分辨率可通过`size`参数,格式为宽x高 480P档位: | 宽高比 | 分辨率 | | ---- | ------- | | 1:1 | 624x624 | | 9:16 | 480x832 | | 16:9 | 832x480 | 720P档位: | 宽高比 | 分辨率 | | ---- | -------- | | 1:1 | 960x960 | | 4:3 | 1088x832 | | 3:4 | 832x1088 | | 16:9 | 1280x720 | | 9:16 | 720x1280 | 1080P档位: | 宽高比 | 分辨率 | | ---- | --------- | | 1:1 | 1440x1440 | | 4:3 | 1632x1248 | | 3:4 | 1248x1632 | | 16:9 | 1920x1080 | | 9:16 | 1080x1920 | ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wanx2.1-t2v-plus", "prompt":"一只小猫在月光下奔跑", "negative_prompt": "花朵" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "wanx2.1-t2v-plus", "task_id": "d2e29377-e3a5-42ad-a8bc-f46ed241b01a", "task_status": "succeed", "video_result": [ { "id": "094442e7-2be3-4cdd-b503-ecd4fde6912f", "url": "https://static.geekai.co/video/2026/02/05/e994125fccf62188d1d23d5ad69ad31b.mp4" } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 **首尾帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wanx2.1-kf2v-plus", "prompt": "写实风格,一只黑色小猫好奇地看向天空,镜头从平视逐渐上升,最后俯拍它的好奇的眼神。", "image":"https://wanx.alicdn.com/material/20250318/first_frame.png", "image_tail":"https://wanx.alicdn.com/material/20250318/last_frame.png", "resolution": "720P", "watermark": false }' ``` `wanx2.1-kf2v-plus`的`resolution` 可选值:`720P`,同样也支持 Base64 编码数据,只需在`image`和`image_tail`填入即可 支持特效模板生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wanx2.1-kf2v-plus", "prompt": "根据特效生成视频", "image":"https://ty-yuanfang.oss-cn-hangzhou.aliyuncs.com/lizhengjia.lzj/tmp/11.png", "resolution": "720P", "watermark": false, "extra_body": { "template": "hanfu-1" } }' ``` **首帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wanx2.1-i2v-plus", "prompt": "一只猫在草地上奔跑", "image":"https://cdn.translate.alibaba.com/r/wanx-demo-1.png", "resolution": "720P", "watermark": true }' ``` ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wanx2.1-i2v-turbo", "prompt": "一只猫在草地上奔跑", "image":"https://cdn.translate.alibaba.com/r/wanx-demo-1.png", "resolution": "480P", "duration": 4, "watermark": false }' ``` `wanx2.1-i2v-turbo`:`resolution`可选值:480P、720P, `wanx2.1-i2v-plus`:`resolution`可选值:720P, `wanx2.1-i2v-turbo`可以支持 `duration`的值为3、4、5。同样也支持 Base64 编码数据,只需在`image`填入即可 # 通义万相2.2 Source: https://docs.geekai.co/cn/docs/video/dashscope/wanx-2.2 通义万相2.2视频生成模型支持文字生成视频、图片生成视频(基于首帧或首尾帧)新视频等多种模式:wan2.2-t2v-plus支持通过文本描述生成指定规格的视频内容,默认生成无声视频, wan2.2-i2v-flash是万相2.2极速版,极致生成速度,在画面细节表现、运动稳定性方面均有显著提升。wan2.2-i2v-plus是万相2.2专业版,指令理解更精准,运镜可控,画面元素保持一致,稳定性与成功率全面提升,生成内容更丰富。 ### 模型参数 * 模型ID:`wan2.2-t2v-plus`/`wan2.2-i2v-plus`/`wan2.2-i2v-flash` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `with_audio` * `aspect_ratio` * `quality` * `fps` 附:[万相2.2 官方 API 文档](https://help.aliyun.com/zh/model-studio/use-video-generation) 指定生成的视频分辨率可通过`size`参数,格式为宽x高,具体参考值同万相2.1 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.2-t2v-plus", "prompt":"一只小猫在月光下奔跑", "negative_prompt": "花朵", "size": "832x480" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "wan2.2-t2v-plus", "task_id": "0041c0cc-cdb8-4788-a470-c06d4978839c", "task_status": "succeed", "video_result": [ { "id": "6d13a8d7-a528-4ad9-a81a-0be8c3aafc48", "url": "https://static.geekai.co/video/2026/02/05/66ae7c0d2cab719e37e79a65c5e9be52.mp4" } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 **首帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.2-i2v-plus", "prompt":"一只小猫在月光下奔跑", "image": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png", "resolution": "480P" }' ``` `wan2.2-i2v-plus`:`resolution`可选值:480P、1080P, `wan2.2-i2v-flash`:`resolution`可选值:480P、720P、1080P,调用同`wan2.2-i2v-plus` 同样也支持 Base64 编码数据,只需在`image`填入即可 **首尾帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.2-kf2v-flash", "prompt": "写实风格,一只黑色小猫好奇地看向天空,镜头从平视逐渐上升,最后俯拍它的好奇的眼神。", "image":"https://wanx.alicdn.com/material/20250318/first_frame.png", "image_tail":"https://wanx.alicdn.com/material/20250318/last_frame.png", "resolution": "720P" }' ``` `wan2.2-kf2v-flash`:`resolution`可选值:480P、720P、1080P, 同样也支持 Base64 编码数据 # 通义万相2.5 Source: https://docs.geekai.co/cn/docs/video/dashscope/wanx-2.5 通义万相2.5视频生成模型支持文字生成视频、图片生成视频,wan2.5-t2v-preview: 该模型能够根据文本描述生成视频,适用于需要从文本内容生成动态视频的场景。支持“说话”、“唱歌”、“表演”等多种对口型场景,适用于不同的视频制作需求。支持真人(肖像、半身、全身)及卡通人物,适用于不同的角色需求。 wan2.5-i2v-preview:该模型能够基于单张图片生成视频,适用于需要从静态图像转换为动态视频的场景,支持自动配音,或传入自定义音频文件 ### 模型参数 * 模型ID:`wan2.5-i2v-preview`/`wan2.5-t2v-preview` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `with_audio` * `aspect_ratio` * `image_tail` * `quality` * `fps` 附:[万相2.5 官方 API 文档](https://help.aliyun.com/zh/model-studio/use-video-generation) 指定生成的视频分辨率可通过`size`参数,格式为宽x高,具体参考值同万相2.1 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.5-t2v-preview", "prompt": "一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。", "size": "832x480" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "wan2.5-t2v-preview", "task_id": "b3edb816-3aaa-4c55-bf55-5997a5871616", "task_status": "succeed", "video_result": [ { "id": "b93ebeb3-9280-4157-9361-c44c14f0874c", "url": "https://static.geekai.co/video/2026/02/06/6dd6538d58ab5edfe8910202ac30d18b.mp4" } ] } ``` 下面图生视频生成响应结构是一样的,不再列举。 ### 图生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.5-i2v-preview", "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png", "resolution": "480P", "duration": 10 }' ``` 支持传入音频文件的url: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.5-i2v-preview", "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png", "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3", "resolution": "480P" }' ``` `wan2.5-i2v-preview`:`resolution`可选值:480P、720P、1080P, 同样也支持 Base64 编码数据 # 通义万相2.6 Source: https://docs.geekai.co/cn/docs/video/dashscope/wanx-2.6 通义万相2.6视频生成模型,支持文生视频,图生视频(基于首帧),参考生视频,新增多镜头叙事能力,同时支持自动配音和传入自定义音频文件,万相-参考生视频模型支持参考输入视频或图像中的角色形象,同时可参考视频中的音色,搭配提示词生成表演视频。 ### 模型参数 * 模型ID:`wan2.6-t2v`/`wan2.6-i2v`/`wan2.6-i2v-flash`/`wan2.6-r2v`/`wan2.6-r2v-flash` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `aspect_ratio` * `image_tail` * `quality` * `fps` 附:[万相2.6 官方 API 文档](https://help.aliyun.com/zh/model-studio/use-video-generation) 指定生成的视频分辨率可通过`size`参数,格式为宽x高,具体参考值同万相2.1 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.6-t2v", "prompt": "一只小猫在月光下奔跑", "negative_prompt": "花朵", "size": "1280x720" }' ``` `wan2.6-t2v`也支持传入音频文件,通过`audio_url`参数传递即可: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.6-t2v", "prompt": "一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。", "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.mp3", "size": "1280x720" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "wan2.6-t2v", "task_id": "025f3574-5b1f-4c39-93b8-02498d2c7674", "task_status": "succeed", "video_result": [ { "id": "5897099e-2a2b-4409-a35d-f7a5f4539dc3", "url": "https://static.geekai.co/video/2026/04/10/5e13e21fb9500ef1350bc2676b650dee.mp4" } ] } ``` 下面图生视频等生成响应结构是一样的,不再列举。 ### 图生视频(基于首帧) ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.6-i2v", "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png", "resolution": "720P" }' ``` 支持传入音频文件的url: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.6-i2v", "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png", "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3", "resolution": "720P", "duration": 10 }' ``` `wan2.6-i2v-flash`调用方式同上,wan2.6-i2v-flash 和 wan2.6-i2v 的`resolution`可选值:720P、1080P(注意分辨率的P需要大写), 图像同样也支持 Base64 编码数据,通过image参数传递即可 ### 参考生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.6-r2v-flash", "prompt": "Character2 坐在靠窗的椅子上,手持 character3,在 character4 旁演奏一首舒缓的美国乡村民谣。Character1 对Character2开口说道:“听起来不错”", "size": "1280x720", "duration": 10, "extra_body": { "reference_urls": [ "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png" ] } }' ``` `wan2.6-r2v`调用方式同上,替换模型名称即可 ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的通用异步方式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务),流程完全一样。 # 通义万相2.7 Source: https://docs.geekai.co/cn/docs/video/dashscope/wanx-2.7 通义万相2.7视频生成模型,支持文生视频,图生视频,参考生视频,视频编辑,文生视频通过提示词控制生成多镜头视频,支持自动配音和传入自定义音频文件,图生视频支持首帧生视频、首尾帧生视频、视频续写三大任务,视频编辑支持输入多模态(文本/图像/视频),可完成指令编辑和视频迁移任务 ### 模型参数 * 模型ID:`wan2.7-t2v`/`wan2.7-i2v`/`wan2.7-r2v`/`wan2.7-videoedit` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=dashscope\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `with_audio` * `size` * `quality` * `fps` 附:[万相2.7 官方 API 文档](https://help.aliyun.com/zh/model-studio/use-video-generation) `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` * `4:3` * `3:4` 不同宽高比对应的输出视频分辨率: | 分辨率 | 宽高比 | 输出视频分辨率(宽x高) | | ----- | ---- | ------------ | | 720P | 16:9 | 1280x720 | | | 9:16 | 720x1280 | | | 1:1 | 960x960 | | | 4:3 | 1104x832 | | | 3:4 | 832x1104 | | 1080P | 16:9 | 1920x1080 | | | 9:16 | 1080x1920 | | | 1:1 | 1440x1440 | | | 4:3 | 1648x1248 | | | 3:4 | 1248x1648 | 注意: 在使用 `resolution` 参数时,请确保分辨率中的P需要大写,如:`720P`,`1080P`。 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.7-t2v", "prompt": "一段紧张刺激的侦探追查故事,展现电影级叙事能力。第1个镜头[0-3秒] 全景:雨夜的纽约街头,霓虹灯闪烁,一位身穿黑色风衣的侦探快步行走。 第2个镜头[3-6秒] 中景:侦探进入一栋老旧建筑,雨水打湿了他的外套,门在他身后缓缓关闭。 第3个镜头[6-9秒] 特写:侦探的眼神坚毅专注,远处传来警笛声,他微微皱眉思考。 第4个镜头[9-12秒] 中景:侦探在昏暗走廊中小心前行,手电筒照亮前方。 第5个镜头[12-15秒] 特写:侦探发现关键线索,脸上露出恍然大悟的表情。", "resolution": "720P", "aspect_ratio": "16:9" }' ``` `wan2.7-t2v`也支持传入音频文件,通过`audio_url`参数传递即可: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.7-t2v", "prompt": "一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。", "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.mp3", "resolution": "720P", "aspect_ratio": "16:9", "duration": 10 }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "wan2.7-t2v", "task_id": "da83f740-b46b-40c9-bae3-5e92eaaeffbe", "task_status": "succeed", "video_result": [ { "id": "5e395454-749b-4520-8da5-f778d3e589fb", "url": "https://static.geekai.co/video/2026/04/10/b8953f0104c94770acf4563779207106.mp4" } ] } ``` 下面图生视频等生成响应结构是一样的,不再列举。 ### 图生视频 **基于首帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.7-i2v", "prompt": "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由rap构成,没有其他对话或杂音。", "image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png", "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3", "resolution": "720P" }' ``` **基于首尾帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.7-i2v", "prompt": "写实风格,一只小黑猫好奇地仰望天空,镜头从平视角度逐渐升高,最后以俯视角度捕捉到它好奇的眼神。", "image": "https://wanx.alicdn.com/material/20250318/first_frame.png", "image_tail": "https://wanx.alicdn.com/material/20250318/last_frame.png", "resolution": "720P" }' ``` **视频续写** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.7-i2v", "prompt": "一个女孩对镜自拍,自拍结束后背着书包出门", "video": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4", "resolution": "720P", "duration": 10 }' ``` wan2.7-i2v 的`resolution`可选值:720P、1080P ### 参考生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.7-r2v", "prompt": "视频2抱着图3在咖啡厅里弹奏一支舒缓的美式乡村民谣,视频1笑着看着视频2", "resolution": "720P", "duration": 10, "extra_body": { "media": [ { "type": "reference_video", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4" }, { "type": "reference_video", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4" }, { "type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png" } ] } }' ``` ### 视频编辑 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"wan2.7-videoedit", "prompt": "将视频中女孩的衣服替换为图片中的衣服", "resolution": "720P", "extra_body": { "media": [ { "type": "video", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260403/nlspwm/T2VA_22.mp4" }, { "type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/fwjpqf/wan2.7-videoedit-change-clothes.png" } ] } }' ``` ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的通用异步方式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务),流程完全一样。 # Veo 3.1 & Veo 3.1 Fast & Veo 3.1 Lite Source: https://docs.geekai.co/cn/docs/video/google/veo-3.1 Veo 3.1 是谷歌最新的高端视频生成模型,能够生成时长 8 秒、分辨率为 720p 或 1080p 的高保真视频,画面逼真且配有原生生成的音频。 Veo 3.1 在多种视觉和电影风格上表现卓越,同时带来了多项全新功能: * 视频扩展:对之前用 Veo 生成的视频进行延长; * 首尾帧生成视频:通过提供首尾帧图像生成视频; * 基于图像的指导:最多使用三张参考图片来引导生成的视频内容。 Veo 3.1 Fast 版本让开发者能够在保证高质量的前提下,更快生成带声音的视频,且针对速度和商业需求进行了优化。它们非常适合用于程序化生成广告的后端服务、快速进行创意概念 A/B 测试的工具,或需要迅速制作社交媒体内容的应用。 你可以通过极客智坊视频生成 API 以编程方式调用该模型,下面是具体的使用示例。 ### 模型参数 ### 模型参数 * 模型ID:`veo-3.1-generate-preview`/`veo-3.1-fast-generate-preview`/`veo-3.1-lite-generate-preview` * 模型价格:你可以在[模型详情页](https://geekai.co/models/veo-3.1-generate-preview)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频公共 API 中的以下参数: * `size` * `fps`(Veo 3.1 系列模型默认 24 fps,且不可更改) * `watermark` 附:[Veo 3.1 官方 API 文档](https://ai.google.dev/gemini-api/docs/video) Veo 3.1 支持的 `aspect_ratio` 宽高比如下: * `16:9`:横屏(默认值) * `9:16`:竖屏 Veo 3.1 支持的 `resolution` 分辨率如下: * `720p`:标清(默认值) * `1080p`:高清 * `4k`:超清(Veo 3.1 Lite 不支持该分辨率) Veo 3.1 官方线路支持的 `duration` 视频时长如下: * `4` 秒(默认值) * `6` 秒 * `8` 秒 ### 模型价格 Veo 3.1 生成视频按时长和分辨率计费,以下是 Veo 3.1 的价格表: | 模型 | 分辨率 | 价格(单位:元/秒) | | ------------ | ----- | ---------- | | Veo 3.1 | 720p | 3.00 | | Veo 3.1 | 1080p | 3.00 | | Veo 3.1 | 4k | 4.50 | | Veo 3.1 Fast | 720p | 0.75 | | Veo 3.1 Fast | 1080p | 0.90 | | Veo 3.1 Fast | 4k | 2.25 | | Veo 3.1 Lite | 720p | 0.375 | | Veo 3.1 Lite | 1080p | 0.60 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 4 秒、分辨率为 `720p` 的 Veo 3.1 Flash 视频价格是 `0.75 x 4 x 0.8 = 2.4` 元,如果生成同样分辨率的 Veo 3.1 视频价格是 `3.00 x 4 x 0.8 = 9.6` 元。其他参数依次类推。 ### 内容限制 * 不生成成人内容,仅限适合 18 岁以下观众的内容(未来将提供可绕过此限制的设置) * 受版权保护的角色和音乐都将被拒绝 * 无法生成真实人物,包括公众人物 * 目前,包含人脸的图像输入会被拒绝 请确保您的提示、参考图像和文字记录都符合这些规则,以避免生成失败。 ### 文生视频 ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "prompt": "生成一段小猫在火星散步的视频", "model": "veo-3.1-fast-generate-preview", "async": true }' ``` 如果你想要设置生成视频的分辨率和宽高比,请通过 `resolution` 和 `aspect_ratio` 参数显式传递,对于官方线路还可以通过 `duration` 参数设置视频时长,具体支持的参数值请参考上面的模型参数部分。 ### 查询生成状态 通过异步响应中的任务 ID(`task_id`)可查询视频生成状态: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/videos/fbdf2778-3d6e-4760-b256-bbfe1ebfe3d1' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 如果视频还在生成中,响应结果如下: ```json theme={null} { "model": "veo-3.1-fast-generate-preview", "task_id": "fbdf2778-3d6e-4760-b256-bbfe1ebfe3d1", "task_status": "running" } ``` 当视频生成完成后,响应结果如下: ```json theme={null} { "model": "veo-3.1-fast-generate-preview", "task_id": "fbdf2778-3d6e-4760-b256-bbfe1ebfe3d1", "task_status": "succeed", "video_result": [ { "url": "https://static.geekai.co/video/2025/11/28/a272281368ad541d1fbcaf77e2b103b6.mp4" } ] } ``` 通过 `video_result` 中的 URL 即可获取生成的视频,该视频链接默认有效期为 7 天,请及时下载保存。 ### 基于首尾帧生成视频 你可以通过 `image` 参数指定视频的首帧图像,通过 `image_tail` 参数指定视频的尾帧图像,模型会根据这两张图像生成一段过渡视频: ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "prompt": "根据下面的首尾帧图片生成一段大黄蜂从汽车变成机器人的视频", "image": "https://static.geekai.co/storage/2025/07/04/ec7eae8d6f4540a6b02b027ff8bc7a70.jpeg", "image_tail": "https://static.geekai.co/storage/2025/07/04/20250704145107.jpg", "model": "veo-3.1-generate-preview", "async": true }' ``` 如果仅传递 `image` 参数而不传递 `image_tail` 参数,则表示仅使用首帧生成视频。 仅 `veo-3.1-generate-preview` 模型支持该功能。 获取视频生成结果的方式与前面介绍的文生视频相同,不再赘述。 ### 基于多张参考图生成视频 Veo 3.1 现在最多支持使用 3 张参考图片来引导生成视频的内容。您可以提供人物、角色或产品的图片,以确保生成视频中主体的外观得以保留。 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "veo-3.1-generate-preview", "prompt": "[图1]戴着眼镜穿着蓝色T恤的男生和[图2]的柯基小狗,坐在[图3]的草坪上,3D卡通风格", "images": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" ], "async": true }' ``` 仅 `veo-3.1-generate-preview` 模型支持该功能。 ### 视频延长 使用 Veo 3.1 可将之前使用 Veo 生成的视频延长 7 秒,最多可延长 20 次: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "veo-3.1-fast-generate-preview", "prompt": "追踪这只小猫,它转到一块大的火星岩石背后抓一只老鼠", "video": "https://static.geekai.co/video/2026/07/23/150423f07dd2c229cc7936d0b59f81ac.mp4", "async": true }' ``` 仅 `veo-3.1-generate-preview` 和 `veo-3.1-fast-generate-preview` 模型支持该功能。 # 图生视频 Source: https://docs.geekai.co/cn/docs/video/img2video ### 单张图片 大部分视频模型都支持图生视频的功能,和以图生图类似,你可以通过在请求参数传入图片链接来实现基于该图片生成视频的功能: ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "model":"kling-v1-6", "prompt":"让富春山居图动起来", "image":"https://static.geekai.co/image/2025/04/02/79b4256e75137022ddd80f3fc21b5d35.png", "async": true }' ``` 目前支持图生视频的模型有:Veo系列视频模型(Veo3仅高可用及以上渠道支持图生视频)、即梦3视频模型、可灵系列视频模型、Stable Video、CogVideoX 系列视频模型。 图生视频耗时比文生视频更长,建议通过异步方式生成,即将 `async` 参数设置为 `true`,然后将响应中获取到的 `task_id` 字段值填充到下面的查询接口 URL 来轮询视频生成状态,直到任务状态为 `succeed`,并获取到视频生成结果 URL: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/video/{task_id}/result' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' ``` ### 首尾帧 有些视频模型支持首尾帧的功能,你可以通过在请求参数传入首尾帧图片链接来实现基于该图片生成视频的功能: ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "model":"veo-2.0-generate-001", "prompt":"根据下面的首尾帧图片生成一段大黄蜂从汽车变成机器人的视频", "image":"https://static.geekai.co/storage/2025/07/04/ec7eae8d6f4540a6b02b027ff8bc7a70.jpeg", "image_tail":"https://static.geekai.co/storage/2025/07/04/20250704145107.jpg", "async": true }' ``` 目前支持首尾帧的视频生成模型有:`veo-2.0-generate-001`、`MiniMax-Hailuo-02` 以及可灵视频生成模型。 ### 多张图片 如果你希望通过传入更多图片来生成视频,可以通过传递图片链接列表到视频生成接口的 `image` 参数来实现: ```bash curl theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "model":"veo-2.0-generate-001", "prompt":"生成一段让图片1中的猫抓图片2中的蝴蝶的视频", "image":["https://static.geekai.co/image/2025/07/02/2d915923d2904e1e816c684d99abdc17.jpg","https://static.geekai.co/image/2025/07/03/9c020196e343992413ffe120bf120438.png"], "async": true }' ``` 是否支持多图以官方模型参数说明为准。 # 可灵视频 Omni-Video(O1) Source: https://docs.geekai.co/cn/docs/video/kling/kling-video-o1 可灵 o1 ,是全球首个多模态的视频模型,产品继承Multi-modal visual language(MVL)理念,以自然语言作为骨架,配合视频、图片、主体等多模态描述,精准理解你的意图,操作更直观,创作更高校。 在影视创作,创意广告,时尚穿搭,视频后期等场景下具有广泛运用。 ### 模型参数 * 模型ID:`kling-video-o1` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=kling\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `with_audio` * `size` * `fps` 附:[可灵视频 Omni-Video(O1) 官方 API 文档](https://app.klingai.com/cn/dev/document-api/apiReference/model/OmniVideo) 支持传入图片 Base64 编码,在对应的image、image\_tail参数中传入即可。 `aspect_ratio` 可选值: * 16:9 * 1:1 * 9:16 可灵视频 kling-video-o1 的 `duration` 参数支持生成 3-10s 的视频,默认值是 5s 支持通过 `quality` 参数替代官方的 `mode` 参数来控制生成视频的分辨率,`quality` 的取值范围是 `std`(对应 `720p`) 和 `pro`(对应 `1080p`),默认值是 `std`,不同质量的视频生成时间和成本不同。 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`。 支持通过 `extra_body` 传递额外参数来设置视频分镜、参考主体和视频: * `multi_shot`: 控制是否开启分镜,取值范围是 `true` 和 `false`,默认值是 `false`,开启多镜头模式后,可以通过 `shot_type` 参数来指定分镜类型。 * `shot_type`: 指定分镜类型,取值仅支持 `customize`,代表自定义分镜, 当 `multi_shot` 为 `true` 时本参数必填。 * `multi_prompt`: 描述每个分镜的信息,如提示词、时长等,当 `multi_shot` 为 `true` 且 `shot_type` 为 `customize` 时,本参数必填。 * `element_list`: 参考主体列表,基于主体库中主体的 ID 配置,最多支持3个。 * `image_list`: 参考图片列表,包括主体、场景、风格等参考图片,也可作为首帧或尾帧生成视频。 * `video_list`: 参考视频列表,可作为特征参考视频,也可作为待编辑视频,默认为待编辑视频。 ### 文生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-o1", "prompt": "一只小猫开心的玩毛线球", "quality": "std", "aspect_ratio": "16:9", "duration": 5 }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "kling-video-o1", "task_id": "b2ab93bf-dbde-49d5-a6e6-dc5665276ce3", "task_status": "succeed", "video_result": [ { "id": "856171451312410716", "url": "https://static.geekai.co/video/2026/02/27/6bfaac882515946ddb29fad95b31eaf7.mp4" } ] } ``` 图生视频生成响应结构是一样的,不再列举。 ### 首尾帧 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-o1", "prompt": "镜头拉远,女生微笑", "image": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-2.png", "image_tail": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-1.png", "quality": "pro", "duration": 5 }' ``` ### 参考图 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-o1", "prompt": "让<<>>中的人物向镜头挥手", "quality": "std", "aspect_ratio": "16:9", "duration": 5, "extra_body": { "image_list": [ { "image_url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-1.png" } ] } }' ``` ### 视频参考 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-o1", "prompt": "删除<<>>中道路两侧的路人,保留马车", "quality": "pro", "duration": 5, "extra_body": { "video_list": [ { "video_url":"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/omni/ov-del.mp4", "refer_type":"base", "keep_original_sound":"yes" } ] } }' ``` ### 主体参考 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-o1", "prompt": "<<>>走过来笑着打招呼", "quality": "pro", "duration": 5, "aspect_ratio": "1:1", "extra_body": { "element_list": [ { "element_id": "856189775194779667" } ] } }' ``` 如果想要异步创建视频获取生成结果请参考[可灵视频3.0示例](https://docs.geekai.co/cn/docs/video/kling/kling-v3),流程完全一样 # 可灵视频 v2.5 Turbo Source: https://docs.geekai.co/cn/docs/video/kling/kling-video-v2-5-turbo 可灵2.5 Turbo 模型,效果进一步提升。文本理解与响应显著提升,能更深入理解具有因果关系的复杂指令,实现对创意表达的精细化控制。动态效果进一步增强,能生成动态幅度更大的动作和运镜,在提升运动呈现幅度和强度的同时,更流畅,更稳定。风格保持、美学效果等进一步提升,在色彩影调、光影分布、笔触质感和整体氛围以及风格统一性上显著提升 ### 模型参数 * 模型ID:`kling-video-v2-5-turbo` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=kling\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `with_audio` * `size` * `fps` 附:[可灵视频 v2.5 Turbo 官方 API 文档](https://app.klingai.com/cn/dev/document-api/apiReference/model/textToVideo) 标准模式std下不支持`image_tail`参数,只有文生视频才支持`aspect_ratio`参数。 支持传入图片 Base64 编码,在对应的image、image\_tail参数中传入即可。 `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` 可灵视频 v2.5 Turbo 的 `duration` 参数支持生成 5s和10s 的视频,默认值是 5s 支持通过 `quality` 参数替代官方的 `mode` 参数来控制生成视频的分辨率,`quality` 的取值范围是 `std`(对应 `720p`) 和 `pro`(对应 `1080p`),默认值是 `std`,不同质量的视频生成时间和成本不同。 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`。 支持通过 `extra_body` 传递额外参数来设置视频分镜、参考主体和音色等信息: * `multi_shot`: 控制是否开启分镜,取值范围是 `true` 和 `false`,默认值是 `false`,开启多镜头模式后,可以通过 `shot_type` 参数来指定分镜类型。 * `shot_type`: 指定分镜类型,取值范围是 `customize` 和 `intelligence`,分别代表自定义分镜和智能分镜, 当 `multi_shot` 为 `true` 时本参数必填。 * `multi_prompt`: 描述每个分镜的信息,如提示词、时长等,当 `multi_shot` 为 `true` 且 `shot_type` 为 `customize` 时,本参数必填。 * `element_list`: 参考主体列表,基于主体库中主体的 ID 配置,最多支持3个。 * `voice_list`: 生成视频时所引用的音色的列表,基于定制音色ID进行设置,最多支持2个,`element_list` 与 `voice_list` 互斥,不能共存。 * `camera_control`: 控制相机运动的条款(如不指定,模型将根据输入的文本/图片智能匹配)。 * `static_mask`: 静态笔刷涂抹区域(用户通过运动笔刷涂抹的 mask 图片)。 * `dynamic_masks`: 动态笔刷配置列表。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v2-5-turbo", "prompt": "一只可爱的小兔子,戴着眼镜,坐在桌边,看报纸,桌上放着一杯卡布奇诺", "aspect_ratio": "16:9", "quality": "std" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "kling-video-v2-5-turbo", "task_id": "33b6015a-6817-45de-9e0d-2452eb563fbb", "task_status": "succeed", "video_result": [ { "id": "855872092758622288", "url": "https://static.geekai.co/video/2026/02/26/514a1da5fcce3da089bc57ebbcfafca8.mp4" } ] } ``` 图生视频生成响应结构是一样的,不再列举。 ### 图生视频 **单图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v2-5-turbo", "prompt": "生成一个小猫玩球的可爱视频", "image": "https://static.geekai.co/image/2026/02/26/f64163e4cb9ad3df328174731c38e622.png", "quality": "std", "duration": 5 }' ``` **首尾帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v2-5-turbo", "prompt": "镜头拉远,女生微笑", "image": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-2.png", "image_tail": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-1.png", "quality": "pro" }' ``` 如果想要异步创建视频获取生成结果请参考[可灵视频3.0示例](https://docs.geekai.co/cn/docs/video/kling/kling-v3),流程完全一样 # 可灵视频 v2.6 Source: https://docs.geekai.co/cn/docs/video/kling/kling-video-v2-6 可灵视频 2.6 模型,首次推出音画同出功能:单次生成即可同步产出视频画面与完整音频,涵盖语音、音效及环境音等内容,在节奏、情绪与叙事表达上实现高度协调,真正达成“所见即所闻”的视听体验。 重点强化了:语音节奏、环境音与画面动作紧密呼应,避免“画面一套、声音一套”的割裂感;支持人声、音效、环境声等多类型声音生成,音质更干净、层次更丰富,更接近真实混音效果;对多种场景下的文本描述、口语表达和复杂剧情有较强的语义理解能力,能更准确地把握创作者意图,输出更贴合需求的音画内容。 ### 模型参数 * 模型ID:`kling-video-v2-6` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=kling\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `size` * `fps` 附:[可灵视频 v2.6 Turbo 官方 API 文档](https://app.klingai.com/cn/dev/document-api/apiReference/model/textToVideo) 只有文生视频才支持`aspect_ratio`参数。 支持传入图片 Base64 编码,在对应的image、image\_tail参数中传入即可。 `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` 可灵视频 v2.6 的 `duration` 参数支持生成 5s和10s 的视频,默认值是 5s 支持通过 `quality` 参数替代官方的 `mode` 参数来控制生成视频的分辨率,`quality` 的取值范围是 `std`(对应 `720p`) 和 `pro`(对应 `1080p`),默认值是 `std`,不同质量的视频生成时间和成本不同。 支持通过 `with_audio` 参数替代官方的 `sound` 参数来控制是否生成带有音频的视频,`with_audio` 的取值范围是 `true` 和 `false`,默认值是 `false`,生成带有音频的视频会增加生成时间和成本。 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`。 支持通过 `extra_body` 传递额外参数来设置视频分镜、参考主体和音色等信息: * `multi_shot`: 控制是否开启分镜,取值范围是 `true` 和 `false`,默认值是 `false`,开启多镜头模式后,可以通过 `shot_type` 参数来指定分镜类型。 * `shot_type`: 指定分镜类型,取值范围是 `customize` 和 `intelligence`,分别代表自定义分镜和智能分镜, 当 `multi_shot` 为 `true` 时本参数必填。 * `multi_prompt`: 描述每个分镜的信息,如提示词、时长等,当 `multi_shot` 为 `true` 且 `shot_type` 为 `customize` 时,本参数必填。 * `element_list`: 参考主体列表,基于主体库中主体的 ID 配置,最多支持3个。 * `voice_list`: 生成视频时所引用的音色的列表,基于定制音色ID进行设置,最多支持2个,`element_list` 与 `voice_list` 互斥,不能共存。 * `camera_control`: 控制相机运动的条款(如不指定,模型将根据输入的文本/图片智能匹配)。 * `static_mask`: 静态笔刷涂抹区域(用户通过运动笔刷涂抹的 mask 图片)。 * `dynamic_masks`: 动态笔刷配置列表。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v2-6", "prompt": "一只可爱的小兔子,戴着眼镜,坐在桌边,看报纸,桌上放着一杯卡布奇诺", "quality": "pro", "aspect_ratio": "1:1", "with_audio": true, "duration": 5 }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "kling-video-v2-6", "task_id": "b328ce05-06c9-438a-be38-793aa332737e", "task_status": "succeed", "video_result": [ { "id": "855898559710404631", "url": "https://static.geekai.co/video/2026/02/26/f7c88ada9a8e61e35afb2c9c549b7631.mp4" } ] } ``` 文生视频标准版模式std下,只支持无声视频 图生视频生成响应结构是一样的,不再列举。 ### 图生视频 **单图** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v2-6", "prompt": "生成一个小猫玩球的可爱视频", "image": "https://static.geekai.co/image/2026/02/26/f64163e4cb9ad3df328174731c38e622.png", "quality": "std", "duration": 10 }' ``` **首尾帧** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v2-6", "prompt": "镜头拉远,女生微笑", "image": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-2.png", "image_tail": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-1.png", "quality": "pro", "duration": 5 }' ``` 单图标准模式std下生成无声视频,专家模式pro下生成有声视频 首尾帧不支持标准版std下生成视频,首尾帧生成视频下只支持无声视频 如果想要异步创建视频获取生成结果请参考[可灵视频3.0示例](https://docs.geekai.co/cn/docs/video/kling/kling-v3),流程完全一样 # 可灵视频 3.0 模型 Source: https://docs.geekai.co/cn/docs/video/kling/kling-video-v3 相比上一版本,可灵视频 3.0 音画同步升级,主体一致性增强,支持多镜头叙事。 在可灵视频 O1 和可灵视频 2.6 的基础之上,可灵 3.0 系列模型基于深度融合的统一模型训练框架,实现了更原生的多模态输入和输出,将音画同步能力和主体一致性控制能力融合,并且突破了时长限制。 在支持更长视频生成(15s)的同时,可灵 3.0 系列模型支持原生直出音画,并实现了高度灵活的分镜控制能力与更精准的语义响应精度,为 AI 影像内容注入生命力,整体画面真实感显著提升,人物演绎更具表演张力。 ![可灵视频 3.0 模型能力对比概览](https://static.geekai.co/storage/2026/02/27/image-20260227142959902.png) ### 模型参数 * 模型ID:`kling-video-v3` * 模型价格:你可以在[模型详情页](https://geekai.co/models/kling-video-v3)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持视频公共 API 中的以下参数: * `negative_prompt` * `size` * `fps` 附:[可灵视频 3.0 官方 API 文档](https://docs.qingque.cn/d/home/eZQCedMeoI1MTquS1SFRihz4S?identityId=1oEFzU43FYK#section=h.0zdc4fiohq6h) `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` 支持通过 `quality` 参数替代官方的 `mode` 参数来控制生成视频的分辨率,`quality` 的取值范围是 `std`(对应 `720p`)、 `pro`(对应 `1080p`)和 `4k`(v3开始支持),默认值是 `std`,不同质量的视频生成时间和成本不同。 支持通过 `with_audio` 参数来控制是否生成带有音频的视频,`with_audio` 的取值范围是 `true`(对应官方 `audio` 值为 `native`) 和 `false`(对应官方 `audio` 值为 `off`),默认值是 `false`,生成带有音频的视频会增加生成时间和成本。 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`。 可灵视频 3.0 的 `duration` 参数支持生成 3-15s 的视频,默认值是 5s,生成更长时长的视频会增加生成时间和成本。 支持通过 `extra_body` 传递额外参数来设置视频分镜、参考主体和音色等信息: * `multi_shot`: 控制是否开启分镜,取值范围是 `true` 和 `false`,默认值是 `false`,开启多镜头模式后,可以通过 `shot_type` 参数来指定分镜类型。 * `shot_type`: 指定分镜类型,取值范围是 `customize` 和 `intelligence`,分别代表自定义分镜和智能分镜, 当 `multi_shot` 为 `true` 时本参数必填。 * `multi_prompt`: 描述每个分镜的信息,如提示词、时长等,当 `multi_shot` 为 `true` 且 `shot_type` 为 `customize` 时,本参数必填。 * `element_list`: 参考主体列表,基于主体库中主体的 ID 配置,最多支持3个。 以上字段参数类型和官方参数完全一致: ![可灵视频 3.0 分镜参数说明](https://static.geekai.co/storage/2026/02/27/image-20260227150217721.png) ### 模型价格 可灵视频 3.0 的价格按照生成视频的质量、时长和是否带有音频来计算,以下是价格表: | 模型 | 质量 | 声音 | 价格(单位:元/秒) | | ------- | ------------ | -- | ---------- | | 可灵视频3.0 | `720p`(std) | 无声 | 0.6 | | 可灵视频3.0 | `720p`(std) | 有声 | 0.9 | | 可灵视频3.0 | `1080p`(pro) | 无声 | 0.8 | | 可灵视频3.0 | `1080p`(pro) | 有声 | 1.2 | | 可灵视频3.0 | `4k` | 无声 | 3.0 | | 可灵视频3.0 | `4k` | 有声 | 3.0 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 5 秒无声标准视频价格是 `0.6 x 5 x 0.8 = 2.4` 元,其他参数依次类推。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3", "prompt": "广角跟踪镜头:一辆影青色的双门轿跑在沙漠公路上行驶,热浪扭曲清晰可见,头顶烈日高悬", "async": true }' ``` 由于视频生成通常比较耗时,建议通过极客智坊提供的异步任务模式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID: ```json theme={null} { "model": "kling-video-v3", "task_id": "77e3772b-4e92-4fce-a24c-63907585689d", "task_status": "pending" } ``` 你可以使用返回的任务 ID 来查询生成状态和获取视频结果: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/videos/77e3772b-4e92-4fce-a24c-63907585689d' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 你可以根据视频生成任务状态 `task_status` 值判断视频是否已经生成完成,这个状态值包括四种情况: * `pending`:任务已创建,等待处理 * `running`:任务正在处理 * `succeed`:任务成功完成,可以获取结果 * `failed`:任务失败,可能是由于内容违规或其他错误 如果任务还在运行中,返回结果如下: ```json theme={null} { "model": "kling-video-v3", "task_id": "77e3772b-4e92-4fce-a24c-63907585689d", "task_status": "running" } ``` 轮询视频生成结果接口直到任务状态值为 `succeed`,你就可以获取到生成的视频 URL: ```json theme={null} { "model": "kling-video-v3", "task_id": "77e3772b-4e92-4fce-a24c-63907585689d", "task_status": "succeed", "video_result": [ { "url": "https://static.geekai.co/video/2025/10/14/6c6b8c475899a1c82bcd59a84e78ab46.mp4" } ] } ``` ### 图生视频 **首帧** 通过 `image` 传入单图即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3", "prompt": "无人机以极快速度穿越复杂障碍或自然奇观,带来沉浸式飞行体验", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_i2v.png", "async": true }' ``` **首尾帧** 通过 `image` + `image_tail` 传入首尾两张图即可实现基于首尾帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3", "prompt": "图中女孩对着镜头说\"茄子\",360度环绕运镜", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_first_frame.jpeg", "image_tail": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_last_frame.jpeg", "async": true }' ``` 图片要求: * 支持 JPG、PNG、WEBP 格式,单张图片大小不超过 10MB; * 支持 URL 和 Base64 两种方式传入图片,URL 方式需要保证图片可以被公网访问; * 图片宽高尺寸不小于 300px,图片宽高比介于 1:2.5 \~ 2.5:1 之间; * image 参数与 image\_tail 参数至少二选一,二者不能同时为空。 ### 动作控制 可灵视频动作控制是一项基于视频动作捕捉与迁移的技术,主要核心功能包括动作克隆、精准动作迁移、肢体与表情全面掌控。它能提取参考视频中的人物动作、手势、口型与表情特征,驱动静态图像角色生成动态视频。 下面是可灵视频 3.0 动作控制生成视频的一个示例: ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3", "action": "motion-control", "prompt": "The girl is wearing a loose gray T-shirt and denim shorts", "images": [ "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/35d77e27300cf5e8995704cd858d759c.png" ], "videos": [ "https://v4-kling.kechuangai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance_10s.mp4" ], "async": true }' ``` 要基于动作控制生成视频,需要设置 `action` 字段值为 `motion-control`,目前仅 2.6 和 3.0 版本支持该功能,其他模型设置该参数会报错。 ### 自定义主体 可灵视频 3.0 支持通过自定义主体来生成视频,自定义主体可以实现基于参考图+参考视频+自定义音色生成视频。 你可以通过独立的主体管理API生成自定义主体进行引用,也可以在创建视频任务时一起提交主体素材,对于一次性任务这样更方便(自定义音色暂不支持自动转化,仍然需要通过独立的自定义音色接口获取音色ID): ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3", "prompt": "镜头逐渐环绕至女孩的正面,随后女孩抬起头,面向镜头温暖地微笑,仿佛出看见多年的好友", "extra_body": { "element_list": [ { "name": "test", "description": "test", "reference_type": "image_refer", "image": "https://docs.qingque.cn/image/api/convert/loadimage?id=5429715788081310775fcACVlWX4tixUlJ4_9IB6cLY5&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true", "images": [ "https://docs.qingque.cn/image/api/convert/loadimage?id=-8171406105386702772fcADvwnhMxVe7ui5iW40e9ytI&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true", "https://docs.qingque.cn/image/api/convert/loadimage?id=-2458305557636706550fcADvwnhMxVe7ui5iW40e9ytI&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true", "https://docs.qingque.cn/image/api/convert/loadimage?id=-8983666481517966162fcADvwnhMxVe7ui5iW40e9ytI&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true" ] } ] }, "async": true }' ``` 如果你想要通过独立的自定义主体接口获取主体ID,则需要调用自定义主体功能先创建主体: ```bash theme={null} curl --location 'https://geekai.co/api/v1/elements/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "name": "test", "description": "test", "reference_type": "image_refer", "image": "https://docs.qingque.cn/image/api/convert/loadimage?id=5429715788081310775fcACVlWX4tixUlJ4_9IB6cLY5&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true", "images": [ "https://docs.qingque.cn/image/api/convert/loadimage?id=-8171406105386702772fcADvwnhMxVe7ui5iW40e9ytI&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true", "https://docs.qingque.cn/image/api/convert/loadimage?id=-2458305557636706550fcADvwnhMxVe7ui5iW40e9ytI&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true", "https://docs.qingque.cn/image/api/convert/loadimage?id=-8983666481517966162fcADvwnhMxVe7ui5iW40e9ytI&docId=eZQCqDGoymg61UKgMckSB2oMh&identityId=2Cn18n4EIHT&loadSource=true" ], "platform": "kling" }' ``` 主体创建接口是一个异步接口,需要通过响应字段中获取的 `task_id` 调用自定义主体轮询接口获取主体生成结果: ```bash theme={null} curl --location 'https://geekai.co/api/v1/elements/{task_id}' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ ``` 当 `task_status` 值为 `succeed`, 表示生成成功,对应的生成结果数据结构如下: ```json theme={null} { "task_id": "f886ca26-908b-4e26-9ffb-361694376bd7", "task_status": "succeed", "task_result": { "elements": [ { "element_id": 317708663449203, "element_name": "test", "element_description": "test", "element_image_list": { "frontal_image": "https://p4-kling.klingai.com/bs2/upload-ylab-stunt/muse/826925436873121851/IMAGE/20260803/397445ffd89d6c4c97ca4a0e77edab88-2f846b67-7dac-476e-90a8-4721006b19af?x-kcdn-pid=113274", "refer_images": [ { "image_url": "https://p4-kling.klingai.com/bs2/upload-ylab-stunt/muse/826925436873121851/IMAGE/20260803/d011e36b6110d27e2e9a35fddc6690df-abd1d09a-d804-4b67-8559-aed9f40fc77d?x-kcdn-pid=113274" }, { "image_url": "https://p4-kling.klingai.com/bs2/upload-ylab-stunt/muse/826925436873121851/IMAGE/20260803/d258b8655e67bb611346603e036ea770-271c8e7b-2b37-4e47-b87e-a3499ce4c107?x-kcdn-pid=113274" }, { "image_url": "https://p4-kling.klingai.com/bs2/upload-ylab-stunt/muse/826925436873121851/IMAGE/20260803/3b0a96d2a2ef050388bffbe027614f7f-dc5388b5-5ed4-4970-a978-08f3453cd9a7?x-kcdn-pid=113274" } ] }, "status": "succeed" } ] } } ``` `task_result.elements[0].element_id` 即为本次生成的主体 ID,你可以将其传入视频生成接口实现基于自定义主体创建视频: ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3", "prompt": "镜头逐渐环绕至女孩的正面,随后女孩抬起头,面向镜头温暖地微笑,仿佛出看见多年的好友", "extra_body": { "element_list": [ { "id": 317708663449203 } ] }, "async": true }' ``` 如果要基于参考视频生成自定义主体,则 `reference_type` 参数需要设置为 `video_refer` 同时通过 `videos` 字段传入参考视频 URL。 ### 自定义音色 你可以通过自定义音色接口创建自定义音色用于在自定义主体时引用: ```bash theme={null} curl --location 'https://geekai.co/api/v1/voices/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "name": "定制人声", "url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/out.mp3", "platform": "kling" }' ``` 该接口也是异步接口,需要通过响应字段中获取的 `task_id` 调用自定义音色轮询接口获取音色生成结果: ```bash theme={null} curl --location 'https://geekai.co/api/v1/voices/{task_id}' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 生成结果数据结构如下: ```json theme={null} { "task_id": "dfa470a4-15b1-46e1-94c3-f05e0d3719a1", "task_status": "succeed", "task_result": { "voices": [ { "voice_id": "913110442183659540", "voice_name": "定制人声", "trial_url": "https://v4-kling.kechuangai.com/bs2/upload-ylab-stunt/muse/826925436873121851/AUDIO/20260803/824e0d209316c56bc79376e51334511f-ca312556-2b4b-4b54-8ee1-ec1a30af619e.quality.wav?x-kcdn-pid=113274" } ] } } ``` ### 视频分镜 可灵视频 3.0 支持通过 `extra_body` 参数来控制分镜能力,以下是一个多镜头图生视频示例: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3", "prompt":"她转身一笑,然后缓缓走出画面", "image":"https://static.geekai.co/storage/2025/11/14/woman_skyline_original_720p.jpeg", "duration": 8, "extra_body": { "multi_shot": true, "shot_type": "customize", "multi_prompt": [ { "index": 1, "prompt": "第一镜头:她转身一笑", "duration": "3" }, { "index": 2, "prompt": "第二镜头:她缓缓走出画面", "duration": "5" } ] }, "async": true }' ``` # 可灵视频 3.0 Omni Source: https://docs.geekai.co/cn/docs/video/kling/kling-video-v3-omni 可灵视频 3.0 Omni 支持全能多模态输入,有声角色驱动,直出音画和分镜。 在可灵视频 O1 和可灵视频 2.6 的基础之上,可灵 3.0 系列模型基于深度融合的统一模型训练框架,实现了更原生的多模态输入和输出,将音画同步能力和主体一致性控制能力融合,并且突破了时长限制。 在支持更长视频生成(15s)的同时,可灵 3.0 系列模型支持原生直出音画,并实现了高度灵活的分镜控制能力与更精准的语义响应精度,为 AI 影像内容注入生命力。 基于新一代的统一多模态大模型,可灵视频 2.6 模型升级为视频 3.0,可灵视频 O1 模型升级为视频 3.0 Omni,带来可控性与叙事力的全面进化,整体画面真实感显著提升,人物演绎更具表演张力。 ![可灵视频 3.0 Omni 模型能力对比概览](https://static.geekai.co/storage/2026/02/27/image-20260227143351526.png) ### 模型参数 * 模型ID:`kling-video-v3-omni` * 模型价格:你可以在[模型详情页](https://geekai.co/models/kling-video-v3-omni)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持视频公共 API 中的以下参数: * `negative_prompt` * `size` * `fps` 附:[可灵视频 3.0 Omni 官方 API 文档](https://klingai.com/document-api/api/video/3-0-omni) `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` 支持通过 `quality` 参数替代官方的 `mode` 参数来控制生成视频的分辨率,`quality` 的取值范围是 `std`(对应 `720p` 标准视频)、 `pro`(对应 `1080p` 高清视频)和 `4k`(v3开始支持),默认值是 `std`,不同质量的视频生成时间和成本不同。 支持通过 `with_audio` 参数来控制是否生成带有音频的视频,`with_audio` 的取值范围是 `true`(对应官方 `audio` 值为 `native`) 和 `false`(对应官方 `audio` 值为 `off`),默认值是 `false`,生成带有音频的视频会增加生成时间和成本。 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`,表示不带水印。 可灵视频 3.0 Omni 的 `duration` 参数支持生成 3-15s 的视频,默认值是 5s,生成更长时长的视频会增加生成时间和成本。 支持通过 `extra_body` 传递额外参数来设置视频分镜、参考主体和视频: * `multi_shot`: 控制是否开启分镜,取值范围是 `true` 和 `false`,默认值是 `false`,开启多镜头模式后,可以通过 `shot_type` 参数来指定分镜类型。 * `shot_type`: 指定分镜类型,取值仅支持 `customize`,代表自定义分镜, 当 `multi_shot` 为 `true` 时本参数必填。 * `multi_prompt`: 描述每个分镜的信息,如提示词、时长等,当 `multi_shot` 为 `true` 且 `shot_type` 为 `customize` 时,本参数必填。 * `element_list`: 参考主体列表,基于主体库中主体的 ID 配置,最多支持3个。 * `image_list`: 参考图片列表,包括主体、场景、风格等参考图片,也可作为首帧或尾帧生成视频。 * `video_list`: 参考视频列表,可作为特征参考视频,也可作为待编辑视频,默认为待编辑视频。 以上字段数据类型和官方参数完全一致: ![可灵视频 3.0 Omni 分镜参数说明](https://static.geekai.co/storage/2026/02/27/image-20260227212519547.png) 此外,可灵视频 3.0 Omni 还支持通过 `extra_body` 传递额外参数来设置参考视频和主体: * `video_list`:参考视频列表,可作为特征参考视频,也可作为待编辑视频,默认为待编辑视频 * `image_list`:参考图片列表,包括主体、场景、风格等参考图片,也可作为首帧或尾帧生成视频 * `element_list`:参考主体列表 以上字段数据类型和官方参数完全一致: ![video\_list参数说明](https://static.geekai.co/storage/2026/02/27/image-20260227213207191.png) ![image\_list参数说明](https://static.geekai.co/storage/2026/02/27/image-20260227213326678.png) ![element\_list参数说明](https://static.geekai.co/storage/2026/02/27/image-20260227213417097.png) ### 模型价格 可灵视频 3.0 Omni 的价格按照生成视频的质量、时长和是否带有音频来计算,以下是价格表: | 模型 | 质量 | 参考视频 | 声音 | 价格(单位:元/秒) | | ------------ | ------------ | ----- | -- | ---------- | | 可灵视频3.0 Omni | `720p`(std) | 无参考视频 | 无声 | 0.6 | | 可灵视频3.0 Omni | `720p`(std) | 无参考视频 | 有声 | 0.8 | | 可灵视频3.0 Omni | `720p`(std) | 有参考视频 | - | 0.9 | | 可灵视频3.0 Omni | `1080p`(pro) | 无参考视频 | 无声 | 0.8 | | 可灵视频3.0 Omni | `1080p`(pro) | 无参考视频 | 有声 | 1.0 | | 可灵视频3.0 Omni | `1080p`(pro) | 有参考视频 | - | 1.2 | | 可灵视频3.0 Omni | `4k` | 无参考视频 | 无声 | 3.0 | | 可灵视频3.0 Omni | `4k` | 无参考视频 | 有声 | 3.0 | | 可灵视频3.0 Omni | `4k` | 有参考视频 | 无声 | 3.0 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 5 秒无声无参考视频的标准视频价格是 `0.6 x 5 x 0.8 = 2.4` 元,其他参数以此类推。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt":"广角跟踪镜头:一辆影青色的双门轿跑在沙漠公路上行驶,热浪扭曲清晰可见,头顶烈日高悬", "async": true }' ``` 由于视频生成通常比较耗时,建议将 `async` 设置为 `true` 通过极客智坊提供的异步任务模式生成视频。关于异步视频生成结果获取请参考文档最后的[异步任务](https://docs.geekai.co/cn/docs/video/kling/kling-v3-omni#%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1)说明。 ### 图生视频 **首帧** 通过 `image` 传入单图即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3-omni", "prompt": "无人机以极快速度穿越复杂障碍或自然奇观,带来沉浸式飞行体验", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_i2v.png", "async": true }' ``` **首尾帧** 通过 `image` + `image_tail` 传入首尾两张图即可实现基于首尾帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3-omni", "prompt": "图中女孩对着镜头说\"茄子\",360度环绕运镜", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_first_frame.jpeg", "image_tail": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_last_frame.jpeg", "async": true }' ``` **参考图** 除了首尾帧外,可灵多模态视频模型还支持通过 `images` 传入多张参考图生成视频,包括主体、场景、风格等: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt": "<<>>戴着眼镜穿着蓝色T恤的男生和<<>>的柯基小狗,坐在<<>>的草坪上,3D卡通风格", "images": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" ], "async": true }' ``` 除了以上通用字段外,可灵视频 3.0 Omni 还支持通过 `extra_body` 传递额外参数来传入参考图,此时需要通过 `type` 来指定首尾帧: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt":"图中女孩对着镜头说\"茄子\",360度环绕运镜", "extra_body": { "image_list": [ { "type": "first_frame", "image_url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_first_frame.jpeg" }, { "type": "end_frame", "image_url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_last_frame.jpeg" } ] }, "async": true }' ``` 如果是参考图,则不需要设置 `type` 字段: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt":"<<>>戴着眼镜穿着蓝色T恤的男生和<<>>的柯基小狗,坐在<<>>的草坪上,3D卡通风格", "extra_body": { "image_list": [ { "image_url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png" }, { "image_url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png" }, { "image_url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" } ] }, "async": true }' ``` 图片要求: * 支持 JPG、PNG、WEBP 格式,单张图片大小不超过 10MB; * 支持 URL 和 Base64 两种方式传入图片,URL 方式需要保证图片可以被公网访问; * 图片宽高尺寸不小于 300px,图片宽高比介于 1:2.5 \~ 2.5:1 之间; * 无参考视频+仅有多图主体时,参考图片与多图主体数量之和不得超过7; * 无参考视频+有视频主体时,参考图片与多图主体数量之和不得超过4; * 有参考视频+仅有多图主体时,参考图片与多图主体数量之和不得超过4。 ### 参考视频 **视频编辑** 可灵视频 3.0 Omni 支持通过 `extra_body.video_list` 传入参考视频进行视频编辑,此时需要设置 `refer_type` 字段为 `base` 来指定参考视频类型为待编辑视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt":"<<>>视频中女孩对着镜头说\"茄子\",360度环绕运镜", "extra_body": { "image_list": [ { "image_url": "xxx" } ], "video_list": [ { "video_url":"xxxxxxxx", "refer_type":"base", "keep_original_sound":"yes" } ] }, "async": true }' ``` 你可以通过 `keep_original_sound` 字段来指定是否保留参考视频的原始音频,取值范围是 `yes` 表示保留,`no` 表示不保留。 **视频参考** 参考视频还可以作为特征参考视频,此时需要设置 `refer_type` 字段为 `feature` 来指定参考视频类型为特征参考视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt":"参考<<>>的运镜方式,生成一段在东京街头漫步偶遇<<>>的视频", "extra_body": { "image_list": [ { "image_url": "xxx" } ], "video_list": [ { "video_url":"xxxxxxxx", "refer_type":"feature", "keep_original_sound":"yes" } ] }, "async": true }' ``` ### 视频分镜 可灵视频 3.0 Omni 支持通过 `extra_body` 参数来控制分镜能力,以下是一个多镜头图生视频示例: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt":"她转身一笑,然后缓缓走出画面", "duration": 8, "extra_body": { "multi_shot": true, "shot_type": "customize", "multi_prompt": [ { "index": 1, "prompt": "<<>>第一镜头:她转身一笑", "duration": "3" }, { "index": 2, "prompt": "第二镜头:她缓缓走出画面", "duration": "5" } ], "image_list": [ { "type": "first_frame", "image_url": "https://static.geekai.co/storage/2025/11/14/woman_skyline_original_720p.jpeg" } ] }, "async": true }' ``` 除了设置分镜参数外,这里还通过 `image_list` 参数上传了参考图(仅 Omni 模型支持),视频生成时会将该图作为第一镜头的内容进行视频生成,后续镜头则根据对应的提示词进行生成。 ### 自定义主体 可灵视频 3.0 Omni 支持通过自定义主体来生成视频,自定义主体的参数传入和[可灵视频 3.0](https://docs.geekai.co/cn/docs/video/kling/kling-v3) 完全一致,这里不再赘述。 ### 异步任务 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 **创建视频生成任务** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"kling-video-v3-omni", "prompt":"她转身一笑,然后缓缓走出画面", "image":"https://static.geekai.co/storage/2025/11/14/woman_skyline_original_720p.jpeg", "duration": 15, "quality": "pro", "with_audio": true, "async": true }' ``` 响应中会包含任务ID: ```json theme={null} { "model": "kling-video-v3-omni", "task_id": "77e3772b-4e92-4fce-a24c-63907585689d", "task_status": "pending" } ``` **查询视频生成结果** 你可以使用返回的任务 ID 来查询生成状态和获取视频结果: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/videos/77e3772b-4e92-4fce-a24c-63907585689d' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 你可以根据视频生成任务状态 `task_status` 值判断视频是否已经生成完成,这个状态值包括四种情况: * `pending`:任务已创建,等待处理 * `running`:任务正在处理 * `succeed`:任务成功完成,可以获取结果 * `failed`:任务失败,可能是由于内容违规或其他错误 如果任务还在运行中,返回结果如下: ```json theme={null} { "model": "kling-video-v3-omni", "task_id": "77e3772b-4e92-4fce-a24c-63907585689d", "task_status": "running" } ``` 轮询视频生成结果接口直到任务状态值为 `succeed`,你就可以获取到生成的视频 URL: ```json theme={null} { "model": "kling-video-v3-omni", "task_id": "77e3772b-4e92-4fce-a24c-63907585689d", "task_status": "succeed", "video_result": [ { "url": "https://static.geekai.co/video/2025/10/14/6c6b8c475899a1c82bcd59a84e78ab46.mp4" } ] } ``` # 可灵视频 3.0 Turbo Source: https://docs.geekai.co/cn/docs/video/kling/kling-video-v3-turbo 可灵视频 3.0 Turbo 支持720P、1080P的文生视频和图生视频。 ### 模型参数 * 模型ID:`kling-video-v3-turbo` * 模型价格:你可以在[模型详情页](https://geekai.co/models/kling-video-v3-turbo)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持视频公共 API 中的以下参数: * `negative_prompt` * `size` * `fps` * `aspect_ratio` * `audio` * `with_audio` * `image_tail` * `video` 附:[可灵视频 3.0 Turbo 官方 API 文档](https://klingai.com/document-api/api/video/3-0-turbo) 支持通过 `resolution` 参数来控制生成视频的分辨率,`quality` 的取值范围是 `720p` 标准视频和 `1080p` 高清视频,默认值是 `720p`。 支持通过 `watermark` 参数替代官方的 `watermark_info` 参数来控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`,表示不带水印。 支持通过 `duration` 参数生成 3-15s 的视频,默认值是 5s,生成更长时长的视频会增加生成时间和成本。 ### 模型价格 可灵视频 3.0 Turbo 的价格按照生成视频的分辨率和时长来计算,以下是价格表: | 模型 | 分辨率 | 价格(单位:元/秒) | | ------------- | ------- | ---------- | | 可灵视频3.0 Turbo | `720p` | 0.8 | | 可灵视频3.0 Turbo | `1080p` | 1.0 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用Pro渠道为例,折扣值是 `0.8`,那么生成 5 秒无声无参考视频的标准视频价格是 `0.8 x 5 x 0.8 = 3.2` 元,其他参数以此类推。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3-turbo", "prompt": "广角跟踪镜头:一辆影青色的双门轿跑在沙漠公路上行驶,热浪扭曲清晰可见,头顶烈日高悬", "async": true }' ``` ### 图生视频 **首帧** 通过 `image` 传入单图即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "kling-video-v3-omni", "prompt": "无人机以极快速度穿越复杂障碍或自然奇观,带来沉浸式飞行体验", "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seepro_i2v.png", "async": true }' ``` 可灵视频 3.0 Turbo 目前仅支持首帧生视频,不支持首尾帧和参考图生视频 图片要求: * 支持 JPG、PNG、WEBP 格式,单张图片大小不超过 50MB; * 支持 URL 和 Base64 两种方式传入图片,URL 方式需要保证图片可以被公网访问; * 图片宽高尺寸不小于 300px,图片宽高比介于 1:2.5 \~ 2.5:1 之间。 # MiniMax-H3 Source: https://docs.geekai.co/cn/docs/video/minimax/MiniMax-H3 MiniMax H3 是一款通用的全模态生成模型,支持对文本、图像、视频、声音组成的多模态上下文的统一理解能力、能够输出具备原生双声道的音视频,最高可支持 15s 2K 分辨率。 根据前期的邀测反馈,MiniMax H3 具备商用级的多场景内容生成能力,在指令遵循、文字与品牌信息呈现、V2V Motion Transfer(视频到视频动作迁移)等方面表现出色,可实现精准、可控的多模态内容编辑与生成,广泛适用于广告、品牌、电商、产品设计、UI/UX、游戏等商业场景。 ### 模型参数 * 模型ID:`MiniMax-H3` * 模型价格:你可以在[模型详情页](https://geekai.co/models/MiniMax-H3)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://geekai.co/user/api_keys) 不支持视频 API 中的以下参数: * `negative_prompt` * `with_audio`(H3 生成的视频默认带音频) * `fps` * `quality` * `size` 附:[MiniMax H3 官方 API 文档](https://platform.minimaxi.com/docs/api-reference/video-generation-v2-create) 极客智坊使用视频生成接口通用的提示词、首尾帧、参考图、参考视频和参考音频传参,和官方有差异,不过可以和官方完全对齐: * `prompt`:文本提示词,支持中文和英文,最大支持7000字符; * `image`:首帧图片,支持 URL 或 Base64 编码的图片数据; * `image_tail`:尾帧图片,支持 URL 或 Base64 编码的图片数据; * `images`:参考图片,最多支持9张,通过数组传递,支持 URL 或 Base64 编码的图片数据; * `video`:参考视频,最多支持3个,多个参考视频通过数组传递,仅支持 URL; * `audio`:参考音频,最多支持3个,多个参考音频通过数组传递,仅支持 URL,不支持单独传参考音频必须配合参考图或参考视频。 MiniMax H3 支持的 `resolution` 分辨率为 `768P` 和 `2K`,默认值是 `768P`。 MiniMax H3 支持的 `duration` 视频时长为 4-15s,默认 5s。 MiniMax H3 支持的 `aspect_ratio` 参数取值范围如下:、 * `1:1` * `16:9` * `4:3` * `3:4` * `9:16` * `21:9` * `adaptive`:自适应 文生视频不支持 `adaptive`,首尾帧图生视频仅支持 `adaptive`(默认值),其他配置无效,参考生视频则支持所有取值。 MiniMax H3 支持的 `watermark` 参数用于控制生成视频是否带有水印,`watermark` 的取值范围是 `true` 和 `false`,默认值是 `false`,表示不带水印。 ### 模型价格 MiniMax H3 生成视频按时长和分辨率计费,以下是 MiniMax H3 的价格表: | 分辨率(resolution) | 价格(单位:元/秒) | | --------------- | ---------- | | 768P | 0.5 | | 2K | 0.8 | 其他计费项: * 包含参考图时,参考图片张数在5张以内免费,超过5张的部分每张加收0.2元; * 包含参考视频时,参考视频时长会和输出视频时长累加计费,单价不变。 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用Pro渠道为例,折扣值是 `0.8`,那么生成一段分辨率为 `768P`、时长为 `6` 秒的视频价格是 `0.5 x 6 x 0.8 = 2.4` 元,如果生成同样时长但分辨率为 `2K` 的视频价格是 `0.8 x 6 x 0.8 = 3.84` 元。渠道折扣也适用于其他计费项。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"MiniMax-H3", "prompt": "小猫对着镜头打哈欠", "async": true }' ``` 响应是一个 JSON 对象,包含生成视频的任务 ID,你可以通过 [视频查询接口](https://docs.geekai.co/cn/api/video/result) 轮询视频生成状态,状态值为 `succeed` 时,表示视频生成成功,响应中会返回视频 URL。 ### 图生视频 **首帧** 通过 `image` 传入单图即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"MiniMax-H3", "prompt":"老鼠跑向镜头前,微笑着眨了眨眼睛", "image":"https://cdn.hailuoai.com/prod/2024-09-18-16/user/multi_chat_file/9c0b5c14-ee88-4a5b-b503-4f626f018639.jpeg", "async": true }' ``` **首尾帧** 通过 `image` + `image_tail` 传入首尾两张图即可实现基于首尾帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"MiniMax-H3", "prompt":"一个小女孩从小成长到大的变化", "image":"https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg", "image_tail":"https://filecdn.minimax.chat/public/97b7cd08-764e-4b8b-a7bf-87a0bd898575.jpeg", "duration": 8, "async": true }' ``` ### 参考生视频 MiniMax H3 支持基于参考图+视频+音频生成视频。 **参考图** 通过 `images` 传入一张或多张图即可实现基于多张参考图生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "MiniMax-H3", "prompt": "@图1戴着眼镜穿着蓝色T恤的男生和@图2的柯基小狗,坐在@图3的草坪上,3D卡通风格", "images": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_2.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seelite_ref_3.png" ], "async": true }' ``` **多模态参考** 你可以同时传入参考图、参考视频和参考音频来生成视频,实现多模态参考(最多支持9张参考图+3个参考视频+3个参考音频): ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "MiniMax-H3", "prompt": "全程使用视频1的第一视角构图,全程使用音频1作为背景音乐。第一人称视角果茶宣传广告,极客智坊牌「苹苹安安」苹果果茶限定款;首帧为图片1,你的手摘下一颗带晨露的阿克苏红苹果,轻脆的苹果碰撞声;2-4 秒:快速切镜,你的手将苹果块投入雪克杯,加入冰块与茶底,用力摇晃,冰块碰撞声与摇晃声卡点轻快鼓点,背景音:「鲜切现摇」;4-6 秒:第一人称成品特写,分层果茶倒入透明杯,你的手轻挤奶盖在顶部铺展,在杯身贴上粉红包标,镜头拉近看奶盖与果茶的分层纹理;6-8 秒:第一人称手持举杯,你将图片2中的果茶举到镜头前(模拟递到观众面前的视角),杯身标签清晰可见,背景音「来一口鲜爽」,尾帧定格为图片2。背景声音统一为女生音色。", "images": [ "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg", "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic2.jpg" ], "video": [ "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_tea_video1.mp4" ], "audio": [ "https://ark-project.tos-cn-beijing.volces.com/doc_audio/r2v_tea_audio1.mp3" ], "aspect_ratio": "16:9", "duration": 10, "async": true }' ``` 多模态传入参数图片、视频、音频时,支持以下组合: * 文本 * 文本 + 图片 * 文本 + 视频 * 文本 + 图片 + 音频 * 文本 + 图片 + 视频 * 文本 + 视频 + 音频 * 文本 + 图片 + 视频 + 音频 不能仅传入音频不带图片或视频,否则会报错。 # MiniMax-Hailuo-02 Source: https://docs.geekai.co/cn/docs/video/minimax/MiniMax-Hailuo-02 Hailuo 02 是 MiniMax 推出的全新视频生成模型,支持文生视频、图生视频、首尾帧视频等功能,适用于多种场景的视频生成需求。 ### 模型参数 * 模型ID:`MiniMax-Hailuo-02` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=minimax\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `with_audio` * `size` * `quality` * `aspect_ratio` * `fps` 附:[Hailuo 02 官方 API 文档](https://platform.minimaxi.com/document/text_to_video) 传递首尾帧时参数设置和官方有差异,极客智坊视频 API 使用 `image` 传递首帧(对应海螺视频 API `first_frame_image` 字段),使用 `image_tail` 传递尾帧(对应海螺视频 API `last_frame_image` 字段),二者均支持传入图片 URL 或者 Base64 编码的图片数据。 Hailuo 02 支持的 `resolution` 分辨率为 `512P`、`768P` 和 `1080P`,默认值是 `768P`。 Hailuo 02 支持的 `duration` 视频时长为 6s、10s,默认 6s,其中 `1080P` 分辨率仅支持 6s。 ### 模型价格 Hailuo 02 生成视频按时长和分辨率计费,以下是 Hailuo 02 的价格表: | 时长(duration) | 分辨率(resolution) | 价格(单位:元/个) | | ------------ | --------------- | ---------- | | 6 | 512P | 0.6 | | 10 | 512P | 1 | | 6 | 768P | 2 | | 10 | 768P | 4 | | 6 | 1080P | 3.5 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先通道为例,折扣值是 `0.8`,那么生成一张分辨率为 `768P`、时长为 `6` 秒的视频价格是 `2 x 0.8 = 1.6` 元,如果生成同样时长但分辨率为 `1080P` 的视频价格是 `3.5 x 0.8 = 2.8` 元。其他参数依次类推。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"MiniMax-Hailuo-02", "prompt":"男子拿起一本书[上升],然后阅读[固定]" }' ``` `[上升]` 和 `[固定]` 是官方提供的控制指令,可以在 `prompt` 中通过 \[指令] 格式添加运镜指令,以实现精确的镜头控制。更多控制指令请参考[官方文档](https://platform.minimaxi.com/document/text_to_video)。 响应是一个包含生成图片 URL 的 JSON 对象: ```json theme={null} { "model": "MiniMax-Hailuo-02", "task_id": "10489e94-a6d6-4019-a48a-9d2054852a53", "task_status": "succeed", "video_result": [ { "url": "https://static.geekai.co/video/2025/10/14/e140da85afc31d33462b45fe96e575ad.mp4", "duration": 5.875 } ] } ``` 图生视频响应结构和文生视频一样,不再列举。 ### 图生视频 **首帧** 通过 `image` 传入单图即可实现基于首帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"MiniMax-Hailuo-02", "prompt":"老鼠跑向镜头前,微笑着眨了眨眼睛", "image":"https://cdn.hailuoai.com/prod/2024-09-18-16/user/multi_chat_file/9c0b5c14-ee88-4a5b-b503-4f626f018639.jpeg", "duration": 6, "resolution": "1080P" }' ``` **首尾帧** 通过 `image` + `image_tail` 传入首尾两张图即可实现基于首尾帧生成视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model":"MiniMax-Hailuo-02", "prompt":"一个小女孩从小成长到大的变化", "image":"https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg", "image_tail":"https://filecdn.minimax.chat/public/97b7cd08-764e-4b8b-a7bf-87a0bd898575.jpeg", "duration": 6, "resolution": "1080P" }' ``` ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的通用异步方式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 具体操作请参考[Sora-2示例](https://docs.geekai.co/cn/docs/video/openai/sora-2#异步任务),流程完全一样。 # MiniMax-Hailuo-2.3 Source: https://docs.geekai.co/cn/docs/video/minimax/MiniMax-Hailuo-2.3 Hailuo 2.3 是 MiniMax 推出的全新视频生成模型,支持文生视频、图生视频等功能,肢体动作、物理表现与指令遵循能力全面升级,适用于多种场景的视频生成需求。 Hailuo 2.3 Fast 是 MiniMax 推出的全新图生视频生成模型,生成速度大幅提升,以更高性价比兼顾画质与表现力,该模型仅支持图生视频,其他调用参数和 Hailuo 2.3 保持一致。 ### 模型参数 * 模型ID:`MiniMax-Hailuo-2.3`、`MiniMax-Hailuo-2.3-Fast` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=minimax\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频 API 中的以下参数: * `negative_prompt` * `with_audio` * `size` * `quality` * `aspect_ratio` * `fps` * `image_tail`(Hailuo 2.3 及其 Fast 版本不支持跳过首尾帧生成视频功能) 附:[Hailuo 2.3 官方 API 文档](https://platform.minimaxi.com/docs/guides/video-generation) 传递首尾帧时参数设置和官方有差异,极客智坊视频 API 使用 `image` 传递首帧(对应海螺视频 API `first_frame_image` 字段),支持传入图片 URL 或者 Base64 编码的图片数据。 Hailuo 2.3 支持的 `resolution` 分辨率为 `768P` 和 `1080P`,默认值是 `768P`。 Hailuo 2.3 支持的 `duration` 视频时长为 6s、10s,默认 6s,其中 `1080P` 分辨率仅支持 6s,这一点和 Hailuo 02 保持一致。 ### 模型价格 Hailuo 2.3 生成视频按时长和分辨率计费,以下是 Hailuo 2.3 的价格表: | 模型 | 时长(duration) | 分辨率(resolution) | 价格(单位:元/个) | | --------------- | ------------ | --------------- | ---------- | | Hailuo 2.3 | 6 | 768P | 2 | | Hailuo 2.3 | 10 | 768P | 4 | | Hailuo 2.3 | 6 | 1080P | 3.5 | | Hailuo 2.3-Fast | 6 | 768P | 1.35 | | Hailuo 2.3-Fast | 10 | 768P | 2.25 | | Hailuo 2.3-Fast | 6 | 1080P | 2.31 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先通道为例,折扣值是 `0.8`,那么生成一张分辨率为 `768P`、时长为 `6` 秒的视频价格是 `2 x 0.8 = 1.6` 元,如果生成同样时长但分辨率为 `1080P` 的视频价格是 `3.5 x 0.8 = 2.8` 元。其他参数依次类推。 ### 调用示例 除了参数、价格不一样之外,调用示例和 Hailuo 02 一样,这里不再重复演示: * [文生视频示例](https://docs.geekai.co/cn/docs/video/minimax/MiniMax-Hailuo-02#文生视频) * [图生视频示例](https://docs.geekai.co/cn/docs/video/minimax/MiniMax-Hailuo-02#图生视频):注意仅支持首帧,且 Hailuo 2.3 Fast 版本仅支持图生视频 * [异步任务示例](https://docs.geekai.co/cn/docs/video/minimax/MiniMax-Hailuo-02#异步任务) # 模型选择 Source: https://docs.geekai.co/cn/docs/video/model 你可以在[模型广场](https://geekai.co/models)通过筛选/搜索查看所有视频模型,并拷贝模型名称用于 API 调用: ![复制视频模型名称](https://static.geekai.co/storage/2025/07/04/image-20250704163226185.png) 如果你想要进一步区分不同模型,可以通过模型分类、功能、上下文、价格、平台标签进行进一步筛选,比如想要通过图片生成视频,则需要筛选出支持图片识别的视频模型: ![支持图片识别的视频模型](https://static.geekai.co/storage/2025/07/04/image-20250704163317408.png) 依次类推,你可以根据自己的需求筛选出最适合的视频模型进行调用。 # 文生视频 Source: https://docs.geekai.co/cn/docs/video/txt2video ### 快速入门 你可以通过文本提示生成视频,文本提示可以是任何描述性的句子,模型会根据这些描述生成相应的视频: ```bash theme={null} curl --location 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "model":"cogvideox-flash", "prompt":"小猫小狗在草丛中打闹", "async": false }' ``` Stable Video 模型目前仅支持图生视频,不支持文生视频接口。 ### 异步任务 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/videos/{task_id}' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' ``` 直到任务状态值为 `succeed`,并拿到视频生成结果 URL。对于视频生成任务,一般比较耗时,推荐使用异步生成视频模式。 更多视频生成 API 参数细节,请参考[视频创建 API 手册](https://docs.geekai.co/cn/api/video/generations)。 # Vidu Q2 Source: https://docs.geekai.co/cn/docs/video/vidu/viduq2 Vidu Q2是生数科技发布的新一代多模态大模型,在语义理解、情绪表达、运动幅度、专业运镜等方面都有了全面升级,在影视动漫、广告电商、短剧、泛娱乐、文旅等行业中有更大、更深入的应用空间。 指令遵循更强,表情理解更细腻,运动幅度更灵活,运镜更连贯。 ### 模型参数 * 模型ID:`viduq2`/`viduq2-turbo`/`viduq2-pro` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=vidu\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频公共 API 中的以下参数: * `size` * `quality` * `fps` 附:[ViduQ2 官方 API 文档](https://platform.vidu.cn/docs/text-to-video) `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` * `4:3` * `3:4` `resolution` 分辨率参数,可选:540p、720p、1080p `duration` 默认为 5s,可选值:1-10s 支持通过 `extra_body` 传递额外可选参数来设置: * `style`: 风格,可选值: general(通用风格)、anime(动漫风格,仅在动漫风格表现突出) * `movement_amplitude`: 运动幅度默认 auto, 可选值: auto、small、medium、large * `bgm`: 是否为生成的视频添加背景音乐。默认: false, 可选值 true 、false, 传 true 时系统将从预设 BGM 库中自动挑选合适的音乐并添加;不传或为 false 则不添加 BGM * `voice_id`: 音色id,用来决定视频中的声音音色 * `wm_url`: 水印内容,此处为图片URL * `wm_position`: 水印位置,表示水印出现在图片的位置 * `off_peak`: 错峰模式,默认: false,可选值: true: 错峰生成视频; false: 即时生成视频 * `payload`: 透传参数,不做任何处理,仅数据传输 * `meta_data`: 元数据标识,json格式字符串,透传字段 以上字段参数类型和官方参数完全一致 ### 模型价格 vidu q2系列 的价格按照模型,能力,生成视频的分辨率、时长来计算,以下是价格速算表: | 能力 | 模型 | 分辨率 | 价格(元/秒) | | ------ | ------------ | ----- | ------- | | 文生视频 | viduq2 | 540p | 0.3125 | | | viduq2 | 720p | 0.46875 | | | viduq2 | 1080p | 0.625 | | 参考生视频 | viduq2 | 540p | 0.46875 | | | viduq2 | 720p | 0.78125 | | | viduq2 | 1080p | 2.34375 | | | viduq2-pro | 540p | 0.625 | | | viduq2-pro | 720p | 0.9375 | | | viduq2-pro | 1080p | 2.65625 | | 图生视频 | viduq2-turbo | 540p | 0.1875 | | | viduq2-turbo | 720p | 0.25 | | | viduq2-turbo | 1080p | 1.09375 | | | viduq2-pro | 540p | 0.25 | | | viduq2-pro | 720p | 0.46875 | | | viduq2-pro | 1080p | 1.71875 | | 首尾帧生视频 | viduq2-turbo | 540p | 0.1875 | | | viduq2-turbo | 720p | 0.25 | | | viduq2-turbo | 1080p | 1.09375 | | | viduq2-pro | 540p | 0.25 | | | viduq2-pro | 720p | 0.46875 | | | viduq2-pro | 1080p | 1.71875 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以文生视频高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 5 秒 720p 有声标准视频价格是 `0.46875 x 5 x 0.8 = 1.875` 元,其他参数依次类推。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq2", "prompt": "以超写实的时尚摄影风格呈现,采用浅蓝与淡琥珀色调,身着宇航服的航天员漫步雾中。背景由迷人的白金光线构成,营造出极简静物与令人震撼的全景画面。", "duration": 5, "aspect_ratio": "16:9" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "viduq2", "task_id": "72bc4fd2-3c43-4571-b72f-db3aad3096fb", "task_status": "succeed", "video_result": [ { "id": "038a74c4-762a-47c1-a8ba-e0c5d950ab9c", "url": "https://static.geekai.co/video/2026/03/05/152c1175b4379ccab9c48b12b8f5a4a4.mp4" } ] } ``` 下面的图生视频等响应结果同上,不在列举。 ### 图生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq2-turbo", "prompt": "宇航员挥手致意,镜头缓缓上移", "images": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/image2video.png", "duration": 5, "with_audio": true }' ``` viduq2-turbo和viduq2-pro支持图生视频 ### 首尾帧 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq2-turbo", "prompt": "镜头拉近那只鸟,它随即向右飞去。鸟儿飞行姿态流畅自然,在天空中翱翔,身后随之环绕着红色光效。", "image": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg", "image_tail": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg", "duration": 5 }' ``` viduq2-turbo和viduq2-pro支持首尾帧生视频 ### 参考生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq2-pro", "prompt": "圣诞老人和熊在湖边拥抱。", "image": [ "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/reference2video-1.png", "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/reference2video-2.png", "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/reference2video-3.png" ], "duration": 4, "aspect_ratio": "4:3" }' ``` viduq2和viduq2-pro支持参考生视频, `duration`: viduq2-pro:默认5秒,可选:0-10(0秒为自动判断时长) ### 异步任务 由于视频生成通常比较耗时,建议通过极客智坊提供的异步任务模式生成视频。 [视频 API](https://docs.geekai.co/cn/api/video/generations) 中的 `async` 参数用于控制是否异步生成视频,默认为 `false`,表示创建视频接口会同步等待视频生成完毕并返回。如果设置为 `true`,则会异步生成视频并返回任务ID,你可以使用该任务ID轮询视频生成状态。 **创建视频生成任务** ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq2", "prompt": "以超写实的时尚摄影风格呈现,采用浅蓝与淡琥珀色调,身着宇航服的航天员漫步雾中。背景由迷人的白金光线构成,营造出极简静物与令人震撼的全景画面。", "duration": 5, "aspect_ratio": "16:9", "async": true, "extra_body": { "bgm": true } }' ``` 响应中会包含任务ID: ```json theme={null} { "model": "viduq2", "task_id": "371a39ff-d1a6-4990-8c7b-3dcc7e437861", "task_status": "pending" } ``` **查询视频生成结果** 你可以使用返回的任务 ID 来查询生成状态和获取视频结果: ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/videos/{task_id}' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' ``` 你可以根据视频生成任务状态 `task_status` 值判断视频是否已经生成完成,这个状态值包括四种情况: * `pending`:任务已创建,等待处理 * `running`:任务正在处理 * `succeed`:任务成功完成,可以获取结果 * `failed`:任务失败,可能是由于内容违规或其他错误 如果任务还在运行中,返回结果如下: ```json theme={null} { "model": "viduq2", "task_id": "371a39ff-d1a6-4990-8c7b-3dcc7e437861", "task_status": "running" } ``` 轮询视频生成结果接口直到任务状态值为 `succeed`,你就可以获取到生成的视频 URL: ```json theme={null} { "model": "viduq2", "task_id": "371a39ff-d1a6-4990-8c7b-3dcc7e437861", "task_status": "succeed", "video_result": [ { "id": "30751061-18f8-41d7-8aa1-fea6415a5a01", "url": "https://static.geekai.co/video/2026/03/05/45abad7a92d050bfce23fb5768eee698.mp4" } ] } ``` # Vidu Q3 Source: https://docs.geekai.co/cn/docs/video/vidu/viduq3 Vidu Q3是vidu新一代模型,支持原生音频+视频一体生成,支持自然的多角色对话,音频与画面同步输出,对话、旁白、音效、音乐四类音轨同步生成,单次生成即可获得完整 16 秒视频,表达更充分、叙事更连贯——减少拼接、避免节奏断裂,让故事自然推进, 从运镜到节奏,你可以精确指挥每一个叙事节点;逐帧级控制帮助你落准关键时刻的时机、重音与情绪节拍。支持英语、日语、中文的视频输出,面向漫剧、电影、短剧等专业叙事场景设计。 ### 模型参数 * 模型ID:`viduq3-pro` * 模型价格:你可以在[模型广场](https://geekai.co/models?platform=vidu\&type=video)查看最新价格信息 * 调用入口:`https://geekai.co/api/v1/videos/generations` * 模型参数:参考[视频 API 手册](https://docs.geekai.co/cn/api/video/generations) * API认证:[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start) 不支持视频公共 API 中的以下参数: * `size` * `quality` * `fps` 附:[ViduQ3 官方 API 文档](https://platform.vidu.cn/docs/text-to-video) `aspect_ratio` 参数支持以下取值: * `1:1` * `16:9` * `9:16` * `4:3` * `3:4` `resolution` 分辨率参数,可选:540p、720p、1080p `duration` 默认为 5s,可选值:1-16s 支持通过 `extra_body` 传递官方额外可选参数,同Vidu Q2的示例。 ### 模型价格 vidu q3系列 的价格按照生成视频的分辨率、时长来计算,以下是价格速算表: | 模型 | 分辨率 | 价格(单位:元/秒) | | ---------- | ----- | ---------- | | viduq3-pro | 540p | 0.4375 | | viduq3-pro | 720p | 0.9375 | | viduq3-pro | 1080p | 1 | 使用极客智坊提供的[低价代理渠道](https://docs.geekai.co/cn/docs/model_price)调用时,不同参数对应价格按照价格表x对应的折扣值即可:以高可用速度优先渠道为例,折扣值是 `0.8`,那么生成 5 秒 720p 有声标准视频价格是 `0.9375 x 5 x 0.8 = 3.75` 元,其他参数依次类推。 ### 文生视频 通过文字描述来生成对应视频: ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq3-pro", "prompt": "以超写实的时尚摄影风格呈现,采用浅蓝与淡琥珀色调,身着宇航服的航天员漫步雾中。背景由迷人的白金光线构成,营造出极简静物与令人震撼的全景画面。", "duration": 5, "aspect_ratio": "16:9" }' ``` 响应是一个 JSON 对象,包含生成视频的 URL: ```json theme={null} { "model": "viduq3-pro", "task_id": "d165a50c-9b6a-47cf-be34-24565f95b26f", "task_status": "succeed", "video_result": [ { "id": "052b2273-216d-432f-bc3b-4e06b196facb", "url": "https://static.geekai.co/video/2026/03/05/fde3ffee3c6acbab01dba9e6563d1f93.mp4" } ] } ``` 下面的图生视频等响应结果同上,不在列举。 ### 图生视频 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq3-pro", "prompt": "宇航员挥手致意,镜头缓缓上移", "images": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/image2video.png", "duration": 5, "with_audio": true }' ``` ### 首尾帧 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/videos/generations' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $GEEKAI_API_KEY' \ --data '{ "model": "viduq3-pro", "prompt": "镜头拉近那只鸟,它随即向右飞去。鸟儿飞行姿态流畅自然,在天空中翱翔,身后随之环绕着红色光效。", "image": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg", "image_tail": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg", "duration": 5 }' ``` ### 异步任务 如果想要异步创建视频获取生成结果请参考[ViduQ2示例](https://docs.geekai.co/cn/docs/video/vidu/viduq2),流程完全一样。 # 3D生成 Source: https://docs.geekai.co/cn/api/3d/generations openapi.yaml POST /image3ds/generations 注意:目前仅 `hunyuan-3d`、`hunyuan-3d-pro`、`hunyuan-3d-pro-fast`、`doubao-seed3d-1.0` 模型支持3D生成,其他模型不支持。 ### 请求/响应参数明细 # 生成结果 Source: https://docs.geekai.co/cn/api/3d/result openapi.yaml GET /image3ds/{task_id} 注:该接口用于查询3D生成任务状态和结果,仅支持异步模式的3D生成资产获取。 # 语音转文本 Source: https://docs.geekai.co/cn/api/audio/speechtotext openapi.yaml POST /audio/transcriptions 注:语音模型名称设置参考[系统支持转录语音模型列表](https://geekai.co/models),请求/响应参数结构完全兼容 [OpenAI](https://platform.openai.com/docs/api-reference/audio/createSpeech),切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和OpenAI不一致,极客智坊底层会自动转换对齐。 响应数据格式和 OpenAI 语音转录文本接口完全兼容。 关于语音转录文本 API 调用示例,可以参考这里:[语音转文本](https://docs.geekai.co/cn/docs/audio/transcribe)。 ### 请求/响应参数明细 # 文本转语音 Source: https://docs.geekai.co/cn/api/audio/texttospeech openapi.yaml POST /audio/speech 注:语音模型名称设置参考[系统支持语音模型列表](https://geekai.co/models),请求/响应参数结构完全兼容 [OpenAI](https://platform.openai.com/docs/api-reference/audio/createSpeech),切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和OpenAI不一致,极客智坊底层会自动转换对齐。 响应数据格式和 OpenAI 完全兼容,即返回音频文件的二进制数据。 关于文本转语音 API 调用示例,可以参考这里:[文本对话](https://docs.geekai.co/cn/docs/audio/tts)。 ### 请求/响应参数明细 # 录音文件识别 Source: https://docs.geekai.co/cn/api/audio/transcription openapi_v2.yaml POST /audio/transcriptions # 对话完成 Source: https://docs.geekai.co/cn/api/chat/completions openapi.yaml POST /chat/completions 注:你可以在模型广场筛选查看[系统支持的所有对话模型列表](https://geekai.co/models),对话模型请求/响应参数结构兼容 [OpenAI](https://platform.openai.com/docs/api-reference/chat/create),切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和 OpenAI 不一致,极客智坊底层会自动转换对齐。 除百度文心一言和讯飞星火模型外,其他所有平台支持函数调用(具体支持模型以平台限制为准)。 调用 GPTs 模型 API 时,需要将 gpt-4-gizmo-\* 中的 \* 替换成对应 GPTs 的 gizmo\_id,获取方式:从 GPTs URL 中提取,以 [https://chatgpt.com/g/g-bo0FiWLY7-researchgpt](https://chatgpt.com/g/g-bo0FiWLY7-researchgpt) 为例, 对应的 gizmo\_id 为 g-bo0FiWLY7。 响应数据基础结构和 OpenAI 完全兼容,并在其基础上为适配其他模型新增功能,提供了对搜索引用链接(`citations`)、搜索计费次数(`billed_units`)、消息内容支持视频、图片/视频输入tokens、推理模式设置(`thinking`)的支持,响应结构会根据是否是流式输出而变化,可以参考下面的请求示例进行判断。 关于对话模型 API 调用示例,可以参考这里:[文本对话](https://docs.geekai.co/cn/docs/chat/base)。 ### 请求/响应参数明细 # 结果查询 Source: https://docs.geekai.co/cn/api/chat/result openapi.yaml GET /chat/{id} 注:该接口用于查询通过对话完成接口创建的对话任务状态和结果,仅[后台模式](https://docs.geekai.co/cn/docs/chat/background)支持。 任务结果默认会保留 7 天,7 天后任务结果将被自动删除,请及时查询和保存结果。 # 查询账户余额 Source: https://docs.geekai.co/cn/api/credit/balance adminapi.yaml GET /credit/balance 查询指定当前用户充值账户余额。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证,需要创建后复制进行使用。 # 查询对话账单 Source: https://docs.geekai.co/cn/api/credit/transaction adminapi.yaml GET /chat/transaction/{uuid} 查询指定对话的账单明细信息,对话ID`uuid`可以通过[对话接口](https://docs.geekai.co/cn/api/chat/completions)响应数据中的`id`字段获取,对于画图、视频生成等场景,需要通过响应数据的`task_id`进行查询。 查询结果中的 `amount` 字段表示此次对话消耗的金币数,单位为金币,100金币=1元。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证。此外,由于账单是异步生成的,拿到对话/任务响应结果后可能需要等待一段时间才能查询到对应的账单信息,这个时间通常是1-3s左右。 # 文本嵌入 Source: https://docs.geekai.co/cn/api/embedding openapi.yaml POST /embeddings 注:你可以在模型广场筛选查看[系统支持的所有向量模型列表](https://geekai.co/models),向量模型请求/响应参数结构兼容 [OpenAI](https://platform.openai.com/docs/api-reference/embeddings),切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和OpenAI不一致,极客智坊底层会自动转换对齐。 响应数据格式和OpenAI完全兼容。 向量模型 API 调用示例可以参考这里:[文本向量化](https://docs.geekai.co/cn/docs/embedding/single_text)。 ### 请求/响应参数明细 # 提取文件内容 Source: https://docs.geekai.co/cn/api/file/extract openapi.yaml GET /file/{uuid}/content 文件上传成功后,就可以通过文件提取接口获取文件内容了。需要注意的是,极客智坊提供的是文件异步加载,所以需要轮询提取文件内容接口获取文件内容,直到获取到文件内容为止。 轮询时,可以通过响应数据中的 `status` 字段判断文件提取状态,`status=reading` 表示文件正在读取中,`status=done` 表示文件读取完成,此时可以通过 `content` 字段值获取文件内容,如果 `status=failed`,则表示文件读取失败。 ### cURL 请求示例 ```bash theme={null} curl --location --request GET 'https://geekai.co/api/v1/file/27f9ab4d-137b-4bb3-bcca-ea28f2f89e95/content' \ --header 'Authorization: Bearer {$GEEKAI_API_KEY}' ``` ### Postman 请求响应示例 提取文件内容 # 上传文件 Source: https://docs.geekai.co/cn/api/file/upload openapi.yaml POST /files 极客智坊提供了文件上传与内容提取功能,支持多种文件格式,包括.PDF .DOCX .DOC .XLS .XLSX .PPT .PPTX .PNG .JPG .JPEG .CSV .PY .TXT .MD .BMP .GIF等,你可以通过上传文件接口上传待识别文件,然后通过文件内容提取接口获取文件内容,借助该基础服务,你可以完成AI文件对话/RAG等上层业务场景的功能实现。 ### cURL 请求示例 ```bash theme={null} curl --location --request POST 'https://geekai.co/api/v1/files' \ --header 'Authorization: Bearer {$GEEKAI_API_KEY}' \ --form 'file=@"/E:/文档/geekai/test.pdf"' --form 'purpose="file-extract"' ``` ### Postman 请求响应示例 上传文件 # 图片超分 Source: https://docs.geekai.co/cn/api/image/clarify openapi.yaml POST /images/clarify 注意:目前仅 `jimeng-image-clarify-v3` 模型支持图片超分,其他模型不支持。 图片超分 API 调用示例可以参考这里:[图片超分](https://docs.geekai.co/cn/docs/image/clarify)。 ### 请求/响应参数明细 # 图片编辑 Source: https://docs.geekai.co/cn/api/image/edit openapi.yaml POST /images/edits 注意:目前仅 `gpt-image-1` 和 `nano-banana` 模型支持图片编辑,其他模型不支持。你可以在模型广场筛选查看[系统支持的所有画图模型列表](https://geekai.co/models),画图模型请求/响应参数结构兼容 [OpenAI](https://platform.openai.com/docs/api-reference/images/generate-image),切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和 OpenAI 不一致,极客智坊底层会自动转换对齐。 图片编辑 API 调用示例可以参考这里:[图片编辑](https://docs.geekai.co/cn/docs/image/edit)。 ### 请求/响应参数明细 # 图像增强 Source: https://docs.geekai.co/cn/api/image/enhance openapi.yaml POST /images/enhance 注意:目前仅 `jimeng-image-enhance-v2` 模型支持图像增强,其他模型不支持。 图像增强 API 调用示例可以参考这里:[图像增强](https://docs.geekai.co/cn/docs/image/enhance)。 ### 请求/响应参数明细 # 图片生成 Source: https://docs.geekai.co/cn/api/image/generations openapi.yaml POST /images/generations 注:你可以在模型广场筛选查看[系统支持的画图模型列表](https://geekai.co/models),画图模型基础请求/响应参数结构兼容 [OpenAI](https://platform.openai.com/docs/api-reference/images),同时扩展了一些新的参数来适配其他模型的功能,切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和 OpenAI 不一致,极客智坊底层会自动转换对齐。 响应数据格式和 OpenAI 完全兼容。 不同AI平台的画图模型支持的尺寸不一样,具体支持的尺寸请参考下面的表格:
平台 模型 支持的尺寸
OpenAI GPT-Image系列 GPT-Image-2开始支持指定范围内的任意尺寸,其他版本:1024x1024,1024x1536,1536x1024,auto,默认是auto
Google Imagen系列 无尺寸配置,支持宽高比:1:1、3:4、4:3、9:16、16:9, 默认1:1,HTTP调用只支持默认值。
Google Banana系列 无尺寸配置,支持通过`size`字段传递分辨率:1k、2k、4k,支持宽高比:1:1、2:3、3:2、3:4、4:3、4:5、5:4、9:16、16:9,21:9, 默认1:1。
智谱清言 CogView系列 1024x1024,768x1344,864x1152,1344x768, 1152x864,1440x720,720x1440,默认是1024x1024
阿里巴巴 通义万相系列 图像宽高边长的像素范围为:\[768, 1440],单位像素。 可任意组合以设置不同的图像分辨率,最高可达200万像素。 默认值:1024\*1024
可灵AI kling系列 无尺寸配置,支持宽高比:16:9、9:16、1:1、4:3、3:4、3:2、2:3, 默认1:1
字节跳动 即梦系列 支持宽高比及对应尺寸:512x512(默认值)、512x384、384x512、512x341、 341x512、512x288、288x512
字节跳动 Seeddream系列 支持宽高比及对应尺寸:[点此查看](https://docs.geekai.co/cn/docs/image/bytedance/doubao-seedream-4.0#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0)
Stability Stable Image系列 图像宽高边长的像素范围为:\[64, 16384],单位像素。 可任意组合以设置不同的图像分辨率,总像素数至少需要达到 4096 像素。
Midjourney * *
画图模型 API 调用示例可以参考这里:[生成图像](https://docs.geekai.co/cn/docs/image/model)。 ### 请求/响应参数明细 # 生成结果 Source: https://docs.geekai.co/cn/api/image/result openapi.yaml GET /images/{task_id} 注:该接口用于查询通过图片生成/编辑接口创建的图片生成任务状态和结果,仅支持异步模式的图片生成模型支持。 # 创建新的 API KEY Source: https://docs.geekai.co/cn/api/key/create adminapi.yaml POST /api_keys 创建一个新的 API KEY。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证,需要创建后复制进行使用。 # 删除指定 API KEY Source: https://docs.geekai.co/cn/api/key/delete adminapi.yaml DELETE /api_keys/{uuid} 通过 UUID 删除一个已存在的 API KEY。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证,需要创建后复制进行使用。 # 获取指定 API KEY 信息 Source: https://docs.geekai.co/cn/api/key/get adminapi.yaml GET /api_keys/{uuid} 通过 UUID 获取指定 API KEY 的详细信息。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证,需要创建后复制进行使用。 # 获取所有 API KEY 信息 Source: https://docs.geekai.co/cn/api/key/list adminapi.yaml GET /api_keys 获取当前账户所有 API KEY 列表。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证,需要创建后复制进行使用。 # 切换 API KEY 状态 Source: https://docs.geekai.co/cn/api/key/toggle adminapi.yaml PATCH /api_keys/{uuid}/status 通过 UUID 切换指定 API KEY 的状态为启用/禁用。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证,需要创建后复制进行使用。 # 更新 API KEY Source: https://docs.geekai.co/cn/api/key/update adminapi.yaml PUT /api_keys/{uuid} 通过 UUID 更新指定 API KEY 的信息。 注意:调用此接口需要通过[系统 KEY](https://geekai.co/user/provision_keys) 进行认证,需要创建后复制进行使用。 # 创建消息 Source: https://docs.geekai.co/cn/api/message Message API 是 Anthropic 为 Claude 系列模型提供的文本对话生成接口,支持文本和图像输入,输出文本内容。 调用 Message API 时直接通过 `https://geekai.co/api/v1/messages` 访问国内代理入口,`https://geekai.dev/api/v1/messages` 访问海外代理入口,然后将 Bearer Token 设置为[极客智坊 API 认证 Token](https://geekai.co/user/api_keys) 即可,所有请求响应参数完全兼容 [Claude Message API](https://docs.claude.com/en/api/messages),按照官方 API 文档调用和处理响应结果即可。 # 模型明细 Source: https://docs.geekai.co/cn/api/model_detail openapi.yaml GET /models/{model} ### 请求/响应参数明细 # 模型列表 Source: https://docs.geekai.co/cn/api/models openapi.yaml GET /models # 名片识别 Source: https://docs.geekai.co/cn/api/ocr/cardrecognition openapi.yaml POST /bizcard/recognize 极客智坊基于 AI 模型服务重构了传统的 OCR 图片识别服务并以 API 接口形式开放。 注:model 值不传递默认使用免费的 glm-4v-flash,你也可以在[模型广场](https://geekai.co/models)选择极客智坊支持的其他图片识别模型,费用以列表显示的模型价格(API)为准。 ### cURL 请求示例 ```bash theme={null} curl --location 'https://geekai.co/api/v1/bizcard/recognize' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "image": "https://example.com/bizcard.jpg" }' ``` ### Postman 请求响应示例 名片识别 # 身份证识别 Source: https://docs.geekai.co/cn/api/ocr/idcardrecognition openapi.yaml POST /idcard/recognize 注:model 值不传递默认使用免费的 glm-4v-flash,你也可以在[模型广场](https://geekai.co/models)选择极客智坊支持的其他图片识别模型,费用以列表显示的模型价格(API)为准。 ### cURL 请求示例 ```bash theme={null} curl --location 'https://geekai.co/api/v1/idcard/recognize' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \ --data '{ "image": "https://example.com/idcard.jpg" }' ``` ### Postman 请求响应示例 身份证识别 # 文本重排 Source: https://docs.geekai.co/cn/api/rerank openapi.yaml POST /rerank 注:嵌入模型名称设置参考[系统支持重排模型列表](https://geekai.co/models),切换模型时只需修改对应的模型名称即可。 响应数据格式和OpenAI完全兼容。 # 创建响应 Source: https://docs.geekai.co/cn/api/response openapi.yaml POST /responses Response API 是 OpenAI 最先进的模型响应生成接口,支持文本和图像输入,输出文本内容。 # 创建素材 Source: https://docs.geekai.co/cn/api/video/assets openapi.yaml POST /assets/create 用于上传文件创建自定义素材。创建自定义素材可用于真人视频场景。 # 创建素材组 Source: https://docs.geekai.co/cn/api/video/assets-group openapi.yaml POST /assets/group 用于创建素材资产组合。 # 获取单个素材 Source: https://docs.geekai.co/cn/api/video/assets-result openapi.yaml GET /assets/{task_id} 创建素材任务需要通过任务结果获取接口查询素材生成状态,当 `status` 字段值为 `succeed` 表明素材创建成功,可以拿到素材ID进行后续操作。 ### 请求/响应参数明细 # 创建视频任务 Source: https://docs.geekai.co/cn/api/video/generations openapi.yaml POST /videos/generations 你可以在模型广场筛选查看[系统支持的所有视频模型列表](https://geekai.co/models)。 不同AI平台的视频生成模型支持的视频尺寸不一样,具体支持的尺寸请参考下面的表格:
平台 模型 支持的尺寸
OpenAI Sora-1 480x480、480x854、854x480、720x720、720x1280、1280x720、1080x1080、1080x1920、1920x1080, 不同尺寸不同时长视频生成价格不同
OpenAI Sora-2 720x1280、1280x720、1024x1792、1792x1024, 不同尺寸不同时长视频生成价格不同
Google Veo系列 无尺寸配置,支持宽高比:16:9(默认值)、9:16,参考图片仅支持 jpg/png 格式,Veo3支持生成音频。
智谱清言 CogVideoX系列 720x480、1024x1024、1280x960、960x1280、1920x1080、1080x1920、2048x1080、3840x216, 默认短边是1080,长边按比例缩放
可灵AI kling系列 无尺寸配置,支持分辨率:720p(std)、1080p(pro)、4k(v3系列开始支持),支持宽高比:16:9、9:16、1:1,默认值:16:9
豆包/即梦AI Seedance系列 无尺寸配置,支持分辨率:480p、720p、1080p,默认值:1080p, 支持宽高比:16:9、4:3、1:1、3:4、9:16、21:9,默认值:16:9,图生视频默认值:adaptive
通义万相 Wanx系列 无尺寸配置,支持分辨率:480p、720p、1080p,其中`wanx2.1-t2v-plus`、`wanx2.1-i2v-plus`、`wanx2.1-kf2v-plus`仅支持720p(默认值),`wanx2.1-t2v-turbo`、`wanx2.1-i2v-turbo`、`wan2.2-i2v-flash`支持480p、720p(默认值),`wan2.2-t2v-plus`、`wan2.2-i2v-plus`支持480p、1080p(默认值),并且文生视频通过`size`字段传递分辨率,图生视频通过`resolution`传递分辨率。
通义万相 快乐马系列 无尺寸配置,支持分辨率:720p、1080p(默认值)
MiniMax 海螺系列 无尺寸配置,支持分辨率:512P、768P、1080P。
Stability Stable Video系列 无尺寸配置,仅支持图生视频,因此对图片尺寸有要求,限定为以下几种尺寸(单位:像素): 1024x576、576x1024、768x768,参考图片仅支持 jpg/png 格式。
视频模型 API 调用示例可以参考这里:[生成视频](https://docs.geekai.co/cn/docs/video/model)。 ### 请求/响应参数明细 # 获取视频结果 Source: https://docs.geekai.co/cn/api/video/result openapi.yaml GET /videos/{task_id} 异步创建的视频任务(`async`参数为`true`)需要通过视频结果获取接口查询视频生成状态,该接口响应数据格式和创建视频接口完全一致,只需要关注 `task_status` 和 `video_result` 字段值即可。 ### 请求/响应参数明细 # 网页读取 Source: https://docs.geekai.co/cn/api/web_fetch openapi.yaml POST /web_fetch 网页读取 API 是一个专为大模型设计的网页读取工具,可以返回更适合大模型处理的结果(包含网页标题、内容、摘要等信息)。支持多个读取引擎以及多种内容格式输出。 # 联网搜索 Source: https://docs.geekai.co/cn/api/web_search openapi.yaml POST /web_search 联网搜索 API 是一个专给大模型用的搜索引擎,在传统搜索引擎网页抓取、排序的能力基础上,增强了意图识别能力,返回更适合大模型处理的结果(网页标题、URL、摘要、名称、图标等)。支持意图增强检索、结构化输出和多引擎支持。 # BotGem Source: https://docs.geekai.co/cn/cases/botgem 打开 [BotGem](https://botgem.com/) 设置界面,填入极客智坊 API 接口 URL 和 API\_KEY: BotGem 注意:接口 URL 后面不要带 / 后缀。 配置完成后,点击 Check Connection 测试连接是否正常,正常则点击 Save 保存设置,然后进入对话界面即可通过极客智坊代理的 AI 模型进行对话: BotGem # CCSwitch Source: https://docs.geekai.co/cn/cases/ccswitch CC Switch 是一款跨平台桌面应用,专为使用 AI 编程工具的开发者设计。它帮助你统一管理 Claude Code、Codex、Gemini CLI、OpenCode、OpenClaw 和 Hermes 等受管应用的配置。 **核心功能** * 一键切换多个 API 供应商配置 * 统一供应商功能,跨应用共享配置 * 用量查询与余额显示 * 支持预设模板,快速添加常用供应商 * MCP 服务器:管理 Model Context Protocol 服务器,扩展 AI 能力 * Prompts:管理系统提示词预设,快速切换不同场景 * Skills:安装和管理技能扩展 **支持的平台** * Windows 10 及以上 * macOS 12 (Monterey) 及以上 * Ubuntu 22.04+ / Debian 11+ / Fedora 34+(x64 / ARM64) 附[官方文档](https://ccswitch.io/zh/docs)地址 首先,我们需要根据自己的设备环境和操作系统下载并安装 CCSwitch,附下载地址:[CCSwitch 下载](https://github.com/farion1231/cc-switch/releases)。安装完成后打开 CCSwitch,进入web界面: 下载完成之后,就可以打开cc switch了,进入web界面: Web界面 可以看见,cc switch上面 的导航栏,可以点击配置不同的cli终端,本次以配置codex ,claude code, Gemini cli为例,来接入极客智坊的api: 以codex为例,点击codex,然后点击右上面的 "+" 号,进入添加供应商界面: 我们选择自定义配置,然后填写供应商名称,API Key,Base URL,模型名称等相关信息: 添加供应商 对应的config.toml会自定生成配置好: 添加供应商 等所有配置好以后,就直接点击添加就可以了: 添加供应商 然后我们可以,在供应商列表中看到我们刚才添加的供应商,可以先进行一步测试 添加供应商 这个编辑按钮,可以继续调整配置,比如修改模型名称,或者修改模型参数,这个测试按钮,可以测试供应商是否可用 如果有多个供应商,可以进行切换,移动到相应的供应商上,点击启用,就可以切换到这个供应商了: 然后我们打开codex cli 终端,启动,看看是否能正常使用: 添加供应商 对应的账单界面扣除相应的费用: 添加供应商 由于codex目前仅支持response协议,所以有很多模型用不了。但是,随着cc switch更新到v3.16.1的新版本之后,cc-switch可以使用本地路由的配置来使用像deepseek这种不支持response协议的模型: 首先我们将cc-switch升级到最新的v3.16.1版本,升级完成后,我们进去更改供应商极客智坊的配置: 添加供应商 这里我们需要开启这个本地路由映射的开关,然后添加对应的模型映射名称,完成之后记得点击保存。 再进入设置里面的路由配置界面,将这些路由开关开启: 添加供应商 最后,我们重新启动codex cli 终端,可以看到,codex 终端已经使用了本地路由映射的模型: 添加供应商 然后看一下账单页面是否有对应模型的消费记录。如果要使用支持response协议的模型的话,就不需要开启这些本地路由的开关,直接按照之前的步骤配置即可。 同样的,我们也可以添加claude code 和 Gemini cli 的供应商,步骤也是一样的: 点击claude code,点击右上角的"+"号,进入添加供应商界面: 还是按照上面的配置,填写供应商名称,API Key,Base URL,模型名称等相关信息,接口 URL 后面不要带 / 后缀 添加供应商 添加供应商 注意:注意这里使用message 接口的话,base url 要填写[https://geekai.co/api](https://geekai.co/api) , 去掉/v1。 最后点击添加即可,同样配置好以后,我们启用Claude Code 来验证一下: 添加供应商 同样的,我们也可以添加Gemini cli 的供应商,步骤也是一样的: 添加供应商 添加供应商 注意:注意这里,base url 要填写[https://geekai.co/api](https://geekai.co/api) , 去掉/v1。 # Chatbox Source: https://docs.geekai.co/cn/cases/chatbox 打开 [Chatbox](https://chatboxai.app/zh) 设置界面,通过设置->模型提供方->添加新模型提供方,将极客智坊作为第三方模型提供方: ![添加极客智坊作为Chatbox第三方模型提供方](https://static.geekai.co/storage/2025/08/10/image-20250810122907276.png) 然后在配置界面填入极客智坊作为模型代理商的 Base URL 和 API Key,这里需要注意的是新版需要将 Base URL 拆分成两部分,单独配置 API 主机和 API 路径: ![Chatbox 新版本配置极客智坊模型代理](https://static.geekai.co/storage/2025/08/10/image-20250810122439932.png) 极客智坊 Base URL 和 API KEY 获取可以参考极客智坊[首次调用文档](https://docs.geekai.co/cn/docs/quick_start),这里需要注意的是,极客智坊国内版(geekai.co)和国外版(geekai.dev)账号和余额不共享,如果你是国内版注册请使用国内版 API KEY,国外版注册则使用国外版的 API KEY,否则会有报错。 如果你的 Chatbox 报如下错误,需要按照上面的方式进行配置: ![Chatbox 模型提供方报错](https://static.geekai.co/storage/2025/08/10/image-20250810124144150.png) 接下来点击检测按钮检查模型提供方是否可以连通,再通过模型提供方配置界面右下角新建/获取按钮添加模型,模型ID与极客智坊[模型广场](https://geekai.co/models)中拷贝的模型ID一致。 完成以上配置后,点击 Chatbox 界面左下角新对话按钮,进入对话界面即可通过极客智坊代理的 AI 模型进行 Chatbox 对话: ![通过极客智坊模型代理使用 Chatbox 客户端进行 AI 对话](https://static.geekai.co/storage/2025/08/10/image-20250810123714005.png) # Cherry Studio Source: https://docs.geekai.co/cn/cases/cherrystudio 下载安装 [Cherry Studio](https://cherry-ai.com/)后, 打开模型服务设置界面,先创建极客智坊作为模型供应商(注意供应商类型选择 OpenAI,因为极客智坊所有模型 API 均兼容 OpenAI 接口格式,包括 Claude、Gemini): Cherry Studio 然后在模型供应商页面填入极客智坊模型代理 Base URL 和 API\_KEY: Cherry Studio 注意:API 地址后面不要带 / 后缀,输入 [https://geekai.co/api](https://geekai.co/api) 或 [https://geekai.dev/api](https://geekai.dev/api) 即可,以确保 API 完整地址是 [https://geekai.co/api/v1/chat/completions](https://geekai.co/api/v1/chat/completions) 或 [https://geekai.dev/api/v1/chat/completions。](https://geekai.dev/api/v1/chat/completions。) 完成以上配置后,还要点击管理按钮进入模型管理页面,在这里,你可以看到极客智坊支持的所有AI模型列表,选择你想要在 Cherry Studio 中使用的模型点击右侧+号按钮添加即可: Cherry Studio 添加好AI模型后,关闭模型管理弹窗,就可以看到极客智坊模型供应商页面已经展示刚才添加的所有模型了,点击检查按钮可检查任意模型的有效性: Cherry Studio 连接成功则表示该模型可用。 然后你可以进入默认模型配置界面通过极客智坊供应的AI模型配置 Cherry Studio 中不同场景的默认模型: Cherry Studio 完成以上配置后,就可以进入 Cherry Studio 的对话界面通过极客智坊代理的 AI 模型进行对话了: Cherry Studio 更多关于 Cherry Studio 的用法,可以参考官方文档。你可以在极客智坊的账单页面查看所有模型的调用费用: Cherry Studio # Claude Code Source: https://docs.geekai.co/cn/cases/claudecode Claude Code 是 Anthropic 官方推出的代理式编码工具,通过终端使用,可帮助您比以往更快地将想法转化为代码。 ### 快速入门 开始前需要确保终端已经安装过 [Node.js 18 或更高版本](https://nodejs.org/zh-cn/download/)。 安装完成后,打开终端,执行以下命令安装 Claude Code: ```bash theme={null} npm install -g @anthropic-ai/claude-code ``` 安装完成后,通过编辑器打开 Claude 的本地配置文件,配置通过极客智坊模型代理在国内使用 Claude Code: ```bash theme={null} vi ~/.claude/settings.json ``` Windows环境下请在 `%USERPROFILE%\.claude` 目录下新建 `settings.json` 文件进行编辑,其中 `%USERPROFILE%` 为本地用户根目录,请注意将其替换成自己本地的实际路径,例如我的 Windows 登录用户名是 `GeekAI`,对应的本地路径就是 `C:\Users\GeekAI`。 在 `settings.json` 中填入以下内容: ```json theme={null} { "env": { "ANTHROPIC_BASE_URL": "https://geekai.co/api", "ANTHROPIC_AUTH_TOKEN": "" } } ``` 记得将 `` 替换为你的[极客智坊 API 密钥](https://geekai.co/user/api_keys),如果你可以流畅访问[极客智坊国际版](https://geekai.dev/user/api_keys),还可以配置通过极客智坊海外代理使用 Claude Code: ```json theme={null} { "env": { "ANTHROPIC_BASE_URL": "https://geekai.dev/api", "ANTHROPIC_AUTH_TOKEN": "" } } ``` > 注意 Base URL 不要带 `/v1` 后缀,否则会报错。 对个人开发者而言,API KEY 使用默认均衡配置即可,如果你的项目比较大,或者想要更快地响应速度,可以到 [API Keys](https://geekai.co/user/api_keys) 管理页面通过编辑 KEY 的调度策略为**速度优先**来实现更快更稳定的响应速度(价格是官方价4折,支持缓存): ![切换极客智坊 API KEY 调度策略更快使用 Claude Code](https://static.geekai.co/storage/2025/07/26/image-20250726120136412.png) 如果你觉得成本还是高,项目也不大的情况下,可以将线路切换到低价渠道,同时把调度策略保持为**速度优先**,这样可以在保证速度的同时降低成本(价格是官方2折): ![切换极客智坊 API KEY 调度策略更便宜使用 Claude Code](https://static.geekai.co/storage/2025/08/05/a1f62b917f0f9e7b7bcc4764ec4d26b.png) 配置完成后保存文件,即可在终端中输入 `claude` 命令来启动 Claude Code: ```bash theme={null} claude ``` ![首次使用 Claude Code](https://static.geekai.co/storage/2025/07/19/image-20250719162727039.png) 首次使用系统会引导你进行环境配置,一路回车即可,当进入正式交互界面后,你就可以直接与 Claude 进行对话,获取代码建议或解决编程问题: ![通过极客智坊模型代理服务使用 Claude Code 进行编码](https://static.geekai.co/storage/2025/07/19/image-20250719162812032.png) ### 自定义配置 在 `env` 配置项中,除了以上基本配置之外,你还可以通过以下配置项进行更详细的自定义配置: * `ANTHROPIC_MODEL`: 要使用的自定义模型名称,默认为 `claude-sonnet-4-5-20250929` * `ANTHROPIC_SMALL_FAST_MODEL`: 后台任务模型名称,默认是 `claude-haiku-4-5-20251001` * `BASH_DEFAULT_TIMEOUT_MS`:长时间运行的 Bash 命令的默认超时时间 * `BASH_MAX_TIMEOUT_MS`:模型可以为长时间运行的 Bash 命令设置的最大超时 * `BASH_MAX_OUTPUT_LENGTH`: 模型可以为长时间运行的 Bash 命令设置的最大输出长度 * `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`: 每个 Bash 命令后返回到原始工作目录 * `CLAUDE_CODE_MAX_OUTPUT_TOKENS`: 模型生成的最大输出 token 数量 * `HTTP_PROXY`: 为网络连接指定 HTTP 代理服务器 * `HTTPS_PROXY`: 为网络连接指定 HTTPS 代理服务器 * `MAX_THINKING_TOKENS`: 强制模型思考预算 * `MCP_TIMEOUT`: MCP 服务器启动的超时时间(毫秒) * `MCP_TOOL_TIMEOUT`: MCP 工具执行的超时时间(毫秒) * `MAX_MCP_OUTPUT_TOKENS`: MCP 工具响应中允许的最大令牌数(默认:25000) 除此之外,你还可以通过以下命令来设置 Claude Code 的全局配置: * 列出设置:`claude config list` * 查看设置:`claude config get ` * 更改设置:`claude config set ` 例如要设置 Claude Code 的主题,可以通过如下指令完成: ```bash theme={null} claude config set theme dark #深色主题 claude config set theme light #浅色主题 ``` 要设置完整显示 Bash 指令输出,可以使用以下命令: ```bash theme={null} claude config set verbose true #默认false ``` 更多 Claude Code 配置信息请参考[官方文档](https://docs.anthropic.com/zh-CN/docs/claude-code/settings)。 ### 使用第三方模型 #### 使用 Kimi K2 最新发布的 Kimi K2 版本支持通过 Claude Code 进行调用,你只需要在配置极客智坊模型代理的基础上,通过 `/model` 指令切换到 Kimi 模型即可: ```bash theme={null} /model kimi-k2-0711-preview ``` ![在 Claude Code 中使用 Kimi K2](https://static.geekai.co/storage/2025/08/22/image-20250822191806247.png) #### 使用 DeepSeek V3.1 最新发布的 DeepSeek 3.1 版本支持通过 Claude Code 进行调用,你只需要在配置极客智坊模型代理的基础上,通过 `/model` 指令切换到 DeepSeek 模型即可: ```bash theme={null} /model deepseek-v3.1 ``` ![在 Claude Code 中使用 DeepSeek V3.1](https://static.geekai.co/storage/2025/08/22/image-20250822185215040.png) #### 使用 GLM 4.5 智谱清言旗下最新发布的 GLM 4.5 系列也提供了对 Claude Code 的兼容,极客智坊也提供了对这一兼容的支持,通过 `/model` 指令切换到对应的 GLM 模型即可: ```bash theme={null} /model glm-4.5 ``` ![在 Claude Code 中使用 GLM 4.5](https://static.geekai.co/storage/2025/09/05/image-20250905231320537.png) `glm-4.5`、`glm-4.5-air` 和 `glm-4.5-flash` 三个模型均支持通过 Claude Code 进行调用。 #### 使用 Qwen3 Coder 通义千问的 Qwen3 Coder Plus 版本也支持通过 Claude Code 进行调用,极客智坊提供了对这一兼容的支持,通过 `/model` 指令切换到对应的 Qwen3 Coder 模型即可: ```bash theme={null} /model qwen3-coder-plus ``` ![在 Claude Code 中使用 Qwen3-Coder-Plus](https://static.geekai.co/storage/2025/09/07/image-20250907003625796.png) #### 使用 MiniMax M2 MiniMax M2 兼容 Claude Code,专为 Agent 和代码而生,仅 Claude Sonnet 8% 价格,2倍速度,限时免费! ```bash theme={null} /model minimax-m2 ``` ![在 Claude Code 中使用 MiniMax M2](https://static.geekai.co/storage/2025/10/29/image-20251029001512284.png) ### 在 IDE 中使用 以 VSCode 为例,你可以在 VSCode 中安装 Claude Code 插件: ![Claude Code for VSCode](https://static.geekai.co/storage/2025/08/01/image-20250801102817642.png) 然后,在编辑器右上角点击 Claude Code 图标,就可以打开 Claude Code 窗口进行交互了: ![在 VSCode 中使用 Claude Code](https://static.geekai.co/storage/2025/08/01/image-20250801103317069.png) ![在 VSCode 中使用 Claude Code](https://static.geekai.co/storage/2025/08/01/image-20250801103657864.png) Claude Code for VSCode 插件目前会直接使用你在终端配置的 Claude Code 环境,因此无需额外配置。 # Cline Source: https://docs.geekai.co/cn/cases/cline 在 VS Code 中安装 [Cline](https://github.com/cline/cline) 扩展后,打开 Cline 配置界面,在 AI 供应商下拉列表中选择 OpenAI Compatible,然后在下面的配置项中填入极客智坊模型代理接口 Base URL 和 API\_KEY,以及默认使用的模型名称: Cline 配置完成后,点击 Let’s go 按钮,就可以通过极客智坊的模型代理服务在 VS Code 中使用 Cline 了: Cline 如果你想要显示推理模型的思考链,需要在 Cline API 配置界面点开模型配置(Model Configuration),勾选 Enable R1 messages format: ![在Cline中配置显示推理模型思考链](https://static.geekai.co/storage/2025/06/19/image-20250619235935005.png) 在 Model ID 中填入一个兼容 DeepSeek R1 的推理模型名称,例如 `deepseek-r1-0528:free`,然后点击 Save 按钮保存配置,下次对话就可以在 Cline 界面看到思考链输出了: ![在Cline中查看极客智坊推理模型思考链输出](https://static.geekai.co/storage/2025/06/20/20250620000504.jpg) > 极客智坊所有[推理模型](https://docs.geekai.co/cn/docs/chat/reasoning)思考链输出均兼容 DeepSeek R1 格式,因此都可以在 Cline 中按照这种方式配置思考链输出。 你可以在极客智坊后台[账单记录页面](https://geekai.co/user/transactions) 查看API消耗情况: Cline 更多关于 Cline 的用法,可以参考[官方文档](https://docs.cline.bot/) 。 # Codex CLI Source: https://docs.geekai.co/cn/cases/codexcli Codex CLI 是 OpenAI 官方推出的代理式编码工具,通过终端使用,可帮助您比以往更快地将想法转化为代码。 开始前需要确保终端已经安装过 [Node.js 18 或更高版本](https://nodejs.org/zh-cn/download/)。 安装完成后,打开终端,执行以下命令安装 Claude Code: ```bash theme={null} npm install -g @openai/codex # Alternatively: `brew install codex` ``` 安装完成后,通过 Vi 编辑器打开 Codex 的本地配置文件,配置通过极客智坊模型代理在国内使用 Codex: ```bash theme={null} vim ~/.codex/config.toml ``` 填入以下内容: ```toml theme={null} # 填写你默认使用的模型,支持填写极客智坊所有对话模型ID model = "gpt-5.3-codex" # 填写你默认使用的模型提供商 model_provider = "geekai" # 模型提供商的配置 [model_providers.geekai] # 将在Codex用户界面中显示的提供者名称。 name = "GeekAI" # Base URL,如果你的终端可以访问外网,可以使用海外入口 https://geekai.dev/api/v1 base_url = "https://geekai.co/api/v1" # API KEY,用于 API 请求认证 env_key = "GEEKAI_API_KEY" # wire_api 的有效值为 "chat" 和 "responses"。如果省略,默认为 "chat"。 wire_api = "responses" ``` 配置 `model` 为 `gpt-5.3-codex` 时,必须保证 `wire_api` 设置为 `responses`,否则会报错,因为 GPT-5.3-Codex 仅支持 Response API。 注意这里的 `env_key` 必须填写为 `GEEKAI_API_KEY`,这是 Codex CLI 约定的环境变量名称,用于读取 API KEY,**不要配置成了 API KEY 的值!!!** 保存配置文件后,需要通过以下命令在环境变量中设置 API KEY 的值: ```bash theme={null} export GEEKAI_API_KEY= ``` > 直接执行 `export` 只能当前会话生效,如果想要永久生效,可以将上述命令添加到 `~/.bashrc` 或 `~/.zshrc` 文件中,然后执行 `source ~/.bashrc` 或 `source ~/.zshrc` 来使更改生效。 记得将 `` 替换为您的[极客智坊 API 密钥](https://geekai.co/user/api_keys),如果 Base URL 使用的是海外入口,则需要前往[极客智坊海外版](https://geekai.dev/user/api_keys)获取 API KEY。 对个人开发者而言,API KEY 使用默认均衡配置即可,如果你的项目比较大,或者想要更快地响应速度,可以到 [API Keys](https://geekai.co/user/api_keys) 管理页面通过编辑 KEY 的线路为高可用来实现更快更稳定的响应速度: ![切换极客智坊API KEY调度策略](https://static.geekai.co/storage/2025/07/26/image-20250726123753201.png) 如果你对价格比较敏感,同时对接口稳定性要求不高,可以选择将 API KEY 的线路切换为低价渠道。 配置完成后保存文件,即可在终端中输入 `codex` 命令来启动 OpenAI Codex CLI: ```bash theme={null} codex ``` ![首次使用 OpenAI Codex CLI](https://static.geekai.co/storage/2025/07/26/image-20250726130308039.png) Codex CLI 不需要做任何配置,当进入正式交互界面后,你就可以直接与 OpenAI Codex 进行对话,获取代码建议或解决编程问题: ![通过极客智坊模型代理服务使用 OpenAI Codex 进行编码](https://static.geekai.co/storage/2025/07/26/image-20250726130640193.png) # Continue Source: https://docs.geekai.co/cn/cases/continue 在 VS Code 中安装 Continue 扩展后,打开 Continue 配置文件,以 OpenAI 兼容供应商方式配置极客智坊模型代理 Base URL 和 API KEY: Continue 配置完成后,就可以通过极客智坊的模型代理服务在 VS Code 中使用 Continue 了,你可以在模型下拉框选择配置文件中配置的模型: Continue 然后输入你的问题,即可获得对问题的解答: Continue 更多关于 Continue 的用法,可以参考[官方文档](https://docs.continue.dev/) 。 # 扣子插件 Source: https://docs.geekai.co/cn/cases/coze 我们已经发布了官方插件 GeekAI 到[扣子插件商店](https://www.coze.cn/store/plugin/7470533618771804212),方便你在扣子平台创建智能体/应用时使用 GeekAI 提供的 AI 模型对话和画图服务: 在扣子中使用极客智坊AI模型服务 在扣子中使用极客智坊AI模型服务 以在扣子中创建智能体为例,我们可以通过在插件中添加 GeekAI 来提供低价模型代理服务用于智能体对话: 在扣子中使用极客智坊AI模型服务 我们需要在插件参数中填入极客智坊 API KEY 到 GeekAI-Api-Key 认证头用于 API 认证以及模型名称来自定义使用的对话模型,你还可以配置温度参数来为智能体设置适合的回答风格: 在扣子中使用极客智坊AI模型服务 在扣子中使用极客智坊AI模型服务 还可以通过创建工作流引用 GeekAI 插件来完成更复杂的业务逻辑: 在扣子中使用极客智坊AI模型服务 在扣子中使用极客智坊AI模型服务 同样也要配置认证参数和模型信息: 在扣子中使用极客智坊AI模型服务 此外,为了能够正常处理输入输出消息,我们还需要通过代码处理输入消息数据结构: 在扣子中使用极客智坊AI模型服务 以及在结束流程中获取AI响应消息输出: 在扣子中使用极客智坊AI模型服务 完整的工作流配置如下: 在扣子中使用极客智坊AI模型服务 配置好了之后,就可以通过极客智坊模型代理服务进行扣子智能体对话了: 在扣子中使用极客智坊AI模型服务 使用过程中如果遇到任何问题,可以加入极客智坊官方用户交流群进行咨询和交流: 极客智坊微信群 # Cursor Source: https://docs.geekai.co/cn/cases/cursor 打开 [Cursor](https://www.cursor.com/)配置界面,填入极客智坊 API 接口 URL 和 API\_KEY: Cursor 注意:接口 URL 后面要带 /v1 后缀。 配置完成后,点击 Verify 进行验证,验证通过后保存设置,然后进入对话界面即可通过极客智坊代理 OpenAI 模型进行对话: Cursor 如果你觉得其他模型编写代码质量更高,比如 Claude Sonnet 4.0,但 Cursor 不支持自定义 Claude 请求 URL,这可以通过自定义模型 `geekai-coder` 进行转发来达到曲线救国的效果: Cursor 极客智坊在接收到该模型请求时,会自动转发到 Claude Sonnet 4.0 标准版接口,所以你可以在 Cursor 中直接使用: Cursor > 另外,极客智坊提供了 `geekai-coder-thinking` 别名指向 Claude Sonnet 4 推理版,以及 `geekai-3-5-coder`、`geekai-3-7-coder` 别名指向 Claude Sonnet 3.5 和 Claude Sonnet 3.7 模型,方便用户选用。 # Dify Source: https://docs.geekai.co/cn/cases/dify 打开 [Dify](https://cloud.dify.ai/apps) 设置界面,填入极客智坊 API Base URL 和 API\_KEY 将其作为 OpenAI 模型代理供应商: Dify Dify Dify 通过这种方式只能代理 OpenAI 平台的模型,要在 Dify 中使用极客智坊支持的其他平台模型,需要通过 OpenAI-API-Compatible 入口继续添加其他模型: Dify Dify # Gemini CLI Source: https://docs.geekai.co/cn/cases/geminicli Gemini CLI 是 Google 官方推出的代理式编程工具,通过本地终端使用,支持 Gemini 3,支持查询和编辑大型代码库,支持从图像或 PDF 生成应用程序,并自动化复杂的工作流程。 开始前需要确保终端已经安装过 [Node.js 18 或更高版本](https://nodejs.org/zh-cn/download/)。 安装完成后,打开终端,执行以下命令安装 Claude Code: ```bash theme={null} npm install -g @google/gemini-cli ``` 安装完成后,运行如下指令配置通过极客智坊模型代理在国内使用 Gemini: ```bash theme={null} export GOOGLE_GEMINI_BASE_URL="https://geekai.co/api" export GEMINI_API_KEY="" ``` > 直接执行 `export` 只能当前会话生效,如果想要永久生效,可以将上述命令添加到 `~/.bashrc` 或 `~/.zshrc` 文件中,然后执行 `source ~/.bashrc` 或 `source ~/.zshrc` 来使更改生效。 记得将 `` 替换为您的[极客智坊 API 密钥](https://geekai.co/user/api_keys),如果 Base URL 使用的是海外入口,则需要前往[极客智坊海外版](https://geekai.dev/user/api_keys)获取 API KEY。 对个人开发者而言,API KEY 使用默认均衡配置即可,如果你的项目比较大,或者想要更快地响应速度,可以到 [API Keys](https://geekai.co/user/api_keys) 管理页面通过编辑 KEY 的线路为高可用来实现更快更稳定的响应速度: ![切换极客智坊 API KEY 调度策略](https://static.geekai.co/storage/2025/07/26/image-20250726123753201.png) 如果你对价格敏感,还可以切换到低价线路,但是稳定性会有所下降。 配置完成后保存文件,即可在终端进入项目目录输入 `gemini` 命令来启动 Gemini CLI: ```bash theme={null} gemini ``` ![首次使用 Gemini CLI](https://static.geekai.co/storage/2025/11/27/image-20251127141940635.png) Gemini CLI 不需要做任何配置,当进入正式交互界面后,你就可以直接与 Gemini 进行对话,获取代码建议或解决编程问题: ![通过极客智坊模型代理服务使用 Gemini CLI 进行编码](https://static.geekai.co/storage/2025/11/27/image-20251127142239041.png) 目前 Gemini CLI 默认使用的是 Gemini 2.5 Pro 模型,如果你想要使用最新的 Gemini 3 Pro Preview 模型,可以通过 `/settings` 命令进入设置界面,并开启 Preview features: ```bash theme={null} /settings ``` ![开启 Gemini CLI 使用 Genini 3 Pro Preview](https://static.geekai.co/storage/2025/11/27/image-20251127142600180.png) 该功能默认是关闭的,选中后 Enter 即可开启在 Gemini CLI 中使用 Gemini 3 Pro Preview 模型进行交互,接下来,你还可以通过 `/model` 命令进一步切换不同的 Gemini 模型: ```bash theme={null} /model ``` ![切换 Gemini CLI 使用不同 Gemini 模型](https://static.geekai.co/storage/2025/11/27/image-20251127143601470.png) # 沉浸式翻译 Source: https://docs.geekai.co/cn/cases/immersivetranslation 打开 [沉浸式翻译](https://immersivetranslate.com/zh-Hans/) 浏览器插件设置界面,填入极客智坊 API 接口 URL 和 API\_KEY: 沉浸式翻译 沉浸式翻译 注意:翻译任务使用免费模型即可,性价比最高,比如glm-4-flash。 配置完成后会自动保存设置,然后在浏览器页面即可通过极客智坊代理 OpenAI 模型进行沉浸式翻译了: 沉浸式翻译 # LobeChat Source: https://docs.geekai.co/cn/cases/lobechat 打开 [LobeChat](https://lobechat.com/) 设置面板进入语言模型界面,在 OpenAI 选项卡填入极客智坊 API 接口 URL 和 API\_KEY: LobeChat 注意:不要勾选使用客户端请求模式,否则会连接失败。 点击检查按钮,成功则表示可以正常连接,然后点击获取模型列表,选择你喜爱的模型用于在聊天对话界面显示: LobeChat 配置完成后会自动保存设置,进入 LobeChat 对话聊天界面,就可以通过极客智坊代理的 AI 模型进行对话了: LobeChat LobeChat # OpenAI Translator Source: https://docs.geekai.co/cn/cases/openaitranslator 打开 [OpenAI Translator](https://chromewebstore.google.com/detail/openai-translator/ogjibjphoadhljaoicdnjnmgokohngcc) 浏览器插件设置界面,填入极客智坊 API 接口 URL 和 API\_KEY: OpenAI Translator OpenAI Translator 配置完成后,点击 Save 保存设置,然后在浏览器页面即可通过极客智坊代理 OpenAI 模型进行翻译: OpenAI Translator # OpenClaw Source: https://docs.geekai.co/cn/cases/openclaw ### 什么是 OpenClaw OpenClaw(曾用名 ClawdBot/Moltbot)是 2026 年最火的开源 AI Agent 项目,GitHub 已获得超过 68,000 星标。它不是普通的聊天机器人,而是一个真正能够执行任务的个人 AI 助理。 **本地执行** * 数据存储在你的设备上,无需上传云端 * 完全掌控隐私和数据安全 **真实执行** * 不仅是对话,能实际操作你的电脑 * 自动化处理邮件、日历、文件管理等任务 **多平台消息** * 支持 WhatsApp、Telegram、Discord、Slack 等 10+ 平台 * 从单一入口管理所有通讯 **持久记忆** * 跨会话保存上下文和用户偏好 * 随着时间推移越来越了解你,持续提升效率 **开源免费** * 完全开源,只需自备 API Key * 免费,完全自主控制 **OpenClaw vs 传统 AI 助手** 传统 AI(如 ChatGPT): * 你:“帮我整理桌面文件” * AI:“我建议你可以这样做:1. 创建文件夹…… 2. 按类型分类……” OpenClaw: * 你:“帮我整理桌面文件” * OpenClaw:直接重命名、分类、移动文件 “已完成!我把 47 个文件按类型整理到 5 个文件夹中。” 这就是“聊天机器人”和“AI Agent”的本质区别。 ### 新手阶段:基础入门 #### 第一步:环境准备 系统要求: * 操作系统: macOS、Linux 或 Windows (需要 WSL) * Node.js: v22 或更高版本 * AI 模型 API Key: Claude、GPT、Gemini 等官方或极客智坊等第三方聚合代理的 API 密钥 🔨 检查环境: ```bash theme={null} # 检查 Node.js 版本 node --version # 如果版本低于 v22,需要升级 curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs ``` #### 第二步:安装 OpenClaw 下面我们以 macOS/Linux 为例,演示如何通过 NPM 安装 OpenClaw: ```bash theme={null} # 全局安装 OpenClaw npm install -g openclaw # 验证安装 openclaw --version ``` ### 第三步:初始化配置 ```bash theme={null} # 启动初始化向导 openclaw onboard ``` ![OpenClaw 启动向导](https://static.geekai.co/storage/2026/02/28/image-20260228220400205.png) 向导会引导你完成: * 选择 AI 模型提供商(Anthropic/OpenAI/自定义):这里我们选择自定义模型供应商并输入极客智坊 Base URL * 输入 API Key:粘贴你的[极客智坊 API Key](https://geekai.co/user/api_keys) * 输入模型名称:输入你想使用的极客智坊对话模型ID,例如 `gpt-5.3-codex`、`claude-sonnet-4-6` 或 `gemini-3.1-pro-preview`,所有对话模型ID可以在[极客智坊模型广场](https://geekai.co/models)查看拷贝 * 选择消息平台(Telegram/Discord/WhatsApp 等) * 配置系统权限(建议先选择沙盒模式) ![OpenClaw 配置自定义模型供应商](https://static.geekai.co/storage/2026/02/28/image-20260228220747794.png) ![OpenClaw 配置模型供应商 Base URL 和 API KEY](https://static.geekai.co/storage/2026/02/28/image-20260228220851531.png) #### 第四步:第一次对话 启动 OpenClaw: ```bash theme={null} # 启动 OpenClaw openclaw # 或者启动 Dashboard(Web 界面) openclaw dashboard ``` ![基于极客智坊模型代理与 OpenClaw 对话](https://static.geekai.co/storage/2026/03/02/image-20260302171601787.png) 如果对话报错,提示 `Model context window too small (4096 tokens)`,可以通过编辑配置文件 `~/.openclaw/openclaw.json`,增加对应模型的 `contextWindow` 以及 `maxTokens` 参数,例如: ```json theme={null} "geekai": { "baseUrl": "https://geekai.co/api/v1", "apiKey": { "source": "env", "provider": "default", "id": "GEEKAI_API_KEY" }, "api": "openai-completions", "models": [ { "id": "gpt-5.3-codex", "name": "gpt-5.3-codex (Custom Provider)", "reasoning": false, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 16000, "maxTokens": 400000 } ] } ``` 编辑后保存即可正常使用。 安装配置中遇到任何问题,可以加入**极客智坊用户群**寻求帮助: 极客智坊微信群 #### 第五步:理解核心概念 **Gateway(网关)** Gateway 是 OpenClaw 与外部世界交互的方式: * 消息网关:Telegram、Discord、WhatsApp * API 网关:HTTP API 接口 * CLI 网关:命令行交互 **Skills(技能)** Skills 是 OpenClaw 的能力扩展,类似于“插件”或“应用”: * 每个 Skill 定义了一组特定任务 * 可以从 Clawhub 安装第三方 Skills * 也可以自己编写自定义 Skills **Memory(记忆)** OpenClaw 会记住: * 你的偏好和习惯 * 之前的对话上下文 * 重要的信息和任务 **Sandbox(沙盒)** 沙盒模式限制 OpenClaw 的系统访问权限,保护你的电脑安全: * Sandbox Mode: 限制文件系统、网络、Shell 访问 * Full Access Mode: 完全权限(需谨慎使用) 🔨 探索工作空间: ```bash theme={null} # 查看 OpenClaw 的工作目录 ls ~/.openclaw # 查看配置文件 openclaw config list # 查看已安装的 Skills openclaw skills list # 运行安全审计 openclaw security audit ``` ### 进阶阶段:实用技能 #### 第六步:安装和使用 Skills 浏览 Skills 市场,访问 [Clawhub](https://clawhub.geekai.co) 或使用命令: ```bash theme={null} # 搜索 Skills openclaw skills search email # 查看 Skill 详情 openclaw skills info @author/skill-name ``` 安装常用 Skills: ```bash theme={null} # 安装邮件管理 Skill openclaw skills install @openclaw/email-manager # 安装日历管理 Skill openclaw skills install @openclaw/calendar # 安装文件整理 Skill openclaw skills install @openclaw/file-organizer # 安装网页搜索 Skill(使用 Tavily 替代 Brave) openclaw skills install @openclaw/tavily-search ``` #### 第七步:Google Workspace 集成 OpenClaw 可以管理你的 Gmail、Google 日历、Google 文档等。 配置步骤: 1. 创建 Google Cloud 项目 * 访问 console.cloud.google.com * 创建新项目 * 启用 Gmail API、Google Calendar API、Google Drive API 2. 创建服务账号 * 在 IAM & Admin → Service Accounts 创建服务账号 * 下载 JSON 密钥文件 3. 配置 OpenClaw ```bash theme={null} openclaw config set integrations.google.enabled true openclaw config set integrations.google.credentialsPath "/path/to/credentials.json" ``` 4. 授权访问 ```bash theme={null} openclaw integrations google authorize ``` #### 第八步:设置定时任务(Cron Jobs) OpenClaw 可以定期自动执行任务。 创建每日简报: ```bash theme={null} 我想让你每天早上 8 点给我发送一份简报,包含: 1. 今天的天气 2. 我的日历安排 3. 未读邮件数量 4. 一句励志的话 ``` OpenClaw 会自动创建一个定时任务(cron job)。 查看定时任务: ```bash theme={null} # 列出所有定时任务 openclaw cron list # 查看任务详情 openclaw cron show # 禁用任务 openclaw cron disable # 删除任务 openclaw cron delete ``` #### 第九步:配置持久记忆 OpenClaw 的记忆系统让它能记住你的偏好。 **训练你的助手** 告诉 OpenClaw 关于你的信息: ```bash theme={null} 记住以下关于我的信息: - 我的名字是 [你的名字] - 我的工作是 [你的职业] - 我的工作时间是周一到周五 9:00-18:00 - 我喜欢简洁的回复,不要太啰嗦 - 我使用中文交流 - 我的时区是 GMT+8 ``` 查看记忆: ```bash theme={null} # 查看记忆文件 cat ~/.openclaw/memory/long-term.json # 或在对话中询问 你记得我的哪些信息? ``` ### 中级阶段:高级应用 #### 第十步:编写自定义 Skill Skills 使用 YAML 或 Markdown 格式定义。 **Skill 基本结构** 创建文件 `~/.openclaw/skills/my-first-skill.yaml`: * name: "每日新闻摘要" * description: "获取并总结今日科技新闻" * version: "1.0.0" ```yaml theme={null} triggers: - "今日新闻" - "科技新闻" steps: - action: web_search query: "latest tech news today" max_results: 5 - action: summarize content: "{{search_results}}" style: "bullet_points" - action: respond message: "📰 今日科技新闻摘要: {{summary}}" ``` **安装自定义 Skill** ```bash theme={null} # 重新加载 Skills openclaw skills reload # 测试 Skill openclaw skills test "每日新闻摘要" ``` #### 第十一步:多 Agent 管理 你可以运行多个 OpenClaw 实例,每个有不同的配置和用途。 创建多个 Agent: ```bash theme={null} # 创建工作用 Agent openclaw create-agent work openclaw config --agent work set ai.model "claude-sonnet-4.6" # 创建个人用 Agent openclaw create-agent personal openclaw config --agent personal set ai.model "gpt-5.3" # 切换 Agent openclaw switch-agent work openclaw switch-agent personal # 列出所有 Agent openclaw list-agents ``` 使用场景: * 工作 Agent: 连接公司邮箱、项目管理工具 * 个人 Agent: 管理个人日程、家庭事务 * 实验 Agent: 测试新功能、新 Skills #### 第十二步:Docker 沙盒安全实践 Docker 沙盒提供最强的安全隔离。 配置 Docker 沙盒: ```bash theme={null} # 安装 Docker(如果还没有) # macOS: 下载 Docker Desktop # Linux: sudo apt install docker.io # 配置 OpenClaw 使用 Docker 沙盒 openclaw config set sandbox.mode "docker" openclaw config set sandbox.docker.image "openclaw/sandbox:latest" # 测试沙盒 openclaw sandbox test ``` Docker 沙盒会限制: * 文件系统访问(只能访问指定目录) * 网络访问(可配置白名单) * 系统命令执行 * 资源使用(CPU、内存限制) #### 第十三步:浏览器控制 OpenClaw 可以控制浏览器执行复杂的网页操作。 启用浏览器控制: ```bash theme={null} # 安装浏览器控制插件 openclaw plugins install @openclaw/browser-control # 配置浏览器 openclaw config set browser.enabled true openclaw config set browser.headless false # false 表示显示浏览器窗口 ``` 使用示例: ```bash theme={null} 打开浏览器,访问 GitHub,搜索 "openclaw",并告诉我前 3 个结果 ``` ```bash theme={null} 帮我在亚马逊上搜索 "机械键盘",找到评分最高的 3 个产品,记录价格 ``` ### 第十四步:与其他工具集成 Linear 集成(项目管理): ```bash theme={null} # 安装 Linear Skill openclaw skills install @openclaw/linear # 配置 API Key openclaw config set integrations.linear.apiKey "YOUR_LINEAR_API_KEY" ``` 使用示例: ```bash theme={null} 在 Linear 中创建一个新任务:"修复登录页面的 bug",优先级高 ``` Obsidian 集成(笔记): ```bash theme={null} # 安装 Obsidian Skill openclaw skills install @openclaw/obsidian # 配置 Obsidian vault 路径 openclaw config set integrations.obsidian.vaultPath "/path/to/obsidian/vault" ``` 使用示例: ```bash theme={null} 在 Obsidian 中创建一篇新笔记,标题是"OpenClaw 学习笔记" ``` #### 第十五步:高级配置优化 性能优化: ```bash theme={null} # 配置缓存 openclaw config set cache.enabled true openclaw config set cache.ttl 3600 # 配置并发请求 openclaw config set ai.maxConcurrentRequests 3 # 配置超时 openclaw config set ai.timeout 30000 ``` 成本控制: ```bash theme={null} # 设置每日 API 调用限制 openclaw config set ai.dailyLimit 1000 # 设置每月预算(美元) openclaw config set ai.monthlyBudget 50 # 查看使用统计 openclaw stats usage openclaw stats cost ``` 日志和调试: ```bash theme={null} # 启用详细日志 openclaw config set logging.level "debug" # 查看日志 openclaw logs # 查看特定时间的日志 openclaw logs --since "2026-02-20" # 导出日志 openclaw logs --export logs.txt ``` # OpenCode Source: https://docs.geekai.co/cn/cases/opencode [OpenCode](https://opencode.ai/) 是一个开源代理,帮助您在终端、IDE 或桌面端编写代码。 下面我们以终端为例,演示如何在 OpenCode 中配置极客智坊模型代理来使用 OpenCode: ### 快速入门 安装 OpenCode 最简单的方法是通过安装脚本: ```bash theme={null} curl -fsSL https://opencode.ai/install.sh | bash ``` ![安装 OpenCode](https://static.geekai.co/storage/2026/02/25/image-20260225234457882.png) 安装完成后,进入项目目录,在项目根目录下创建一个 `opencode.json` 文件来配置极客智坊作为AI模型提供商: ```json theme={null} { "$schema": "https://opencode.ai/config.json", "provider": { "geekai": { "npm": "@ai-sdk/openai-compatible", "name": "GeekAI", "options": { "baseURL": "https://geekai.co/api/v1", "apiKey": "" }, "models": { "gpt-5.3-codex": { "name": "GPT-5.3 Codex" }, "claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" }, "gemini-3.1-pro-preview": { "name": "Gemini 3.1 Pro Preview" } } } } } ``` 记得将 `` 替换为你的[极客智坊 API 密钥](https://geekai.co/user/api_keys),如果你可以流畅访问[极客智坊国际版](https://geekai.dev),还可以配置通过极客智坊海外代理使用 OpenCode,只需要把 `baseURL` 替换成 `https://geekai.dev/api/v1`,并将 `` 替换为你的[极客智坊国际版 API 密钥](https://geekai.dev/user/api_keys) 即可。 完成配置后保存文件,即可在终端中输入 `opencode` 命令来启动 OpenCode: ```bash theme={null} opencode ``` ![启动 OpenCode](https://static.geekai.co/storage/2026/02/26/image-20260226111621634.png) 如果提示 `opencode: command not found`,请尝试重新打开一个新的终端窗口,或者执行 `source ~/.bashrc`(如果你使用的是 Bash)或 `source ~/.zshrc`(如果你使用的是 Zsh)来加载环境变量。 启动成功后,你就可以在终端中输入自然语言来让 OpenCode 帮你编写代码了: ![通过极客智坊模型代理服务使用 OpenCode 进行编码](https://static.geekai.co/storage/2026/02/26/image-20260226113011165.png) 如果你想要切换到其他模型,只需要运行 `/models` 命令来查看可用模型列表,然后选择对应的模型来切换即可: ![在 OpenCode 中切换模型](https://static.geekai.co/storage/2026/02/26/image-20260226112554508.png) # OpenManus Source: https://docs.geekai.co/cn/cases/openmanus 在 Manus 因邀请码机制陷入争议时,MetaGPT 的 OpenManus 团队 3 小时之内以闪电战般的开发速度迅速推出了免费开源版 Manus —— [OpenManus](https://github.com/mannaandpoem/OpenManus),无需邀请码,完全免费,以下是 OpenManus 的安装启动教程和演示视频: ### 安装教程 0、环境准备 由于 OpenManus 是基于 Python 开发的,这里我们基于 Python 环境管理工具 Conda 来快速安装 OpenManus。如果你的系统尚未安装,以 Ubuntu 为例,可以使用以下命令安装 Conda: ``` wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh ``` > 这里我们选择了轻量版的 [Miniconda](https://www.anaconda.com/docs/getting-started/miniconda/main),如果你的系统已经安装了 Anaconda,可以跳过这一步。 1、创建新的 Conda 环境: ``` conda create -n open_manus python=3.12 conda activate open_manus ``` 2、克隆仓库: ``` git clone https://github.com/mannaandpoem/OpenManus.git cd OpenManus ``` 3、安装依赖: ``` pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple ``` > 国内需要使用镜像源安装依赖加快速度。 安装过程中,遇到任何问题,请加入极客智坊[开发者群](https://docs.geekai.co/cn/docs/quick_start#开发者群)寻求帮助。 ### 快速启动 完成以上安装步骤后,还需要配置使用的大语言模型 API 才能启动 OpenManus,首先在 `config` 目录创建 `config.toml` 文件: ``` cp config/config.example.toml config/config.toml ``` 然后编辑 `config/config.toml` 配置 AI 模型、Base URL 及 API KEY,我们以极客智坊模型代理 API 为例进行演示: ``` # 全局 LLM 配置 [llm] model = "gpt-4o-mini" base_url = "https://geekai.dev/api/v1" api_key = "sk-..." # 替换为极客智坊用户后台 API KEY max_tokens = 4096 temperature = 0.0 # 可选特定 LLM 模型配置 [llm.vision] model = "gpt-4o-mini" base_url = "https://geekai.dev/api/v1" api_key = "sk-..." # 替换为极客智坊用户后台 API KEY ``` > API KEY 可以去极客智坊用户后台[令牌管理](https://geekai.co/user/api_keys)页面复制,极客智坊支持上百种主流 AI 模型,且比官方价格更低,可用性更高,可以从[模型广场](https://geekai.co/models)任意选用。 完成以上配置后,就可以通过以下命令启动 OpenManus 了: ``` python main.py ``` 接下来就可以从终端输入你的需求,开启 OpenManus 之旅了: ![通过控制台与OpenManus交互](https://static.geekai.co/storage/2025/03/07/image-20250307223239833.png) ### Web UI 社区贡献者还为 OpenManus 开发了 Web UI 项目 [OpenManusWeb](https://github.com/YunQiAI/OpenManusWeb),以便开发者在浏览器中体验 OpenManus,如果你已经安装过 OpenManus,可以参考以下步骤快速启动,除了最后启动命令之外,其他和 OpenManus 完全一样。 1、下载项目并安装依赖: ``` git clone https://github.com/YunQiAI/OpenManusWeb.git cd OpenManusWeb conda activate open_manus pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple ``` 2、配置文件: ``` cp config/config.example.toml config/config.toml ``` 配置文件内容和 OpenManus 完全一样,这里不再重复演示。 3、启动 Web 服务: ``` python web_run.py ``` 启动成功会自动在浏览器打开 Web UI 页面: ![OpenManusWeb启动命令](https://static.geekai.co/storage/2025/03/12/image-20250312154720162.png) 如果没有自动打开,可以手动访问 `http://localhost:8000`: ![OpenManus Web UI](https://static.geekai.co/storage/2025/03/12/image-20250312154859628.png) ### 项目演示 以下是 OpenManus 官方提供的 SEO 网站项目演示视频: