IdemcoreIdemcore
Developers · API v0.1Nhà phát triển · API v0.1

Idemcore APIIdemcore API BetaBeta

An OpenAI-compatible chat API that returns a signed receipt with every answer. Anyone holding the receipt can check the signature and the run’s hash chain, and you can ask for the same answer to be replayed on a different engine build and compared.API chat tương thích OpenAI, mỗi câu trả lời đi kèm một receipt có chữ ký. Ai giữ receipt đều kiểm được chữ ký và chuỗi hash của lượt chạy, và bạn có thể yêu cầu phát lại cùng câu trả lời trên một bản build engine khác để so sánh.

The API is in beta (version 0.1.0). Endpoints, limits and fields may still change. Everything on this page is beta unless it says otherwise. Access is by invitation: API đang ở giai đoạn beta (phiên bản 0.1.0). Endpoint, giới hạn và các trường dữ liệu vẫn có thể thay đổi. Mọi thứ trong trang này đều là beta trừ khi ghi rõ khác. Quyền truy cập theo lời mời: request early accessđăng ký dùng thử sớm.

OverviewTổng quan

  • Base URLBase URL: https://api.idemcore.net
  • Requests and responses are JSON (UTF-8). Send Content-Type: application/json on every POST. Maximum request body: 256 KB.Request và response là JSON (UTF-8). Gửi Content-Type: application/json với mọi POST. Kích thước body tối đa: 256 KB.
  • Health check, no key needed: Kiểm tra tình trạng, không cần key: GET/health
EndpointEndpointWhat it doesChức năngKey scopeQuyền của key
POST/v1/chat/completionsChat answer + signed receiptCâu trả lời chat + receipt có chữ kýchat
POST/v1/receipts/verify
alias alias /verify
Check a receipt (L1, L2, disclosure)Kiểm một receipt (L1, L2, disclosure)receipts:verify
POST/v1/receipts/replay
alias alias /replay
Re-run on another engine build (L3)Chạy lại trên bản build engine khác (L3)receipts:verify
GET/v1/audit/export
also POST; alias cả POST; alias /audit/export
Download receipts, events and signed daily rootsTải receipt, sự kiện và gốc theo ngày có chữ kýaudit:export
GET/v1/receipts/{id}Fetch one of your receiptsLấy một receipt của bạnreceipts:read
GET/v1/receipts/{id}/logFetch its hash logLấy log hash của receiptreceipts:read
GET/v1/modelsList available modelsDanh sách mô hình
GET/v1/keysReceipt-signing public keys (JWK)Khóa công khai ký receipt (JWK)

AuthenticationXác thực

Send your API key as a Bearer token on every request except /health. Keys start with ick_ and are shown once, when we issue them. We store only a hash of the key, so we cannot show it again; if you lose it, ask for a new one.Gửi API key dưới dạng Bearer token với mọi request trừ /health. Key bắt đầu bằng ick_ và chỉ hiển thị một lần, lúc được cấp. Chúng tôi chỉ lưu hash của key nên không thể hiển thị lại; nếu làm mất, hãy yêu cầu key mới.

Authorization: Bearer ick_…

A key belongs to one organisation (tenant) and can only read that tenant’s receipts. By default a key has the scopes chat, receipts:read, receipts:verify and audit:export. Keep keys on your server: cross-origin browser calls are not enabled for other sites.Mỗi key thuộc về một tổ chức (tenant) và chỉ đọc được receipt của tenant đó. Mặc định key có các quyền chat, receipts:read, receipts:verify và audit:export. Hãy giữ key ở phía server: gọi trực tiếp từ trình duyệt của trang khác (cross-origin) không được bật.

Chat completionsChat completions

POST/v1/chat/completions Same request and response shape as the OpenAI Chat Completions API, plus an idemcore object in the response and an Idemcore-Receipt-Id header.Request và response có cùng cấu trúc với OpenAI Chat Completions API, kèm thêm đối tượng idemcore trong response và header Idemcore-Receipt-Id.

curl https://api.idemcore.net/v1/chat/completions \
  -H "Authorization: Bearer $IDEMCORE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "messages": [{"role": "user", "content": "Name the three primary colours."}],
    "max_tokens": 64
  }'
{
  "id": "chatcmpl-3550cebf53dbc66a554977e8",
  "object": "chat.completion",
  "model": "MODEL_ID",
  "choices": [{ "index": 0, "finish_reason": "stop",
                "message": { "role": "assistant", "content": "Red, yellow and blue." } }],
  "usage": { "prompt_tokens": 38, "completion_tokens": 16, "total_tokens": 54 },
  "idemcore": {
    "receipt": { "receipt_version": "r1", "receipt_id": "rcpt_3550cebf53dbc66a554977e8", "...": "..." },
    "disclosure": { "salt": "q3J…", "output_token_ids": [785, 2326, 6028, "…"] }
  }
}
# response header:  Idemcore-Receipt-Id: rcpt_3550cebf53dbc66a554977e8

