对话完成接口
curl --request POST \
--url https://geekai.co/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5-mini",
"messages": [
{
"content": "你是一个助手",
"role": "system"
},
{
"content": "你好",
"role": "user"
}
],
"enable_thinking": false,
"thinking": {
"include_thoughts": false,
"budget_tokens": 16000,
"reasoning_effort": "medium",
"thinking_level": "high"
},
"stream": false,
"background": false,
"enable_search": false,
"search_config": {
"engine": "glm/search-std",
"prompt": "<string>",
"intent": false,
"count": 10,
"domain_filter": "<string>",
"recency_filter": "noLimit",
"content_size": "medium",
"return_result": false,
"result_sequence": "after",
"require_search": false,
"deepable": false
},
"enable_url_context": false,
"temperature": 123,
"max_completion_tokens": 4096,
"json_mode": false,
"response_format": {
"type": "text"
},
"modalities": [],
"audio": {
"voice": "alloy",
"format": "wav"
},
"image": {
"image_size": "1K"
},
"tools": "<array>",
"tool_config": {
"functionCallingConfig": {
"mode": "AUTO",
"allowedFunctionNames": [
"<string>"
]
}
},
"parallel_tool_calls": true,
"image_generation": false,
"stop": [
"<string>"
],
"logprobs": false,
"top_logprobs": 2,
"frequency_penalty": 0,
"presence_penalty": 0,
"top_p": 1,
"top_k": 1,
"seed": 123,
"n": 1,
"metadata": {},
"sess_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retries": 0
}
'import requests
url = "https://geekai.co/api/v1/chat/completions"
payload = {
"model": "gpt-5-mini",
"messages": [
{
"content": "你是一个助手",
"role": "system"
},
{
"content": "你好",
"role": "user"
}
],
"enable_thinking": False,
"thinking": {
"include_thoughts": False,
"budget_tokens": 16000,
"reasoning_effort": "medium",
"thinking_level": "high"
},
"stream": False,
"background": False,
"enable_search": False,
"search_config": {
"engine": "glm/search-std",
"prompt": "<string>",
"intent": False,
"count": 10,
"domain_filter": "<string>",
"recency_filter": "noLimit",
"content_size": "medium",
"return_result": False,
"result_sequence": "after",
"require_search": False,
"deepable": False
},
"enable_url_context": False,
"temperature": 123,
"max_completion_tokens": 4096,
"json_mode": False,
"response_format": { "type": "text" },
"modalities": [],
"audio": {
"voice": "alloy",
"format": "wav"
},
"image": { "image_size": "1K" },
"tools": "<array>",
"tool_config": { "functionCallingConfig": {
"mode": "AUTO",
"allowedFunctionNames": ["<string>"]
} },
"parallel_tool_calls": True,
"image_generation": False,
"stop": ["<string>"],
"logprobs": False,
"top_logprobs": 2,
"frequency_penalty": 0,
"presence_penalty": 0,
"top_p": 1,
"top_k": 1,
"seed": 123,
"n": 1,
"metadata": {},
"sess_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retries": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-5-mini',
messages: [{content: '你是一个助手', role: 'system'}, {content: '你好', role: 'user'}],
enable_thinking: false,
thinking: {
include_thoughts: false,
budget_tokens: 16000,
reasoning_effort: 'medium',
thinking_level: 'high'
},
stream: false,
background: false,
enable_search: false,
search_config: {
engine: 'glm/search-std',
prompt: '<string>',
intent: false,
count: 10,
domain_filter: '<string>',
recency_filter: 'noLimit',
content_size: 'medium',
return_result: false,
result_sequence: 'after',
require_search: false,
deepable: false
},
enable_url_context: false,
temperature: 123,
max_completion_tokens: 4096,
json_mode: false,
response_format: {type: 'text'},
modalities: [],
audio: {voice: 'alloy', format: 'wav'},
image: {image_size: '1K'},
tools: '<array>',
tool_config: {functionCallingConfig: {mode: 'AUTO', allowedFunctionNames: ['<string>']}},
parallel_tool_calls: true,
image_generation: false,
stop: ['<string>'],
logprobs: false,
top_logprobs: 2,
frequency_penalty: 0,
presence_penalty: 0,
top_p: 1,
top_k: 1,
seed: 123,
n: 1,
metadata: {},
sess_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
retries: 0
})
};
fetch('https://geekai.co/api/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://geekai.co/api/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-5-mini',
'messages' => [
[
'content' => '你是一个助手',
'role' => 'system'
],
[
'content' => '你好',
'role' => 'user'
]
],
'enable_thinking' => false,
'thinking' => [
'include_thoughts' => false,
'budget_tokens' => 16000,
'reasoning_effort' => 'medium',
'thinking_level' => 'high'
],
'stream' => false,
'background' => false,
'enable_search' => false,
'search_config' => [
'engine' => 'glm/search-std',
'prompt' => '<string>',
'intent' => false,
'count' => 10,
'domain_filter' => '<string>',
'recency_filter' => 'noLimit',
'content_size' => 'medium',
'return_result' => false,
'result_sequence' => 'after',
'require_search' => false,
'deepable' => false
],
'enable_url_context' => false,
'temperature' => 123,
'max_completion_tokens' => 4096,
'json_mode' => false,
'response_format' => [
'type' => 'text'
],
'modalities' => [
],
'audio' => [
'voice' => 'alloy',
'format' => 'wav'
],
'image' => [
'image_size' => '1K'
],
'tools' => '<array>',
'tool_config' => [
'functionCallingConfig' => [
'mode' => 'AUTO',
'allowedFunctionNames' => [
'<string>'
]
]
],
'parallel_tool_calls' => true,
'image_generation' => false,
'stop' => [
'<string>'
],
'logprobs' => false,
'top_logprobs' => 2,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'top_p' => 1,
'top_k' => 1,
'seed' => 123,
'n' => 1,
'metadata' => [
],
'sess_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'retries' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://geekai.co/api/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-5-mini\",\n \"messages\": [\n {\n \"content\": \"你是一个助手\",\n \"role\": \"system\"\n },\n {\n \"content\": \"你好\",\n \"role\": \"user\"\n }\n ],\n \"enable_thinking\": false,\n \"thinking\": {\n \"include_thoughts\": false,\n \"budget_tokens\": 16000,\n \"reasoning_effort\": \"medium\",\n \"thinking_level\": \"high\"\n },\n \"stream\": false,\n \"background\": false,\n \"enable_search\": false,\n \"search_config\": {\n \"engine\": \"glm/search-std\",\n \"prompt\": \"<string>\",\n \"intent\": false,\n \"count\": 10,\n \"domain_filter\": \"<string>\",\n \"recency_filter\": \"noLimit\",\n \"content_size\": \"medium\",\n \"return_result\": false,\n \"result_sequence\": \"after\",\n \"require_search\": false,\n \"deepable\": false\n },\n \"enable_url_context\": false,\n \"temperature\": 123,\n \"max_completion_tokens\": 4096,\n \"json_mode\": false,\n \"response_format\": {\n \"type\": \"text\"\n },\n \"modalities\": [],\n \"audio\": {\n \"voice\": \"alloy\",\n \"format\": \"wav\"\n },\n \"image\": {\n \"image_size\": \"1K\"\n },\n \"tools\": \"<array>\",\n \"tool_config\": {\n \"functionCallingConfig\": {\n \"mode\": \"AUTO\",\n \"allowedFunctionNames\": [\n \"<string>\"\n ]\n }\n },\n \"parallel_tool_calls\": true,\n \"image_generation\": false,\n \"stop\": [\n \"<string>\"\n ],\n \"logprobs\": false,\n \"top_logprobs\": 2,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"top_p\": 1,\n \"top_k\": 1,\n \"seed\": 123,\n \"n\": 1,\n \"metadata\": {},\n \"sess_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"retries\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-5-mini\",\n \"messages\": [\n {\n \"content\": \"你是一个助手\",\n \"role\": \"system\"\n },\n {\n \"content\": \"你好\",\n \"role\": \"user\"\n }\n ],\n \"enable_thinking\": false,\n \"thinking\": {\n \"include_thoughts\": false,\n \"budget_tokens\": 16000,\n \"reasoning_effort\": \"medium\",\n \"thinking_level\": \"high\"\n },\n \"stream\": false,\n \"background\": false,\n \"enable_search\": false,\n \"search_config\": {\n \"engine\": \"glm/search-std\",\n \"prompt\": \"<string>\",\n \"intent\": false,\n \"count\": 10,\n \"domain_filter\": \"<string>\",\n \"recency_filter\": \"noLimit\",\n \"content_size\": \"medium\",\n \"return_result\": false,\n \"result_sequence\": \"after\",\n \"require_search\": false,\n \"deepable\": false\n },\n \"enable_url_context\": false,\n \"temperature\": 123,\n \"max_completion_tokens\": 4096,\n \"json_mode\": false,\n \"response_format\": {\n \"type\": \"text\"\n },\n \"modalities\": [],\n \"audio\": {\n \"voice\": \"alloy\",\n \"format\": \"wav\"\n },\n \"image\": {\n \"image_size\": \"1K\"\n },\n \"tools\": \"<array>\",\n \"tool_config\": {\n \"functionCallingConfig\": {\n \"mode\": \"AUTO\",\n \"allowedFunctionNames\": [\n \"<string>\"\n ]\n }\n },\n \"parallel_tool_calls\": true,\n \"image_generation\": false,\n \"stop\": [\n \"<string>\"\n ],\n \"logprobs\": false,\n \"top_logprobs\": 2,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"top_p\": 1,\n \"top_k\": 1,\n \"seed\": 123,\n \"n\": 1,\n \"metadata\": {},\n \"sess_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"retries\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-5-mini\",\n \"messages\": [\n {\n \"content\": \"你是一个助手\",\n \"role\": \"system\"\n },\n {\n \"content\": \"你好\",\n \"role\": \"user\"\n }\n ],\n \"enable_thinking\": false,\n \"thinking\": {\n \"include_thoughts\": false,\n \"budget_tokens\": 16000,\n \"reasoning_effort\": \"medium\",\n \"thinking_level\": \"high\"\n },\n \"stream\": false,\n \"background\": false,\n \"enable_search\": false,\n \"search_config\": {\n \"engine\": \"glm/search-std\",\n \"prompt\": \"<string>\",\n \"intent\": false,\n \"count\": 10,\n \"domain_filter\": \"<string>\",\n \"recency_filter\": \"noLimit\",\n \"content_size\": \"medium\",\n \"return_result\": false,\n \"result_sequence\": \"after\",\n \"require_search\": false,\n \"deepable\": false\n },\n \"enable_url_context\": false,\n \"temperature\": 123,\n \"max_completion_tokens\": 4096,\n \"json_mode\": false,\n \"response_format\": {\n \"type\": \"text\"\n },\n \"modalities\": [],\n \"audio\": {\n \"voice\": \"alloy\",\n \"format\": \"wav\"\n },\n \"image\": {\n \"image_size\": \"1K\"\n },\n \"tools\": \"<array>\",\n \"tool_config\": {\n \"functionCallingConfig\": {\n \"mode\": \"AUTO\",\n \"allowedFunctionNames\": [\n \"<string>\"\n ]\n }\n },\n \"parallel_tool_calls\": true,\n \"image_generation\": false,\n \"stop\": [\n \"<string>\"\n ],\n \"logprobs\": false,\n \"top_logprobs\": 2,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"top_p\": 1,\n \"top_k\": 1,\n \"seed\": 123,\n \"n\": 1,\n \"metadata\": {},\n \"sess_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"retries\": 0\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created": 123,
"model": "<string>",
"object": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"reasoning_content": "<string>",
"image": "<string>",
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": 123,
"transcript": "<string>"
},
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"billed_units": 123,
"prompt_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"cached_tokens": 123,
"image_tokens": 123,
"video_tokens": 123,
"citation_tokens": 123
},
"completion_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"accepted_prediction_tokens": 123,
"rejected_prediction_tokens": 123
}
},
"citations": [
"<string>"
],
"system_fingerprint": "<string>"
}{
"code": "validation_error",
"message": "参数验证失败",
"details": {
"field": "错误描述"
}
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}文本对话
POST
/
chat
/
completions
对话完成接口
curl --request POST \
--url https://geekai.co/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5-mini",
"messages": [
{
"content": "你是一个助手",
"role": "system"
},
{
"content": "你好",
"role": "user"
}
],
"enable_thinking": false,
"thinking": {
"include_thoughts": false,
"budget_tokens": 16000,
"reasoning_effort": "medium",
"thinking_level": "high"
},
"stream": false,
"background": false,
"enable_search": false,
"search_config": {
"engine": "glm/search-std",
"prompt": "<string>",
"intent": false,
"count": 10,
"domain_filter": "<string>",
"recency_filter": "noLimit",
"content_size": "medium",
"return_result": false,
"result_sequence": "after",
"require_search": false,
"deepable": false
},
"enable_url_context": false,
"temperature": 123,
"max_completion_tokens": 4096,
"json_mode": false,
"response_format": {
"type": "text"
},
"modalities": [],
"audio": {
"voice": "alloy",
"format": "wav"
},
"image": {
"image_size": "1K"
},
"tools": "<array>",
"tool_config": {
"functionCallingConfig": {
"mode": "AUTO",
"allowedFunctionNames": [
"<string>"
]
}
},
"parallel_tool_calls": true,
"image_generation": false,
"stop": [
"<string>"
],
"logprobs": false,
"top_logprobs": 2,
"frequency_penalty": 0,
"presence_penalty": 0,
"top_p": 1,
"top_k": 1,
"seed": 123,
"n": 1,
"metadata": {},
"sess_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retries": 0
}
'import requests
url = "https://geekai.co/api/v1/chat/completions"
payload = {
"model": "gpt-5-mini",
"messages": [
{
"content": "你是一个助手",
"role": "system"
},
{
"content": "你好",
"role": "user"
}
],
"enable_thinking": False,
"thinking": {
"include_thoughts": False,
"budget_tokens": 16000,
"reasoning_effort": "medium",
"thinking_level": "high"
},
"stream": False,
"background": False,
"enable_search": False,
"search_config": {
"engine": "glm/search-std",
"prompt": "<string>",
"intent": False,
"count": 10,
"domain_filter": "<string>",
"recency_filter": "noLimit",
"content_size": "medium",
"return_result": False,
"result_sequence": "after",
"require_search": False,
"deepable": False
},
"enable_url_context": False,
"temperature": 123,
"max_completion_tokens": 4096,
"json_mode": False,
"response_format": { "type": "text" },
"modalities": [],
"audio": {
"voice": "alloy",
"format": "wav"
},
"image": { "image_size": "1K" },
"tools": "<array>",
"tool_config": { "functionCallingConfig": {
"mode": "AUTO",
"allowedFunctionNames": ["<string>"]
} },
"parallel_tool_calls": True,
"image_generation": False,
"stop": ["<string>"],
"logprobs": False,
"top_logprobs": 2,
"frequency_penalty": 0,
"presence_penalty": 0,
"top_p": 1,
"top_k": 1,
"seed": 123,
"n": 1,
"metadata": {},
"sess_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retries": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-5-mini',
messages: [{content: '你是一个助手', role: 'system'}, {content: '你好', role: 'user'}],
enable_thinking: false,
thinking: {
include_thoughts: false,
budget_tokens: 16000,
reasoning_effort: 'medium',
thinking_level: 'high'
},
stream: false,
background: false,
enable_search: false,
search_config: {
engine: 'glm/search-std',
prompt: '<string>',
intent: false,
count: 10,
domain_filter: '<string>',
recency_filter: 'noLimit',
content_size: 'medium',
return_result: false,
result_sequence: 'after',
require_search: false,
deepable: false
},
enable_url_context: false,
temperature: 123,
max_completion_tokens: 4096,
json_mode: false,
response_format: {type: 'text'},
modalities: [],
audio: {voice: 'alloy', format: 'wav'},
image: {image_size: '1K'},
tools: '<array>',
tool_config: {functionCallingConfig: {mode: 'AUTO', allowedFunctionNames: ['<string>']}},
parallel_tool_calls: true,
image_generation: false,
stop: ['<string>'],
logprobs: false,
top_logprobs: 2,
frequency_penalty: 0,
presence_penalty: 0,
top_p: 1,
top_k: 1,
seed: 123,
n: 1,
metadata: {},
sess_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
retries: 0
})
};
fetch('https://geekai.co/api/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://geekai.co/api/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-5-mini',
'messages' => [
[
'content' => '你是一个助手',
'role' => 'system'
],
[
'content' => '你好',
'role' => 'user'
]
],
'enable_thinking' => false,
'thinking' => [
'include_thoughts' => false,
'budget_tokens' => 16000,
'reasoning_effort' => 'medium',
'thinking_level' => 'high'
],
'stream' => false,
'background' => false,
'enable_search' => false,
'search_config' => [
'engine' => 'glm/search-std',
'prompt' => '<string>',
'intent' => false,
'count' => 10,
'domain_filter' => '<string>',
'recency_filter' => 'noLimit',
'content_size' => 'medium',
'return_result' => false,
'result_sequence' => 'after',
'require_search' => false,
'deepable' => false
],
'enable_url_context' => false,
'temperature' => 123,
'max_completion_tokens' => 4096,
'json_mode' => false,
'response_format' => [
'type' => 'text'
],
'modalities' => [
],
'audio' => [
'voice' => 'alloy',
'format' => 'wav'
],
'image' => [
'image_size' => '1K'
],
'tools' => '<array>',
'tool_config' => [
'functionCallingConfig' => [
'mode' => 'AUTO',
'allowedFunctionNames' => [
'<string>'
]
]
],
'parallel_tool_calls' => true,
'image_generation' => false,
'stop' => [
'<string>'
],
'logprobs' => false,
'top_logprobs' => 2,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'top_p' => 1,
'top_k' => 1,
'seed' => 123,
'n' => 1,
'metadata' => [
],
'sess_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'retries' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://geekai.co/api/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-5-mini\",\n \"messages\": [\n {\n \"content\": \"你是一个助手\",\n \"role\": \"system\"\n },\n {\n \"content\": \"你好\",\n \"role\": \"user\"\n }\n ],\n \"enable_thinking\": false,\n \"thinking\": {\n \"include_thoughts\": false,\n \"budget_tokens\": 16000,\n \"reasoning_effort\": \"medium\",\n \"thinking_level\": \"high\"\n },\n \"stream\": false,\n \"background\": false,\n \"enable_search\": false,\n \"search_config\": {\n \"engine\": \"glm/search-std\",\n \"prompt\": \"<string>\",\n \"intent\": false,\n \"count\": 10,\n \"domain_filter\": \"<string>\",\n \"recency_filter\": \"noLimit\",\n \"content_size\": \"medium\",\n \"return_result\": false,\n \"result_sequence\": \"after\",\n \"require_search\": false,\n \"deepable\": false\n },\n \"enable_url_context\": false,\n \"temperature\": 123,\n \"max_completion_tokens\": 4096,\n \"json_mode\": false,\n \"response_format\": {\n \"type\": \"text\"\n },\n \"modalities\": [],\n \"audio\": {\n \"voice\": \"alloy\",\n \"format\": \"wav\"\n },\n \"image\": {\n \"image_size\": \"1K\"\n },\n \"tools\": \"<array>\",\n \"tool_config\": {\n \"functionCallingConfig\": {\n \"mode\": \"AUTO\",\n \"allowedFunctionNames\": [\n \"<string>\"\n ]\n }\n },\n \"parallel_tool_calls\": true,\n \"image_generation\": false,\n \"stop\": [\n \"<string>\"\n ],\n \"logprobs\": false,\n \"top_logprobs\": 2,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"top_p\": 1,\n \"top_k\": 1,\n \"seed\": 123,\n \"n\": 1,\n \"metadata\": {},\n \"sess_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"retries\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-5-mini\",\n \"messages\": [\n {\n \"content\": \"你是一个助手\",\n \"role\": \"system\"\n },\n {\n \"content\": \"你好\",\n \"role\": \"user\"\n }\n ],\n \"enable_thinking\": false,\n \"thinking\": {\n \"include_thoughts\": false,\n \"budget_tokens\": 16000,\n \"reasoning_effort\": \"medium\",\n \"thinking_level\": \"high\"\n },\n \"stream\": false,\n \"background\": false,\n \"enable_search\": false,\n \"search_config\": {\n \"engine\": \"glm/search-std\",\n \"prompt\": \"<string>\",\n \"intent\": false,\n \"count\": 10,\n \"domain_filter\": \"<string>\",\n \"recency_filter\": \"noLimit\",\n \"content_size\": \"medium\",\n \"return_result\": false,\n \"result_sequence\": \"after\",\n \"require_search\": false,\n \"deepable\": false\n },\n \"enable_url_context\": false,\n \"temperature\": 123,\n \"max_completion_tokens\": 4096,\n \"json_mode\": false,\n \"response_format\": {\n \"type\": \"text\"\n },\n \"modalities\": [],\n \"audio\": {\n \"voice\": \"alloy\",\n \"format\": \"wav\"\n },\n \"image\": {\n \"image_size\": \"1K\"\n },\n \"tools\": \"<array>\",\n \"tool_config\": {\n \"functionCallingConfig\": {\n \"mode\": \"AUTO\",\n \"allowedFunctionNames\": [\n \"<string>\"\n ]\n }\n },\n \"parallel_tool_calls\": true,\n \"image_generation\": false,\n \"stop\": [\n \"<string>\"\n ],\n \"logprobs\": false,\n \"top_logprobs\": 2,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"top_p\": 1,\n \"top_k\": 1,\n \"seed\": 123,\n \"n\": 1,\n \"metadata\": {},\n \"sess_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"retries\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-5-mini\",\n \"messages\": [\n {\n \"content\": \"你是一个助手\",\n \"role\": \"system\"\n },\n {\n \"content\": \"你好\",\n \"role\": \"user\"\n }\n ],\n \"enable_thinking\": false,\n \"thinking\": {\n \"include_thoughts\": false,\n \"budget_tokens\": 16000,\n \"reasoning_effort\": \"medium\",\n \"thinking_level\": \"high\"\n },\n \"stream\": false,\n \"background\": false,\n \"enable_search\": false,\n \"search_config\": {\n \"engine\": \"glm/search-std\",\n \"prompt\": \"<string>\",\n \"intent\": false,\n \"count\": 10,\n \"domain_filter\": \"<string>\",\n \"recency_filter\": \"noLimit\",\n \"content_size\": \"medium\",\n \"return_result\": false,\n \"result_sequence\": \"after\",\n \"require_search\": false,\n \"deepable\": false\n },\n \"enable_url_context\": false,\n \"temperature\": 123,\n \"max_completion_tokens\": 4096,\n \"json_mode\": false,\n \"response_format\": {\n \"type\": \"text\"\n },\n \"modalities\": [],\n \"audio\": {\n \"voice\": \"alloy\",\n \"format\": \"wav\"\n },\n \"image\": {\n \"image_size\": \"1K\"\n },\n \"tools\": \"<array>\",\n \"tool_config\": {\n \"functionCallingConfig\": {\n \"mode\": \"AUTO\",\n \"allowedFunctionNames\": [\n \"<string>\"\n ]\n }\n },\n \"parallel_tool_calls\": true,\n \"image_generation\": false,\n \"stop\": [\n \"<string>\"\n ],\n \"logprobs\": false,\n \"top_logprobs\": 2,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"top_p\": 1,\n \"top_k\": 1,\n \"seed\": 123,\n \"n\": 1,\n \"metadata\": {},\n \"sess_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"retries\": 0\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created": 123,
"model": "<string>",
"object": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"reasoning_content": "<string>",
"image": "<string>",
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": 123,
"transcript": "<string>"
},
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"billed_units": 123,
"prompt_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"cached_tokens": 123,
"image_tokens": 123,
"video_tokens": 123,
"citation_tokens": 123
},
"completion_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"accepted_prediction_tokens": 123,
"rejected_prediction_tokens": 123
}
},
"citations": [
"<string>"
],
"system_fingerprint": "<string>"
}{
"code": "validation_error",
"message": "参数验证失败",
"details": {
"field": "错误描述"
}
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}注:你可以在模型广场筛选查看系统支持的所有对话模型列表,对话模型请求/响应参数结构兼容 OpenAI,切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和 OpenAI 不一致,极客智坊底层会自动转换对齐。 除百度文心一言和讯飞星火模型外,其他所有平台支持函数调用(具体支持模型以平台限制为准)。 调用 GPTs 模型 API 时,需要将 gpt-4-gizmo-* 中的 * 替换成对应 GPTs 的 gizmo_id,获取方式:从 GPTs URL 中提取,以 https://chatgpt.com/g/g-bo0FiWLY7-researchgpt 为例, 对应的 gizmo_id 为 g-bo0FiWLY7。
citations)、搜索计费次数(billed_units)、消息内容支持视频、图片/视频输入tokens、推理模式设置(thinking)的支持,响应结构会根据是否是流式输出而变化,可以参考下面的请求示例进行判断。
关于对话模型 API 调用示例,可以参考这里:文本对话。
请求/响应参数明细
授权
bearerAuthapiKeyAuth
API认证token
请求体
application/json
对话模型
消息列表
Show child attributes
Show child attributes
示例:
[
{ "content": "你是一个助手", "role": "system" },
{ "content": "你好", "role": "user" }
]
开启推理模式,仅支持切换思考模式的模型支持
推理模式细节配置
Show child attributes
Show child attributes
是否返回流式响应,默认false
是否开启后台任务模式,默认false,注意 stream 和 background 不能同时为 true
是否启用联网搜索,默认false
联网搜索配置明细,仅智谱清言和不支持内置搜索工具的模型适用
Show child attributes
Show child attributes
是否启用 URL Context,默认false,仅部分 Gemini 模型生效
温度参数,默认为代理模型默认值
最大输出token数,默认设置为当前模型最大支持输出
示例:
4096
是否设置响应格式为JSON对象,默认false
指定响应输出格式,默认不指定为文本输出,如果设置该配置项会覆盖json_mode设置
- Text
- JSON object
- JSON schema
Show child attributes
Show child attributes
输出的多模态类型列表
可用选项:
text, image, audio, video 音频输出配置
Show child attributes
Show child attributes
图像生成配置,仅 Gemini 3 Pro Image 适用
Show child attributes
Show child attributes
可调用的工具函数列表
模型在生成响应时应如何选择使用哪个工具(或多个工具)
可用选项:
none, auto, required 工具函数调用配置(兼容gemini)
Show child attributes
Show child attributes
是否并发调用工具函数
是否强制出图,仅支持对话画图的模型支持
停止生成的触发词列表
是否返回token概率
每个位置返回的最可能token数
示例:
2
频率惩罚系数
存在惩罚系数
核采样阈值
最高概率采样数
随机数种子
生成结果数量
自定义元数据
第三方应用自行实现的会话ID
自动重试次数,默认0
此页面对您有帮助吗?
⌘I
