Usage

fetch('https://engine.zfc.digital/v1/chat/completions', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer api-d0e21470-1208-404a-85f1-dc40c5ceab0c-1717806976240`,
    },
    body: JSON.stringify({
        model: 'gpt-3.5-turbo',
        messages: [
            { role: 'system', content: "Hello!" },
        ],
    }),
})
.then(res => res.json())
.then(console.log)
.catch(console.error)

You can send a request as above. You should change the api key and question parts. You can find the sample response below.

{
    "id": "6ba3cfa4-3f39-4a64-8374-c1735f271224",
    "conversationId": "7a22fa89-7fa7-45ae-bd02-2e274f0cc1e3",
    "object": "chat.completion",
    "created": 1717807505962,
    "model": "text-davinci-002-render-sha",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Hi there! How can I assist you today?"
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 2,
        "completion_tokens": 10,
        "total_tokens": 12
    },
    "system_fingerprint": null
}

If you want to integrate it into an existing application, simply change the api base url variable to https://engine.zfc.digital/v1.

Previous How to Continue from a Message?

Just add the parentMessageId and conversationId variables to the request body.

fetch('https://engine.zfc.digital/v1/chat/completions', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer api-d0e21470-1208-404a-85f1-dc40c5ceab0c-1717806976240`,
    },
    body: JSON.stringify({
        model: 'gpt-3.5-turbo',
        messages: [
            { role: 'system', content: "Hello!" },
        ],
         "parentMessageId":"71a29dcb-0fb2-4066-ae43-a23475f2adf0",
         "conversationId": "a3c0a101-cffa-4517-ad1b-2a3dc8adb3bf"

    }),
})
.then(res => res.json())
.then(console.log)
.catch(console.error)

Last updated