- Api.h5
- .chatCreateChatCompletion({
- model: 'gpt-3.5-turbo-1106',
- token: 'sk-f4fe8b67-fcbe-46fd-8cc9-fd1dac5d6d59',
- messages: [
- {
- role: 'user',
- content:
- '使用json格式返回十二生肖,包含中文名和英文名,[{id:"1", enName:"", cnName: ""}]',
- },
- ],
- params: {
- n: 1,
- response_format: { type: 'json_object' },
- },
- })
- .then((res) => {
- if (res.code === 200) {
- console.log(res)
- let content = res.data.completion.choices[0].message.content
- console.log(content)
- try {
- content = JSON.parse(content)
- console.log(content)
- } catch (error) {
- console.log(error)
- }
- }
- })
- }

https://chat.xutongbao.top/api/light/chat/createChatCompletion
post
访问:https://chat.xutongbao.top/
使用邮箱注册账号
点击【我的】
点击【API】
“gpt-3.5-turbo-1106”、 “gpt-3.5-turbo-16k” 、 “gpt-4”、“gpt-4-1106-preview”。 默认值为: “gpt-3.5-turbo-1106”
- {
- "model": "gpt-3.5-turbo-1106",
- "token": "sk-3d76d415-dd72-43ff-b7c8-65fb426f1d7b",
- "messages": [
- {
- "role": "user",
- "content": "List of months that have 30 days in json"
- }
- ],
- "params": {
- "n": 1,
- "response_format": {
- "type": "json_object"
- }
- }
- }
- {
- "code": 200,
- "data": {
- "completion": {
- "id": "chatcmpl-8K3TSgnJ31qpVlomvnSYpqKYmEZFR",
- "object": "chat.completion",
- "created": 1699790606,
- "model": "gpt-3.5-turbo-1106",
- "choices": [
- {
- "index": 0,
- "message": {
- "role": "assistant",
- "content": "{\n \"months\": [\n \"April\",\n \"June\",\n \"September\",\n \"November\"\n ]\n}"
- },
- "finish_reason": "stop"
- }
- ],
- "usage": {
- "prompt_tokens": 17,
- "completion_tokens": 25,
- "total_tokens": 42
- },
- "system_fingerprint": "fp_eeff13170a"
- },
- "info": {
- "isSdHide": "2",
- "sdLimitCount": 2000,
- "sdTextToImg": 412,
- "token": "sk-3d76d415-dd72-43ff-b7c8-65fb426f1d7b",
- "numOfOneDayCanCallApi": 50,
- "numOfOneDayAlreadyCallApi": 7,
- "apiDate": "2023-11-12",
- "isHasGPT4Auth": true
- }
- },
- "message": "成功"
- }
使用json格式返回十二生肖,包含中文名和英文名,[{id:"1", enName:"", cnName: ""}]



