• Getting Started
  • Integrations
  • Chat Models
  • Speech-to-Text
  • Text-to-Speech
  • Image Generation
  • Video Generation
  • API Topups
  • API Keys

Welcome to the PayPerQ API!

Flame

Our API is OpenAI Compatible, which means that you can plug it into hundreds of third party tools like Claude Code and OpenWebUI, even with non-OpenAI models. To check on costs, see Account Activity.

For questions or support, please use the chat widget in the bottom right!

For AI agents and coding assistants, see our llms.txt.

Your API Key:

No API keys found. Create your first API key

Base URL

https://api.ppq.ai

This is the URL you want to set if plugging into a third party tool or software

Endpoint

POST https://api.ppq.ai/chat/completions

This is the URL you want to set if you are calling our Chat API from custom code you've written.

Popular models

Model Name
Model ID
Provider
Max Context
Date Added
Input Rate
Output Rate
Average Cost
Prompts / $1
No models available

All available text models (0)

Model Name
Model ID
Provider
Max Context
Date Added
Input Rate
Output Rate
Average Cost
Prompts / $1
No models available

Models endpoint

A list of our current models, model attributes, and pricing.

import requests

url = "https://api.ppq.ai/v1/models"

response = requests.get(url)
print(response.json())

Code Examples

import requests

api_key = "YOUR_API_KEY"
url = "https://api.ppq.ai/chat/completions"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {api_key}"
}

data = {
    "model": "claude-3.5-sonnet",
    "messages": [{"role": "user", "content": "Hello, how are you?"}]
}

response = requests.post(url, json=data, headers=headers)
print(response.json())

Online Mode

Any model can be given real-time web access by including a plugins array in your request. Before your query reaches the AI model, a web search is performed and the results are injected into the prompt, giving the model real-time context to work with.

How to use

Add a plugins array to your request body with the web plugin:

Plugin parameters

id*Plugin identifier. Use "web" for web search.
max_resultsNumber of web search results to retrieve and inject into the model's context (default: 5). More results provide broader context but increase token usage.

Search providers

The search engine used depends on the model:

Native search— Models from Perplexity, OpenAI (GPT-5+), and Anthropic (Claude) have built-in web search optimized by their providers. Pricing varies by provider.
Exa.AI search— All other models use Exa.AI, a search engine designed for AI applications. Cost: $0.02 per request (in addition to the model's token pricing).

Example

curl -X POST https://api.ppq.ai/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer null" \
  -d '{
    "model": "claude-sonnet-4-5",
    "plugins": [{"id": "web", "max_results": 5}],
    "messages": [{"role": "user", "content": "What is the weather in Omaha, Nebraska right now?"}]
  }'

Speech-to-Text API

Convert audio to text using our OpenAI-compatible transcription API. Powered by Deepgram Nova-3 for high-quality, accurate transcriptions.

Endpoint

POST https://ppq.ai/api/v1/audio/transcriptions

Supported Audio Formats

mp3, mp4, mpeg, mpga, m4a, wav, webm (max 25MB)

Parameters

file*The audio file to transcribe
modelModel to use: "nova-3" (default) or "nova-2"
response_formatFormat: json, text, srt, vtt, or verbose_json (default: json)
languageLanguage code (e.g., "en", "es", "fr") or "multi" for auto-detect
promptOptional text to guide the model's style

Code Examples

from openai import OpenAI

# Initialize client with PayPerQ API
client = OpenAI(
    api_key="null",
    base_url="https://ppq.ai/api/v1"
)

# Transcribe audio file
with open("audio.mp3", "rb") as audio_file:
    transcription = client.audio.transcriptions.create(
        model="nova-3",  # Deepgram Nova-3
        file=audio_file,
        response_format="json"  # Options: json, text, srt, vtt, verbose_json
    )

print(transcription.text)

Text-to-Speech API

Convert text to natural-sounding speech using our OpenAI-compatible TTS API. Powered by DeepGram Aura for high-quality voice synthesis.

Endpoint

POST https://ppq.ai/api/v1/audio/speech

Parameters

