GPTs API
The complete documentation for GoAPI's GPTs API.
Developers can now add GPTs into their own applications and projects! Sign up now and start integrating!
Check out the GPTs API pricing here.
- Conversation API
- GPTs Management API (WIP)
- Models API (WIP)
- Gizmos API (WIP)
Note: The PPU service option is only available for Developer Plan or above, the BYOA service option is available for all subscription plans.
Conversation API
Create/add-message/add-file to a multimodal ChatGPT conversation
Available models:
- gpt-4
- gpt-4o
Available domains:
- If you are experience server issues with your API calls, please see try different available domains as per GoAPI Domains.
Create conversation
- If you are experience server issues with your API calls, please see try different available domains as per GoAPI Domains.
Request Body Explained
{ "model": "gpt-4o", "content": { "content_type": "text", "parts": [ "hello, introduce yourself" ] }, "gizmo_id": "g-3w1rEXGE0" //you can get this id from ChatGPT GPTs conversation page, you will need to remove the GPTs names //for example: https://chat.openai.com/g/g-3w1rEXGE0-web-browser , the gizmo_id is g-3w1rEXGE0 }
Request Example
import requests
import json
url = "https://api.goapi.xyz/api/chatgpt/v1/conversation"
payload = json.dumps({
"model": "gpt-4",
"content": {
"content_type": "text",
"parts": [
"draw me a wild cat"
]
}
})
headers = {
'X-API-Key': 'YOUR_GOAPI_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response Example
this API returns only STREAM response
data: {"message": {"id": "3bbbf479-f201-4530-bc3b-3820531daced", "author": {"role": "system", "name": null, "metadata": {}}, "create_time": null, "update_time": null, "content": {"content_type": "text", "parts": [""]}, "status": "finished_successfully", "end_turn": true, "weight": 0.0, "metadata": {}, "recipient": "all"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
data: {"message": {"id": "af818153-563c-4cf2-959c-c11578cc24f6", "author": {"role": "user", "name": null, "metadata": {}}, "create_time": 1704793809.059035, "update_time": null, "content": {"content_type": "text", "parts": ["draw me a wild cat"]}, "status": "finished_successfully", "end_turn": null, "weight": 1.0, "metadata": {"timestamp_": "absolute", "message_type": null}, "recipient": "all"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
data: {"message": {"id": "7e7e84ef-12e9-4425-af6b-38103a76599b", "author": {"role": "assistant", "name": null, "metadata": {}}, "create_time": 1704793809.103825, "update_time": null, "content": {"content_type": "code", "language": "json", "text": ""}, "status": "in_progress", "end_turn": null, "weight": 1.0, "metadata": {"inline_gizmo_id": null, "message_type": "next", "model_slug": "gpt-4", "parent_id": "af818153-563c-4cf2-959c-c11578cc24f6"}, "recipient": "dalle.text2im"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
data: {"conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "message_id": "af818153-563c-4cf2-959c-c11578cc24f6", "is_completion": false, "moderation_response": {"flagged": false, "blocked": false, "moderation_id": "modr-8f32H4jN06GiEvQ5lqdT2nnmNDYn1"}}
data: {"message": {"id": "7e7e84ef-12e9-4425-af6b-38103a76599b", "author": {"role": "assistant", "name": null, "metadata": {}}, "create_time": 1704793809.103825, "update_time": null, "content": {"content_type": "code", "language": "json", "text": "{\""}, "status": "in_progress", "end_turn": null, "weight": 1.0, "metadata": {"inline_gizmo_id": null, "message_type": "next", "model_slug": "gpt-4", "parent_id": "af818153-563c-4cf2-959c-c11578cc24f6"}, "recipient": "dalle.text2im"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
Add message to conversation
Request Body Explained
{ "content": { "content_type": "text", "parts": [ "draw me a wild cat" ] } }
Request Example
import requests
import json
url = "https://api.goapi.xyz/api/chatgpt/v1/conversation/asdlkjfoaiweghlasjdflkjad"
payload = json.dumps({
"content": {
"content_type": "text",
"parts": [
"draw me a wild cat"
]
}
})
headers = {
'X-API-Key': 'YOUR_GOAPI_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response Example
this API returns only STREAM response
data: {"message": {"id": "3bbbf479-f201-4530-bc3b-3820531daced", "author": {"role": "system", "name": null, "metadata": {}}, "create_time": null, "update_time": null, "content": {"content_type": "text", "parts": [""]}, "status": "finished_successfully", "end_turn": true, "weight": 0.0, "metadata": {}, "recipient": "all"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
data: {"message": {"id": "af818153-563c-4cf2-959c-c11578cc24f6", "author": {"role": "user", "name": null, "metadata": {}}, "create_time": 1704793809.059035, "update_time": null, "content": {"content_type": "text", "parts": ["draw me a wild cat"]}, "status": "finished_successfully", "end_turn": null, "weight": 1.0, "metadata": {"timestamp_": "absolute", "message_type": null}, "recipient": "all"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
data: {"message": {"id": "7e7e84ef-12e9-4425-af6b-38103a76599b", "author": {"role": "assistant", "name": null, "metadata": {}}, "create_time": 1704793809.103825, "update_time": null, "content": {"content_type": "code", "language": "json", "text": ""}, "status": "in_progress", "end_turn": null, "weight": 1.0, "metadata": {"inline_gizmo_id": null, "message_type": "next", "model_slug": "gpt-4", "parent_id": "af818153-563c-4cf2-959c-c11578cc24f6"}, "recipient": "dalle.text2im"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
data: {"conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "message_id": "af818153-563c-4cf2-959c-c11578cc24f6", "is_completion": false, "moderation_response": {"flagged": false, "blocked": false, "moderation_id": "modr-8f32H4jN06GiEvQ5lqdT2nnmNDYn1"}}
data: {"message": {"id": "7e7e84ef-12e9-4425-af6b-38103a76599b", "author": {"role": "assistant", "name": null, "metadata": {}}, "create_time": 1704793809.103825, "update_time": null, "content": {"content_type": "code", "language": "json", "text": "{\""}, "status": "in_progress", "end_turn": null, "weight": 1.0, "metadata": {"inline_gizmo_id": null, "message_type": "next", "model_slug": "gpt-4", "parent_id": "af818153-563c-4cf2-959c-c11578cc24f6"}, "recipient": "dalle.text2im"}, "conversation_id": "4f33f3be-191e-49a2-8ea0-446a78fefeeb", "error": null}
Upload file to conversation
OpenAI may change its api protocol. Check this blog if your file is not recongnized by the model: https://gap3ratfzt3.feishu.cn/wiki/HGY4wGGFMiUGJFkSQUxcmTkOnGg?fromScene=spaceOverview (opens in a new tab)
Valid file mimeType
[
"text/x-tex",
"text/x-script.python",
"application/msword",
"text/x-c",
"text/x-sh",
"text/x-c++",
"text/x-php",
"text/x-csharp",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"application/pdf",
"application/json",
"text/plain",
"text/javascript",
"text/html",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"text/x-ruby",
"text/markdown",
"application/x-latext",
"text/x-typescript",
"text/x-java",
"image/png",
"image/gif",
"image/webp",
"image/jpeg"
]
Request Example
import requests
url = "https://api.goapi.xyz/api/chatgpt/v1/conversation/asdgasdfgasdfasdfasdfasdf/file"
payload={}
files=[
('file',('hair4.png',open('/hair4.png','rb'),'image/png'))
]
headers = {
'X-API-Key': 'YOUR-GOAPI-KEY'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Response Example
{
"code": 200,
"data": {
"file_name": "hair4.png",
"file_id": "file-oeqJ9Aj9wLXVn1F36huwkmKj",
"file_size": 886531
},
"message": "success"
}
Download file from code interpretor's sandbox
Request Example
import requests
import json
url = "https://api.goapi.xyz/api/chatgpt/v1/conversation/650cc0cc-5223-4629-b889-d9e1d2827de1/sandbox_download"
payload = json.dumps({
"message_id": "ced396f6-d611-41e6-9876-c451589cb4ca",
"sandbox_path": "/mnt/data/The_Quantum_Voyager.pdf"
})
headers = {
'X-API-Key': 'YOUR-GOAPI-KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Download file from conversation
Request Example
import requests
import json
url = "https://api.goapi.xyz/api/chatgpt/v1/conversation/alosdiugakdjfalskdjflakjsd/download"
payload = json.dumps({
"file_id": "file-oeqJ9Aj9wLXVn1F36huwkmKj"
})
headers = {
'X-API-Key': 'YOUR-GOAPI-KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response Example
{
"code": 200,
"data": {
"status": "success",
"download_url": "https://files.oaiusercontent.com/file-oeqJ9Aj9wLXVn1F36huwkmKj?se=2024-01-09T11%3A53%3A09Z&sp=r&sv=2021-08-06&sr=b&rscc=max-age%3D299%2C%20immutable&rscd=attachment%3B%20filename%3Dhair4.png&sig=hb2pB4Vg0RwCfvjZ97whwIA8V9ufYLEmY6ia3MPrSbc%3D",
"file_name": "hair4.png",
"creation_time": "2024-01-09 11:28:58.988169+00:00"
},
"message": "success"
}