Skip to main content

FreeAI::Server::OpenAI — OpenAI API server based on built-in AI model parsers.

OpenAI Server

Parser overview

The parser provides the ability to deploy your own OpenAI-compatible API server, which can be connected to from your applications (e.g., Cherry Studio, Cline, etc.) and scripts — both via the official OpenAI SDK and using regular HTTP requests. The parser provides access to free and paid models parsed by A-Parser.

List of supported models:

Connection to Cherry Studio

  • Settings (top right corner)
  • List of providers, at the very bottom "add"
  • Set an arbitrary name, Provider type must be OpenAI
  • Enter API Key (any key)
  • Enter host (configured in FreeAI::Server::OpenAI) initially http://127.0.0.1:3000
  • "Manage" button to add the required models
View connection video

connection to cherry studio

Connection via OpenAI SDK

Connection to FreeAI::Server::OpenAI via nodejs + openai sdk
Code from example
import OpenAI from "openai";

(async function () {
const openai = new OpenAI({
baseURL: "http://127.0.0.1:3000/v1", //Link where FreeAI::Server::OpenAI is hosted
apiKey: "123",
});

const completion = await openai.chat.completions.create({
model: "FreeAI::ChatGPT", //Model is the parser name from the FreeAI::Server::OpenAI list, see "Parser overview" for supported models
messages: [{ role: "user", content: "Why is the sky blue?" }], //Request to the model
});

console.log(completion.choices[0].message.content); //Output response from the AI model
})();

Getting results via HTTP request

Connection to FreeAI::Server::OpenAI via nodejs http request
Code from example
const resp = await fetch("http://127.0.0.1:3000/v1/chat/completions", {
method: "POST",
headers: {
Authorization: "Bearer 123",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "FreeAI::ChatGPT", //Model is the parser name from the FreeAI::Server::OpenAI list, see "Parser overview" for supported models
messages: [{ role: "user", content: "Nodejs use cases" }], //Request to the model
}),
});

if (!resp.ok) {
const text = await resp.text();
throw new Error(`HTTP ${resp.status}: ${text}`);
}

const data = await resp.json();
console.log(data.choices?.[0]?.message?.content);

Possible settings

Parameter nameDefault valueDescription
Listen Host127.0.0.1IP address or hostname of the interface where the service accepts incoming connections
Listen Port3000Port number where the service accepts incoming connections
FreeAI::ChatGPT presetdefaultPreset for FreeAI::ChatGPT parser
FreeAI::Copilot presetdefaultPreset for FreeAI::Copilot parser
FreeAI::DeepAI presetdefaultPreset for FreeAI::DeepAI parser
FreeAI::GoogleAI presetdefaultPreset for FreeAI::GoogleAI parser
FreeAI::Kimi presetdefaultPreset for FreeAI::Kimi parser
FreeAI::Perplexity presetdefaultPreset for FreeAI::Perplexity parser