cURL
curl --request POST \ --url https://api.ttapi.io/v1/messages \ --header 'Content-Type: application/json' \ --header 'TT-API-KEY: <api-key>' \ --data ' { "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ], "model": "<string>", "max_tokens": 123, "...": "<unknown>" } '
{ "id": "msg_018zZJf8ZJf8ZJf8ZJf8ZJf8ZJf8", "type": "message", "role": "assistant", "content": [ { "type": "text", "text": " Hello! My name is Claude." } ], "model": "claude-2.0", "stop_reason": "stop_sequence", "usage": { "input_tokens": 15, "output_tokens": 22 } }
TTAPI中转 Claude create message ,除去Header中的TT-API-KEY外,所有请求以及相应参数全都同步官方一致,具体使用详见
授权字段,控制台获取授权信息
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" }]
TTAPI 支持使用的模型,详见Claude支持模型
max_tokens请注意,我们的模型可能会在达到此最大值之前停止。此参数仅指定要生成的绝对最大标记数。
其他具体详见官方文档,所有参数同步官方文档
成功响应
消息唯一标识
"msg_018zZJf8ZJf8ZJf8ZJf8ZJf8ZJf8"
响应类型
"message"
角色标识
"assistant"
消息内容列表
Show child attributes
使用的模型版本
"claude-2.0"
token 使用统计
停止原因
"stop_sequence"