input*The text to convert to speech (max 2000 characters)
modelModel to use: "deepgram_aura_2" (default)
voiceDeepGram Aura voice ID (default: aura-2-arcas-en)

Available Voices

aura-2-arcas-enArcas - Natural, Smooth, Clear
aura-2-thalia-enThalia - Clear, Confident, Energetic
aura-2-andromeda-enAndromeda - Casual, Expressive
aura-2-helena-enHelena - Caring, Natural, Friendly
aura-2-apollo-enApollo - Confident, Comfortable
aura-2-aries-enAries - Warm, Energetic, Caring
For more voices, visit DeepGram: developers.deepgram.com/docs/tts-models

Code Examples

from openai import OpenAI

# Initialize client with PayPerQ API
client = OpenAI(
    api_key="null",
    base_url="https://ppq.ai/api/v1"
)

# Generate speech from text
response = client.audio.speech.create(
    model="deepgram_aura_2",
    voice="aura-2-arcas-en",  # Natural, Smooth, Clear
    input="Hello, welcome to PayPerQ!"
)

# Save to file
response.stream_to_file("output.mp3")

Image Generation API

Generate images from text prompts or transform existing images using state-of-the-art AI models. Requests are synchronous — the API returns the generated images directly in the response.

Endpoint

POST https://api.ppq.ai/v1/images/generations

Parameters

model*The model to use for generation (see Available Models below)
prompt*A text description of the image to generate
nNumber of images to generate, 1–10 (default: 1)
qualityQuality tier — varies by model (e.g. "low", "medium", "high", "1k", "2k")
sizeImage size or aspect ratio (e.g. "1:1", "16:9"). Model-specific.
image_urlSource image URL for image-to-image models (e.g. flux-2-pro-i2i)

Available Image Models

gpt-image-1GPT Image 1 (4o) — quality: low, medium, high
gpt-image-1.5GPT Image 1.5 — quality: medium, high
nano-banana-proGemini 3.0 — quality: standard, 4k
flux-2-proFlux 2 Pro — quality: 1k, 2k
flux-2-flexFlux 2 Flex — quality: 1k, 2k
flux-2-pro-i2iFlux 2 Pro (Image-to-Image) — requires image_url
flux-kontext-proFlux Kontext Pro — flat pricing
flux-kontext-maxFlux Kontext Max — flat pricing
Use GET /v1/media/models to see all available models and current pricing.

Response

{
  "created": 1709234567,
  "model": "gpt-image-1",
  "cost": 0.0805,
  "data": [
    {
      "url": "https://api.ppq.ai/v1/media/gen_abc123/0?sig=...&exp=...",
      "content_type": "image/png"
    }
  ]
}

Code Examples

import requests

api_key = "YOUR_API_KEY"
url = "https://api.ppq.ai/v1/images/generations"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {api_key}"
}

data = {
    "model": "gpt-image-1",
    "prompt": "A futuristic cityscape at sunset",
    "quality": "medium",
    "n": 1
}

response = requests.post(url, json=data, headers=headers)
result = response.json()

# Each item in data[] has a signed URL
for image in result["data"]:
    print(image["url"])

Video Generation API

Generate videos from text prompts or input images. Video generation is asynchronous — submit a request, then poll for the result. Supports text-to-video and image-to-video models.

Step 1: Submit a Generation

POST https://api.ppq.ai/v1/videos

Parameters

model*The video model to use (see Available Models below)
prompt*A text description of the video to generate
aspect_ratioAspect ratio (e.g. "16:9", "9:16", "1:1"). Default: "16:9"
durationVideo duration in seconds (e.g. "5", "10"). Model-specific.
qualityQuality/resolution tier (e.g. "720p", "1080p"). Model-specific.
image_urlA publicly accessible image URL for image-to-video models

Submit Response (202)

{
  "id": "gen_abc123",
  "model": "kling-2.1-pro",
  "status": "pending",
  "created": 1709234567,
  "estimated_cost": 0.2875
}

Step 2: Poll for Status

GET https://api.ppq.ai/v1/videos/:id

