PORDL API

Drop-in OpenAI replacement with smart model routing. Send requests to api.pordl.dev instead of api.openai.com, and PORDL routes each request to the cheapest model that can handle it.

Base URL for all API requests:

https://api.pordl.dev

All endpoints use JSON request/response bodies and follow OpenAI's API format — any OpenAI-compatible client works out of the box.

Content policy: All requests pass an automated content-safety check; prohibited content is refused. See the Acceptable Use Policy.

Quick Start

Node.js (SDK)

import Pordl from "@plagtech/pordl";

const client = new Pordl({ apiKey: "pd_live_..." });

const res = await client.chat.completions.create({
  model: "auto",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(res.choices[0].message.content);

Node.js (OpenAI SDK directly)

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "pd_live_...",
  baseURL: "https://api.pordl.dev/v1",
});

Python

from openai import OpenAI

client = OpenAI(
    api_key="pd_live_...",
    base_url="https://api.pordl.dev/v1",
)

curl

curl https://api.pordl.dev/v1/chat/completions \
  -H "Authorization: Bearer pd_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Sign Up

POST /proxy/auth/signup

Create an account and receive your API key. Save the key — it won't be shown again. Signup requires accepting the Acceptable Use Policy and confirming you are 18 or older; the acceptance time is recorded.

Request

{
  "email": "you@example.com",     // required
  "password": "your-password",    // required
  "accepted_aup": true,           // required — see /aup
  "confirmed_18_plus": true       // required
}

Response

{
  "message": "Account created",
  "user": {
    "id": "a15769e8-...",
    "email": "you@example.com",
    "tier": "free"
  },
  "api_key": "pd_live_6b7c140dd949cac44b14bb23b6cfa19a",
  "note": "Save this API key — it won't be shown again."
}

Log In

POST /proxy/auth/login

Log in and generate a new API key.

Request

{
  "email": "you@example.com",
  "password": "your-password"
}

API Keys

All authenticated requests require an API key in the Authorization header. Keys start with pd_live_ for production or pd_test_ for testing.

Authorization: Bearer pd_live_your_key_here

Keys are hashed and stored securely — PORDL never stores your raw key. If you lose your key, log in again to generate a new one.

Chat Completions

POST /v1/chat/completions

Send a chat completion request. Follows the OpenAI format exactly.

Request Body

ParameterTypeDescription
model required string Use "auto" for smart routing, or specify a model directly (e.g. "gpt-4o-mini")
messages required array Array of message objects with role and content
temperature optional number Sampling temperature, 0 to 2. Default: 1
max_tokens optional integer Maximum tokens in the response. Default and per-request ceiling: 4096

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 8,
    "total_tokens": 20
  }
}

Models

GET /v1/models

List available models. No authentication required.

Smart Routing

When you set model: "auto", PORDL classifies your request by complexity and routes it to the cheapest model that can handle it:

ComplexityRouted ToExample
Simple gpt-4o-mini Factual Q&A, formatting, translation
Medium gpt-4o SQL queries, code review, analysis
Complex gpt-5.4 System design, multi-step reasoning

You can also pass a specific model name to bypass routing. The routing classification is returned in the x-pordl-complexity response header.

Response Headers

Every chat completion response includes routing metadata:

HeaderDescription
x-pordl-model Which model handled the request
x-pordl-complexity How the request was classified (simple / medium / complex)
x-pordl-routing Routing mode used (auto / direct)
x-pordl-cost Cost of the call in USD
x-pordl-savings Estimated savings vs. the model you requested (for "auto" requests, vs. the typical direct default, GPT-4o)
x-pordl-latency Total response time in ms
x-pordl-cached true if response was served from cache
x-pordl-credits-limit Your monthly credit allowance (tier + any top-ups)
x-pordl-credits-used Credits used this billing period
x-pordl-credits-remaining Credits remaining this billing period (hard stop at zero — no overage billing)

Pricing

The free tier includes 100K credits/month — no card required. Paid tiers have a hard cap at their allowance: when credits run out, requests pause until next month or an explicit one-time top-up. PORDL never auto-charges.

Creator

$4.99 /mo
1M credits/mo

Creator Pro

$9.99 /mo
5M credits/mo

Creator Ultra

$19.99 /mo
15M credits/mo

Credits: 1 credit = 1 budget-model token (deepseek-v4-flash). Each request decrements your balance by its actual provider cost, so premium models burn credits faster. Per-model burn rates are returned by GET /v1/models (credits_per_1k_tokens) and shown on the pricing page; your dashboard shows projected month-end usage.

Checkout

POST /proxy/billing/checkout

Create a Stripe checkout session to subscribe to a paid tier. Returns a URL to redirect the user to.

Request

// Header: Authorization: Bearer pd_live_...
{
  "tier": "creator"   // "creator" | "creator_pro" | "creator_ultra"
}

Response

{
  "url": "https://checkout.stripe.com/c/pay/cs_live_...",
  "tier": "creator"
}

Credit Top-Up

POST /proxy/billing/topup

Create a Stripe checkout for a one-time credit top-up applied to the current month. Top-ups are always an explicit purchase — PORDL never charges automatically.

Customer Portal

POST /proxy/billing/portal

Create a Stripe customer portal session to manage or cancel your subscription.

Usage

GET /proxy/auth/usage

Get your current usage stats for the billing period.

Request

Authorization: Bearer pd_live_...

Errors

Errors follow a consistent JSON format:

{
  "error": {
    "message": "Invalid API key",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}
HTTP CodeTypeMeaning
400invalid_request_errorBad request body or missing fields
400content_policyRequest failed the automated content-safety check — refused, never forwarded to a provider. See Acceptable Use Policy
401authentication_errorMissing or invalid API key
403key_suspendedKey suspended pending manual review — contact abuse@pordl.dev
429rate_limit_errorRate limit, concurrency limit, or credit allowance exhausted (credits_exhausted)
500server_errorSomething went wrong on our end
503moderation_unavailableContent-safety check temporarily unavailable — requests are refused rather than forwarded unscreened; retry shortly

Rate Limits

Rate limits depend on your subscription tier:

TierMonthly CreditsRequests / min
Free100,00010
Creator1,000,00030
Creator Pro5,000,00060
Creator Ultra15,000,000120

Rate limit info is returned in response headers: x-ratelimit-limit-requests, x-ratelimit-remaining-requests, x-ratelimit-reset-requests.

SDK

Install the official Node.js SDK:

npm install @plagtech/pordl

The SDK is a thin wrapper around the OpenAI Node.js SDK — it sets baseURL to api.pordl.dev and handles auth. All OpenAI methods and types work as-is.

import Pordl from "@plagtech/pordl";

const client = new Pordl({ apiKey: "pd_live_..." });

const res = await client.chat.completions.create({
  model: "auto",
  messages: [{ role: "user", content: "What is 2+2?" }],
});

console.log(res.choices[0].message.content);
// "4"

For Python, use the standard OpenAI library with a custom base_url. See Quick Start for examples.

← Back to PORDL  ·  Terms  ·  Acceptable Use  ·  Privacy  ·  GitHub  ·  npm