# Gudang.Ai — Enterprise Multimodal AI API Gateway & Hosted MCP Server > Unified OpenAI, Anthropic, and Multimodal AI Gateway across 805+ verified AI models with exact NUMERIC(20,8) USD financial precision (36-digit Decimal.js accounting, 2-phase row-locked wallet reservations, FinOps budget guardrails, and 100% automatic rollback on error). ## Base URLs - **OpenAI & Multimodal REST Base URL**: `https://gudang.ai/v1` - **Anthropic Messages Native Root URL**: `https://gudang.ai` *(SDKs append `/v1/messages` automatically; full endpoint: `https://gudang.ai/v1/messages`)* - **Hosted MCP Server (Authenticated, All 9 Tools)**: `https://gudang.ai/mcp` - **Hosted MCP Server (Public Read-Only, Keyless, 3 Free Tools)**: `https://gudang.ai/mcp/public` ## Authentication Headers Pass your `gdai-sk-...` secret API key using any of the following standard headers: - `Authorization: Bearer gdai-sk-YOUR_API_KEY` - `Authorization:Bearer gdai-sk-YOUR_API_KEY` *(no-space header supported on `/mcp` for Windows `mcp-remote`)* - `x-api-key: gdai-sk-YOUR_API_KEY` - `api-key: gdai-sk-YOUR_API_KEY` ## Complete `/v1/*` REST Gateway Endpoints 1. `GET /v1/models` — List all 805+ active verified AI models with live 8-decimal USD selling rates (supports optional `?category=...&q=...` filters). 2. `GET /v1/models/:modelId` — Retrieve full public specifications, context limits, modalities, supported endpoints, and exact USD pricing for a single model. 3. `POST /v1/chat/completions` — OpenAI-compatible chat, vision (`image_url`), structured tool/function calling, JSON mode, reasoning, and real-time SSE streaming (`stream: true`) up to `65,536` output tokens. 4. `POST /v1/messages` — Native Anthropic Messages API (Claude Code CLI & `@anthropic-ai/sdk` ready, including `cache_control` prompt caching up to -90% on cache reads). 5. `POST /v1/responses` — Native OpenAI Responses API (`instructions`, `input`, and `reasoning.effort` schema; OpenAI Codex CLI `wire_api = "responses"` ready). 6. `POST /v1/images/generations` & `POST /v1/images/edits` — Text-to-image synthesis and reference-guided image editing (`prompt`, `size`, `n`, optional `image_url`). 7. `POST /v1/video/generations`, `POST /v1/videos`, `GET /v1/videos/:id`, & `GET /v1/videos/:id/content` — Text-to-video & image-to-video synthesis (`prompt`, `duration` / `seconds`, `resolution`: `720p` | `1080p` | `1440p` | `2160p`/`4K`, `aspect_ratio`, optional `image_url`), plus authenticated OpenAI Video API job status inspection (`GET /v1/videos/:id`) and zero-disk binary video stream pass-through (`GET /v1/videos/:id/content`). Asynchronous render jobs on `POST` are also auto-polled server-side up to 180s until a playable MP4 Media Vault URL is ready. 8. `POST /v1/music/generations` — Full-track stereo AI music & instrumental composition (`prompt`, optional `duration`). 9. `POST /v1/audio/speech` — Neural text-to-speech (TTS) audio synthesis (`input` / `prompt`, `voice`; returns JSON receipt with `audio_url` / `data[0].url` and `gudangai_billing`). 10. `POST /v1/audio/transcriptions` — Speech-to-text (STT) Whisper audio transcription (`duration_seconds` / audio input). 11. `POST /v1/3d/generations` — Game-ready textured 3D mesh (`.glb`) generation (`prompt`, optional `image_url`). 12. `POST /v1/answers` — Grounded AI web/knowledge search & multimodal vision Q&A (`prompt`, optional `image_url`). 13. `POST /v1/embeddings` — High-dimensional float vector embeddings (`input` string or array) for PostgreSQL `pgvector`, Pinecone, or Qdrant RAG pipelines. 14. `GET /v1/media/file/:token/:filename` — AES-256-GCM encrypted Zero-Disk Media Vault pass-through streaming (0 MB gateway disk retention, HTTP `Range` scrubbing, `?download=1` attachment download, 24–72h retention window -> clean `410 Gone` on expiry). ## Hosted MCP Server (Streamable HTTP JSON-RPC 2.0, Protocol `2025-03-26`) `initialize`, `ping`, and `tools/list` work unauthenticated on both `/mcp` (returns all 9 tools) and `/mcp/public` (returns 3 free discovery tools). JSON-RPC batch arrays (up to 50 items) are also supported. ### Free Read-Only MCP Tools (`$0.00000000`, Keyless on `/mcp` and `/mcp/public`) 1. `list_models({ category?, provider?, search?, limit? })` — Search active verified models (default `limit: 20`, max `50`) with live 8-decimal USD rates. 2. `get_model({ model_id })` — Inspect model context window, capabilities, modalities, supported `/v1/*` endpoints, exact USD pricing, and ready-to-run `example_request` (also accepts `model` / `id` alias). 3. `quote_cost({ model_id, prompt_tokens?, completion_tokens?, cached_tokens?, media_units? })` — Exact 36-digit Decimal.js dry-run cost simulation quantized to `NUMERIC(20,8)` USD before spending funds (also accepts `model`, `input_tokens`, `output_tokens` aliases). ### Authenticated Execution & Wallet MCP Tools (`Authorization: Bearer gdai-sk-...` on `/mcp`) 4. `get_balance({})` — Free (`$0.00000000`) live `NUMERIC(20,8)` USD wallet `balance_usd`, `reserved_usd`, `key_quota_limit_usd`, `key_quota_used_usd`, `key_quota_reserved_usd`, and `key_rpm_limit`. 5. `chat_completion({ prompt, model?, system?, temperature?, max_tokens?, max_cost_usd? })` — Execute LLM chat/reasoning via `/v1/chat/completions`. 6. `generate_image({ prompt, model?, size?, n?, max_cost_usd? })` — Generate AI images via `/v1/images/generations`. 7. `generate_video({ prompt, model?, duration?, resolution?, aspect_ratio?, image_url?, max_cost_usd? })` — Render HD/4K AI video clips via `/v1/video/generations`. 8. `generate_audio({ prompt, mode?: "music" | "speech", model?, voice?, duration?, max_cost_usd? })` — Generate stereo AI music (`mode: "music"`) or neural speech (`mode: "speech"`). 9. `generate_3d({ prompt?, image_url?, model?, max_cost_usd? })` — Generate 3D `.glb` mesh assets via `/v1/3d/generations`. > **Per-Call MCP Budget Guardrail**: Tools 5–9 accept `max_cost_usd`. If the pre-quoted Decimal.js cost exceeds `max_cost_usd`, the call aborts cleanly with `code: "max_cost_exceeded"` before reserving wallet funds (`$0.00000000` charged). ## Key Governance, Rotation, FinOps Guardrails & Calculator APIs (`/api/*`) - **Public Free Cost Calculator**: `POST /api/calculate-cost` (alias `POST /api/calculate`) with `{ model_id, prompt_tokens?, completion_tokens?, cached_read_tokens?, cached_write_tokens?, media_units? }` -> returns exact `total_cost_usd` and `calculation_formula` for `$0.00`. - **Scoped API Key Management** (Developer Console session auth): - `GET /api/keys` & `POST /api/keys` — Create keys scoped with `allowed_models` (via the Console **Visual AI Model Picker** or `["*"]`), `quota_limit_usd`, and `rate_limit_rpm` (`10–5,000 RPM`, default `120`). - `PATCH /api/keys/:id` — Update `name`, `quota_limit_usd`, `reset_quota_used`, `rate_limit_rpm`, `is_active` (pause/resume key without deleting), or `allowed_models` anytime. - `POST /api/keys/:id/rotate` — Atomically rotate a compromised `gdai-sk-...` secret in 1 click (old key invalidated immediately; key policies preserved). - `DELETE /api/keys/:id` — Permanently revoke an API key. - **Account FinOps Budget Guardrails**: - `GET /api/account/guardrails` & `PUT /api/account/guardrails` — Configure `max_single_request_usd`, UTC `daily_spend_cap_usd`, UTC `monthly_spend_cap_usd`, `low_balance_alert_usd`, and `routing_mode` (`balanced` | `latency` | `cost`). - **Active Device Session Governance**: - `GET /api/account/sessions`, `DELETE /api/account/sessions/others`, `DELETE /api/account/sessions/:sessionRef` — Inspect SHA-256 session references and revoke other logged-in devices. ## Popular Verified Model IDs - **Chat, Coding & Reasoning**: `openai/gpt-5.4-pro`, `claude-sonnet-4-6`, `deepseek-v4.1-flash`, `qwen/qwen3-coder-next`, `google/gemma-3-4b-it` - **Image Synthesis**: `black-forest-labs/flux.2-flex`, `black-forest-labs/flux-schnell`, `gpt-image-2`, `nano-banana-pro` - **HD & 4K Video**: `veo-3.1-lite`, `sora-2`, `kling-3.0-turbo`, `bytedance/seedance-2-0-text-to-video`, `doubao-seedance-2.0` - **Music & Voice (TTS/STT)**: `google-deepmind/lyria-3-pro`, `canopy-labs/tts-orpheus`, `venice/whisper-large-v3` - **3D, Grounded Search & Embeddings**: `tencent/hunyuan3d-3-1-image-to-3d-rapid`, `allenai/molmo-2-image-qa`, `openai/text-embedding-3-small` ## Exact `NUMERIC(20,8)` Headers, Sandbox Simulation & Error Codes Every settled `/v1/*` response includes deterministic 8-decimal USD audit headers and a `gudangai_billing` JSON receipt: - `x-gudangai-request-id`: Immutable ledger/usage correlation ID (`req_...`) - `x-gudangai-cost-usd`: Exact settled USD charge (e.g. `0.00014250`) - `x-gudangai-balance-usd`: Updated spendable wallet balance in USD after settlement - `x-gudangai-simulate: true`: Optional request header enabling deterministic synthetic sandbox execution for integration testing - `gudangai_billing`: `{ request_id, cost_usd, input_cost_usd, output_cost_usd, cache_cost_usd, unit_cost_usd, formula, balance_before_usd, balance_after_usd }` ### Deterministic HTTP Error Statuses & Codes (`$0.00000000` Charged on All Errors) - `400`: Malformed JSON or invalid parameters (`invalid_json`, `missing_messages`, `invalid_max_tokens`, `invalid_n_parameter`, `unsafe_image_url`). - `401`: Missing, invalid, revoked, paused, or rotated `gdai-sk-...` API key (`missing_api_key`, `invalid_api_key`, `api_key_disabled`, `invalid_session`, or JSON-RPC `-32001` on `/mcp`). - `402`: Pre-flight wallet, key quota, or FinOps guardrail block (`insufficient_balance` / `insufficient_quota`, `key_quota_exceeded` / `api_key_quota_exceeded`, `guardrail_single_request_cap`, `guardrail_daily_cap`, `guardrail_monthly_cap`). - `403`: Blocked by key `allowed_models` allowlist (`model_not_allowed` / `model_not_allowed_for_key`), disabled model (`model_disabled`), or suspended account (`account_suspended`). - `404`: Unknown model ID (`model_not_found`) or unmatched endpoint path. - `409`: Cannot reset key quota while in-flight reservations exist (`key_has_inflight_reservations`), or duplicate registration email. - `410`: Expired Zero-Disk Media Vault link after 24–72h privacy window (`media_artifact_expired`). - `413`: Request body exceeds `25mb` gateway payload cap (`payload_too_large`). - `429`: Per-key sliding-window RPM limit (`rate_limit_exceeded`) or IP flood/login protection (`auth_ip_rate_limited`, `api_ip_rate_limited`, `login_rate_limited`) with `Retry-After` header. - `502 / 503 / 504`: Upstream cluster unreachable or timed out — 100% of pre-authorization hold is automatically refunded (`$0.00000000` charged).