Quickstart
The API is OpenAI-compatible. Use any OpenAI SDK with this base URL and your key.
Base URL
https://api.oneaipass.com/v1
Authenticate with Authorization: Bearer YOUR_API_KEY. Get a key on the account page. Pick a MODEL_ID from the models list.
Example requests
curl
curl https://api.oneaipass.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"MODEL_ID","messages":[{"role":"user","content":"Hello"}]}'
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(base_url="https://api.oneaipass.com/v1", api_key="YOUR_API_KEY")
r = client.chat.completions.create(
model="MODEL_ID",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)
Node (OpenAI SDK)
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.oneaipass.com/v1", apiKey: "YOUR_API_KEY" });
const r = await client.chat.completions.create({
model: "MODEL_ID",
messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);Add "stream": true for server-sent-event streaming.
Other endpoints
| Endpoint | What it does |
|---|---|
GET /v1/models | List available models with context length and pricing. |
GET /v1/credits | Your prepaid balance. |
GET /v1/usage | Your usage summary. |
POST /v1/chat/completions | Chat completions, streaming supported. |
Errors you may see
| Status | Meaning |
|---|---|
400 content_policy_violation | The prompt was blocked by moderation before any charge. |
| 401 | Missing or unrecognised API key. |
| 402 | Out of credit. Top up on the pricing page. |
| 429 | Rate limit or daily spend cap reached for this key. |
| 5xx | Upstream provider problem. We try other routes first, so retry after a moment. |