API Reference | MoogleTechnology
Moogle AI Gateway • Public API • v2

API Reference

A single, stable API that powers MoogleTechnology apps — chat, translation, math, search, OCR, speech, and document extraction.

Base URL & Authentication

All requests use the same base URL and a Bearer token in the Authorization header.

Base URL
https://ai.moogletechnology.com
Auth Header
Authorization: Bearer YOUR_TOKEN
Minimal cURL
curl https://ai.moogletechnology.com/health \
  -H "Authorization: Bearer $MOOGLE_TOKEN"

Chat Completions

POST /v1/chat/completions

Generate responses from your configured provider (local, cloud, or hybrid). This is the primary endpoint used across Moogle apps. :contentReference[oaicite:0]{index=0}

Request Body

Parameter Type Notes
model string Recommended (example: "moogle-1")
messages array Chat history objects: { role, content }
temperature number Optional (default varies by server config)
cURL Example
curl https://ai.moogletechnology.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -d '{
    "model": "moogle-1",
    "messages": [
      {"role": "user", "content": "Write a 1-sentence product tagline for a PDF editor."}
    ]
  }'

Translate

POST /v1/translate

Translate text into a target language using the gateway’s configured translate mode. :contentReference[oaicite:1]{index=1}

cURL Example
curl https://ai.moogletechnology.com/v1/translate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -d '{
    "text": "Good morning. How are you?",
    "to": "fr"
  }'

Math Solve

POST /v1/math/solve

Solve math or structured logic tasks via the gateway’s math mode. :contentReference[oaicite:2]{index=2}

cURL Example
curl https://ai.moogletechnology.com/v1/math/solve \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -d '{
    "question": "Simplify: (3/4) + (2/3). Show steps."
  }'

Search

POST /v1/search

Retrieve grounded results (URLs + snippets) for a query. Accepts q (or query) and optional result count. :contentReference[oaicite:3]{index=3}

cURL Example
curl https://ai.moogletechnology.com/v1/search \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -d '{
    "q": "best offline pdf editor features",
    "num": 5
  }'

Vision OCR

POST /v1/vision/ocr

OCR for images using the configured local vision model pathway. :contentReference[oaicite:4]{index=4}

cURL Example
curl https://ai.moogletechnology.com/v1/vision/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -d '{
    "image_base64": ""
  }'

Audio Transcriptions

POST /v1/audio/transcriptions

Upload an audio file as multipart form-data field file. Returns { "text": "..." }. :contentReference[oaicite:5]{index=5}

cURL Example (multipart upload)
curl https://ai.moogletechnology.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -F "file=@sample.wav"

Text-to-Speech

POST /v1/audio/speech

Generate speech audio from text. This gateway supports format=wav and accepts input (or text). :contentReference[oaicite:6]{index=6}

cURL Example (returns audio/wav)
curl https://ai.moogletechnology.com/v1/audio/speech \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -d '{
    "input": "Welcome to MoogleTechnology.",
    "format": "wav"
  }' --output speech.wav

PDF Text Extraction

POST /v1/pdf/extract

Upload a PDF as multipart form-data field file. Returns { "text": "..." }. :contentReference[oaicite:7]{index=7}

cURL Example (multipart upload)
curl https://ai.moogletechnology.com/v1/pdf/extract \
  -H "Authorization: Bearer $MOOGLE_TOKEN" \
  -F "file=@document.pdf"

Models

GET /v1/models

List available models exposed through the gateway (varies by deployment). :contentReference[oaicite:8]{index=8}

cURL Example
curl https://ai.moogletechnology.com/v1/models \
  -H "Authorization: Bearer $MOOGLE_TOKEN"

Health

GET /health

Basic service health endpoint. :contentReference[oaicite:9]{index=9}

cURL Example
curl https://ai.moogletechnology.com/health \
  -H "Authorization: Bearer $MOOGLE_TOKEN"

Word Relations

GET /v1/words/related

Lightweight word suggestions. Query params: term (required) and limit (optional). :contentReference[oaicite:10]{index=10}

cURL Example
curl "https://ai.moogletechnology.com/v1/words/related?term=focus&limit=12" \
  -H "Authorization: Bearer $MOOGLE_TOKEN"

Error Handling

The gateway uses standard HTTP status codes and returns errors as JSON: { error: { message } }.

401

Unauthorized

Missing or invalid Bearer token.

429

Rate Limited

Too many requests. Slow down and retry.

500/502

Server / Upstream Error

Gateway error or provider unavailable.