Request fieldsCác trường của request

FieldTrườngNotesGhi chú
modelRequired. A model id from GET /v1/models.Bắt buộc. Một model id từ GET /v1/models.
messagesRequired. 1–64 messages, each {{role, content}} with role system, user or assistant and string content; up to 32,000 characters in total.Bắt buộc. 1–64 message, mỗi message là {{role, content}} với role system, user hoặc assistant và content dạng chuỗi; tổng cộng tối đa 32.000 ký tự.
max_tokens1–512, default 64. max_completion_tokens is also accepted.1–512, mặc định 64. Cũng chấp nhận max_completion_tokens.
temperatureOmit it or send 0. Decoding is greedy in this version; other values are rejected.Bỏ trống hoặc gửi 0. Phiên bản này giải mã greedy; giá trị khác bị từ chối.
stream, nStreaming is not supported yet. n must be 1.Chưa hỗ trợ streaming. n phải bằng 1.
idemcore.privacyOptional: "hash_only" (default) or "full". See privacy modes.Tùy chọn: "hash_only" (mặc định) hoặc "full". Xem chế độ riêng tư.

Receipt objectĐối tượng receipt

A receipt is a small signed JSON object (format r1). It commits to which model and engine build produced the answer, which input and output were involved, and a digest of the run’s per-position hash log. It does not contain your prompt or the answer text.Receipt là một đối tượng JSON nhỏ có chữ ký (định dạng r1). Nó cam kết mô hình và bản build engine nào đã tạo ra câu trả lời, đầu vào và đầu ra nào liên quan, cùng một digest của log hash theo từng vị trí của lượt chạy. Receipt không chứa prompt hay nội dung câu trả lời của bạn.

{
  "receipt_version": "r1",
  "receipt_id": "rcpt_3550cebf53dbc66a554977e8",
  "issued_at": "2026-10-31T07:46:05.758Z",
  "tenant_id": "857588f4-…",
  "model_id": "MODEL_ID",
  "weights_hash": "9f923a5b…",            // SHA-256 of the model weights
  "kernel_version": "…",                  // engine identifier
  "engine_build": "b8faf4f5…",            // SHA-256 of the engine build
  "privacy": "hash_only",
  "prompt_hash": "3dff8f72…",             // salted commitment, not the prompt
  "params_hash": "d72a6d7e…",
  "seed": 0,
  "decoding": "greedy",
  "prompt_tokens": 38,
  "output_tokens": 16,
  "output_token_hash": "2b0654b1…",       // salted commitment, not the output
  "chain_digest": "3b1d1d9e…",            // digest of the per-position hash log
  "chain_fnv": "4a387c09…",               // compatibility digest
  "log_ref": "idemcore://logs/rcpt_3550cebf53dbc66a554977e8",
  "finish_reason": "stop",
  "key_id": "ed25519:…",
  "signature": "…"                        // Ed25519, base64url
}
  • Commitments (prompt_hash, output_token_hash, params_hash) and the chain digest are SHA-256 based. The signature is Ed25519 over the canonical JSON of the receipt without signature.Các cam kết (prompt_hash, output_token_hash, params_hash) và chain digest dựa trên SHA-256. Chữ ký là Ed25519 trên JSON chuẩn hóa của receipt khi bỏ trường signature.
  • finish_reason (stop or length) and request_id are optional. Any field not listed in the spec makes a receipt invalid.finish_reason (stop hoặc length) và request_id là tùy chọn. Trường nào không có trong đặc tả sẽ làm receipt không hợp lệ.
  • Receipts contain no floating-point numbers and are safe to store, forward or publish.Receipt không chứa số thực dấu phẩy động và có thể lưu, chuyển tiếp hoặc công khai an toàn.

Privacy modesChế độ riêng tư

