DEV Community

Cover image for Harnessing the Power of ChatNBX API
Vikrant Guleria
Vikrant Guleria

Posted on

Harnessing the Power of ChatNBX API

In today's dynamic world of artificial intelligence and chatbots, ChatNBX stands out as a cutting-edge chat interface that merges the familiarity of ChatGPT with the might of open-source LLaMA models working effortlessly behind the scenes. ChatNBX is at the forefront of revolutionizing our interactions with AI-powered chatbots, and in this blog post, we'll dive into how you can leverage its API to craft your own AI-driven applications.

Unleashing ChatNBX for Your AI Apps

ChatNBX isn't just about using AI; it's about empowering you to create AI-driven applications tailored to your specific needs. By integrating ChatNBX's API into your projects, you can infuse your apps with human-like conversational abilities and provide users with intelligent, context-aware interactions.

Generating an API Key for ChatNBX

Before we delve into building AI apps, you'll need an API key from ChatNBX. Here's how you can obtain one:

  1. Go to https://chat.nbox.ai to access the ChatNBX platform.
  2. On the platform's sidebar, locate and click on the "APIs" menu. This is where you'll manage and create your API keys.
  3. In the APIs section, you'll find an option to create a new API key. Click on it to initiate the key generation process.

Image description

Now that you have your ChatNBX API key, you're ready to harness its capabilities to create AI apps that excel in various domains, from customer support bots that understand user queries to content generation engines that produce compelling articles with ease.

Using ChatNBX API: A Sample Snippet

Once you have your ChatNBX API key, you can start integrating ChatNBX into your applications. Here's a sample code snippet in Python that demonstrates how to make API calls to ChatNBX:

import json
import requests

stream = False

url = "https://chat.nbox.ai/api/chat/completions"
headers = {
    "Authorization": "tune-your-api-key-007078",
    "Content-Type": "application/json"
}
data = {
    "temperature": 0.5,
    "messages": [
        {
            "role": "system",
            "content": "You are ChatNBX"
        },
        {
            "role": "user",
            "content": "Who are you?"
        }
    ],
    "model": "oasst-llama2-70b-4k",
    "stream": stream,
    "max_tokens": 1000
}
response = requests.post(url, headers=headers, json=data)
if stream:
    for line in response.iter_lines():
        if line:
            l = line[6:]
            if l != b'[DONE]':
              print(json.loads(l))
else:
  print(response.json())
Enter fullscreen mode Exit fullscreen mode

ChatNBX is at the forefront of AI-driven conversational experiences, and with your API key in hand, you're ready to unlock its full potential. Whether you're building chatbots, virtual assistants, or simply exploring the capabilities of AI, ChatNBX offers a powerful platform to enhance your applications and engage with your users in a whole new way. So, dive in, experiment, and discover the possibilities of ChatNBX today!

Top comments (1)

Collapse
 
thevinitgupta profile image
Vinit Gupta

A great application with a familiar UI.

Really solves the problem of using LLama 🦙