This project provides a simple API interface to communicate with the BlackboxAI service using Express.js and Axios. The API allows users to send messages and manage conversations with the AI model of their choice.
- Send and continue conversations with BlackboxAI.
- Supports dynamic model selection.
- Maintains conversation history using unique conversation IDs.
- Error handling for various scenarios.
- Node.js (>= 12.x)
- npm (Node Package Manager)
-
Clone the repository:
git clone https://github.com/notsopreety/blackbox-api.git cd blackboxai-api -
Install the required dependencies:
npm install express axios
-
Run the server:
node index.js
-
The server will start on
http://localhost:3000.
- Endpoint:
/api/blackbox - Method:
GET - Query Parameters:
text: The user's message (required).conversationId: A unique identifier for the conversation (required).model: The AI model to use (optional). If not provided, it defaults toblackboxai.
Example Request:
GET http://localhost:3000/api/blackbox?text=Hello%20AI&conversationId=1&model=gpt-4oExample Response:
{
"response": "AI's response here."
}Test Deployed API:
GET https://blackbox-api-chi.vercel.app/api/blackbox?text=Hello%20AI&conversationId=435HGS&model=gpt-4oThe API handles various error scenarios, including:
- Missing required parameters (
textandconversationId). - Server errors while communicating with the BlackboxAI service.
In case of an error, the response will include an appropriate error message and status code.
If you would like to contribute to this project, please fork the repository and submit a pull request. All contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
Samir Thakuri
My GitHub Profile