Why the move is mostly configuration
Most self-hosted inference servers copied the OpenAI HTTP shape on purpose. vLLM serves it under /v1 (port 8000 by default), llama.cpp's llama-server does too, Ollama answers on /v1 next to its native routes, and LM Studio has a local server with the same layout. A client written with the OpenAI SDK therefore needs three values to talk to any of them: a base URL, a key and a model name.
The hosted endpoint covered here follows the same contract. Its base URL is https://api.uncensoredmodel.cc/v1, auth is Authorization: Bearer <key>, and the model ID is uncensored. It supports POST /v1/chat/completions, POST /v1/responses and GET /v1/models. It is one open-weight model from an independent provider, not the official API of any lab and not a router across vendors.
If you run an llm api self hosted today because of cost or refusals, that is a reasonable reason to compare, and the sections below keep the migration reversible.
A profile-based client
Put the three values behind a profile and pick one with an environment variable. Your application code never mentions a URL:
import os
from openai import OpenAI
PROFILES = {
"vllm": {"base_url": "http://localhost:8000/v1", "model": "your-served-model-name"},
"llamacpp": {"base_url": "http://localhost:8080/v1", "model": "local"},
"hosted": {"base_url": "https://api.uncensoredmodel.cc/v1", "model": "uncensored"},
}
p = PROFILES[os.environ.get("LLM_PROFILE", "hosted")]
client = OpenAI(base_url=p["base_url"], api_key=os.environ.get("LLM_API_KEY", "none"))
def chat(messages, **kw):
return client.chat.completions.create(model=p["model"], messages=messages, **kw)Self-hosted servers often ignore the API key, which is why the default is a dummy string. The model name is another trap: vLLM wants whatever you passed to its serve command, while hosted wants uncensored. Keeping it in the profile avoids a late-night search for a 404 on model not found.
The same idea works with LangChain or any framework with a configurable OpenAI client. The page on using LangChain with a local model shows where those fields live.
Smoke test before you switch traffic
Run two curl calls first. The first proves the key and URL are right, the second proves a completion works and shows headers:
export KEY=YOUR_KEY
curl -s https://api.uncensoredmodel.cc/v1/models -H "Authorization: Bearer $KEY"
curl -s https://api.uncensoredmodel.cc/v1/chat/completions \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"model":"uncensored","messages":[{"role":"user","content":"Reply with the word ok"}],"max_tokens":5}' -i | head -20In the response headers look for X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. Keep the request id when you ask support about a specific call. Your remaining credit also appears at GET /v1/balance.
You need a key for this. Sign up and use the one-click trial on the API key page: $0.50 of credit, no card, valid 7 days, one per person.
Differences that break migrations
Concurrency and rate limits
Your own server queues requests however it likes and never says no. The hosted API enforces limits: on a full key, 8 concurrent requests and 300 per minute; on a trial key, 2 and 60. Past a limit the API returns HTTP 429 with rate_limited or concurrency. A temporary overload also gives 429 with Retry-After: 5. Add a retry:
import time
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://api.uncensoredmodel.cc/v1", api_key="YOUR_KEY", max_retries=0)
def call(messages):
for attempt in range(5):
try:
return client.chat.completions.create(model="uncensored", messages=messages)
except RateLimitError:
time.sleep(5 * (attempt + 1))
raise RuntimeError("still limited after 5 tries")Context window
Self-hosted context is whatever you configured and your memory allows. Here it is fixed at 100,000 tokens, prompt and completion together, with an 8 MB body limit. Long-context apps often get easier, short ones are unaffected.
Features
Tool calling, JSON mode (response_format of type json_object) and streaming are supported. Server-specific extras that exist on some self-hosted stacks, such as guided decoding or custom sampler fields, are not part of the contract here. Parameters passed through are temperature, top_p, stop, seed and the penalties. Embeddings, images and fine-tuning are not offered; keep those on your own servers.
Cost comparison without guesswork
Self-hosted cost is hardware plus power plus attention. Hosted cost is $0.15 per 1M input tokens and $0.50 per 1M output tokens, billed from prepaid credit, with no charge for failed or refused requests. Take a workload of 20 million input tokens and 5 million output tokens a month: 20 x $0.15 = $3.00 for input, 5 x $0.50 = $2.50 for output, $5.50 in total. If your servers cost more than that to keep running, the hosted side is cheaper at this volume.
Turn that around for large volumes: 2 billion input and 500 million output tokens costs 2,000 x $0.15 + 500 x $0.50 = $300 + $250 = $550. That is the kind of scale where a dedicated machine might compete. Compute your own number with a week of real usage logs; see the pricing page for top-up amounts and bonuses.
Migration checklist
- Move every URL, key and model name into configuration.
- Run the smoke test against the hosted URL.
- Replay 20 to 50 real prompts from your logs against both backends and compare the answers by eye.
- Re-test tool calls, JSON mode and your longest prompt.
- Add the 429 retry, and cap concurrency in your app at 8 or lower.
- Send a small share of traffic first, then raise it.
- Keep the self-hosted profile working so you can switch back in minutes.
Prompts sent to the hosted API are not used for training. Top-ups are any whole amount from $20 to $500, payable by crypto (USDT on TRC20, USDC on Base), with bonuses of +5% from $50, +10% from $100 and +15% from $200. The docs list each endpoint and header.

