VCMP BROWSER API
Complete Wiki & Endpoint Reference

Browser handles itself — no port forwarding required for all "LOCAL" APIs.
Every endpoint below is shown with a working request/response example you can paste into a VC:MP script.

Table of Contents

1. APIs Proxied by Browser NO PORT FORWARD

The browser process listens on these localhost ports and injects the API key itself. Your script only sends a plain HTTP request to 127.0.0.1:<port> — no key, no external host.

1.1 Groq ChatGPT Proxy LOCAL

Hostlocalhost
Port3300
MethodPOST
Path/openai/v1/chat/completions
Upstreamapi.groq.com (key injected by browser)

Example — raw HTTP request

POST /openai/v1/chat/completions HTTP/1.1
Host: localhost:3300
Content-Type: application/json
Content-Length: 142
Connection: close

{
  "model": "llama-3.3-70b-versatile",
  "messages": [
    { "role": "system", "content": "You are a friendly VCMP NPC." },
    { "role": "user",   "content": "Where is the nearest car?" }
  ]
}

Example — Squirrel usage

Socket = NewSocket("Chat_OnResponse");
Socket.SetNewConnFunc("connEstablished");
Socket.SetLostConnFunc("connClosed");
Socket.Connect("localhost", 3300);

function connEstablished() {
    local body = "{ \"model\": \"llama-3.3-70b-versatile\", " +
                 "\"messages\": [ { \"role\": \"user\", \"content\": \"Hello NPC\" } ] }";
    Socket.Send("POST /openai/v1/chat/completions HTTP/1.1\r\n" +
                "Host: localhost:3300\r\n" +
                "Content-Type: application/json\r\n" +
                "Content-Length: " + body.len() + "\r\n" +
                "Connection: close\r\n\r\n" + body);
}
function connClosed() { if (Socket != null) Socket.Delete(); }

Example — expected response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "choices": [
    { "message": { "role": "assistant", "content": "The nearest car is a blue Stallion 30m away." },
      "finish_reason": "stop" }
  ]
}

Parsing

local jsonStart = data.find("\r\n\r\n") + 4;
local jsonData  = data.slice(jsonStart);
local s = jsonData.find("\"content\":\"") + 11;
local e = jsonData.find("\"},\"logprobs\":null,\"finish_reason\":\"stop\"", s);
local reply = jsonData.slice(s, e);
The browser injects the Authorization: Bearer … header. You do not need to send it. Keep the response compact (no pretty‑printing) or the manual slicer above will miss the end marker.

1.2 Weather Proxy LOCAL

Hostlocalhost
Port3800
MethodGET
Path/weather?place=<URL-encoded place>
Upstreamweatherapi-com.p.rapidapi.com

Example — raw HTTP request

GET /weather?place=London HTTP/1.1
Host: localhost:3800
Connection: close

Example — Squirrel usage

Socket = NewSocket("Weather_OnResponse");
Socket.SetNewConnFunc("connEstablished");
Socket.SetLostConnFunc("connClosed");
Socket.Connect("localhost", 3800);

function connEstablished() {
    local place = "London";
    local encoded = SearchAndReplace(place, " ", "%20");
    Socket.Send("GET /weather?place=" + encoded + " HTTP/1.1\r\n" +
                "Host: localhost:3800\r\n" +
                "Connection: close\r\n\r\n");
}
function connClosed() { if (Socket != null) Socket.Delete(); }

Example — expected response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "location": "London",
  "temperature": 12,
  "condition": "Partly cloudy",
  "humidity": 78,
  "wind_speed": 15,
  "feels_like": 10
}

Parsing

local s = jsonData.find("\"temperature\":") + 15;
local e = jsonData.find(",", s);
local temperature = jsonData.slice(s, e);
The flat shape above is required by the manual slicer. If the proxy returns a nested current object, adjust the offsets.

1.3 Profanity Filter Proxy LOCAL

Hostlocalhost
Port3700
MethodGET
Path/v1/profanityfilter?text=<URL-encoded text>
Upstreamapi.api-ninjas.com

Example — raw HTTP request

GET /v1/profanityfilter?text=you%20idiot HTTP/1.1
Host: localhost:3700
Connection: close

Example — Squirrel usage

Socket = NewSocket("Profanity_OnResponse");
Socket.SetNewConnFunc("connEstablished");
Socket.SetLostConnFunc("connClosed");
Socket.Connect("localhost", 3700);

function connEstablished() {
    local text = "you idiot";
    local encoded = URLEncode(text);
    Socket.Send("GET /v1/profanityfilter?text=" + encoded + " HTTP/1.1\r\n" +
                "Host: localhost:3700\r\n" +
                "Connection: close\r\n\r\n");
}
function connClosed() { if (Socket != null) Socket.Delete(); }

