Skip to main content

Uncensored Chat

Overview

Uncensored chat endpoint allows you to create chat conversation and get responses based on the conversation. It is very flexible such that it could answer any question without restriction of answer.

Request

--request POST 'https://stablediffusionapi.com/api/v5/uncensored_chat' \

Send a POST request to https://stablediffusionapi.com/api/v5/uncensored_chat endpoint and append the response of the api back to the request.

Attributes

ParameterTypeDescription
keyStringYour API Key used for request authorization
messagesArrayIt accepts the role and content key. The role accepts the value of user or assistant while the content accepts the chat description
max_tokensIntThe maximum number of token

Example

Body

Body Raw
{
"key": "",
"messages": [
{
"role": "user",
"content": "write php function to make api call"
},
],
"max_tokens": 1000
}

Once the endpoint is called, the sample response looks like so;

Body Raw
{
"status": "success",
"message": "Here is an example of a PHP function that makes an API call using the cURL extension:\n
\nfunction make_api_call($url, $data = []) {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));\n curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n $response = curl_exec($ch);\n curl_close($ch);\n return $response;\n}\n",
"meta": {
"messages": [
{
"role": "user",
"content": "write php function to make api call"
}
],
"max_tokens": 1000,
"temperature": 1,
"top_p": 1,
"presence_penalty": 0,
"frequency_penalty": 0,
"track_id": null,
"webhook": null
}
}

To continue the next API call, append the object of property role and content to the messages array where the role value is assistant and the content value is the response message from the previous call. After that, append another object of same property and pass role value as user and content value as your new description to continue the chat. The request will look like so;

Body Raw

{
"key": "",
"messages": [
{
"role": "user",
"content": "write php function to make api call"
},
{
"role":"assistant",
"content":"Here is an example of a PHP function that makes an API call using the cURL extension:\n
\nfunction make_api_call($url, $data = []) {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));\n curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n $response = curl_exec($ch);\n curl_close($ch);\n return $response;\n}\n"
},
{
"role": "user",
"content": "write function to make api call to openai"
},

],
"max_tokens": 1000
}

The response of the above request looks like so

Body Raw
{
"status": "success",
"message": " Here is an example of a PHP function that makes an API call to OpenAI using the curl_ext extension:\n
\nfunction make_openai_api_call($endpoint, $params) {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $endpoint);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));\n $response = curl_exec($ch);\n curl_close($ch);\n return $response;\n}\n",
"meta": {
"messages": [
{
"role": "user",
"content": "write php function to make api call"
},
{
"role": "assistant",
"content": "Here is an example of a PHP function that makes an API call using the cURL extension:\n
\nfunction make_api_call($url, $data = []) {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));\n curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n $response = curl_exec($ch);\n curl_close($ch);\n return $response;\n}\n
"
},
{
"role": "user",
"content": "write function to make api call to openai"
}
],
"max_tokens": 1000,
"temperature": 1,
"top_p": 1,
"presence_penalty": 0,
"frequency_penalty": 0,
"track_id": null,
"webhook": null
}
}

Repeat the process as many times as possible until you are satisfied with the results

Model being used is Mistral 7B Instruct-v0.1

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"messages": [
{
"role": "user",
"content": "write php function to make api call"
},
],
"max_tokens": 1000
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://stablediffusionapi.com/api/v5/uncensored_chat", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"message": "Here is an example of a PHP function that makes an API call using the cURL extension:\n
\nfunction make_api_call($url, $data = []) {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));\n curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n $response = curl_exec($ch);\n curl_close($ch);\n return $response;\n}\n",
"meta": {
"messages": [
{
"role": "user",
"content": "write php function to make api call"
}
],
"max_tokens": 1000,
"temperature": 1,
"top_p": 1,
"presence_penalty": 0,
"frequency_penalty": 0,
"track_id": null,
"webhook": null
}
}