post https://api-beta.codegpt.co/api/v1/chat/completions
Description
The /completion endpoint in the CodeGPT API is designed for user interaction with an AI Agent. To use this endpoint, you send a POST request with a structured JSON object in the body and your API Key in the header.
The API Key should be included in the header as follows: Authorization: Bearer CODEGPT_API_KEY
The JSON object should include the following fields:
- agent: This is the unique ID of the AI Agent you want to interact with.
- messages: This is an array of message objects. Each object should include a role (either 'user' or 'assistant') and content (the actual text of the message).
When you send this request, the AI Agent processes the 'messages', performs a semantic search on its knowledge base, and generates a response. This response, returned by the API, is the "completion".
Example
{
"agentId": "0000-0000-0000-0000",
"stream":true,
"format":"json"
"messages":
[{
"content": "What is the meaning of life?",
"role": "user"
}]
}