OpenAI SDK Compatible · LAN & WSS Bridge

Connect Apps, IDEs & Bots to Pandux AI

Turn your Android device into an OpenAI-compatible inference endpoint. Use the Local Network Server on your Wi-Fi LAN or the Pocket Inference Node over an encrypted WebSocket tunnel.

1. Local Network Server (OpenAI-Compatible LAN API)

Enable Local Network Server inside Pandux AI to bind an HTTP server on your local Wi-Fi interface (default port 8080). Standard OpenAI endpoints are exposed:

  • GET /v1/models — Lists the currently loaded GGUF model.
  • POST /v1/chat/completions — Chat completions (supports stream: true).
  • POST /v1/completions — Raw text completions.
curl http://192.168.1.42:8080/v1/chat/completions \
  -H "Authorization: Bearer YOUR_LOCAL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "local-gguf",
    "messages": [{"role": "user", "content": "Explain zero-custody AI in 2 sentences."}],
    "stream": false
  }'

2. Pocket Inference Node (Cloud API Bridge — WSS)

When your client is outside your home Wi-Fi, enable Pocket Inference Node. Your phone opens an outbound encrypted WSS connection to the Pandux Relay using a scoped node key (pdx_node_...). Prompts and tokens pass end-to-end without being logged on relay servers.

  • Base URL: https://api.pandux.ai/v1
  • Auth Header: Authorization: Bearer pdx_node_...
  • Compatible with Cursor, Continue.dev, LangChain, and OpenAI SDKs.

3. Hardware Guardrail Error Codes

To protect your phone's battery and thermal envelope, Pandux AI enforces automatic hardware guardrails and returns standard HTTP status codes:

HTTP StatusConditionRecommended Client Action
401 UnauthorizedMissing or invalid Bearer / pdx_node_ keyVerify token in Pandux AI Server settings
408 Request TimeoutInference exceeded mobile timeout windowReduce max_tokens or prompt length
429 Too Many RequestsConcurrent request limit reached (mobile GPU/CPU busy)Retry with exponential backoff
503 Service UnavailableThermal throttling, low battery, or node offlineWait for device cooldown or reconnect node

4. Self-Hosted Relay Quickstarts (Node.js & Python)

Point any official OpenAI SDK at your LAN IP or Pocket Node URL:

Node.js (OpenAI SDK)

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "http://192.168.1.42:8080/v1",
  apiKey: process.env.PANDUX_TOKEN,
});

const res = await client.chat.completions.create({
  model: "local-gguf",
  messages: [{ role: "user", content: "Hello from Node.js!" }],
});
console.log(res.choices[0].message.content);

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="http://192.168.1.42:8080/v1",
    api_key="YOUR_LOCAL_TOKEN",
)

resp = client.chat.completions.create(
    model="local-gguf",
    messages=[{"role": "user", "content": "Hello from Python!"}],
)
print(resp.choices[0].message.content)

5. Security, Prompt Hygiene & Real Mobile Capacity

  • Keep Tokens Private: Never commit pdx_node_... keys to public repositories. Rotate keys immediately in-app if exposed.
  • Context Window & RAM: Mobile devices typically perform best with 4-bit quantized 1.5B–7B GGUF models and context windows of 2048–4096 tokens.
  • Privacy & Safety: All local server traffic is governed by the Pandux AI Privacy Policy and Terms of Service.