ModeChế độWhat we storeChúng tôi lưu gìWhat you get backBạn nhận lại gì
hash_only (default)(mặc định)The receipt, the run’s hash log (hash values only) and audit events. Never the prompt or answer text.Receipt, log hash của lượt chạy (chỉ giá trị hash) và sự kiện kiểm toán. Không bao giờ lưu nội dung prompt hay câu trả lời.idemcore.disclosure: a random 32-byte salt and the output token ids. We do not keep the salt, so only you can later prove what the prompt and output were.idemcore.disclosure: một salt ngẫu nhiên 32 byte và các token id của đầu ra. Chúng tôi không giữ salt, nên chỉ bạn mới có thể chứng minh sau này prompt và đầu ra là gì.
fullEverything above plus the messages, output token ids, output text and parameters, so replay can run server-side without you resending anything.Mọi thứ ở trên, cộng thêm message, token id đầu ra, nội dung đầu ra và tham số, để có thể phát lại phía server mà bạn không cần gửi lại gì.The receipt only (no salt is used).Chỉ receipt (không dùng salt).

Set "idemcore": {{"privacy": "full"}} on a request to opt in, or ask us to change your organisation’s default.Gửi "idemcore": {{"privacy": "full"}} trong request để chọn chế độ này, hoặc yêu cầu chúng tôi đổi mặc định cho tổ chức của bạn.

Verify a receiptKiểm chứng receipt

POST/v1/receipts/verify Body: receipt (required), optional log_text (a hash log you hold; otherwise the stored log is used when the receipt is yours), and optional disclosure with salt plus messages and/or output_token_ids.Body: receipt (bắt buộc), tùy chọn log_text (log hash bạn đang giữ; nếu không gửi, hệ thống dùng log đã lưu khi receipt thuộc về bạn), và tùy chọn disclosure gồm salt cùng messages và/hoặc output_token_ids.

curl https://api.idemcore.net/v1/receipts/verify \
  -H "Authorization: Bearer $IDEMCORE_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<'JSON'
{
  "receipt": { "receipt_version": "r1", "receipt_id": "rcpt_…", "...": "..." },
  "disclosure": {
    "messages": [{"role": "user", "content": "Name the three primary colours."}],
    "salt": "q3J…",
    "output_token_ids": [785, 2326, 6028]
  }
}
JSON
{
  "ok": true,
  "levels": {
    "L1": { "level": "L1", "ok": true, "errors": [] },
    "L2": { "level": "L2", "ok": true, "errors": [], "log_source": "stored" },
    "disclosure": { "level": "disclosure", "ok": true, "errors": [] }
  }
}

ok is true only if every level that ran passed. Each level lists its errors when it fails.ok chỉ đúng khi mọi mức đã chạy đều đạt. Mức nào không đạt sẽ liệt kê errors.

Verification levelsCác mức kiểm chứng

LevelMứcWhat is checkedKiểm tra gìNeedsCần có
L1 · signaturechữ kýThe receipt is well-formed and its Ed25519 signature matches a published Idemcore signing key.Receipt đúng định dạng và chữ ký Ed25519 khớp với một khóa ký Idemcore đã công bố.The receiptReceipt
L2 · chainchuỗiThe chain digests are recomputed from the run’s hash log and must match the receipt; the log must cover exactly the prompt and output positions.Chain digest được tính lại từ log hash của lượt chạy và phải khớp với receipt; log phải phủ đúng số vị trí của prompt và đầu ra.The receipt + the stored log or a log you supplyReceipt + log đã lưu hoặc log bạn cung cấp
DisclosureDisclosureYour messages and/or output token ids match the salted commitments in the receipt.Message và/hoặc token id đầu ra của bạn khớp với các cam kết có salt trong receipt.The salt from the original responseSalt từ response gốc
L3 · replayphát lạiThe same model is re-run on a different engine build and must produce the same chain digest, bit for bit.Cùng mô hình được chạy lại trên một bản build engine khác và phải cho ra cùng chain digest, giống hệt từng bit./v1/receipts/replay/v1/receipts/replay

Replay (L3)Phát lại (L3)

POST/v1/receipts/replay Re-runs one of your receipts on a different engine build and compares the chain digest. For hash_only receipts send receipt_id, messages and salt (and the output_token_ids from the disclosure); the disclosure is checked first. For full receipts receipt_id is enough. Replay is slower than verify and shares the chat rate limit.Chạy lại một receipt của bạn trên bản build engine khác và so sánh chain digest. Với receipt hash_only, gửi receipt_id, messages và salt (cùng output_token_ids từ disclosure); disclosure được kiểm trước. Với receipt full, chỉ cần receipt_id. Phát lại chậm hơn kiểm chứng và dùng chung giới hạn tần suất với chat.

