Quickstart

Get started with Harpocrates in minutes. This guide will walk you through making your first confidential AI inference request.

Installation (NOT LIVE YET, PLEASE DO NOT TRY)

JavaScript / TypeScript

npm install harpocrates
# or
pnpm add harpocrates
# or
yarn add harpocrates

Python

pip install harpocrates

Get Your API Key

Sign up at the Harpocrates dashboard to receive your API key. Store it securely as an environment variable:

export HARPOCRATES_API_KEY="hpc_your_api_key_here"
Never commit your API key to version control. Use environment variables or a secure secrets management system.

Your First Inference Request

JavaScript

import { Harpocrates } from "harpocrates";

const client = new Harpocrates({ 
  apiKey: process.env.HARPOCRATES_API_KEY 
});

async function main() {
  // Encrypt your sensitive prompt
  const encrypted = await client.encrypt(
    "Classify this confidential document as legal, financial, or medical."
  );

  // Perform confidential inference
  const result = await client.infer({
    model: "llm-secure-7b",
    input: encrypted
  });

  // Decrypt the response
  const output = await client.decrypt(result.output);
  console.log(output);
  
  // Verify the attestation (optional but recommended)
  const valid = await client.verifyAttestation(result.attestation);
  console.log("Attestation valid:", valid);
}

main();

Python

from harpocrates import Harpocrates
import os

client = Harpocrates(api_key=os.getenv("HARPOCRATES_API_KEY"))

# Encrypt your sensitive prompt
encrypted = client.encrypt(
    "Classify this confidential document as legal, financial, or medical."
)

# Perform confidential inference
result = client.infer(
    model="llm-secure-7b",
    input=encrypted
)

# Decrypt the response
output = client.decrypt(result.output)
print(output)

# Verify the attestation
valid = client.verify_attestation(result.attestation)
print(f"Attestation valid: {valid}")

Understanding Encryption Helpers

The SDK provides built-in encryption helpers that handle the cryptographic operations for you:

  • encrypt() - Encrypts your data before sending
  • decrypt() - Decrypts the response from the enclave
  • verifyAttestation() - Verifies the ZK proof of correct computation
Encryption keys are managed automatically by the SDK using secure key exchange protocols with the TEE enclave.

Testing on Horizen Testnet

During development, you can test against the Horizen testnet without spending real ETH:

const client = new Harpocrates({
  apiKey: process.env.HARPOCRATES_API_KEY,
  network: "testnet" // Use testnet for development
});

Get testnet ETH from the Horizen faucet to test billing and metering features.

Next Steps

Now that you've made your first request, explore these topics: