Summarize the given text.




Nexra
ChatGPT

Immerse yourself in meaningful conversations with multiple iterations of ChatGPT, from the versatile GPT-3 to the evolved GPT-4. Explore a range of skills spanning from contextual analysis to advanced response generation, providing a fascinating journey through different levels of artificial intelligence and knowledge.
Usage with cURL

Use the cURL command for a quick and effective demonstration of the API with this simple command.

curl -X POST \
  https://nexra.aryahcr.cc/api/chat/gpt \
  -H 'Content-Type: application/json' \
  -d '{
    "messages": [
        {
            "role": "assistant",
            "content": "Hello! How are you today?"
        },
        {
            "role": "user",
            "content": "Hello, my name is Yandri."
        },
        {
            "role": "assistant",
            "content": "Hello, Yandri! How are you today?"
        }
    ],
    "prompt": "Can you repeat my name?",
    "model": "GPT-4",
    "markdown": false
}'

Usage with JavaScript

You can use the fetch method to efficiently make requests to the API and retrieve the necessary data.

fetch("https://nexra.aryahcr.cc/api/chat/gpt", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        messages: [
            {
                role: "assistant",
                content: "Hello! How are you today?"
            },
            {
                role: "user",
                content: "Hello, my name is Yandri."
            },
            {
                role: "assistant",
                content: "Hello, Yandri! How are you today?"
            }
        ],
        prompt: "Can you repeat my name?",
        model: "GPT-4",
        markdown: false
    })
}).then((response) => {
    response.text().then((result) => {
        // Modify your code to remove the '_' at the end of the output
        console.log(result);
    }).catch((err) => {
        console.log(err);
    });
}).catch((err) => {
    console.log(err);
});

Usage with NodeJS

Utilize the Axios npm library to efficiently and easily make requests to the API.

const axios = require('axios');

axios.post('https://nexra.aryahcr.cc/api/chat/gpt', {
    messages: [
        {
            role: "assistant",
            content: "Hello! How are you today?"
        },
        {
            role: "user",
            content: "Hello, my name is Yandri."
        },
        {
            role: "assistant",
            content: "Hello, Yandri! How are you today?"
        }
    ],
    prompt: "Can you repeat my name?",
    model: "GPT-4",
    markdown: false
}, {
    headers: {
        'Content-Type': 'application/json'
    }
}).then(response => {
    if(response.status === 200){
        // Modify your code to remove the '_' at the end of the output
        console.log(response.data);
    } else {
        console.log("Error");
    }
}).catch(error => {
    console.error('Error:', error);
});

Usage with PHP

You can use the curl function in PHP to make requests through the API.

<?php

$url = 'https://nexra.aryahcr.cc/api/chat/gpt';

$data = array(
    "messages" => [
        [
            "role" => "assistant",
            "content" => "Hello! How are you today?"
        ],
        [
            "role" => "user",
            "content" => "Hello, my name is Yandri."
        ],
        [
            "role" => "assistant",
            "content" => "Hello, Yandri! How are you today?"
        ]
    ],
    "prompt" => "Can you repeat my name?",
    "model" => "GPT-4",
    "markdown" => false
);

$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if ($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Modify your code to remove the '_' at the end of the output
    echo $response;
}

curl_close($ch);

?>

Usage with Python

You can use Python along with the requests library to make the request to the API.

import requests
import json

url = "https://nexra.aryahcr.cc/api/chat/gpt"

headers = {
    "Content-Type": "application/json"
}

data = {
    "messages": [
        {
            "role": "assistant",
            "content": "Hello! How are you today?"
        },
        {
            "role": "user",
            "content": "Hello, my name is Yandri."
        },
        {
            "role": "assistant",
            "content": "Hello, Yandri! How are you today?"
        }
    ],
    "prompt": "Can you repeat my name?",
    "model": "GPT-4",
    "markdown": False
}

try:
    response = requests.post(url, headers=headers, data=json.dumps(data))
    if response.status_code == 200:
        # Modify your code to remove the '_' at the end of the output
        print(response.text)
    else:
        print(f"Error: {response.status_code}")
except Exception as e:
    print(e)

JSON Response

The following is the final result in JSON format obtained after making a call to the API.

{
    "code": 200,
    "status": true,
    "model": "gpt-4",
    "gpt": "Hello, Yandri! How can I assist you today?",
    "original": null
}

Modelos

Select one of these available models in the API to enhance your experience.

    gpt-4
    gpt-4-0613
    gpt-4-32k
    gpt-4-0314
    gpt-4-32k-0314
    gpt-3.5-turbo
    gpt-3.5-turbo-16k
    gpt-3.5-turbo-0613
    gpt-3.5-turbo-16k-0613
    gpt-3.5-turbo-0301
    text-davinci-003
    text-davinci-002
    code-davinci-002
    gpt-3
    text-curie-001
    text-babbage-001
    text-ada-001
    davinci
    curie
    babbage
    ada
    babbage-002
    davinci-002

ChatGPT Web

This enhanced version of the language model, GPT-4, has been fine-tuned and refined with significant improvements through my work. However, it is important to note that, as with any system, errors or limitations may arise in certain internet searches due to the complex and constantly evolving nature of technology. Therefore, while this model has been improved with my intervention, I recommend exercising caution when relying entirely on its accuracy for certain queries or online tasks.
Usage with cURL

Use the cURL command for a quick and effective demonstration of the API with this simple command.

curl -X POST \
  https://nexra.aryahcr.cc/api/chat/gptweb \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "¿What is DALLE-3 and how does it create images?",
    "markdown": false
}'

Usage with JavaScript

You can use the fetch method to efficiently make requests to the API and retrieve the necessary data.

fetch("https://nexra.aryahcr.cc/api/chat/gptweb", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        prompt: "¿What is DALLE-3 and how does it create images?",
        markdown: false
    })
}).then((response) => {
    response.text().then((result) => {
        // Modify your code to remove the '_' at the end of the output
        console.log(result);
    }).catch((err) => {
        console.log(err);
    });
}).catch((err) => {
    console.log(err);
});

Usage with NodeJS

Utilize the Axios npm library to efficiently and easily make requests to the API.

const axios = require('axios');

axios.post('https://nexra.aryahcr.cc/api/chat/gptweb', {
    prompt: "¿What is DALLE-3 and how does it create images?",
    markdown: false
}, {
    headers: {
        'Content-Type': 'application/json'
    }
}).then(response => {
    if(response.status === 200){
        // Modify your code to remove the '_' at the end of the output
        console.log(response.data);
    } else {
        console.log("Error");
    }
}).catch(error => {
    console.error('Error:', error);
});

Usage with PHP

You can use the curl function in PHP to make requests through the API.

<?php

$url = 'https://nexra.aryahcr.cc/api/chat/gptweb';

$data = array(
    "prompt" => "¿What is DALLE-3 and how does it create images?",
    "markdown" => false
);

$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if ($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Modify your code to remove the '_' at the end of the output
    echo $response;
}

curl_close($ch);

?>

Usage with Python

You can use Python along with the requests library to make the request to the API.

import requests
import json

url = "https://nexra.aryahcr.cc/api/chat/gptweb"

headers = {
    "Content-Type": "application/json"
}

data = {
    "prompt": "¿What is DALLE-3 and how does it create images?",
    "markdown": False
}

try:
    response = requests.post(url, headers=headers, data=json.dumps(data))
    if response.status_code == 200:
        # Modify your code to remove the '_' at the end of the output
        print(response.text)
    else:
        print(f"Error: {response.status_code}")
except Exception as e:
    print(e)

JSON Response

The following is the final result in JSON format obtained after making a call to the API.

{
    "code": 200,
    "status": true,
    "gpt": "DALLE-3 is an AI model developed by OpenAI that is capable of generating images based on text descriptions. It is an advanced version of the DALL-E model, which was first launched in January 2021. DALLE-3 has been trained using a huge dataset of text-image pairs and is capable of generating images that closely adhere to the provided text prompts.\n\nTo create an image using DALLE-3, users can provide a text description as input, and the model will generate an image that corresponds to that description. The model has been trained with a large number of images and text descriptions, allowing it to understand and capture the nuances and details of the text prompts to create visually accurate and appealing images.\n\nDALLE-3 represents a significant improvement in the field of generative AI technology and has the potential to be used for various applications, including concept art, illustrations, visualizing ideas, and creating memes. It combines the power of deep learning with image generation, allowing users to generate images based on their textual descriptions.",
    "original": null
}

ChatGPT v2

It's quite similar, with the difference that it has the capability to generate real-time responses via streaming using GPT-3.5 Turbo.
Usage with cURL

Use the cURL command for a quick and effective demonstration of the API with this simple command.

curl -X POST \
  https://nexra.aryahcr.cc/api/chat/complements \
  -H 'Content-Type: application/json' \
  -d '{
    "messages": [
        {
            "role": "assistant",
            "content": "Hello! How are you today?"
        },
        {
            "role": "user",
            "content": "Hello, my name is Yandri."
        },
        {
            "role": "assistant",
            "content": "Hello, Yandri! How are you today?"
        },
        {
            "role": "user",
            "content": "Can you repeat my name?"
        }
    ],
    "stream": false,
    "markdown": false,
    "model": "chatgpt"
}'

Usage with JavaScript

You can use the fetch method to efficiently make requests to the API and retrieve the necessary data.

let messages = [
    {
        "role": "assistant",
        "content": "Hello! How are you today?"
    },
    {
        "role": "user",
        "content": "Hello, my name is Yandri."
    },
    {
        "role": "assistant",
        "content": "Hello, Yandri! How are you today?"
    },
    {
        "role": "user",
        "content": "Can you repeat my name?"
    }
]

// Normal

fetch("https://nexra.aryahcr.cc/api/chat/complements", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        messages: messages,
        stream: false,
        markdown: false,
        model: "chatgpt"
    })
}).then((response) => {
    response.text().then((result) => {
        // Modify your code to remove the '_' at the end of the output
        console.log(result);
    }).catch((err) => {
        console.log(err);
    });
}).catch((err) => {
    console.log(err);
});

// Streaming

fetch("https://nexra.aryahcr.cc/api/chat/complements", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        messages: messages,
        stream: true,
        markdown: false,
        model: "chatgpt"
    })
}).then(response => {
    const reader = response.body.getReader();
    let tmp = '';
    let err = null;
    
    reader.read().then(function processText({ done, value }) {
        if (done) {
            if(err != null){
                console.log(err);
            } else {
                console.log('end');
            }
            return;
        }
        
        const chunk = new TextDecoder().decode(value);
        chk = chunk.toString().split('');
            
        chk.forEach(part => {
            if(err === null){
                let result = null;
                let convert = "";
                
                try {
                    convert = JSON.parse(part);
                    result = part;
                    tmp = null;
                } catch(e){
                    if(tmp === null){
                        tmp = part;
                    } else {
                        try {
                            convert = JSON.parse(tmp);
                            result = tmp;
                            tmp = null;
                        } catch(e){
                            tmp = tmp + part;
                            try {
                                convert = JSON.parse(tmp);
                                result = tmp;
                                tmp = null;
                            } catch(e){
                            tmp = tmp;
                            }
                        }
                    }
                }

                if(result !== null){
                    if(result.code === undefined && result.status === undefined){
                        console.log(result);
                    } else {
                        err = result;
                    }
                }
            }
        });
        
        return reader.read().then(processText);
    }).catch((err) => {
        console.error(err)
    });
}).catch((err) => {
    console.error(err)
});

Usage with NodeJS

Utilize the Axios npm library to efficiently and easily make requests to the API.

let messages = [
    {
        "role": "assistant",
        "content": "Hello! How are you today?"
    },
    {
        "role": "user",
        "content": "Hello, my name is Yandri."
    },
    {
        "role": "assistant",
        "content": "Hello, Yandri! How are you today?"
    },
    {
        "role": "user",
        "content": "Can you repeat my name?"
    }
]

// Normal

const axios = require('axios');

axios.post('https://nexra.aryahcr.cc/api/chat/complements', {
    messages: messages,
    stream: false,
    markdown: false,
    model: "chatgpt"
}, {
    headers: {
        'Content-Type': 'application/json'
    }
}).then(response => {
    if(response.status === 200){
        // Modify your code to remove the '_' at the end of the output
        console.log(response.data);
    } else {
        console.log("Error");
    }
}).catch(error => {
    console.error('Error:', error);
});

// Streaming

const axios = require('axios');

axios.post('https://nexra.aryahcr.cc/api/chat/complements', {
    messages: messages,
    stream: true,
    markdown: false,
    model: "chatgpt"
}, {
    headers: {
        'Content-Type': 'application/json'
    },
    responseType: "stream"
}).then(response => {
    let chat = null;
    let error = false;
    response.data.on("data", (chunk) => {
        let chk = chunk.toString();
        chk = chk.split("");
        let tmp = null;

        chk.forEach((data) => {
            let result = null;
            let convert = "";
            
            try {
                convert = JSON.parse(data);
                result = data;
                tmp = null;
            } catch(e){
                if(tmp === null){
                    tmp = data;
                } else {
                    try {
                        convert = JSON.parse(tmp);
                        result = tmp;
                        tmp = null;
                    } catch(e){
                        tmp = tmp + data;
                        try {
                            convert = JSON.parse(tmp);
                            result = tmp;
                            tmp = null;
                        } catch(e){
                            tmp = tmp;
                        }
                    }
                }
            }

            if(result != null){
                try {
                    result = JSON.parse(result);
                    if(chat === null && result != null){
                        chat = "";
                    }

                    if(result != undefined && result != null && result.code === undefined && result.status === undefined){
                        if(error === false){
                            if(result != undefined && result != null && result.finish != undefined && result.finish != null && result.finish === true){
                                chat = result;
                            } else {
                                chat = result;
                                console.log(chat);
                            }
                        }
                    } else {
                        error = result;
                        chat = result;
                    }
                } catch(e){
                    // continue
                }
            }
        });
    })

    response.data.on("end", () => {
        if(chat != null){
            if(error === false){
                console.log(chat);
            } else {
                console.log(error);
            }
        } else {
            error = {
                "code": 500,
                "status": false,
                "error": "INTERNAL_SERVER_ERROR",
                "message": "general (unknown) error"
            }
            console.log(error);
        }
    });

    response.data.on("error", (err) => {
        error = {
            "code": 500,
            "status": false,
            "error": "INTERNAL_SERVER_ERROR",
            "message": "general (unknown) error"
        }
        console.log(error);
    });
}).catch(error => {
    console.error('Error:', error);
});

Usage with PHP

You can use the curl function in PHP to make requests through the API.

<?php