curl https://api.idemcore.net/v1/receipts/replay \
  -H "Authorization: Bearer $IDEMCORE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "receipt_id": "rcpt_3550cebf53dbc66a554977e8",
    "messages": [{"role": "user", "content": "Name the three primary colours."}],
    "salt": "q3J…",
    "output_token_ids": [785, 2326, 6028]
  }'
{
  "ok": true,
  "level": "L3",
  "errors": [],
  "mode": "…",
  "replay_build": "alt",
  "replay_engine_build": "…",
  "receipt_engine_build": "b8faf4f5…",
  "chain_digest_expected": "3b1d1d9e…",
  "chain_digest_replayed": "3b1d1d9e…"
}

Audit exportXuất log kiểm toán

GET/v1/audit/export Returns NDJSON: a header line, your receipts, your audit events and one signed root per day. Every issuance, verification, replay, export and key creation is appended to a hash-chained, append-only event log. Each daily root is a Merkle root over that day’s events, signed with Ed25519. Parameters since and until are dates (YYYY-MM-DD, UTC), at most 31 days apart; by default the window runs from yesterday to tomorrow. The same parameters work as a JSON body with POST.Trả về NDJSON: một dòng header, các receipt, các sự kiện kiểm toán và mỗi ngày một gốc có chữ ký. Mọi lần cấp receipt, kiểm chứng, phát lại, xuất log và tạo key đều được ghi thêm vào một log sự kiện nối chuỗi hash, chỉ ghi thêm (append-only). Mỗi gốc theo ngày là Merkle root của các sự kiện trong ngày đó, ký bằng Ed25519. Tham số since và until là ngày (YYYY-MM-DD, UTC), cách nhau tối đa 31 ngày; mặc định từ hôm qua tới ngày mai. Có thể gửi cùng tham số dưới dạng JSON body bằng POST.

curl "https://api.idemcore.net/v1/audit/export?since=2026-10-01&until=2026-10-31" \
  -H "Authorization: Bearer $IDEMCORE_API_KEY" \
  -o idemcore-audit.ndjson
{"type":"header","format":"idemcore-audit-export/r1","since":"2026-10-01","until":"2026-10-31","receipts":42,"events":97,"chain_check":"ok",…}
{"type":"receipt","receipt":{…}}
{"type":"event","event":{"seq":1,"event_type":"receipt.issued","receipt_id":"rcpt_…","prev_hash":"000…","event_hash":"…",…}}
{"type":"root","root":{"day":"2026-10-30","merkle_root":"…","signature":"…",…}}

Other endpointsEndpoint khác

  • GET/v1/receipts/{id} returns {{"receipt": …}} for a receipt id (rcpt_ + 24 hex) owned by your organisation; /log returns its hash log.trả về {{"receipt": …}} cho một receipt id (rcpt_ + 24 ký tự hex) thuộc tổ chức của bạn; /log trả về log hash của nó.
  • GET/v1/models lists model ids in OpenAI format.liệt kê model id theo định dạng OpenAI.
  • GET/v1/keys returns the receipt-signing public keys as Ed25519 JWKs with their kid, so you can check signatures offline.trả về các khóa công khai ký receipt dưới dạng JWK Ed25519 kèm kid, để bạn kiểm chữ ký ngoại tuyến.

Python and JavaScriptPython và JavaScript

Python (requests)

import os, requests

API = "https://api.idemcore.net"
H = {"Authorization": f"Bearer {os.environ['IDEMCORE_API_KEY']}"}

r = requests.post(f"{API}/v1/chat/completions", headers=H, timeout=60, json={
    "model": "MODEL_ID",
    "messages": [{"role": "user", "content": "Name the three primary colours."}],
    "max_tokens": 64,
})
r.raise_for_status()
res = r.json()
print(res["choices"][0]["message"]["content"])

receipt = res["idemcore"]["receipt"]          # safe to store and share
disclosure = res["idemcore"]["disclosure"]    # keep private: salt + output token ids

v = requests.post(f"{API}/v1/receipts/verify", headers=H, timeout=30,
                  json={"receipt": receipt}).json()
print(v["ok"], {name: lvl["ok"] for name, lvl in v["levels"].items()})

Python (OpenAI SDK, compatibility mode)Python (OpenAI SDK, chế độ tương thích) BetaBeta

from openai import OpenAI   # OpenAI-compatible client, pointed at Idemcore

client = OpenAI(base_url="https://api.idemcore.net/v1",
                api_key=os.environ["IDEMCORE_API_KEY"])
