Step 3.5 Flash API 接口、模型参数 & 代码示例
stepfun/step-3.5-flash
Step 3.5 Flash 是阶跃星辰目前最强大的开源基座模型。它专为极致效率而生,具备前沿的推理能力和卓越的智能体(Agent)性能。该模型基于稀疏混合专家(MoE)架构,拥有 1960 亿参数,但处理每个 Token 时仅需选择性激活 110 亿参数。这种极高的“智能密度”使其推理深度足以媲美顶级闭源模型,同时兼顾了实时交互所需的敏捷响应速度。
- 模型 ID
- stepfun/step-3.5-flash
- 模型系列
- StepFun
- 更新日期
- 模型能力
- 文本生成、代码补全、深度思考
- 上下文长度
- 256 K
- 模型价格(每 1000 tokens 输入)
- ¥ 0.0012
- 模型价格(每 1000 tokens 输出)
- ¥ 0.0035
Step 3.5 Flash 模型介绍:
核心能力:
-
高速深度推理:聊天机器人主要用于阅读理解,而智能体必须快速推理。借助三路多 token 预测(3-way Multi-Token Prediction,MTP-3),Step 3.5 Flash 在典型使用中可实现 100–300 tok/s 的生成吞吐量(在单流编码任务中峰值可达 350 tok/s)。这使得模型能够进行复杂、多步骤的推理链,并即时响应。
-
面向编码与智能体的强大引擎:Step 3.5 Flash 专为智能体任务设计,集成可扩展的强化学习框架,实现持续自我提升。在 SWE-bench Verified 上获得 74.4%,在 Terminal-Bench 2.0 上获得 51.0%,证明其能够稳定处理复杂、长周期任务。
-
高效的长上下文支持:通过采用 3:1 滑动窗口注意力(Sliding Window Attention, SWA)比率——每个全注意力层集成三层 SWA,模型支持 256K 上下文窗口 的高效运行。这种混合策略保证了在海量数据集或大型代码库上保持性能稳定,同时大幅降低了标准长上下文模型的计算开销。
-
可本地部署:优化了可访问性,Step 3.5 Flash 可将顶级智能引入本地环境。它可在高端消费级硬件上安全运行(如 Mac Studio M4 Max、NVIDIA DGX Spark),在不牺牲性能的前提下保障数据隐私。
性能表现:
Step 3.5 Flash 在保持开放高效的同时,实现了与领先闭源系统相当的性能。
Step 3.5 Flash 的性能覆盖 推理能力、编码能力 和 智能体能力。开源模型(左侧)按总参数量排序,顶级闭源模型(右侧)展示在右侧。xbench-DeepSearch 的分数来源于 https://xbench.org/agi/aisearch 以保证一致性。阴影条表示使用 Parallel Thinking 后 Step 3.5 Flash 的性能增强。
| Benchmark | Step 3.5 Flash | DeepSeek V3.2 | Kimi K2 Thinking / K2.5 | GLM-4.7 | MiniMax M2.1 | MiMo-V2 Flash |
|---|---|---|---|---|---|---|
| # Activated Params | 11B | 37B | 32B | 32B | 10B | 15B |
| # Total Params (MoE) | 196B | 671B | 1T | 355B | 230B | 309B |
| Est. decoding cost @ 128K context, Hopper GPU** | 1.0x 100 tok/s, MTP-3, EP8 |
6.0x 33 tok/s, MTP-1, EP32 |
18.9x 33 tok/s, no MTP, EP32 |
18.9x 100 tok/s, MTP-3, EP8 |
3.9x 100 tok/s, MTP-3, EP8 |
1.2x 100 tok/s, MTP-3, EP8 |
| Agent | ||||||
| τ²-Bench | 88.2 | 80.3 (85.2*) | 74.3*/85.4* | 87.4 | 86.6* | 80.3 (84.1*) |
| BrowseComp | 51.6 | 51.4 | 41.5* / 60.6 | 52.0 | 47.4 | 45.4 |
| BrowseComp (w/ Context Manager) | 69.0 | 67.6 | 60.2/74.9 | 67.5 | 62.0 | 58.3 |
| BrowseComp-ZH | 66.9 | 65.0 | 62.3 / 62.3* | 66.6 | 47.8* | 51.2* |
| BrowseComp-ZH (w/ Context Manager) | 73.7 | — | —/— | — | — | — |
| GAIA (no file) | 84.5 | 75.1* | 75.6*/75.9* | 61.9* | 64.3* | 78.2* |
| xbench-DeepSearch (2025.05) | 83.7 | 78.0* | 76.0*/76.7* | 72.0* | 68.7* | 69.3* |
| xbench-DeepSearch (2025.10) | 56.3 | 55.7* | —/40+ | 52.3* | 43.0* | 44.0* |
| ResearchRubrics | 65.3 | 55.8* | 56.2*/59.5* | 62.0* | 60.2* | 54.3* |
| Reasoning | ||||||
| AIME 2025 | 97.3 | 93.1 | 94.5/96.1 | 95.7 | 83.0 | 94.1 (95.1*) |
| HMMT 2025 (Feb.) | 98.4 | 92.5 | 89.4/95.4 | 97.1 | 71.0* | 84.4 (95.4*) |
| HMMT 2025 (Nov.) | 94.0 | 90.2 | 89.2*/— | 93.5 | 74.3* | 91.0* |
| IMOAnswerBench | 85.4 | 78.3 | 78.6/81.8 | 82.0 | 60.4* | 80.9* |
| Coding | ||||||
| LiveCodeBench-V6 | 86.4 | 83.3 | 83.1/85.0 | 84.9 | — | 80.6 (81.6*) |
| SWE-bench Verified | 74.4 | 73.1 | 71.3/76.8 | 73.8 | 74.0 | 73.4 |
| Terminal-Bench 2.0 | 51.0 | 46.4 | 35.7*/50.8 | 41.0 | 47.9 | 38.5 |
- "—" indicates the score is not publicly available or not tested.
- "*" indicates the original score was inaccessible or lower than our reproduced, so we report the evaluation under the same test conditions as Step 3.5 Flash to ensure fair comparability.
- BrowseComp (with Context Manager): when the effective context length exceeds a predefined threshold, the agent resets the context and restarts the agent loop. (By contrast, Kimi K2.5 and DeepSeek-V3.2 used a discard-all strategy.)
- In decoding cost section, decoding is estimated using a similar but more accurate approach than https://arxiv.org/abs/2507.19427.
架构详情:
Step 3.5 Flash 基于 稀疏专家混合(Sparse Mixture-of-Experts, MoE) Transformer 架构构建,在推理阶段优化了高吞吐量和低显存使用。
技术规格:
| Component | Specification |
|---|---|
| Backbone | 45-layer Transformer (4,096 hidden dim) |
| Context Window | 256K |
| Vocabulary | 128,896 tokens |
| Total Parameters | 196.81B (196B Backbone + 0.81B Head) |
| Active Parameters | ~11B (per token generation) |
专家混合(MoE)路由:
与传统密集模型不同,Step 3.5 Flash 使用细粒度路由策略以最大化效率:
- 细粒度专家:每层 288 个路由专家 + 1 个共享专家(始终激活)。
- 稀疏激活:每个 token 仅选择前 8 个专家。
- 结果:模型保留了 196B 参数模型的“记忆”,但执行速度如同 11B 模型。
API 接口地址:
https://wcode.net/api/gpt/v1/chat/completions
此 API 接口兼容 OpenAI 的 API 接口规范,也就是可以直接使用 OpenAI 的 SDK 来调用各个模型。仅需替换以下两项配置即可:
base_url替换为https://wcode.net/api/gpt/v1api_key替换为从 https://wcode.net/get-apikey 获取到的 API Key具体可参考下方的各编程语言代码示例中的 OpenAI SDK 调用示例。
请求方法:
POST
各编程语言代码示例:
# TODO: 以下代码中的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
curl --request POST 'https://wcode.net/api/gpt/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_KEY' \
--data '{
"model": "stepfun/step-3.5-flash",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}'
import Foundation
let headers = [
"Authorization": "Bearer API_KEY", // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
"content-type": "application/json"
]
let parameters = [
"model": "stepfun/step-3.5-flash",
"messages": [
[
"role": "user",
"content": "你好"
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://wcode.net/api/gpt/v1/chat/completions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 60.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
var headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY' // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
};
var request = http.Request('POST', Uri.parse('https://wcode.net/api/gpt/v1/chat/completions'));
request.body = json.encode({
"model": "stepfun/step-3.5-flash",
"messages": [
{
"role": "user",
"content": "你好"
}
]
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
require 'uri'
require 'net/http'
url = URI("https://wcode.net/api/gpt/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer API_KEY' # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
request["content-type"] = 'application/json'
request.body = "{\"model\":\"stepfun/step-3.5-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}"
response = http.request(request)
puts response.read_body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "https://wcode.net/api/gpt/v1/chat/completions";
let payload = json!({
"model": "stepfun/step-3.5-flash",
"messages": (
json!({
"role": "user",
"content": "你好"
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Authorization", "Bearer API_KEY".parse().unwrap()); // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::<serde_json::Value>()
.await
.unwrap();
dbg!(results);
}
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://wcode.net/api/gpt/v1/chat/completions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer API_KEY"); // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"model\":\"stepfun/step-3.5-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}");
CURLcode ret = curl_easy_perform(hnd);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://wcode.net/api/gpt/v1/chat/completions"
payload := strings.NewReader("{\"model\":\"stepfun/step-3.5-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer API_KEY") // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://wcode.net/api/gpt/v1/chat/completions");
request.Headers.Add("Authorization", "Bearer API_KEY"); // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
request.Content = new StringContent("{\"model\":\"stepfun/step-3.5-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}", null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var client = new RestClient("https://wcode.net/api/gpt/v1/chat/completions");
var request = new RestRequest("", Method.Post);
request.AddHeader("Authorization", "Bearer API_KEY"); // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"model\":\"stepfun/step-3.5-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}", ParameterType.RequestBody);
var response = client.Execute(request);
const axios = require('axios');
let data = JSON.stringify({
"model": "stepfun/step-3.5-flash",
"messages": [
{
"role": "user",
"content": "你好"
}
]
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://wcode.net/api/gpt/v1/chat/completions',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY' // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
},
data : data
};
axios.request(config).then((response) => {
console.log(JSON.stringify(response.data));
}).catch((error) => {
console.log(error);
});
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"model\":\"stepfun/step-3.5-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}");
Request request = new Request.Builder()
.url("https://wcode.net/api/gpt/v1/chat/completions")
.post(body)
.addHeader("Authorization", "Bearer API_KEY") // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
$client = new \GuzzleHttp\Client();
$headers = [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY', // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
];
$body = '{
"model": "stepfun/step-3.5-flash",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}';
$request = new \GuzzleHttp\Psr7\Request('POST', 'https://wcode.net/api/gpt/v1/chat/completions', $headers, $body);
$response = $client->sendAsync($request)->wait();
echo $response->getBody();
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://wcode.net/api/gpt/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 5,
CURLOPT_TIMEOUT => 300,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'stepfun/step-3.5-flash',
'messages' => [
[
'role' => 'user',
'content' => '你好'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY", // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
"content-type: application/json",
],
]);
$response = curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);
if ($error) {
echo "cURL Error #:" . $error;
} else {
echo $response;
}
import requests
import json
url = "https://wcode.net/api/gpt/v1/chat/completions"
payload = {
"model": "stepfun/step-3.5-flash",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}
headers = {
"Authorization": "Bearer API_KEY", # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(json.dumps(response.json(), indent=4, ensure_ascii=False))
from openai import OpenAI
client = OpenAI(
base_url="https://wcode.net/api/gpt/v1",
api_key="API_KEY" # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
)
completion = client.chat.completions.create(
model="stepfun/step-3.5-flash",
messages=[
{
"role": "user",
"content": "你好"
}
]
)
print(completion.choices[0].message.content)
各 AI 产品/工具/第三方应用接入示例:
配置 OpenClaw(龙虾):
推荐方式:修改 openclaw.json(通常位于~/.openclaw/openclaw.json)
注意事项:以下配置中的
<API_KEY>需要替换为从 https://wcode.net/get-apikey 获取的 API Key
步骤 1. 修改models字段:
{
...其他配置,
"models": {
"mode": "merge",
"providers": {
"wcode": {
"baseUrl": "https://wcode.net/api/gpt/v1",
"apiKey": "<API_KEY>",
"api": "openai-completions",
"models": [
{
"id": "stepfun/step-3.5-flash",
"name": "Step 3.5 Flash",
"reasoning": false,
"input": ["text"],
"contextWindow": 256000,
"maxTokens": 256000
}
]
}
}
},
...其他配置
}
步骤 2. 修改agents字段:
{
...其他配置,
"agents": {
"defaults": {
"model": {
"primary": "wcode/stepfun/step-3.5-flash"
}
}
},
...其他配置
}
完成以上配置后,
- 执行以下命令,即可通过命令行的方式开始对话:
openclaw tui
- 执行以下命令,即可通过 Web 界面的方式开始对话:
openclaw dashboard
配置 OpenCode:
推荐方式:修改 opencode.json(通常位于~/.config/opencode/opencode.json)
注意事项:以下配置中的
<API_KEY>需要替换为从 https://wcode.net/get-apikey 获取的 API Key
配置如下:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "wcode",
"options": {
"baseURL": "https://wcode.net/api/gpt/v1",
"apiKey": "<API_KEY>"
},
"models": {
"stepfun/step-3.5-flash": {
"name": "Step 3.5 Flash"
}
}
}
}
}
完成以上配置后,执行以下命令,即可启动 OpenCode:
opencode
输入 /models,选择配置的 stepfun/step-3.5-flash 模型并在 OpenCode 中使用。
API 响应示例(curl):
{
"id": "chatcmpl-t1772859257s612r51377df1e154e9ec8bab0df5",
"object": "chat.completion",
"created": 1772859258,
"model": "stepfun/step-3.5-flash",
"system_fingerprint": null,
"choices": [
{
"index": 0,
"logprobs": null,
"finish_reason": "stop",
"native_finish_reason": "stop",
"message": {
"role": "assistant",
"content": "你好!我是 **Step**,由 **阶跃星辰(StepFun)** 开发的大语言模型。 \n我具备强大的多模态推理能力,能够理解和处理文字、图像等多种输入形式,擅长 **视觉推理、数理逻辑、知识问答、创意写作、代码编程** 等任务。我的目标是为你提供**准确、有用、友善**的信息和帮助。\n\n---\n\n### 🌟 我的核心能力包括:\n1. **多模态理解** \n 不仅能理解文字,还能分析图像内容,例如识别物体、场景、图表信息等。\n2. **逻辑与数理推理** \n 在数学计算、逻辑推理、数据分析等方面有较强能力。\n3. **知识问答** \n 覆盖广泛领域,包括科学、技术、文化、历史等,力争提供可靠的信息。\n4. **创意与写作** \n 支持故事创作、文案策划、诗歌写作等多种创意任务。\n5. **代码与算法** \n 能编写、解释多种编程语言的代码,辅助解决算法问题。\n6. **多语言支持** \n 能理解并使用多种语言进行交流。\n\n---\n\n### 🤝 我的原则:\n- **诚实可靠**:尽力提供准确、有依据的回答。 \n- **有用友善**:关注你的需求,以积极的态度互动。 \n- **尊重隐私**:不收集或存储个人敏感信息。 \n- **客观中立**:避免偏见,保持公正。 \n- **促进积极交流**:拒绝有害内容,维护友善的对话环境。\n\n---\n\n如果你愿意,可以告诉我你感兴趣的方向或具体需求,我会努力提供更有针对性的帮助! \n你想先聊聊什么话题呢? 😊",
"refusal": null,
"reasoning": "嗯,用户询问我的身份信息,需要先确认自己的定位。虽然用户提到了“Step 3.5 Flash”,但我的官方名称是Step,由阶跃星辰(StepFun)开发。用户可能看到过不同版本的测试名称,需要澄清这一点。\n\n可以考虑先礼貌纠正名称差异,再分模块介绍核心能力。身份澄清部分要简洁,避免让用户困惑。能力部分可以按多模态、逻辑、语言等分类,最后增加开放性问题引导用户进一步互动。\n\n用户没有提供具体需求场景,所以回复要保持通用性,同时展示足够的细节让用户知道能做什么。可以准备用emoji增强可读性,但思考中不需要标记,直接自然输出结构。"
}
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 494,
"total_tokens": 518,
"prompt_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0,
"audio_tokens": 0,
"video_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 245,
"image_tokens": 0,
"audio_tokens": 0
}
}
}
可选参数:
- 思考模式推理程度(Reasoning Effort Level)
- 温度(Temperature)
- Top-P
- Top-K
- 频率惩罚
- 存在惩罚
- 重复惩罚
- Min-P
- Top-A
- 种子
- 最大 tokens 数
- Logit Bias
- 对数概率
- 最高对数概率
- 响应格式
- 结构化输出
- 停止
- 工具
- 工具选择
- 并行工具调用
- 冗长程度
重要提示:由于模型架构不同,部分参数可能仅适用于特定的模型。
思考模式推理程度(Reasoning Effort Level)
-
参数:
reasoning -
可选,object
-
默认:
-
reasoning 参数整合了用于控制不同模型间推理强度的设置:
"effort": "xhigh"- 分配最大比例的 token 用于推理(约占 max_tokens 的 95%)"effort": "high"- 分配较大比例的 token 用于推理(约占 max_tokens 的 80%)"effort": "medium"- 分配中等比例的 token 用于推理(约占 max_tokens 的 50%)"effort": "low"- 分配较小比例的 token 用于推理(约占 max_tokens 的 20%)"effort": "minimal"- 分配更小比例的 token 用于推理(约占 max_tokens 的 10%)"effort": "none"- 完全禁用推理
curl 代码示例:
# TODO 1: 以下代码中的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
# TODO 2: 以下代码中的 MODEL_ID 需要替换,模型列表:https://wcode.net/models
curl --request POST 'https://wcode.net/api/gpt/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_KEY' \
--data '{
"model": "MODEL_ID",
"messages": [
{
"role": "user",
"content": "你好"
}
],
"reasoning": {
"effort": "high"
}
}'
Python OpenAI SDK 代码示例:
from openai import OpenAI
client = OpenAI(
base_url="https://wcode.net/api/gpt/v1",
api_key="API_KEY" # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://wcode.net/get-apikey
)
completion = client.chat.completions.create(
model="MODEL_ID", # TODO: 这里的 MODEL_ID 需要替换,模型列表:https://wcode.net/models
messages=[
{
"role": "user",
"content": "天空为什么是蓝色的?"
}
],
extra_body={
"reasoning": {
"effort": "high"
}
}
)
print(completion.choices[0].message.content)
温度(Temperature)
-
参数:
temperature -
可选,浮点数,0.0 到 2.0
-
默认:
1.0
此设置影响模型回复的多样性。较低的值会使回复更可预测、更常见;较高的值会鼓励更具多样性且较不常见的回复。当设置为 0 时,模型对相同输入将尽可能的给出相同的回复。
Top-P
-
参数:
top_p -
可选,float,0.0 至 1.0
-
默认值:
1.0
top_p 参数控制模型在生成文本时的候选词选择范围。具体来说,模型会生成一组候选 token,然后从累积概率达到或超过 p 的 token 中随机选择一个作为输出。通过这种方式,top_p 能够在保证生成内容的多样性的同时,考虑到概率分布的合理性。
由于 temperature 与 top_p 均可以控制生成文本的多样性,因此建议您只设置其中一个值。
Top-K
-
参数:
top_k -
可选,int,>= 0
-
默认值:
0
top_k 会限制模型在每一步对 token 的选择,使其从较小的集合中进行选择。值为 1 表示模型将始终选择最有可能的下一个 token,从而得到可预测的结果。
频率惩罚
-
参数:
frequency_penalty -
可选,float,-2.0 至 2.0
-
默认值:
0.0
frequency_penalty 可根据词条在输入中出现的频率来控制其重复使用。它会尝试减少那些在输入中出现频率较高的词条的使用频率,这与它们出现的频率成正比。词条惩罚会随着出现次数的增加而增加。负值将鼓励词条重复使用。
存在惩罚
-
参数:
presence_penalty -
可选,float,-2.0 至 2.0
-
默认值:
0.0
presence_penalty 调整模型重复输入中已使用的特定标记的频率。值越高,重复的可能性就越小,负值则相反。标记惩罚不会随着出现次数而变化。负值会鼓励标记重用。
重复惩罚
-
参数:
repetition_penalty -
可选,float,0.0 至 2.0
-
默认值:
1.0
repetition_penalty 有助于减少输入中标记的重复。较高的值会降低模型重复标记的可能性,但过高的值会使输出不够连贯(通常会出现缺少小词的连续句子)。标记惩罚会根据原始标记的概率进行调整。
Min-P
-
参数:
min_p -
可选,float,0.0 至 1.0
-
默认值:
0.0
min_p 表示某个 token 被考虑的最小概率,该概率是相对于最可能的 token 的概率而言的。如果 min_p 设置为 0.1,则意味着它只允许概率至少为最佳选项十分之一的 token 被考虑。
Top-A
-
参数:
top_a -
可选,float,0.0 到 1.0
-
默认值:
0.0
top_a 仅考虑概率“足够高”的 top tokens,该概率基于最可能的 token 概率。可以将其视为一个动态的 Top-P。较低的 Top-A 值会根据概率最高的 token 集中选择,但范围会更窄。较高的 Top-A 值不一定会影响输出的创造性,但会根据最大概率优化过滤过程。
种子
-
参数:
seed -
可选,int
如果指定了 seed 参数,推理将确定性地进行采样,即使用相同种子和参数的重复请求应该返回相同的结果。某些模型无法保证确定性。
最大 tokens 数
-
参数:
max_tokens -
可选,int,>= 1
max_tokens 可设定模型在响应中可以生成的 token 数量的上限。模型不会生成超过此限制的 token。其最大值等于上下文长度减去 prompt 长度。
Logit Bias
-
参数:
logit_bias -
可选,object
logit_bias 是一个可选参数,用于修改指定 token 在模型生成输出中出现的可能性。
对数概率
-
参数:
logprobs -
可选,boolean
logprobs 设置是否返回输出 token 的对数概率。如果为 true,则返回每个输出 token 的对数概率。
最高对数概率
-
参数:
top_logprobs -
可选,int
top_logprobs 是一个介于 0 和 20 之间的整数,指定在每个 token 位置要返回的最可能 token 的数量,每个 token 都会带有相应的对数概率。如果使用此参数,则必须将 logprobs 设置为 true。
响应格式
-
参数:
response_format -
可选,object
response_format 强制模型产出特定的输出格式。将其设置为 { "type": "json_object" } 可启用 JSON 模式,保证模型生成的消息为有效的 JSON。
注意:使用 JSON 模式时,应同时通过 system 或 user 提示词指示模型生成 JSON。
结构化输出
-
参数:
structured_outputs -
可选,boolean
指示模型是否能够使用 response_format 中的 json_schema 返回结构化输出。
停止
-
参数:
stop -
可选,array
如果模型遇到 stop 数组中指定的任意 token,则立即停止生成。
工具
-
参数:
tools -
可选,array
工具调用参数,遵循 OpenAI 的工具调用请求格式。对于非 OpenAI 提供者,会相应地进行转换。
工具选择
-
参数:
tool_choice -
可选,array
控制模型调用哪个工具。'none' 表示模型不会调用任何工具,而是生成一条消息。'auto' 表示模型可以在生成消息或调用一个或多个工具之间进行选择。'required' 表示模型必须调用一个或多个工具。通过 {"type": "function", "function": {"name": "my_function"}} 指定特定工具会强制模型调用该工具。
并行工具调用
-
参数:
parallel_tool_calls -
可选,boolean
-
默认:true
是否在使用工具时启用并行函数调用。如果为 true,模型可以同时调用多个函数。如果为 false,函数将按顺序依次调用。
冗长程度
-
参数:
verbosity -
可选,enum,
lowmediumhigh -
默认:medium
控制模型响应的冗长程度和长度。较低的值会生成更简洁的回答,而较高的值会生成更详细、更全面的回答。
以上文档为标准版 API 接口文档,可直接用于项目开发和系统调用。如果标准版 API 接口无法满足您的需求,需要定制开发 API 接口,请联系我们的 IT 技术支持工程师:
(沟通需求✅ → 确认技术方案✅ → 沟通费用与工期✅ → 开发&测试✅ → 验收交付✅ → 维护升级✅)
![]()