Example — expected response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "original": "you idiot",
  "censored": "you *****",
  "has_profanity": true
}

Parsing

local s = jsonData.find("\"has_profanity\":") + 17;
local e = jsonData.find(",", s);
if (e == null) e = jsonData.find("}", s);
local hasProfanity = jsonData.slice(s, e);   // "true" / "false"
Side‑effect: when has_profanity == true the example kicks the player with akicki <name>. Make sure that command exists on your server, otherwise the kick fails silently.

1.4 NPC Vision / Image Description LOCAL

Hostlocalhost
Port3330
MethodGET
Path/getImageDescription?model=<model>&apiKey=<key>
UpstreamGroq vision model

Example — raw HTTP request

GET /getImageDescription?model=llama-3.2-90b-vision-preview&apiKey=YOUR_KEY HTTP/1.1
Host: localhost:3330
Connection: close

Example — Squirrel usage

// Step 1 — take the screenshot first
SendCommand("npcss");

// Step 2 — ask the vision proxy
Socket = NewSocket("ImageDescription_OnResponse");
Socket.SetNewConnFunc("connEstablished");
Socket.SetLostConnFunc("connClosed");
Socket.Connect("localhost", 3330);

function connEstablished() {
    local model = "llama-3.2-90b-vision-preview";
    local key   = "YOUR_KEY";
    Socket.Send("GET /getImageDescription?model=" + model + "&apiKey=" + key + " HTTP/1.1\r\n" +
                "Host: localhost:3330\r\n" +
                "Connection: close\r\n\r\n");
}
function connClosed() { if (Socket != null) Socket.Delete(); }

Example — expected response

HTTP/1.1 200 OK
Content-Type: application/json

{ "description": "A player stands near a blue car on the sidewalk." }

Parsing

local s = jsonData.find("\"description\":") + 15;
local e = jsonData.find("\"", s);
local description = jsonData.slice(s, e);
The npcss command must run before this request. If it is missing, the proxy will describe a stale or blank frame.

1.5 Translation Proxy LOCAL

Hostlocalhost
Port4500
MethodPOST
Path/api/v1/translator/html
Upstreamgoogle-translate113.p.rapidapi.com

Example — raw HTTP request

POST /api/v1/translator/html HTTP/1.1
Host: localhost:4500
Content-Type: application/json
Content-Length: 64
Connection: close

{ "text": "Hello world", "source": "en", "target": "ur" }

Example — expected response

HTTP/1.1 200 OK
Content-Type: application/json

{ "translated": "ہیلو ورلڈ" }

1.6 Discord Proxy LOCAL

Hostlocalhost
Port3310
MethodsPOST /sendDiscordMessage
POST /receiveDiscordMessage

Example — send a message to Discord

POST /sendDiscordMessage HTTP/1.1
Host: localhost:3310
Content-Type: application/json
Content-Length: 62
Connection: close

{ "discord_app_message": "PlayerOne: Hello, Discord!" }

Example — Squirrel usage

Socket = NewSocket("Discord_OnResponse");
Socket.SetNewConnFunc("connEstablished");
Socket.SetLostConnFunc("connClosed");
Socket.Connect("localhost", 3310);

function connEstablished() {
    local body = "{ \"discord_app_message\": \"" + player.Name + ": " + text + "\" }";
    Socket.Send("POST /sendDiscordMessage HTTP/1.1\r\n" +
                "Host: localhost:3310\r\n" +
                "Content-Type: application/json\r\n" +
                "Content-Length: " + body.len() + "\r\n" +
                "Connection: close\r\n\r\n" + body);
}
function connClosed() { if (Socket != null) Socket.Delete(); }

1.7 OneSignal Push Notification LOCAL

Hostlocalhost
Port3309
MethodPOST
Path/sendNotification

Example — payload

POST /sendNotification HTTP/1.1
Host: localhost:3309
Content-Type: application/json
Content-Length: 412
Connection: close

{
  "appId": "your-app-id",
  "restKey": "your-rest-key",
  "playerName": "Megamind",
  "avatarUrl": "https://example.com/avatar.png",
  "randomImageUrl": "https://example.com/random.png",
  "latestPostLink": "https://example.com/news",
  "title": "Server Event",
  "message": "A new event started!",
  "androidChannelId": "your-channel-id"
}

1.8 Open URL Proxy LOCAL

Hostlocalhost
Port1111
MethodGET
Path/?url=<encodedUrl>&playerid=<id>&playerip=<ip>

Example — raw HTTP request

