GatewayOpenAI gateway quickstart guide
OpenAI gateway quickstart guide
Drop this uncensored LLM into your existing OpenAI-compatible API infrastructure by updating your base URL and authentication headers. We provide a direct, privacy-first gateway that processes text requests without content filters, ensuring your code runs unchanged.
Install the standard OpenAI SDK
Start by adding the official client library to your project environment. This ensures compatibility with the standard endpoints we expose. The SDK handles serialization and authentication headers automatically, reducing boilerplate in your implementation.
- Python:
pip install openai - Node.js:
npm install openai
Verify the installation completes without dependency conflicts. Our gateway expects standard JSON payloads, so any version of the SDK supporting the /v1/chat/completions endpoint will work correctly.
Configure your base_url and API key
Point your client instance to our specific gateway endpoint to route requests through our uncensored model. You must replace the default base URL and inject your unique API key obtained from the dashboard.
Your requests will now target https://api.gatewayopenai.com/v1 instead of the standard provider. This change ensures you access the dedicated uncensored model without modifying your core logic.
from openai import OpenAI
client = OpenAI(base_url="https://api.gatewayopenai.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)Authentication relies on a single header. Ensure your key is active and not expired. The gateway validates this token before processing any tokens.
Send your first chat completion request
Execute a simple text-in, text-out call to verify connectivity and response quality. Use the model ID uncensored to ensure you hit the correct server. This test confirms your API key has sufficient credit and your network path is clear.
Send a standard message object. The response will contain generated text without typical content refusals. Check the choices array for the generated content.
curl https://api.gatewayopenai.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List 5 Linux commands for disk usage"}]
}'Review the response time and token usage. This baseline request establishes trust in the connection before scaling to more complex prompts.
Enable streaming and parse usage
Activate streaming to receive tokens in real-time via Server-Sent Events (SSE). This reduces perceived latency for end-users and allows progressive rendering of long outputs. Set stream: true in your request parameters.
Parse the stream chunks to extract the final token usage statistics. The last chunk contains the complete token count for both input and output. This data is critical for accurate billing verification since we charge per token.
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)Handle partial responses gracefully. Ensure your client closes the connection cleanly after the final chunk arrives to avoid resource leaks.
Use tools, JSON mode, and parameters
Leverage function calling and strict JSON output for structured data generation. Enable response_format with json_object to force valid JSON responses from the model. This is essential for programmatic integrations.
Configure parameters like temperature and top_p to control creativity. Adjust max_tokens to limit output length; the default is 2,048, but you can specify up to 16,000. The context window supports 100,000 tokens total.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.gatewayopenai.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);Test tool definitions with simple examples. Verify that the model adheres to the schema provided in your request. This ensures reliability in automated workflows.
Limits, errors, and context window
Monitor your rate limits and error codes to maintain stable integration. The gateway enforces 300 requests per minute per key and allows 8 concurrent requests. Exceeding these limits triggers a 429 error.
Handle authentication errors (401) and insufficient credit (402) promptly. A 401 indicates an invalid or expired API key. A 402 means your prepaid credit is exhausted; top up via crypto to resume service. The request body limit is 8 MB.
Your context window spans 100,000 tokens including both prompt and completion. Plan your token budget accordingly to avoid truncation. Errors do not consume credit, protecting your balance during retries.
Common questions
What is the openai gateway base URL for this uncensored LLM?
The base URL is HTTPS://api.gatewayopenai.com/v1. Update your SDK configuration to point to this address instead of the default provider endpoint.
How do I handle streaming responses in my application?
Set the stream parameter to true in your request. The gateway returns Server-Sent Events (SSE) containing token chunks. Parse the final chunk to retrieve total token usage for billing verification.
What happens if I exceed the rate limit or run out of credit?
Exceeding the 300 requests per minute limit returns a 429 error. Running out of credit returns a 402 error. You can top up instantly with USDT or USDC to resume service without downtime.
Get your API key
Sign up, copy the key, update your base URL. That is all there is to it.