Gateway API Reference

Proxy Base URLhttps://nothekx.com/api/v1

Quickstart

/api/v1/* · /v1/*
openai-sdk.ts
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://nothekx.com/api/v1',
  apiKey: process.env.NOETHEKX_KEY,
});

const response = await client.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Summarize status.' }],
});
anthropic-messages.sh
curl -X POST 'https://nothekx.com/api/v1/messages' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: '"$NOETHEKX_KEY" \
  -H 'anthropic-version: 2023-06-01' \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 128,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
gemini-native.sh
curl -X POST 'https://nothekx.com/api/v1/models/gemini-3.8-flash:generateContent' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer '"$NOETHEKX_KEY" \
  -d '{
    "contents": [{"parts": [{"text": "Hello"}]}],
    "generationConfig": {"maxOutputTokens": 64}
  }'

Gateway Response Headers

  • X-Noethekx-Request-Id — Unique request trace identifier (req_...).
  • X-Noethekx-Credential-Mode — Active key source (byok, passthrough, or sandbox).
  • X-Noethekx-Remaining-Daily-Usd — Remaining daily USD allowance after settlement.
  • X-Noethekx-Block-Reason — Exact policy code returned on blocked requests.

Credential Modes

BYOK Vault

AES-256-GCM Encrypted Storage

Store OpenAI, Anthropic, or Gemini keys in Provider Vault. Keys are encrypted with org-scoped AAD and decrypted only inside the request handler.

Zero-Storage Pass-Through

x-upstream-api-key Header

Supply your upstream provider secret via x-upstream-api-key on each request. Noethekx holds the key strictly in request memory and never writes it to Firestore or logs.

passthrough-header.sh
curl -X POST 'https://nothekx.com/api/v1/chat/completions' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer '"$NOETHEKX_KEY" \
  -H 'x-upstream-api-key: '"$UPSTREAM_PROVIDER_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Test pass-through"}]
  }'

Zero-Key Gemini Sandbox

New workspaces can test live gateway routing and spend settlement immediately without connecting an upstream provider key. Requests exceeding sandbox bounds are rejected fail-closed.

Sandbox GuardrailEnforced Limit
Lifetime Workspace Allowance25 requests / $0.10 total spend
Per-Request Output / Inputmax_tokens <= 256 · input <= 4,000 chars
Allowed Sandbox Modelsgemini-3.8-flash, gemini-3.8-flash-lite, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite
IP Rate Limits5 requests / min · 25 requests / day
Response IndicatorsX-Noethekx-Sandbox: true · X-Noethekx-Sandbox-Remaining-Requests

Gateway Error Codes

Blocked responses mirror the active provider error envelope (OpenAI, Anthropic, or Gemini) alongside X-Noethekx-Block-Reason.

HTTPCodeBehavior
401INVALID_API_KEY / KEY_REVOKEDProxy key missing, malformed, or revoked.
402CAP_EXCEEDED / MAX_REQUEST_COST_EXCEEDED / PLAN_VOLUME_EXCEEDEDDaily, monthly, single-request, or plan tracked volume limit reached.
403KILL_SWITCH_ENGAGED / MODEL_NOT_ALLOWEDWorkspace kill switch is active or model is outside key allowlist.
429LOOP_DETECTED / RATE_LIMITEDIdentical-request sliding-window threshold or per-key RPM limit tripped.
503SPEND_GUARD_UNAVAILABLEFail-closed rejection because budget reservation state could not be verified.

Webhook Signature Verification

Outbound alert deliveries sign ${timestamp}.${rawBody} using your endpoint secret and send X-Noethekx-Timestamp plus X-Noethekx-Signature.

verify-webhook.ts
import { createHmac, timingSafeEqual } from 'node:crypto';

export function verifyNoethekxWebhook(params: {
  rawBody: string;
  timestampHeader: string | null;
  signatureHeader: string | null;
  signingSecret: string;
}): boolean {
  const { rawBody, timestampHeader, signatureHeader, signingSecret } = params;
  if (!timestampHeader || !signatureHeader) return false;

  const expectedHex = createHmac('sha256', signingSecret)
    .update(`${timestampHeader}.${rawBody}`, 'utf8')
    .digest('hex');
  const expected = Buffer.from(`v1=${expectedHex}`, 'utf8');
  const provided = Buffer.from(signatureHeader, 'utf8');

  return expected.length === provided.length && timingSafeEqual(expected, provided);
}

Security Model

Noethekx enforces fail-closed budget transactions, HMAC-SHA256 reveal-once proxy key hashing, per-credential AES-256-GCM authenticated encryption, and DNS-rebinding SSRF protection on all outbound webhook deliveries. Client-side direct Firestore access is denied; every workspace mutation runs behind authenticated server-side RBAC (owner, admin, viewer).