GET /?url=https%3A%2F%2Fexample.com&playerid=3&playerip=127.0.0.1 HTTP/1.1
Host: localhost:1111
Connection: close

Example — Squirrel usage

function openurl(url, playerid, playerip) {
    local encodedUrl = URLEncode(url);
    local requestUrl = "/?url=" + encodedUrl + "&playerid=" + playerid + "&playerip=" + playerip;
    Socket = NewSocket("OpenURL_OnResponse");
    Socket.SetNewConnFunc("connEstablished");
    Socket.SetLostConnFunc("connClosed");
    Socket.Connect("localhost", 1111);

    function connEstablished() {
        Socket.Send("GET " + requestUrl + " HTTP/1.1\r\n" +
                    "Host: localhost:1111\r\n" +
                    "Connection: close\r\n\r\n");
    }
    function connClosed() { if (Socket != null) Socket.Delete(); }
}

1.9 VoIP Bridge LOCAL

Host127.0.0.1
Port1112
MethodGET
Path/voip?action=<call|accept|reject|hangup>&fromId=&fromName=&toId=&toName=

Example — raw HTTP request

GET /voip?action=call&fromId=3&fromName=Khattak&toId=7&toName=Megamind HTTP/1.1
Host: localhost
Connection: close

Example — Squirrel usage

function VoIP_Request(action, fromId, fromName, toId, toName) {
    local url = "/voip?action=" + action +
                "&fromId="   + fromId +
                "&fromName=" + VoIP_UrlEncode(fromName) +
                "&toId="     + toId +
                "&toName="   + VoIP_UrlEncode(toName);

    Socket = NewSocket("VoIP_OnResponse");
    Socket.SetNewConnFunc("connEstablished");
    Socket.SetLostConnFunc("connClosed");
    Socket.Connect("127.0.0.1", 1112);

    function connEstablished() {
        Socket.Send("GET " + url + " HTTP/1.1\r\n" +
                    "Host: localhost\r\n" +
                    "Connection: close\r\n\r\n");
    }
    function connClosed() { if (Socket != null) Socket.Delete(); }
}

Example — command wiring

// /call <player>
VoIP_Request("call", player.ID, player.Name, target.ID, target.Name);

// /accept call
VoIP_Request("accept", player.ID, player.Name, -1, "");

// /reject call
VoIP_Request("reject", player.ID, player.Name, -1, "");

