Authentication and API Keys
Start by creating an account to get your API key immediately. You can sign up using Google or an email password without needing a phone number. The system generates one active key per account, and creating a new key replaces the old one instantly. You only need an email address to begin, and your prompts are not used for training. Use this key in the Authorization header as a bearer token for all requests.
First Request
Make your first call to the chat completions endpoint using your API key. The base URL is https://api.aidphn.com/v1 and works with standard OpenAI-compatible clients. You must specify the model uncensored to access the unfiltered large language model. Errors and refusals do not consume your prepaid credits, so you can test safely.
curl https://api.aidphn.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the top 5 Rust crates for async HTTP clients"}]
}'
Verify your key is working by checking the model list endpoint. This confirms connectivity before you send complex prompts. The API accepts text in and returns text out, supporting standard parameters like temperature and top_p.
Python SDK Integration
Use the official OpenAI Python library to interact with our endpoint. Set the base URL to our API server and provide your key. This approach lets you reuse existing code from OpenAI projects without major changes. The model ID remains uncensored for all completions.
from openai import OpenAI
client = OpenAI(base_url="https://api.aidphn.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)
You can configure parameters like max_tokens to control output length. The default max output is 2,048 tokens, but you can increase it up to 16,000 per request. Streaming is available for long responses to reduce latency.
Node SDK Usage
Integrate the API into your Node.js applications using the standard SDK. Point the client to our base URL and authenticate with your key. This method supports both synchronous and asynchronous requests for flexible integration. You can pass tools for function calling or enforce JSON output modes.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.aidphn.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);
Handle responses by parsing the content field from the completion object. The API supports standard parameters like stop sequences and seed for reproducibility. Error handling should account for rate limits and credit availability.
Streaming Responses via SSE
Enable streaming by setting stream: true in your request. The API returns Server-Sent Events (SSE) for real-time token delivery. Each chunk contains partial content, allowing you to display output as it generates. The final chunk includes the total token usage for billing transparency.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Streaming reduces perceived latency for users waiting for long responses. You can process tokens incrementally or buffer them for later use. The context window supports up to 100,000 tokens for prompt and completion combined.
Limits and Errors
Monitor your usage against strict rate limits and credit balances. You can send 300 requests per minute and have 8 concurrent requests per key. The maximum request body size is 8 MB. Errors like 401 indicate an invalid key, while 402 means you need to top up. 429 errors signal you have exceeded the rate limit. Top up with crypto only, starting from $20, to continue using the service without interruption.