快速调用#
完成首次 API 调用,请参见 快速入门
import os
from arkruntime import Ark
client = Ark(
base_url='https://ark.cn-beijing.volces.com/api/v3',
# Get API Key: https://ark.volcengine.com/region:cn-beijing/apikey
api_key=os.getenv('ARK_API_KEY'),
)
response = client.responses.create(
model="doubao-seed-2-1-pro-260915",
input="hello", # Replace with your prompt
# thinking={"type": "disabled"}, # Manually disable deep thinking
)
print(response)
# Get API Key: https://ark.volcengine.com/region:cn-beijing/apikey
curl https://ark.cn-beijing.volces.com/api/v3/responses \
-H "Authorization: Bearer $ARK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seed-2-1-pro-260915",
"input": "hello"
}'
Windows CMD 环境下请将 $ARK_API_KEY 替换为 %ARK_API_KEY%,PowerShell 环境下替换为 $env:ARK_API_KEY。
package main
import (
"context"
"fmt"
"os"
"github.com/volcengine/ark-runtime-go/arkruntime"
"github.com/volcengine/ark-runtime-go/arkruntime/model/responses"
)
func main() {
client := arkruntime.NewClientWithApiKey(
// Get API Key: https://ark.volcengine.com/region:cn-beijing/apikey
os.Getenv("ARK_API_KEY"),
arkruntime.WithBaseUrl("https://ark.cn-beijing.volces.com/api/v3"),
)
ctx := context.Background()
resp, err := client.CreateResponses(ctx, &responses.ResponsesRequest{
Model: "doubao-seed-2-1-pro-260915",
Input: responses.NewStringResponsesInput("hello"),
})
if err != nil {
fmt.Printf("response error: %v\n", err)
return
}
fmt.Println(resp)
}
package com.ark.sample;
import com.volcengine.ark.runtime.service.ArkService;
import com.volcengine.ark.runtime.models.responses.*;
public class DemoSample {
public static void main(String[] args) {
// Get API Key: https://ark.volcengine.com/region:cn-beijing/apikey
String apiKey = System.getenv("ARK_API_KEY");
// The base URL for model invocation
ArkService arkService = ArkService.builder().apiKey(apiKey)
.baseUrl("https://ark.cn-beijing.volces.com/api/v3")
.build();
ResponsesRequest request = ResponsesRequest.builder()
.model("doubao-seed-2-1-pro-260915")
.input(ResponsesInput.ofString("hello")) // Replace with your prompt
// .thinking(Thinking.builder().type(ThinkingMode.DISABLED).build()) // Manually disable deep thinking
.build();
Response resp = arkService.createResponse(request);
System.out.println(resp);
arkService.shutdownExecutor();
}
}
import os
from openai import OpenAI
client = OpenAI(
base_url='https://ark.cn-beijing.volces.com/api/v3',
# Get API Key: https://ark.volcengine.com/region:cn-beijing/apikey
api_key=os.getenv('ARK_API_KEY'),
)
response = client.responses.create(
model="doubao-seed-2-1-pro-260915",
input="hello", # Replace with your prompt
extra_body={
# "thinking": {"type": "disabled"}, # Manually disable deep thinking
},
)
print(response)
浏览模型#
完整模型列表:模型列表
基础使用#
快速掌握模型使用规则、调用限制和常见场景示例。
进阶使用#
了解如何拓展模型能力、提升性能、降低成本


