Getting Started

OmniChat API is a model-agnostic platform for interacting with multiple AI models through a single interface. Below you'll find available endpoints, sample Node.js code snippets, and details about the expected responses to help you integrate quickly.

Setup

Install dependencies:

npm install axios

Endpoints

1. POST/api/chatCompletion

Generate a chat completion using the chosen AI model.

const axios = require('axios');

axios.post('http://localhost:3000/api/chatCompletion', {
	prompt: 'Hello, how are you?',
	calledBy: 'testClient',
	config: {
		model: 'o3-mini' // or 'deepseek-reasoner', 'gemini flash 2.0', etc.
	},
	headers: {
		'x-api-key': 'OMNICHAT_TOKEN'
	}
})
.then(response => {
	console.log(response.data);
})
.catch(error => {
	console.error(error);
});
Expected Response: A JSON object containing a response key with the AI-generated text.

Example:
{ "response": "Hello! I'm doing well, thank you." }

2. POST/api/chatBoolean

Checks if the provided text sample meets certain requirements.

axios.post('http://localhost:3000/api/chatBoolean', {
	sample: 'Sample text to check.',
	test: 'All words must be spelled correctly.',
	calledBy: 'testClient',
	origin: 'devEnv',
	config: {
		model: 'o3-mini',
		token: 'YOUR_API_KEY_HERE'
	}
})
.then(response => {
	console.log(response.data);
})
.catch(error => {
	console.error(error);
});
Expected Response: A JSON object with a response key containing a boolean value (true or false).

Example:
{ "response": true }

3. POST/api/currentChat

Enhances the user prompt with real-time Google Search data before generating a response.

axios.post('http://localhost:3000/api/currentChat', {
	prompt: 'What is the latest news on AI technology?',
	calledBy: 'testClient',
	origin: 'devEnv',
	config: {
		model: 'o3-mini',
		token: 'YOUR_API_KEY_HERE'
	}
})
.then(response => {
	console.log(response.data);
})
.catch(error => {
	console.error(error);
});
Expected Response: A JSON object with a response key containing a combined text from the prompt and relevant current information.

Example:
{ "response": "Latest AI news: [details...]." }

4. POST/api/genGoogleQuery

Converts a prompt into a Google search query optimized for better results.

axios.post('http://localhost:3000/api/genGoogleQuery', {
	prompt: 'Find me the top restaurants in New York.',
	calledBy: 'testClient',
	origin: 'devEnv',
	config: {
		model: 'o3-mini',
		token: 'YOUR_API_KEY_HERE'
	}
})
.then(response => {
	console.log(response.data);
})
.catch(error => {
	console.error(error);
});
Expected Response: A JSON object with a response key containing a search query string.

Example:
{ "response": "Top restaurants in New York" }

5. POST/api/linkify

Analyzes a text and embeds relevant links to support or reference the content.

axios.post('http://localhost:3000/api/linkify', {
	originalText: 'This is some text that needs relevant links...',
	calledBy: 'testClient',
	origin: 'devEnv',
	config: {
		model: 'o3-mini',
		token: 'YOUR_API_KEY_HERE'
	}
})
.then(response => {
	console.log(response.data);
})
.catch(error => {
	console.error(error);
});
Expected Response: A JSON object with a response key containing the input text with HTML links embedded at contextually appropriate positions.

Example:
{ "response": "<p>This is some text with a <a href='https://example.com' target='_blank'>relevant link</a>...</p>" }

6. POST/api/proofedChat

Generates text that must satisfy a set of requirements, validated by the AI itself.

axios.post('http://localhost:3000/api/proofedChat', {
	prompt: 'Write a short story about a hero.',
	test: 'The story must have exactly 3 paragraphs.',
	calledBy: 'testClient',
	origin: 'devEnv',
	config: {
		model: 'o3-mini',
		token: 'YOUR_API_KEY_HERE'
	}
})
.then(response => {
	console.log(response.data);
})
.catch(error => {
	console.error(error);
});
Expected Response: A JSON object with a response key containing the generated text that meets the specified requirements.

Example:
{ "response": "Once upon a time... [3 paragraphs story]" }

In all these examples, replace YOUR_API_KEY_HERE with the token for the AI service you wish to use.