SDKs
The @protypa/subsidia TypeScript SDK (Gateway with proofs, Cortex, the Vérificateur, the Registre, and ask()), the official OpenAI and Anthropic SDKs, and plain fetch for everything else.
The part of the API that most developers use, the Gateway, is OpenAI and Anthropic compatible, so the official OpenAI and Anthropic SDKs work as they are, in every language they support. @protypa/subsidia adds what those SDKs cannot know about: the proof certificates (fetched and checked offline), Cortex, the Vérificateur, the Registre, and ask(), which chains them. Everything else is plain HTTP.
| You want to | Use | Language |
|---|---|---|
| Call a model, stream, use tools | The official OpenAI or Anthropic SDK pointed at the Gateway, or subsidia.gateway | Any language those SDKs support; TypeScript for @protypa/subsidia |
| Ask a question of your documents and get an answer you can prove | subsidia.ask() | TypeScript |
| Upload documents and wait until they are ready, query Cortex, read facts and health | subsidia.cortex, or fetch / requests | TypeScript, or any HTTP client |
| Fetch and verify proof certificates, run the Vérificateur, read and audit the Registre | subsidia.proofs, subsidia.verify, subsidia.registre (or @protypa/subsidia-verify alone), or HTTP | TypeScript, or any HTTP client |
| Manage agents, memory, conversations, webhooks, Reflex flows | HTTP (not yet in @protypa/subsidia) | Any |
Gateway: the OpenAI and Anthropic SDKs
Change the base URL and the key, keep everything else. To read the proof id, use the SDK's raw-response helper (withResponse() in TypeScript, with_raw_response in Python) and take the x-pulse-proof header. More on streaming, tools and Claude Code in Gateway.
import OpenAI from 'openai'
const client = new OpenAI({ baseURL: 'https://api.subsidia.protypa.fr/v1', apiKey: process.env.SUBSIDIA_API_KEY, // sk_live_...})
const { data, response } = await client.chat.completions .create({ model: 'pulse-auto', messages: [{ role: 'user', content: 'Hello' }] }) .withResponse()
console.log(data.choices[0].message.content, response.headers.get('x-pulse-proof'))The TypeScript SDK: @protypa/subsidia
@protypa/subsidia runs on the global fetch (Node 18 or later, Deno, Bun, modern browsers) and depends only on @protypa/subsidia-verify, the zero-dependency library that checks certificates offline. Install it with npm install @protypa/subsidia. It retries network errors, 408, 429 and 5xx (a POST only on 429, since it may already have been done), honours Retry-After, and throws typed errors. Point baseUrl at your own host for an on-premise install.
import { Subsidia } from '@protypa/subsidia'
const subsidia = new Subsidia({ apiKey: process.env.SUBSIDIA_API_KEY }) // sk_live_...
// Ingest, wait until it can be queriedawait subsidia.cortex.ingestAndWait({ name: 'Lease', content: 'Monthly rent: EUR 1,200.' })
// Retrieve -> answer from the passages only -> check every claim -> verify both certificates hereconst answer = await subsidia.ask({ question: 'What is the monthly rent?', revise: 1 })
answer.text // 'The monthly rent is EUR 1,200 [1].'answer.citations // [{ n: 1, source: 'Lease', page: null, content: '...' }]answer.ok // no claim unsupported or contradictedanswer.proofs // { answer, report }: certificates checked offline, bound to this exchange| Resource | What it does | Routes |
|---|---|---|
ask() | Retrieve, answer from the passages only, verify every claim, optionally rewrite what failed, prove both certificates | /v1/knowledge/query, /v1/chat/completions, /v1/verify |
gateway | chat, stream (typed chunks, the certificate known before the first token), models, agents, address(), settings for the official SDKs (openai(), anthropic()), proofFrom(headers) | /v1/chat/completions, /v1/models. See Gateway and Model addressing. |
cortex | ingestAndWait, uploadAndWait, ingestMany (bounded parallelism), query, and sources, facts, contradictions, health | /v1/knowledge-sources*, /v1/knowledge/*. See Knowledge sources, Knowledge query, Knowledge insights. |
verify | check (with your own passages or Cortex dossiers), list, iterate, get, certificate, usage, export | /v1/verify* |
registre | list, iterate, summary, export, audit | /v1/registre* |
proofs | get, publicKey, verify, assertValid, verifyChain | /v1/proofs/:id, /v1/gateway/public-key |
Errors. Everything extends SubsidiaError. HTTP failures are AuthenticationError (401), PlanLimitError (402, with the code and the details: plan feature, key budget, subscription), PermissionError (403), NotFoundError, RateLimitError (429, with retryAfterMs), BadRequestError and ServerError, all with status, code and body, so you can branch as described in Errors. Network failures are ConnectionError, TimeoutError and AbortError; every method accepts an AbortSignal.
Plain HTTP
The API is ordinary JSON over HTTPS, so a few lines of fetch or requests are enough for any route, and for any language without an SDK. A minimal typed wrapper that works for every route, including the ones the SDK does not cover yet (agents, conversations, webhooks, Reflex):
const BASE = 'https://api.subsidia.protypa.fr'
export async function subsidia<T>(method: string, path: string, body?: unknown): Promise<{ data: T; headers: Headers }> { const res = await fetch(BASE + path, { method, headers: { Authorization: 'Bearer ' + process.env.SUBSIDIA_API_KEY, ...(body ? { 'Content-Type': 'application/json' } : {}), }, body: body ? JSON.stringify(body) : undefined, }) if (!res.ok) throw Object.assign(new Error('Subsidia ' + res.status), { status: res.status, body: await res.json().catch(() => null) }) return { data: (await res.json()) as T, headers: res.headers }}
// e.g. verify a certificateconst { data } = await subsidia<{ valid: boolean }>('GET', '/v1/proofs/' + proofId + '/verify')OpenAPI
A machine-readable snapshot of the routes is served at https://dev.subsidia.protypa.fr/openapi.json. It is generated from the server and can be fed to a code generator for languages the SDK does not cover. Treat the written pages as the reference for behaviour and error handling, since a schema does not capture those.
Is there a Python or Go SDK?
Not from Subsidia. For the Gateway use the official OpenAI or Anthropic SDK in your language; for the platform APIs use requests or net/http, optionally with a client generated from the OpenAPI snapshot.
Will the OpenAI SDK break on the extra fields in responses?
No. Responses carry an additional pulse block next to the standard fields, and the SDKs ignore fields they do not know. The block holds the proof id, the provider and the number of values masked.