
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@peac/adapter-openai-compatible
Advanced tools
OpenAI-compatible chat completion adapter for PEAC interaction evidence (hash-first)
OpenAI-compatible chat completion adapter for PEAC interaction evidence using a hash-first model.
pnpm add @peac/adapter-openai-compatible
@peac/adapter-openai-compatible maps chat completion responses from any OpenAI-compatible provider into PEAC interaction evidence. It uses a hash-first model: only SHA-256 digests of messages and output are recorded, along with model identifiers, token counts, and timing metadata. No raw prompt or completion text ever appears in the evidence structure. Works with OpenAI, Anthropic (via adapter), Ollama, vLLM, Together, and any other OpenAI-compatible provider without importing their SDKs.
import { fromChatCompletion } from '@peac/adapter-openai-compatible';
const evidence = await fromChatCompletion({
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'What is 2+2?' },
],
completion: {
id: 'chatcmpl-abc123',
object: 'chat.completion',
created: 1709251200,
model: 'gpt-4',
choices: [
{
index: 0,
message: { role: 'assistant', content: 'The answer is 4.' },
finish_reason: 'stop',
},
],
usage: { prompt_tokens: 20, completion_tokens: 5, total_tokens: 25 },
},
provider: 'openai',
});
// evidence.input.digest -> SHA-256 of canonicalized messages (no raw text)
// evidence.output.digest -> SHA-256 of output content (no raw text)
// evidence.extensions -> model, usage, finish_reason
import { hashMessages, hashOutput } from '@peac/adapter-openai-compatible';
const inputHash = await hashMessages([{ role: 'user', content: 'Hello' }]);
// 'sha256:...'
const outputHash = await hashOutput('The answer is 4.');
// 'sha256:...'
@peac/kernel (Layer 0): Wire constants and types@peac/schema (Layer 1): Interaction evidence schemas@peac/protocol (Layer 3): Receipt issuance with mapped inference evidenceIf you are building an AI agent or service that calls OpenAI-compatible LLM APIs:
fromChatCompletion() after each API call to produce signed evidence of the interactionprovider to tag evidence with the source platformApache-2.0
PEAC Protocol is an open source project stewarded by Originary and community contributors.
FAQs
OpenAI-compatible chat completion adapter for PEAC interaction evidence (hash-first)
The npm package @peac/adapter-openai-compatible receives a total of 77 weekly downloads. As such, @peac/adapter-openai-compatible popularity was classified as not popular.
We found that @peac/adapter-openai-compatible demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.