$messages = [
    [
        "role" => "assistant",
        "content" => "Hello! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ],
    [
        "role" => "assistant",
        "content" => "Hello, Yandri! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Can you repeat my name?"
    ]
];

// Normal

$url = 'https://nexra.aryahcr.cc/api/chat/complements';

$data = array(
    "messages" => $messages,
    "stream" => false,
    "markdown" => false,
    "model" => "chatgpt"
);

$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if ($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Modify your code to remove the '_' at the end of the output
    echo $response;
}

curl_close($ch);

// Streaming

require 'vendor/autoload.php';

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;

$client = new Client([
    'base_uri' => 'https://nexra.aryahcr.cc/',
]);

$body = [
    'json' => [
        "messages" => $messages,
        "stream" => true,
        "markdown" => false,
        "model" => "chatgpt"
    ],
    'stream' => true
];

$response = $client->request('POST', 'api/chat/complements', $body);

$bodyStream = $response->getBody();

$tmp = null;
$convert = "";
$err = null;
while (!$bodyStream->eof()) {
    $chunk = $bodyStream->read(1024);

    $chunk = explode("", $chunk);

    foreach($chunk as $data){
        if($err === null){
            $result = null;
            $convert = json_decode($data);
            if(is_object($convert)){
                $result = $data;
                $tmp = null;
            } else {
                if($tmp == null){
                    $tmp .= $data;
                } else {
                    $convert = json_decode($tmp);
                    if(is_object($convert)){
                        $result = $tmp;
                        $tmp = null;
                    } else {
                        $tmp .= $data;
                        $convert = json_decode($tmp);
                        if(is_object($convert)){
                            $result = $tmp;
                            $tmp = null;
                        } else {
                            $tmp = $tmp;
                        }
                    }
                }
            }

            if($result != null){
                $result = json_decode($result);
                if(!isset($result->code) && !isset($result->status)){
                    echo(json_encode($result)."\n");
                } else {
                    $err = $result;
                    echo(json_encode($err));
                }
            }
        }
    }
}
?>

Usage with Python

You can use Python along with the requests library to make the request to the API.

import requests
import json

url = "https://nexra.aryahcr.cc/api/chat/complements"

messages = [
    {
        "role": "assistant",
        "content": "Hello! How are you today?"
    },
    {
        "role": "user",
        "content": "Hello, my name is Yandri."
    },
    {
        "role": "assistant",
        "content": "Hello, Yandri! How are you today?"
    },
    {
        "role": "user",
        "content": "Can you repeat my name?"
    }
]

url = "https://nexra.aryahcr.cc/api/chat/complements"

headers = {
    "Content-Type": "application/json"
}

data = {
    "messages": messages,
    "stream": False,
    "markdown": False,
    "model": "chatgpt"
}

try:
    response = requests.post(url, headers=headers, data=json.dumps(data))
    if response.status_code == 200:
        # Modify your code to remove the '_' at the end of the output
        print(response.text)
    else:
        print(f"Error: {response.status_code}")
except Exception as e:
    print(e)

# Streaming

data = {
    "messages": messages,
    "stream": True,
    "markdown": False,
    "model": "chatgpt"
}

try:
    response = requests.post(url, json=payload, stream=True)
    if response.status_code == 200:
        tmp = None
        err = None
        for chunk in response.iter_content(chunk_size=1024):
            if err == None:
                if chunk:
                    chk = chunk.decode()
                    chk = chk.split("")

                    for data in chk:
                        result = None

                        try:
                            convert = json.loads(data)
                            result = data
                            tmp = None
                        except Exception as e:
                            if tmp == None:
                                tmp = data
                            else:
                                try:
                                    convert = json.loads(tmp)
                                    result = tmp
                                    tmp = None
                                except Exception as e:
                                    tmp = tmp + data
                                    try:
                                        convert = json.loads(tmp)
                                        result = tmp
                                        tmp = None
                                    except Exception as e:
                                        tmp = tmp
                        
                        if result != None:
                            if "code" not in result and "status" not in result:
                                print(result)
                            else:
                                err = result
                                print(err)
    else:
        print("Error")
except requests.exceptions.RequestException as e:
    print(e)

JSON Response

The following is the final result in JSON format obtained after making a call to the API.

{
    "code": 200,
    "status": true,
    "model": "ChatGPT",
    "message": "Of course, Yandri! How can I assist you today?",
    "original": null
}

Transmisión de la respuesta JSON

Lo siguiente es el resultado final obtenido en formato JSON a través de transmisión después de realizar una llamada a la API.

{"message":"Hello! How are you today?","original":null,"finish":false,"error":false}
{"message":"","original":null,"finish":false,"error":false}
{"message":"Of","original":null,"finish":false,"error":false}
{"message":"Of course","original":null,"finish":false,"error":false}
{"message":"Of course,","original":null,"finish":false,"error":false}
{"message":"Of course, Yand","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri!","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can I","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can I assist","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can I assist you","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can I assist you today","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can I assist you today?","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can I assist you today?","original":null,"finish":false,"error":false}
{"message":"Of course, Yandri! How can I assist you today?","original":null,"finish":false,"error":false}
{"message":null,"original":null,"finish":true,"error":false}

Error Codes

These are the error codes that will be presented in case the API fails.
Code 	Error 	Description
400 	BAD_REQUEST 	Not all parameters have been entered correctly
500 	INTERNAL_SERVER_ERROR 	The server has experienced failures
200 		The API worked without issues

Terms and Conditions

Developed and maintained by yandricr