Poll this endpoint every 5–10 seconds until status changes to "completed" or "failed". Returns 202 while processing, 200 when done.

Completed Response (200)

{
  "id": "gen_abc123",
  "model": "kling-2.1-pro",
  "status": "completed",
  "created": 1709234567,
  "data": {
    "url": "https://api.ppq.ai/v1/media/gen_abc123/0?sig=...&exp=...",
    "content_type": "video/mp4"
  },
  "cost": 0.2875
}

Available Video Models

Text-to-Video

veo3Google Veo 3 (Quality) — 8s
veo3-fastGoogle Veo 3 (Fast) — 8s
sora-2Sora 2 — 10s, 15s
sora-2-proSora 2 Pro — 720p/1080p, 10s/15s
kling-2.1-proKling 2.6 — 5s, 10s
kling-2.1-masterKling 2.1 Master — 1080p, 5s/10s
kling-2.5-turboKling 2.5 Turbo — 5s, 10s
runway-gen4Runway Gen-4 — 720p/1080p, 5s/10s
runway-alephRunway Aleph — 5s, 10s

Image-to-Video

veo3-i2vGoogle Veo 3 I2V — requires image_url
sora-2-i2vSora 2 I2V — 10s, 15s
sora-2-pro-i2vSora 2 Pro I2V — 720p/1080p
kling-2.1-master-i2vKling 2.1 Master I2V — 5s, 10s
kling-2.5-turbo-i2vKling 2.5 Turbo I2V — 5s, 10s
Use GET /v1/media/models to see all available models and current pricing.

Code Examples

import requests
import time

api_key = "YOUR_API_KEY"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {api_key}"
}

# Step 1: Submit video generation request
data = {
    "model": "kling-2.1-pro",
    "prompt": "A golden retriever running through a meadow",
    "aspect_ratio": "16:9",
    "duration": "5"
}

response = requests.post(
    "https://api.ppq.ai/v1/videos",
    json=data,
    headers=headers
)
job = response.json()
generation_id = job["id"]
print(f"Job submitted: {generation_id}")

# Step 2: Poll for completion
while True:
    status_res = requests.get(
        f"https://api.ppq.ai/v1/videos/{generation_id}",
        headers=headers
    )
    status = status_res.json()

    if status["status"] == "completed":
        print(f"Video ready: {status['data']['url']}")
        break
    elif status["status"] == "failed":
        print(f"Error: {status.get('error')}")
        break

    print("Processing...")
    time.sleep(5)

Poll Status Example

import requests

api_key = "YOUR_API_KEY"
generation_id = "gen_abc123"

response = requests.get(
    f"https://api.ppq.ai/v1/videos/{generation_id}",
    headers={"Authorization": f"Bearer {api_key}"}
)

result = response.json()
print(result)
# {"id": "gen_abc123", "model": "kling-2.1-pro", "status": "completed",
#  "data": {"url": "https://api.ppq.ai/v1/media/gen_abc123/0?sig=...&exp=..."},
#  "cost": 0.2875}

API Topups

The PayPerQ API allows users to programmatically create deposit invoices and top up their account balances using various payment methods including Bitcoin (Lightning), Bitcoin (on-chain), Monero, Litecoin, and Liquid Bitcoin.

POST /topup/create/{method}

Create a topup invoice for the specified payment method.

Methods: btc-lightning, btc, ltc, lbtc, xmr

Example: Create Bitcoin Lightning Topup (USD)

curl -X POST https://api.ppq.ai/topup/create/btc-lightning \
  -H "Authorization: Bearer null" \
  -H "Content-Type: application/json" \
  -d '{"amount": 1000, "currency": "SATS"}'  # Also supports "BTC" and "USD" as currency

GET /topup/status/{invoice_id}

Check the status of a topup invoice.

Example:

curl -X GET https://api.ppq.ai/topup/status/BTCPayInvoiceId123 \
  -H "Authorization: Bearer null"

GET /topup/payment-methods

Get a list of all supported payment methods with their limits and supported currencies.

Example:

curl -X GET https://api.ppq.ai/topup/payment-methods

