Capabilities
Chat
Chat is the core of Pendra: send a list of messages, get a reply. It
powers assistants, summarisation, classification, code generation, and
anything else you'd reach for a language model to do. Pendra is
OpenAI-compatible, so if you've written against the OpenAI Chat
Completions API before, the shapes are identical — point your client at
https://api.pendra.ai with a pdr_sk_… key and
you're running.
Send a message
Every request carries a model and an array of
messages. Each message has a role —
system (instructions), user (the prompt), or
assistant (the model's previous turns) — and
content. Pass the whole conversation back on each call;
Pendra is stateless and doesn't remember prior turns for you.
from pendra import Pendra
client = Pendra() # reads PENDRA_API_KEY
response = client.chat.completions.create(
model="qwen3.6:27b",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain GPUs in one sentence."},
],
)
print(response.choices[0].message.content) A GPU is a specialised processor built for the massively parallel arithmetic that graphics and, more recently, AI workloads depend on.
Stream the reply
Set stream: true to receive tokens as they're generated
rather than waiting for the whole reply. Pendra returns
Server-Sent Events
in OpenAI's format, flushed immediately so text appears as it's produced.
Streaming is the right default for any interactive UI, since text appears
as it's produced. (Non-streaming requests are fine for long generations
too — Pendra keeps the connection alive for you up to ~30 minutes.)
stream = client.chat.completions.create(
model="qwen3.6:27b",
stream=True,
messages=[{"role": "user", "content": "Write a haiku."}],
)
for event in stream:
print(event.choices[0].delta.content or "", end="") Shape the output
The usual sampling controls all work:
temperature, top_p, top_k,
min_p, max_tokens, stop,
seed, and the frequency_penalty /
presence_penalty repetition controls. Lower
temperature for predictable, factual answers; raise it for
more variety. Penalties default to off, so output is unchanged unless you
set them.
Go further
- Thinking — reasoning models that show their working.
- Tool calling — let the model call your functions.
- Structured outputs — constrain replies to valid JSON.
- Vision — send images alongside text.