if ($backend_path === '/') { http_response_code(200); header('Content-Type: text/html; charset=utf-8'); ?> mse_ai_api — Documentation

🚀 mse_ai_api

An OpenAI-compatible API proxy powered by web automation. Use this endpoint in n8n, Python, Node.js, or any project that supports custom OpenAI Base URLs.

Customized by: Muhammed Koka.

⚠️ Note on Speed: Because this bypasses standard APIs by utilizing a real browser instance, responses typically take 10-20 seconds. It is designed for background tasks (like n8n workflows), not real-time chat UIs.

🛠️ Configuration

📡 Endpoints

Chat Completions

POST /v1/chat/completions

Standard OpenAI chat format. Fully supports conversation history by passing the full messages array.

curl -X POST "https://ai.herculesprojects.net/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ]
  }'

Responses API

POST /v1/responses

OpenAI Responses API format.

Models

GET /v1/models

💻 Integration Examples

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://ai.herculesprojects.net/v1"
)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "user", "content": "Write a python script."}
    ]
)
print(response.choices[0].message.content)

Node.js (OpenAI SDK)

import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://ai.herculesprojects.net/v1"
});

const response = await openai.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(response.choices[0].message.content);

n8n Setup

  1. Add an OpenAI Model node.
  2. Under Credentials, create a new OpenAI Api credential.
  3. Set the API Key to your secret key.
  4. Set the Base URL to: https://ai.herculesprojects.net/v1
  5. In the node settings, set the model to gpt-4o-mini.
  6. Important: In the n8n workflow settings, increase the "Execution Timeout" to at least 120 seconds.

📝 How History Works

This API is strictly stateless. It does not remember previous requests on the server. To keep history, your app must send the entire conversation array every time.

{
  "messages": [
    {"role": "user", "content": "My name is Hercules"},
    {"role": "assistant", "content": "Hello Hercules!"},
    {"role": "user", "content": "What is my name?"} 
  ]
}