POST /accounts/create

Create a new account, which returns a new credit_id and an api_key.

Example:

curl -X POST https://api.ppq.ai/accounts/create

POST /credits/balance

Get the current credit balance for your account.

Example:

curl -X POST "https://api.ppq.ai/credits/balance" \
  -H "Content-Type: application/json" \
  -d '{"credit_id":"4af59b9d-f6ec-4531-82f7-ce776d49e207"}'

More Usage Examples

Bitcoin On-Chain Topup (BTC)

curl -X POST https://api.ppq.ai/topup/create/btc \
  -H "api-key: null" \
  -H "Content-Type: application/json" \
  -d '{"amount": 0.001, "currency": "BTC"}'

Monero Topup

curl -X POST https://api.ppq.ai/topup/create/xmr \
  -H "Authorization: Bearer null" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50.00, "currency": "USD"}'

Limits

Bitcoin Lightning (btc-lightning)

  • Currencies: USD, BTC, SATS
  • USD Limits: $0.10 - $1,000
  • BTC Limits: 0.000001 - 0.01 BTC
  • SATS Limits: 100 - 1,000,000 SATS
  • Expiration: 15 minutes
  • Bonus: 5% Lightning fee bonus

Bitcoin On-Chain (btc)

  • Currencies: USD, BTC
  • USD Limits: $10 - $10,000
  • BTC Limits: 0.0001 - 0.01 BTC
  • Expiration: 60 minutes

Litecoin (ltc)

  • Currencies: USD, LTC
  • USD Limits: $2 - $1,000
  • LTC Limits: 0.03 - 100 LTC
  • Expiration: 60 minutes

Liquid Bitcoin (lbtc)

  • Currencies: USD, LBTC
  • USD Limits: $2 - $10,000
  • LBTC Limits: 0.00005 - 0.1 LBTC
  • Expiration: 60 minutes

Monero (xmr)

  • Currencies: USD, XMR
  • USD Limits: $5 - $10,000
  • XMR Limits: 0.01 - 50 XMR
  • Expiration: 60 minutes

NWC Auto-Topup (Nostr Wallet Connect)

Connect a Nostr Wallet Connect (NWC) compatible Lightning wallet to automatically top up your balance when it falls below a threshold. Your wallet needs to support the pay_invoice capability. Compatible wallets include Alby Hub, LNBits, Primal, and others.

POST /nwc-auto-topup/connect

Connect an NWC wallet for automatic top-ups. Requires x-credit-id header.

Parameters:
  • nwc_url (required) — Your NWC connection string
  • threshold_usd (optional, default: 10, min: 5) — Balance threshold to trigger top-up
  • topup_amount_usd (optional, default: 10) — Amount to top up each time

Example:

curl -X POST "https://api.ppq.ai/nwc-auto-topup/connect" \
  -H "Content-Type: application/json" \
  -H "x-credit-id: YOUR_CREDIT_ID" \
  -d '{
    "nwc_url": "nostr+walletconnect://your-wallet-pubkey?relay=wss://relay.example.com&secret=your-secret",
    "threshold_usd": 5,
    "topup_amount_usd": 10
  }'

GET /nwc-auto-topup

Get current NWC auto-topup settings. Requires x-credit-id header.

Example:

curl -X GET "https://api.ppq.ai/nwc-auto-topup" \
  -H "x-credit-id: YOUR_CREDIT_ID"

DELETE /nwc-auto-topup/connection

Disconnect your NWC wallet and disable auto-topup. Requires x-credit-id header.

Example:

curl -X DELETE "https://api.ppq.ai/nwc-auto-topup/connection" \
  -H "x-credit-id: YOUR_CREDIT_ID"

API Keys

Manage your API keys programmatically. Create keys with optional spending limits, reset periods, and expiration dates. All endpoints require the x-credit-id header for authentication.

Base URL: https://api.ppq.ai

GET /keys

List all API keys for your account.

Query Parameters

include_disabledInclude revoked keys in the response (default: false)
show_keyInclude the full api_key value in the response (default: false)

Response

