创建消息
curl --request POST \
--url https://geekai.co/api/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}
'import requests
url = "https://geekai.co/api/v1/messages"
payload = {
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}
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: 'claude-opus-5-5',
max_tokens: 1024,
messages: [{role: 'user', content: 'Hello, Claude!'}]
})
};
fetch('https://geekai.co/api/v1/messages', 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/messages",
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' => 'claude-opus-5-5',
'max_tokens' => 1024,
'messages' => [
[
'role' => 'user',
'content' => 'Hello, Claude!'
]
]
]),
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/messages"
payload := strings.NewReader("{\n \"model\": \"claude-opus-5-5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ]\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/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"claude-opus-5-5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/messages")
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\": \"claude-opus-5-5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
"container": {
"id": "container_011CpZohnwH4vuy7gazohgSP",
"expires_at": "2019-12-27T18:11:19.117Z",
"skills": [
{
"skill_id": "pdf",
"type": "anthropic",
"version": "latest"
}
]
},
"content": [
{
"citations": null,
"text": "Hi! My name is Claude.",
"type": "text"
}
],
"context_management": {
"applied_edits": [
{
"cleared_input_tokens": 0,
"cleared_tool_uses": 0,
"type": "clear_tool_uses_20250919"
}
]
},
"diagnostics": null,
"model": "claude-opus-5-5",
"role": "assistant",
"stop_details": null,
"stop_reason": "end_turn",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 2051,
"cache_read_input_tokens": 2051,
"fallback_credit": {
"status": {
"type": "redeemed"
}
},
"inference_geo": "global",
"input_tokens": 2095,
"iterations": [
{
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 0,
"model": "claude-fable-5-2",
"output_tokens": 0,
"type": "message"
}
],
"output_tokens": 503,
"output_tokens_details": {
"thinking_tokens": 0
},
"server_tool_use": {
"web_fetch_requests": 2,
"web_search_requests": 0
},
"service_tier": "standard",
"speed": "standard"
},
"input_transformations": [
{
"path": "path",
"reason": "model_binding_mismatch",
"type": "thinking_dropped"
}
]
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}Text Models
Create message
POST
/
messages
创建消息
curl --request POST \
--url https://geekai.co/api/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}
'import requests
url = "https://geekai.co/api/v1/messages"
payload = {
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}
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: 'claude-opus-5-5',
max_tokens: 1024,
messages: [{role: 'user', content: 'Hello, Claude!'}]
})
};
fetch('https://geekai.co/api/v1/messages', 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/messages",
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' => 'claude-opus-5-5',
'max_tokens' => 1024,
'messages' => [
[
'role' => 'user',
'content' => 'Hello, Claude!'
]
]
]),
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/messages"
payload := strings.NewReader("{\n \"model\": \"claude-opus-5-5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ]\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/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"claude-opus-5-5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/messages")
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\": \"claude-opus-5-5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
"container": {
"id": "container_011CpZohnwH4vuy7gazohgSP",
"expires_at": "2019-12-27T18:11:19.117Z",
"skills": [
{
"skill_id": "pdf",
"type": "anthropic",
"version": "latest"
}
]
},
"content": [
{
"citations": null,
"text": "Hi! My name is Claude.",
"type": "text"
}
],
"context_management": {
"applied_edits": [
{
"cleared_input_tokens": 0,
"cleared_tool_uses": 0,
"type": "clear_tool_uses_20250919"
}
]
},
"diagnostics": null,
"model": "claude-opus-5-5",
"role": "assistant",
"stop_details": null,
"stop_reason": "end_turn",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 2051,
"cache_read_input_tokens": 2051,
"fallback_credit": {
"status": {
"type": "redeemed"
}
},
"inference_geo": "global",
"input_tokens": 2095,
"iterations": [
{
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 0,
"model": "claude-fable-5-2",
"output_tokens": 0,
"type": "message"
}
],
"output_tokens": 503,
"output_tokens_details": {
"thinking_tokens": 0
},
"server_tool_use": {
"web_fetch_requests": 2,
"web_search_requests": 0
},
"service_tier": "standard",
"speed": "standard"
},
"input_transformations": [
{
"path": "path",
"reason": "model_binding_mismatch",
"type": "thinking_dropped"
}
]
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>",
"details": {
"error_code": "<string>"
}
},
"request_id": "<string>"
}Use the Anthropic Messages format to generate text with Claude from text or image inputs. Send requests to
https://geekai.co/api/v1/messages (mainland China) or https://geekai.dev/api/v1/messages (international). Set the bearer token to your GeekAI API key. Request and response parameters follow the Claude Messages API.Headers
Body
application/json
声明客户端或服务端工具。收到客户端 tool_use 后,使用其 input 调用指定工具,再返回引用该调用 ID 的 tool_result。
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
Show child attributes
Show child attributes
仅从每个后续标记的前 K 个选项中进行采样。
用于删除“长尾”低概率响应。 了解更多技术细节 这里.
仅推荐用于高级用例。通常,您只需要使用 temperature。 旧版采样选项,所附 Beta 文档未列出;支持情况取决于模型和 API 版本。
Required range:
x >= 0Example:
5
Response
非流式调用返回完整 JSON 消息;stream 为 true 时返回 SSE 帧序列。开始推流后的失败通过 error 事件传递,不会更改 HTTP 状态。
Was this page helpful?
