Quickstart
Base URL for all OpenAI-compatible calls:
https://promptopoly.com/api/v1/proxy/v1
Create a proxy key in the cockpit at /app → AI Proxy. The key starts with pk_ and is shown once.
Your first request (OpenAI-compatible):
curl -s https://promptopoly.com/api/v1/proxy/v1/chat/completions \
-H "Authorization: Bearer pk_REPLACE_WITH_YOUR_PROXY_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Sag Hallo."}]}'
Authentication
Every request carries the proxy key. Three equivalent ways — the OpenAI-conformant Bearer header is recommended:
Authorization: Bearer pk_…— recommended, works with every OpenAI SDK out of the box.X-Proxy-Key: pk_…— alternative header.x-api-key: pk_…— fallback for the Anthropic SDK / Claude Code (which sends the key as x-api-key).
Inactive, expired or unknown keys are rejected before forwarding — with an OpenAI-compatible error object (see below).
Endpoint reference
/chat/completionsOpenAI-compatible chat endpoint. Supports stream (SSE), tools / tool_choice (Function-Calling), response_format, stop, seed, temperature, frequency_penalty, presence_penalty, user. Not supported: n > 1.
/embeddingsOpenAI-compatible embeddings passthrough.
/v1/messagesNative Anthropic endpoint (Messages format). Base URL https://promptopoly.com/api/v1/proxy; the SDK appends /v1/messages to it. Routed directly to the Anthropic provider, without provider failover (format boundary).
/modelsList of enabled models. Includes an optional aliases-field with the resolvable model aliases.
Error format & status codes
Errors are returned as an OpenAI-compatible object — typed exceptions in the OpenAI SDK work:
{
"error": {
"message": "Budget exceeded for today.",
"type": "insufficient_quota",
"code": "budget_exceeded",
"param": null
},
"limit_info": { "budget": "daily", "used_cents": 1234, "limit_cents": 1000 }
}
| Status | type | Meaning |
|---|---|---|
401 | authentication_error | Key missing/invalid/inactive. |
402 | insufficient_quota | Wallet balance exhausted. |
403 | permission_error | Firewall: IP/model/regex blocked. |
429 | insufficient_quota / rate_limit_error | Budget limit vs. rate limit. For budget, limit_info is set. |
5xx | api_error | Provider/upstream error. |
An unknown model returns model_not_found with an available:-list of allowed models in error.message.
Integration examples
OpenAI SDK — Python
from openai import OpenAI
client = OpenAI(
api_key="pk_REPLACE_WITH_YOUR_PROXY_KEY",
base_url="https://promptopoly.com/api/v1/proxy/v1",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Sag Hallo in einem Satz."}],
stream=False,
)
print(resp.choices[0].message.content)
OpenAI SDK — Node.js (ESM)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "pk_REPLACE_WITH_YOUR_PROXY_KEY",
baseURL: "https://promptopoly.com/api/v1/proxy/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Say hello in one sentence." }],
});
console.log(resp.choices[0].message.content);
LangChain
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage
llm = ChatOpenAI(
model="gpt-4o-mini",
api_key="pk_REPLACE_WITH_YOUR_PROXY_KEY",
base_url="https://promptopoly.com/api/v1/proxy/v1",
)
answer = llm.invoke([HumanMessage(content="Fasse Promptopoly in einem Satz zusammen.")])
print(answer.content)
Claude Code / Anthropic SDK — native /v1/messages
Claude Code uses the same base URL via the environment variable ANTHROPIC_BASE_URL:
export ANTHROPIC_BASE_URL="https://promptopoly.com/api/v1/proxy"
export ANTHROPIC_API_KEY="pk_REPLACE_WITH_YOUR_PROXY_KEY"
The Anthropic SDK calls the native endpoint directly:
from anthropic import Anthropic
client = Anthropic(
api_key="pk_REPLACE_WITH_YOUR_PROXY_KEY",
base_url="https://promptopoly.com/api/v1/proxy",
)
msg = client.messages.create(
model="claude-3-5-haiku-latest",
max_tokens=256,
messages=[{"role": "user", "content": "Sag Hallo in einem Satz."}],
)
print(msg.content[0].text)
Generic agent framework
Works with any OpenAI-compatible agent framework: set the provider to "OpenAI-compatible", then set the base URL, key and model.
{
"provider": "openai-compatible",
"model": "gpt-4o-mini",
"api_key": "pk_REPLACE_WITH_YOUR_PROXY_KEY",
"base_url": "https://promptopoly.com/api/v1/proxy/v1",
"options": { "stream": true, "temperature": 0.7 }
}
cURL — streaming + non-streaming
# Non-streaming
curl -s https://promptopoly.com/api/v1/proxy/v1/chat/completions \
-H "Authorization: Bearer pk_REPLACE_WITH_YOUR_PROXY_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Sag Hallo."}]}'
# Streaming (SSE): text/event-stream, endet auf data: [DONE]
curl -N https://promptopoly.com/api/v1/proxy/v1/chat/completions \
-H "Authorization: Bearer pk_REPLACE_WITH_YOUR_PROXY_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","stream":true,"messages":[{"role":"user","content":"Zähle bis drei."}]}'
Operations
Hard budgets & wallet
Daily, weekly or monthly budgets are reserved race-safely before the call leaves the gateway. Prepaid wallet debit in cents — no call without sufficient balance.
Model aliases
Stable alias names (e.g. gpt-4o → gpt-4o-mini) decouple your code from concrete provider models. Aliases whose target does not exist are not created; resolution is fail-open.
Failover
If a provider fails (timeout/5xx) before the first byte is streamed, the gateway routes to the next model in the failover chain. The native Anthropic endpoint has no provider failover due to its format.
Audit & GDPR
Every call is recorded in a tamper-proof hash chain. Response payloads are automatically removed after 7 days (retention). Made in Germany, GDPR-compliant.
Rate limits
On top of budgets, a rate limit protects the gateway. Exceeding it returns 429 (rate_limit_error).
Limits
n > 1(multiple completions per request) is not supported.- Native
/v1/messagesis limited to the Anthropic provider (no failover, no cross-alias model rewrite). - If provider usage is missing from a stream, the gateway estimates tokens (approx. 4 chars/token) and marks
usage_estimated=1.
Run your first call
Create a proxy key, swap the base URL, done. No credit card required.