Skip to main content

OpenAI-compatible providers

Any service with an OpenAI chat-completions API works with the same chatbot code: OpenRouter, Groq, DeepSeek, xAI, Together, a local Ollama or LM Studio, or your own endpoint.

Presets​

ProviderBase URLDefault model
openrouterhttps://openrouter.ai/api/v1openai/gpt-5.5
deepseekhttps://api.deepseek.comdeepseek-chat
groqhttps://api.groq.com/openai/v1set model
xaihttps://api.x.ai/v1set model
togetherhttps://api.together.xyz/v1set model
ollamahttp://localhost:11434/v1set model, no key needed
lmstudiohttp://localhost:1234/v1set model, no key needed
openai_compatibleyour baseUrlset model

Chat​

const { Chatbot, OpenAICompatibleInput } = require('intellinode');

// hundreds of models through one key
const bot = new Chatbot(OPENROUTER_API_KEY, 'openrouter');
const input = new OpenAICompatibleInput('You are a helpful assistant.', { model: 'anthropic/claude-sonnet-5' });
input.addUserMessage('Who painted the Mona Lisa?');

const responses = await bot.chat(input);

The default model of a preset can be set once on the chatbot instead of every input:

const groq = new Chatbot(GROQ_API_KEY, 'groq', null, { model: 'llama-3.3-70b-versatile' });

Extra headers, for example the OpenRouter attribution headers:

const bot = new Chatbot(OPENROUTER_API_KEY, 'openrouter', null, {
headers: { 'HTTP-Referer': 'https://my-app.example', 'X-OpenRouter-Title': 'My app' },
});

Local models: Ollama and LM Studio​

No key is needed; pick any model you pulled:

const local = new Chatbot(null, 'ollama', null, { model: 'qwen3' });

console.log(await local.listModels()); // the models the server has

const input = new OpenAICompatibleInput('You are a helpful assistant.');
input.addUserMessage('Give me three names for a coffee shop.');

for await (const chunk of local.stream(input)) process.stdout.write(chunk);

listModels() is available for every compatible provider.

Your own endpoint​

const custom = new Chatbot(MY_API_KEY, 'openai_compatible', null, {
baseUrl: 'https://my-host/v1',
model: 'my-model',
});

Everything else works the same​

Streaming, the tool loop, structured output, the retries & timeouts and every Gen function accept these providers:

const { Gen } = require('intellinode');

const code = await Gen.generate_component('a pricing card', null, 'ollama', { model: 'qwen3' });
const data = await Gen.generate_json('Where is Rome?', schema, DEEPSEEK_API_KEY, 'deepseek');

A ChatGPTInput sent to a compatible provider is converted to a chat-completions request, so existing code can switch providers by changing the chatbot only.

Embeddings​

The embedding controller accepts the compatible providers that serve an embeddings endpoint (openrouter, together, ollama, lmstudio, or openai_compatible with a baseUrl):

const { RemoteEmbedModel, EmbedInput } = require('intellinode');

const embed = new RemoteEmbedModel(null, 'ollama');
const vectors = await embed.getEmbeddings(new EmbedInput({ texts: ['hello world'], model: 'nomic-embed-text' }));

Stay ahead with Super Intelligence.

New AI agent guides straight to your inbox.