Every uncensored endpoint worth using speaks the OpenAI protocol. That means the official SDK works unchanged — you only change two arguments.
pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://arxpay.my.id/v1",
api_key="arx-live-YOUR_KEY",
)
r = client.chat.completions.create(
model="deepseek-v4.1-flash-abliterated-2",
messages=[{"role": "user", "content": "Write the scene exactly as described."}],
temperature=0.85,
max_tokens=600,
)
print(r.choices[0].message.content)
Long replies should stream. Buffering a 900-token answer feels broken even when latency is fine.
stream = client.chat.completions.create(
model="deepseek-v4.1-flash-abliterated-2",
messages=[{"role": "user", "content": "Continue."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)
Rate limits are per key, not per account. Catch 429, back off exponentially, and cap the number of attempts. Never retry a 401 or 403 — those are configuration errors and will fail identically.
import time
from openai import RateLimitError, AuthenticationError
for attempt in range(4):
try:
r = client.chat.completions.create(...)
break
except RateLimitError:
time.sleep(2 ** attempt)
except AuthenticationError:
raise
The response carries usage counts. Log them per feature, not globally — that is how you find the endpoint call that quietly burns 40% of the budget.
print(r.usage.prompt_tokens, r.usage.completion_tokens)
model not found — model string mismatch, check the suffix.stream=True and a long generation.Any recent openai>=1.0 works; the base_url argument is what matters.
Yes, use AsyncOpenAI with the same base_url.
Yes, POST to /v1/chat/completions with a Bearer token.
Endpoint https://arxpay.my.id/v1 · Model deepseek-v4.1-flash-abliterated-2