Connect your agent

OpenAI (ChatGPT / GPT-4 / GPT-5)

Wire Vlozi MCP into ChatGPT or GPT via the OpenAI Function Calling API.

GPT-4, GPT-4o, GPT-5, and any OpenAI-compatible model can drive Vlozi via the function-calling API. The pattern is the same as the Claude flow — fetch the tool list, pass it as functions, forward calls to mcp.vlozi.app, return results.

Install

npm install openai
# or
pip install openai

TypeScript example

import OpenAI from "openai";
 
const VLOZI_KEY = process.env.VLOZI_API_KEY!;
const MCP = "https://mcp.vlozi.app";
 
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY! });
 
async function listVloziTools() {
  const r = await fetch(`${MCP}/tools`, {
    headers: { Authorization: `Bearer ${VLOZI_KEY}` },
  });
  const { data } = await r.json();
  return data.tools.map((t: any) => ({
    type: "function" as const,
    function: {
      name: t.name.replace(".", "_"),
      description: t.description,
      parameters: t.inputSchema,
    },
  }));
}
 
async function callVloziTool(name: string, args: Record<string, unknown>) {
  const r = await fetch(`${MCP}/tools/${name.replace("_", ".")}`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${VLOZI_KEY}`,
      "content-type": "application/json",
      "x-agent-id": "my-gpt-agent",
    },
    body: JSON.stringify(args),
  });
  return r.json();
}
 
async function runAgent(prompt: string) {
  const tools = await listVloziTools();
  const messages: OpenAI.Chat.ChatCompletionMessageParam[] = [
    { role: "user", content: prompt },
  ];
 
  while (true) {
    const res = await openai.chat.completions.create({
      model: "gpt-4o",
      messages,
      tools,
    });
 
    const msg = res.choices[0].message;
    if (!msg.tool_calls) {
      return msg.content;
    }
 
    messages.push(msg);
    for (const call of msg.tool_calls) {
      const args = JSON.parse(call.function.arguments);
      const result = await callVloziTool(call.function.name, args);
      messages.push({
        role: "tool",
        tool_call_id: call.id,
        content: JSON.stringify(result),
      });
    }
  }
}

Custom GPT (no-code)

You can attach Vlozi to a Custom GPT in ChatGPT without writing any code:

  1. In My GPTs → Configure, scroll to Actions
  2. Click Create new action
  3. Paste the OpenAPI schema below
openapi: 3.1.0
info:
  title: Vlozi MCP
  version: "1.0"
servers:
  - url: https://mcp.vlozi.app
paths:
  /tools:
    get:
      operationId: listTools
      summary: List available Vlozi tools
      responses:
        "200":
          description: OK
  /tools/{name}:
    post:
      operationId: callTool
      summary: Call a Vlozi tool by name
      parameters:
        - name: name
          in: path
          required: true
          schema: { type: string }
      requestBody:
        content:
          application/json:
            schema: { type: object }
      responses:
        "200":
          description: OK
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
security:
  - bearerAuth: []
  1. Set Authentication → API Key → Bearer, paste your ls_xxx key
  2. In the GPT's instructions, tell it: "You can call Vlozi tools via /tools/. Always call /tools first to see what's available before answering content questions."

Tips

  • Don't enable strict mode (strict: true on function definitions) — OpenAI's strict mode requires every property to be in required, but our schemas mark many fields optional.
  • Name mapping: OpenAI allows . in tool names, but mapping blog.list_postsblog_list_posts is safer if you target both Claude and GPT.
  • Token cost: Each tool definition is ~80–200 tokens. Pass only relevant ones per turn.
MCP · Connect your agentEdit on GitHub