resp = client.chat.completions.create(
    model="MODEL_ID",
    messages=[{"role": "user", "content": "Name the three primary colours."}],
    temperature=0, max_tokens=64,
)
receipt = resp.model_extra["idemcore"]["receipt"]

JavaScript (fetch)

// Node 18+ or any runtime with fetch. Call from your server: browser CORS is limited.
const API = "https://api.idemcore.net";
const H = { "Authorization": `Bearer ${process.env.IDEMCORE_API_KEY}`,
            "Content-Type": "application/json" };

const res = await fetch(`${API}/v1/chat/completions`, {
  method: "POST", headers: H,
  body: JSON.stringify({
    model: "MODEL_ID",
    messages: [{ role: "user", content: "Name the three primary colours." }],
    max_tokens: 64,
  }),
}).then((r) => r.json());

const { receipt, disclosure } = res.idemcore;
const check = await fetch(`${API}/v1/receipts/verify`, {
  method: "POST", headers: H, body: JSON.stringify({ receipt }),
}).then((r) => r.json());
console.log(check.ok, check.levels);

ErrorsLỗi

Errors use one shape, with deliberately generic messages:Lỗi có chung một cấu trúc, với thông báo cố ý ở mức chung chung:

{ "error": { "type": "invalid_request_error",
             "message": "only greedy decoding (temperature 0) is supported in this preview" } }
HTTPtypeTypical causeNguyên nhân thường gặp
400invalid_request_errorBad JSON or field, temperature > 0, stream, max_tokens out of range, unknown modelJSON hoặc trường sai, temperature > 0, stream, max_tokens ngoài khoảng, model không tồn tại
401authentication_errorMissing or invalid API keyThiếu hoặc sai API key
403permission_errorThe key lacks the scope for this endpointKey không có quyền cho endpoint này
404not_found_errorUnknown endpoint, or a receipt that is not yoursEndpoint không tồn tại, hoặc receipt không thuộc về bạn
409invalid_request_errorStored payload missing for a full-mode replayThiếu dữ liệu đã lưu khi phát lại receipt chế độ full
413 / 415invalid_request_errorBody over 256 KB / Content-Type is not JSONBody quá 256 KB / Content-Type không phải JSON
429rate_limit_errorRate limit exceeded; retry laterVượt giới hạn tần suất; thử lại sau
500server_errorUnexpected error on our sideLỗi không mong muốn phía chúng tôi
503service_unavailableInference backend temporarily unavailableHệ thống suy luận tạm thời không sẵn sàng

Rate limitsGiới hạn tần suất

LimitGiới hạnApplies toÁp dụng cho
20 requests / minute per key20 request / phút mỗi key/v1/chat/completions, /v1/receipts/replay
120 requests / minute per key120 request / phút mỗi keyVerify, receipts, audit export, models, keysKiểm chứng, receipt, xuất log kiểm toán, models, keys
120 requests / minute per IP address120 request / phút mỗi địa chỉ IPAll requests, checked before the keyMọi request, kiểm trước khi xét key

Beta limits; pilots can ask for higher ones. A 429 means wait and retry with backoff.Đây là giới hạn trong giai đoạn beta; khách thí điểm có thể yêu cầu nâng. Lỗi 429 nghĩa là hãy chờ rồi thử lại với backoff.

SDK, MCP plugin and browser extensionSDK, MCP plugin và tiện ích trình duyệt

Python SDK and CLIPython SDK và CLI Coming soonSắp ra mắtA small client and command-line verifier for receipts and audit exports. Until it ships, use the HTTP API above.Client nhỏ và công cụ dòng lệnh kiểm chứng receipt và file xuất kiểm toán. Trước khi phát hành, hãy dùng HTTP API ở trên.
MCP pluginMCP plugin Coming soonSắp ra mắtLets AI assistants that support the Model Context Protocol request answers with receipts and verify them.Cho phép các trợ lý AI hỗ trợ Model Context Protocol yêu cầu câu trả lời kèm receipt và kiểm chứng chúng.
Browser extensionTiện ích trình duyệt Coming soonSắp ra mắtChecks a receipt’s signature in your browser, locally, without sending data anywhere. See the privacy policy.Kiểm chữ ký của receipt ngay trong trình duyệt, cục bộ, không gửi dữ liệu đi đâu. Xem chính sách quyền riêng tư.

Questions about the API: Câu hỏi về API: [email protected]. Security reports: Báo cáo bảo mật: [email protected].