Pera Computing
API docs
Base URL and keys
Base URL https://api.peracomputing.com/v1, model kimi-k3.1-pro. Send your key as
Authorization: Bearer <key> or x-api-key: <key>. For a key, see
Credits or write to hello@peracomputing.com.
Endpoints
POST /v1/chat/completions | OpenAI format, with streaming, tool calls, logprobs and
reasoning returned as reasoning_content. |
POST /v1/messages | Anthropic format, with streaming, tools, images and reasoning
returned as thinking blocks. /v1/messages/count_tokens is not offered. |
GET /v1/models | The model list with context length and prices. No key needed. |
GET /v1/usage | Your key's prices, credit, spend, remaining balance, and today's and 30-day totals. |
OpenAI SDK
from openai import OpenAI
client = OpenAI(base_url="https://api.peracomputing.com/v1", api_key="sk-pe-...")
r = client.chat.completions.create(
model="kimi-k3.1-pro",
messages=[{"role": "user", "content": "Write a haiku about pears."}],
)
print(r.choices[0].message.content, r.usage)
Anthropic SDK
The Anthropic SDK adds /v1/messages itself, so its base URL has no /v1.
from anthropic import Anthropic
client = Anthropic(base_url="https://api.peracomputing.com", api_key="sk-pe-...")
m = client.messages.create(
model="kimi-k3.1-pro",
max_tokens=1024,
messages=[{"role": "user", "content": "Write a haiku about pears."}],
)
print(m.content, m.usage)
Reasoning and reasoning_effort
Reasoning arrives separately from the answer: as reasoning_content on
/v1/chat/completions, as thinking blocks on /v1/messages. Reasoning
tokens are output tokens and are billed as output.
Kimi K3.1 Pro always reasons. Its model
guide lists reasoning_effort values low, high and max,
with max as the default; set it at the top level of the request.
Usage reporting
Every non-streamed response carries usage. On /v1/chat/completions:
prompt_tokens | Input tokens, cached ones included |
prompt_tokens_details.cached_tokens | Input tokens served from the prompt cache, billed at the cached-input price |
completion_tokens | Output tokens, reasoning included |
reasoning_tokens | The part of completion_tokens spent on reasoning |
total_tokens | Prompt plus completion |
For streams, send "stream_options": {"include_usage": true}; the last chunk before
[DONE] then carries usage. On /v1/messages, usage comes as
input_tokens, cache_read_input_tokens and output_tokens; in streams the
final counts are in message_delta.
A request costs uncached input × input price + cached input × cached price + output × output price; the prices are on the home page. Caching is automatic: repeat the start of a conversation and its prefix is read from the cache. We keep token counts, never prompts or completions.
Errors
400, 413 and 422 mean the request itself needs fixing. 429 and 503 mean capacity is full: retry after the
number of seconds in Retry-After; their body uses the error format of the endpoint you called.
Served requests carry an X-Request-Id header; include it when you write to us about a request.