// /hangup
VoIP_Request("hangup", player.ID, player.Name, -1, "");
Names are percent‑encoded with VoIP_UrlEncode(), which keeps a‑z A‑Z 0‑9 - _ . ~ and percent‑encodes everything else (space, [ ] | " < >). This bridge is local. The actual voice traffic goes through the ports documented in §2.1.

1.10 Browser Web UIs LOCAL

ServiceURLExample
Player listhttp://localhost:8080http://localhost:8080
Masterlisthttp://localhost:3000http://localhost:3000
VCMP Storehttp://localhost:8000http://localhost:8000

2. APIs Requiring Port Forward FORWARD

These are served by your own host and must be reachable from players' clients / the public internet.

2.1 VoIP Voice Server — Ports 90 & 27016 FORWARD

Hostyour‑public‑ip
Ports90
Ports27016
ProtocolTCP + UDP (both ports)
PurposeCarry the actual voice stream between players. Without these two ports forwarded, the :1112 bridge can set up a call but no audio will flow when players host their own server.

Router / firewall rule (example)

# Forward BOTH ports, BOTH protocols, to the server host
TCP  90    →  192.168.1.50:90
UDP  90    →  192.168.1.50:90
TCP  27016 →  192.168.1.50:27016
UDP  27016 →  192.168.1.50:27016

# Windows Firewall
netsh advfirewall firewall add rule name="VCMP VoIP TCP" dir=in action=allow protocol=TCP localport=90,27016
netsh advfirewall firewall add rule name="VCMP VoIP UDP" dir=in action=allow protocol=UDP localport=90,27016
The 1112 bridge only handles call setup (ring, accept, reject, hangup). Once a call is accepted, the two players' clients exchange audio directly over 90 and 27016. If either port is closed, the call "connects" but is silent.
Hosting your own server? Every server owner who wants working VoIP must forward 90 and 27016 (TCP + UDP) on their router. If they only forward the game port, the bridge on :1112 still works locally but no audio will reach the other player.

2.2 F10 Camera HTTP API FORWARD

Port3308
PurposeCapture player‑perspective screenshots for AI vision (feeds :3330)

Example — trigger a screenshot from the client

// client-side keybind (F10)
local url = "http://your-public-ip:3308/screenshot";
// HTTP GET → server saves frame → :3330 can now describe it

2.3 Voice Relay Server (TTS / PTT) FORWARD

Hostyour‑public‑ip
Port2301
MethodGET
Path/text-to-wav?text=<text>

Example — raw HTTP request

GET /text-to-wav?text=Hello%20player HTTP/1.1
Host: your-public-ip:2301
Connection: close

Example — Squirrel usage (AI voice reply)

function getTextToWav(text, player) {
    local encoded = URLEncode(text);
    Socket = NewSocket("TTS_OnResponse");
    Socket.SetNewConnFunc("connEstablished");
    Socket.SetLostConnFunc("connClosed");
    Socket.Connect("your-public-ip", 2301);

    function connEstablished() {
        Socket.Send("GET /text-to-wav?text=" + encoded + " HTTP/1.1\r\n" +
                    "Host: your-public-ip:2301\r\n" +
                    "Connection: close\r\n\r\n");
    }
    function connClosed() { if (Socket != null) Socket.Delete(); }
}

2.4 YouTube Music API FORWARD

Hostyour‑public‑ip
Port7777
MethodGET
Path/song?query=<query>

Example — raw HTTP request

GET /song?query=never%20gonna%20give%20you%20up HTTP/1.1
Host: your-public-ip:7777
Connection: close

Example — expected response

HTTP/1.1 200 OK
Content-Type: application/json

{ "title": "Never Gonna Give You Up", "url": "https://…/audio.mp3" }

3. Reserved Ports BROWSER

8080  player list UI
4500  translation proxy
3000  masterlist UI
8000  VCMP store UI
3300  groq / chatgpt proxy
3700  profanity proxy
3800  weather proxy
3330  npc vision
3309  onesignal push
3310  discord proxy
1111  openurl proxy
1112  voip bridge (call setup)

--- port-forward required ---
90    voip voice control   (TCP + UDP)
27016 voip voice media     (TCP + UDP)
2301  voice relay (TTS / PTT)
7777  music api
3308  f10 camera

4. Usage Method & Required Plugins

Required VC:MP plugins (64‑bit)

sockets04rel64
json04rel64
httprequest04rel64

Generic pattern used by every endpoint

Socket = NewSocket("My_OnResponse");
Socket.SetNewConnFunc("connEstablished");
Socket.SetLostConnFunc("connClosed");
Socket.Connect("localhost", PORT);

function connEstablished() {
    Socket.Send("GET /path HTTP/1.1\r\n" +
                "Host: localhost:PORT\r\n" +
                "Connection: close\r\n\r\n");
}
function connClosed() { if (Socket != null) Socket.Delete(); }

function My_OnResponse(data) {
    if (data.find("HTTP/1.1 200 OK") == null) return;
    local jsonStart = data.find("\r\n\r\n") + 4;
    local jsonData  = data.slice(jsonStart);
    // slice the fields you need…
}
References:
• https://forum.vc-mp.org/?topic=7522.0
• https://forum.vc-mp.org/index.php?msg=49282

5. Quick Endpoint Matrix

PortMethodEndpointPurposeForward?
3300POST/openai/v1/chat/completionsAI chatNo
3800GET/weather?place=WeatherNo
3700GET/v1/profanityfilter?text=ProfanityNo
3330GET/getImageDescriptionNPC visionNo
4500POST/api/v1/translator/htmlTranslateNo
3310POST/sendDiscordMessageDiscord sendNo
3310POST/receiveDiscordMessageDiscord recvNo
3309POST/sendNotificationPushNo
1111GET/?url=&playerid=&playerip=Open URLNo
1112GET/voip?action=…VoIP call setupNo
8080GET/Player list UINo
3000GET/Masterlist UINo
8000GET/Store UINo
90TCP+UDPvoice controlVoIP voiceYes
27016TCP+UDPvoice mediaVoIP voiceYes
3308GET/screenshotF10 cameraYes
2301GET/text-to-wav?text=TTS / PTTYes
7777GET/song?query=YouTube musicYes

Security & Reliability Notes

Keys: never commit real API keys inside client‑side scripts. The browser proxy is the only place a key should live. If a key was pasted into a .nut file, rotate it.
VoIP hosting: the 1112 bridge is local and needs no forward, but the actual voice stream uses 90 and 27016 (TCP + UDP). Server owners who want VoIP on their own machine must forward both ports or calls will connect silently.
Unique callback names: every socket should use a distinct pair of connEstablished / connClosed names (or namespace them per module). Re‑declaring the same names in multiple blocks silently overwrites the earlier ones.
Owner check: compare names case‑insensitively (playerName.tolower()) so khattaks, Khattaks, and KHATTAKS all match.

VCMP Browser API Wiki — generated for Megamind's VC:MP setup.