status"success"
dataArray of API key objects with the following fields:
_idMongoDB ObjectId — use this as {id} in other endpoints
nameKey name
api_keyFull key value — only present when show_key=true
usage_limit_usdSpending cap in USD, or null if unlimited
current_period_usage_usdSpending in the current reset period
total_usage_all_time_usdTotal spending since key creation
reset_period"daily" | "weekly" | "monthly" | null
reset_atNext reset datetime (ISO 8601), or null
expire_atExpiration datetime (ISO 8601), or null
created_atCreation datetime (ISO 8601)
updated_atLast update datetime (ISO 8601)
deleted_atRevocation datetime (ISO 8601), or null if active

Code Example

curl -X GET "https://api.ppq.ai/keys" \
  -H "x-credit-id: YOUR_CREDIT_ID"

POST /keys

Create a new API key. The full key value is only returned once — save it securely.

Request Body

name*Key name, 1–25 characters, unique per account
usage_limit_usdSpending cap in USD, minimum $0.01. Omit or pass null for unlimited
reset_periodAuto-reset usage counter: "daily", "weekly", or "monthly". Requires usage_limit_usd
expire_atISO 8601 datetime (e.g. 2027-01-01T00:00:00Z), must be in the future

Response 201 Created

status"success"
dataCreated key object:
_idMongoDB ObjectId
nameKey name
api_keyFull key value — shown only on creation, store it securely
usage_limit_usdSpending cap, or null
reset_periodReset period, or null
reset_atNext reset datetime, or null
expire_atExpiration datetime, or null
created_atCreation datetime (ISO 8601)

Code Example

curl -X POST "https://api.ppq.ai/keys" \
  -H "Content-Type: application/json" \
  -H "x-credit-id: YOUR_CREDIT_ID" \
  -d '{
    "name": "my-app-key",
    "usage_limit_usd": 10.00,
    "reset_period": "monthly",
    "expire_at": "2027-01-01T00:00:00Z"
  }'

GET /keys/{id}

Get details for a single API key by its MongoDB ObjectId.

Query Parameters

show_keyInclude the full api_key value in the response (default: false)

Response

status"success"
dataKey object:
_idMongoDB ObjectId
nameKey name
api_keyFull key value — only present when show_key=true
created_atCreation datetime (ISO 8601)
updated_atLast update datetime (ISO 8601)
deleted_atRevocation datetime, or null if active

Code Example

curl -X GET "https://api.ppq.ai/keys/KEY_ID" \
  -H "x-credit-id: YOUR_CREDIT_ID"

PATCH /keys/{id}

Update an existing API key. Only include the fields you want to change. Pass null to clear a field (e.g. remove a usage limit).

Request Body

nameNew key name, 1–25 characters
usage_limit_usdNew spending cap in USD (min $0.01) or null to remove limit
reset_period"daily", "weekly", "monthly", or null. Changing this resets current_period_usage_usd to $0
expire_atNew expiration datetime (e.g. 2028-06-01T00:00:00Z) or null to remove

Response

status"success"
dataUpdated key object:
_idMongoDB ObjectId
nameKey name
usage_limit_usdSpending cap, or null
current_period_usage_usdSpending in current period (reset to $0 if reset_period changed)
reset_periodReset period, or null
reset_atNext reset datetime, or null
expire_atExpiration datetime, or null
created_atCreation datetime (ISO 8601)
updated_atLast update datetime (ISO 8601)

Code Example

curl -X PATCH "https://api.ppq.ai/keys/KEY_ID" \
  -H "Content-Type: application/json" \
  -H "x-credit-id: YOUR_CREDIT_ID" \
  -d '{
    "name": "updated-key-name",
    "usage_limit_usd": 25.00,
    "reset_period": "weekly"
  }'

DELETE /keys/{id}

Revoke an API key. The key is soft-deleted and immediately stops working. This action cannot be undone.

Response

status"success"
message"API key revoked successfully"

Code Example

curl -X DELETE "https://api.ppq.ai/keys/KEY_ID" \
  -H "x-credit-id: YOUR_CREDIT_ID"