Skip to content

Private Inference

Private Inference is an endpoint that asks a private inference service for chat completions, in the shape of OpenAI’s chat API. It is the one place your data leaves the cluster: an agent keeps its memory in Confidential KV and asks this endpoint for completions, so a unit of apps has a single edge where prompts go out, approved by its owner. It is the package com.calimero.private-inference.

  • One destination, declared and approved. Only this app’s signed manifest declares an outbound host: NEAR AI’s private inference at https://cloud-api.near.ai/v1/chat/completions. Its owner approves it on the consent page, and the instance’s outbound log lists each request’s host, path and status, never its contents.
  • The provider key never reaches you or the package. It is Calimero’s: the node attaches it to requests for that host only, and redacts it from any answer. The endpoint’s owner never sees or sets it.
  • Only the requester reads an answer. Anyone else, the endpoint’s owner included, gets NoSuchRequest. Usage counters hold token counts only, never prompt or answer text.
  • Little is kept. A prompt is kept until it is sent; an answer until you forget it or a day after it finished.
  • Neither Calimero nor the publisher can change the code. The app declares upgrades = "owner".
Term What it is
Endpoint One instance: its allowed models, its access list and its usage.
Models The models the endpoint allows, set by its owner. A new endpoint allows deepseek-ai/DeepSeek-V4.1-Flash-1017, z-ai/glm-5.3-flash and Qwen/Qwen3.6-35B-A3B-FP8.
Access list Who may ask besides the owner: account:<id>, key:<id>, app:<id>, or role:member (the organization’s members, admins and owner). Up to 1,000 entries.
Monthly limit An entry’s optional monthlyTokens: the caller’s total tokens per calendar month (UTC). A request that would pass it is refused with OverMonthlyLimit.
Request complete answers a request id at once; the answer arrives through an action. Read it with result, or name a callback method if you are an app.

When your app’s release uses the endpoint with mode = "create", your app’s instance is its admin: it chooses the models and manages the access list, with no passkey. Being admin reads no one’s prompts or answers.

  1. In the console, open Inference under Services and press New inference endpoint. Pick the cluster and who it is for, approve its outbound host, and confirm with your passkey.
  2. Try a request on the Playground tab, and choose the allowed models on Models.
  3. On Access, add callers and their monthly limits. On Usage, see tokens per day, caller and model.
  4. On Connect, copy the code for a server with an API key, a frontend whose people sign in with passkeys, or a Calimero app.

From code, with mero-js:

import { CalimeroClient } from '@calimero-network/mero-js';
// reads the cluster's nodes, then attests each against this policy before using it
const client = await CalimeroClient.connect({
cluster: '<cluster>',
policy: { release: { minReleaseVersion: '<release>' } },
});
client.useApiKey(process.env.CALIMERO_API_KEY);
const app = '<endpoint-id>';
const request = {
model: 'deepseek-ai/DeepSeek-V4.1-Flash-1017',
messages: [{ role: 'user', content: 'Hello' }],
};
const { result: requestId } = await client.apps.call({ app, method: 'complete', args: { request } });
// the answer arrives through an action: read it until it is no longer pending
const read = async () => (await client.apps.view({ app, method: 'result', args: { requestId } })).result;
let result = await read();
while (result.status === 'pending') {
await new Promise((r) => setTimeout(r, 1000));
result = await read();
}
console.log(result.answer?.message.content ?? result.error);

The request takes model, messages (system, user, assistant, tool), and optionally max_tokens, temperature, tools and tool_choice. stream: true is refused: a person or key that started a request can instead read its text as it arrives from the action’s event stream. A done answer is { message, finish_reason, usage }, and its message goes back into the next request’s messages as is. models() lists the allowed models and myUsage() your own tokens this month.

Limit Value
Messages 64, and 64 KiB as JSON
max_tokens 512 by default, 16,384 at most
Tools 32, 32 KiB together
Answer 256 KiB
Time for an answer 120 seconds, not retried after a timeout
Unanswered request Fails a day after it was made

Requests from apps start within 5 seconds, from a timer; a person’s or a key’s start at once. An endpoint needs nodes on merod 1.0.0-rc.40 or later.

Tokens sent on Calimero’s provider key are billed per model, at NEAR AI’s list price, on every cluster, dedicated ones included. Each payer gets 1M input and 200,000 output tokens free per model each month.

Model Input, per 1M tokens Output, per 1M tokens
deepseek-ai/DeepSeek-V4.1-Flash-1017 $0.30 $1.20
moonshotai/kimi-k2.6 $0.81 $3.85
moonshotai/kimi-k3 $3.30 $16.50
Qwen/Qwen3.6-35B-A3B-FP8 $0.17 $1.10
Qwen/Qwen3.8-27B $0.04 $1.35
z-ai/glm-5.3 $1.80 $5.75
z-ai/glm-5.3-flash $0.08 $0.50

The endpoint’s own calls, views and state are billed as any app instance: see Products → Pricing.