Chat API Free Features: Streaming, Tools and JSON Mode
The $0.50 trial key gives you the same feature set as a paid key, so you can test everything before you top up. This page walks through each feature with code.

What you get on a trial key
When people search for chat api free features, they usually want to know whether the free tier is a cut-down demo. Here the trial is a $0.50 credit you claim with one click on the API key page, and the API surface is the same one a paid key uses. What differs is the rate limit: 2 concurrent requests and 60 requests per minute on trial, 8 and 300 on a full key.
The API is OpenAI-compatible and exposes two methods: POST /v1/chat/completions and GET /v1/models. The model ID is uncensored, auth is a bearer token, and the base URL is https://api.nsfwflux.cc/v1. The context window is 100,000 tokens, shared between prompt and completion, and max_tokens is optional because the completion can use whatever room is left.
Everything below uses the OpenAI Python SDK. Install it with pip install openai and create one client:
from openai import OpenAI
client = OpenAI(
base_url="https://api.nsfwflux.cc/v1",
api_key="YOUR_KEY",
)
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(r.choices[0].message.content)Streaming responses
Set stream: true and the server sends Server-Sent Events, one chunk per piece of text. This is what makes a chat interface feel responsive, because the first words appear while the rest is still being written.
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwflux.cc/v1", api_key="YOUR_KEY")
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Describe a rainy harbour town in 120 words."}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage:
print("\ntokens:", chunk.usage.prompt_tokens, chunk.usage.completion_tokens)
Usage is reported at the end of the stream, so you can log cost per request without counting tokens yourself. One detail matters for the trial key: a streamed request occupies its concurrency slot until the stream ends. With only 2 slots, two long streams running at once will make a third request fail with a 429 and the error code concurrency. In a browser app, cancel the stream when the user closes the tab so the slot frees up.
For a web front end, forward the SSE stream from your server to the browser and render each delta as it arrives. Keep your own server in the middle so the API key never reaches client-side code. If you only need the finished text, skip streaming for batch jobs: a non-streamed call is simpler to retry and does not hold a concurrency slot any longer than the generation itself.
It also helps to measure two numbers when you test: the time until the first chunk arrives and the total time. The first number is what the user feels in a chat window, and the second matters for batch work. Your own location and network affect both, so measure from the machine that will run the app rather than trusting anyone else's figures.
Tool calling
Tool calling lets the model ask your code to do something, such as look up a record or roll dice for a game, and then continue with the result. You describe functions in tools, optionally force a choice with tool_choice, and send results back as messages with role: "tool". When streaming, the calls arrive as streamed tool_calls deltas.
import json
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwflux.cc/v1", api_key="YOUR_KEY")
tools = [{
"type": "function",
"function": {
"name": "roll_dice",
"description": "Roll a die with the given number of sides",
"parameters": {
"type": "object",
"properties": {"sides": {"type": "integer"}},
"required": ["sides"],
},
},
}]
messages = [{"role": "user", "content": "Roll a twenty-sided die for my attack."}]
first = client.chat.completions.create(
model="uncensored", messages=messages, tools=tools, tool_choice="auto"
)
call = first.choices[0].message.tool_calls[0]
sides = json.loads(call.function.arguments)["sides"]
messages.append(first.choices[0].message)
messages.append({"role": "tool", "tool_call_id": call.id, "content": "14"})
final = client.chat.completions.create(
model="uncensored", messages=messages, tools=tools
)
print(final.choices[0].message.content)
Two habits save debugging time. Always parse arguments with a try block, because a model can produce malformed JSON now and then, and always return a tool message for every call ID before the next request. A missing result is the most common cause of a confusing error on the second round trip.
When to force a tool
With tool_choice set to "auto", the model decides whether a tool is needed. If your flow always needs a particular function, such as a classifier that must return a label, name that function in tool_choice and the reply will be a call to it. This turns tool calling into a reliable way to get structured arguments, and it pairs well with a low temperature.
Several calls in one turn
A reply can contain more than one entry in tool_calls. Loop over all of them, run each function, and append one role: "tool" message per call ID, in any order, before you call the API again. Skipping one call is the usual reason a second request fails.
JSON mode
For structured output, pass response_format: {"type": "json_object"}. The reply will be a JSON object you can feed straight into json.loads. Tell the model in the prompt what keys you expect, because JSON mode guarantees the shape of the syntax, not your schema.
curl https://api.nsfwflux.cc/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"response_format": {"type": "json_object"},
"messages": [
{"role": "system", "content": "Return JSON with keys name, motive, weakness."},
{"role": "user", "content": "Invent a villain for a heist story."}
]
}'
Validate the result in your own code anyway. Check that required keys exist and that values have the type you expect, and retry once if they do not. Because failed requests are not charged, a retry loop costs you little.
Two pitfalls are worth knowing. First, if the output is cut off because you set a small max_tokens, the JSON will be incomplete and fail to parse, so either leave the limit unset or give it generous headroom. Second, ask for the object in the prompt and name the keys, because a bare request for JSON can produce an object whose keys differ from run to run. A short example object in the system message fixes most of that.
JSON mode combines with the other features. You can stream a JSON reply and parse it once the stream ends, and you can use JSON mode in a pipeline step that follows a tool call, for instance to summarise tool output into a fixed shape before it reaches your database.
Sampling controls
These parameters are passed through to the model: temperature, top_p, stop, seed and the frequency and presence penalties. A few practical settings:
- Creative writing: temperature 0.8 to 1.0, with a small presence penalty to discourage looping phrases.
- Extraction and JSON: temperature 0 to 0.3, so repeated runs agree.
- Repeatable tests: set
seedand keep every other parameter fixed when you compare prompt versions. - Cutting off a speaker: use
stopwith a string like"\nUser:"so the model does not write the other side of a dialogue.
Change one parameter at a time. If you alter temperature and the system prompt together, you will not know which one helped.
Headers, limits and errors
Every response carries headers worth logging: X-Request-Id for support requests, X-Balance-USD for your remaining credit, and X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency for your current caps. The maximum request body is 8 MB, which is far more than a 100,000-token prompt needs in plain text.
There are two kinds of 429. A rate_limited code means you exceeded requests per minute, so wait for the window to roll over. A concurrency code means too many requests were in flight, so queue them. On temporary overload you also get a 429 with a Retry-After: 5 header. A small helper handles all three:
import time
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://api.nsfwflux.cc/v1", api_key="YOUR_KEY")
def chat(messages, tries=4):
for attempt in range(tries):
try:
return client.chat.completions.create(
model="uncensored", messages=messages
)
except RateLimitError as e:
wait = 5 * (attempt + 1)
print("429, retrying in", wait, "seconds")
time.sleep(wait)
raise RuntimeError("still rate limited")
On the trial key, a simple semaphore with two permits keeps you under the concurrency cap without any retries at all.
Planning for the trial limits
On the trial key, 60 requests per minute works out to one request per second on average, and 2 concurrent requests means a script that fans out to ten workers will hit concurrency errors immediately. Use a worker pool of two for trial testing. A full key raises this to 8 concurrent and 300 per minute, which supports a small production app, and a queue in front of the API smooths out bursts above that.
Log the X-Request-Id value with every failure. If you contact support, it is the fastest way to find a specific call. Support requests go through the support page.
What is not included
The feature list has edges. This is a text API: no image, audio or video generation, no embeddings and no fine-tuning. There is one model, run by an independent provider and tuned to answer without content refusals for lawful adult use, with a hard rule against any sexual content involving minors. Prompts are not used for training.
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, billed from prepaid credit, and a request that fails or is refused costs nothing. For the rates and the top-up bonuses, see the pricing page, and for a first working request in several languages, the quickstart.
If a feature on your wishlist is missing from this page, assume it is not offered. The listed set is streaming, tool calling, JSON mode, the sampling parameters and the usage and rate-limit headers. A good next step is to claim the trial, run each snippet above once, and watch the X-Balance-USD header drop as you go. That small exercise shows how the billing behaves before you add credit.
More guides
Questions and answers
Does the trial key support streaming and tool calling?
Yes. The feature set is the same as a full key. Only the limits differ: 2 concurrent requests and 60 per minute on trial.
Is JSON mode guaranteed to match my schema?
No. It makes the output a valid JSON object, but you should describe the keys in your prompt and validate them in code.
Do I have to set max_tokens?
No, it is optional. The completion can use the remaining room in the 100,000-token context window.
Where can I see my remaining balance?
Each response includes an X-Balance-USD header with your current credit.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Key points
- Streaming uses SSE with stream: true and can report usage in the final chunk.
- Tool calling supports tools, tool_choice, streamed tool_calls and role: tool results.
- JSON mode is switched on with response_format set to json_object.
- A streamed request holds its concurrency slot until the stream ends, which matters on the 2-slot trial key.
Start with trial credit
Email and password, key on screen right away.