- OpenAI
- Claude
- Midjourney
- 翻译
- 文心一言
- Stable Diffusion
聊天 completion
POST
https://api.aigc2d.com/v1/complete
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token示例:
Authorization: Bearer ********************
Body 参数application/json
model
enum<string>
模型
枚举值:
claude-instant-1claude-2
prompt
string
提示
max_tokens_to_sample
integer
最大令牌数
stop_sequences
array[string]
可选
temperature
number
可选
top_p
number
可选
top_k
number
可选
metadata
object
可选
user_id
string
可选
stream
boolean
可选
示例
{
"model": "claude-2",
"prompt": "\n\nHuman: Why is the sky blue?\n\nAssistant:",
"max_tokens_to_sample": "256"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.aigc2d.com/v1/complete' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-2",
"prompt": "\n\nHuman: Why is the sky blue?\n\nAssistant:",
"max_tokens_to_sample": "256"
}'
返回响应
🟢200成功
application/json
Body
object {0}
示例
{
"completion": "Hello",
"stop_reason": "stop_sequence",
"model": "claude-2.1",
"stop": "\n\nHuman:",
"log_id": "9ce6514240d05b53146b1c33afb597642052acfd81a81c3597a15ffa516b9789"
}
🟠400请求有误
修改于 2023-11-26 15:35:25