GitHub Try Ginie →
SDK & Self-Hosting

Python SDK

bash
pip install ginie

Full SDK reference

python
from ginie import GinieClient

client = GinieClient(api_key="your-key")

# Deploy a contract from a prompt
result = client.deploy(
    prompt="Create a bond with issuer Alice, holder Bob, £50,000 principal",
    ledger="ginienet",   # ginienet | localnet | mainnet
    llm="claude"         # claude | gpt4o | gemini | ginie1
)
result.contract_id      # str  — Canton Contract ID
result.cantonscan_url   # str  — CantonScan verification link
result.daml_source      # str  — full .daml source
result.audit_report     # dict — 5-gate findings
result.dar_path         # str  — path to compiled .dar file
result.job_id           # str  — for iteration
python — iterate
# Iterate on an existing contract
v2 = client.iterate(
    job_id=result.job_id,
    prompt="Add an early redemption choice callable by Alice only"
)

# Audit only — no deployment
audit = client.audit(daml_source=result.daml_source)
audit.gates             # list[GateFinding]
audit.critical_count    # int — number of CRITICAL findings
audit.passed            # bool — True if no CRITICALs

Selecting the LLM

The pipeline is model-agnostic. Claude Sonnet is the default — it produces the highest first-pass Daml compile rates in Ginie's production benchmark. You can switch to GPT-4o, Gemini 2.5 Flash, or (from M4) Ginie-1 using the llm parameter.

LLMKeyCompile rateNotes
Claude SonnetclaudeHighest (default)Best first-pass compile rate in production
GPT-4ogpt4oHighGood alternative, slightly higher cost
Gemini 2.5 FlashgeminiMedium-HighFastest, best for rapid iteration
Ginie-1ginie1≥95% targetAir-gapped, M4 release

Environment variables

VariableRequiredDescription
GINIE_API_KEYYes (cloud)Your Ginie API key — alternative to passing api_key in code
ANTHROPIC_API_KEYSelf-hostedClaude API key for self-hosted deployments using Claude
CANTON_LEDGER_HOSTSelf-hostedOverride the Canton participant node endpoint
SDK & Self-Hosting

Self-Hosting

Ginie is open-source (Apache 2.0) and self-hostable. Run the full pipeline on your own infrastructure using Docker — ideal for regulated environments, private networks, or custom Canton node deployments.

bash
# Clone the repo
git clone https://github.com/BlockX-AI/Canton_Ginie
cd Canton_Ginie

# Configure environment
cp .env.example .env.ginie
# Edit .env.ginie — set ANTHROPIC_API_KEY, CANTON_LEDGER_HOST, POSTGRES_URL

# Start all services
docker-compose up -d
# API   → http://localhost:8000
# Canton LocalNet → localhost:6865

Services

ServicePortDescription
ginie-api8000FastAPI backend — REST API and job queue (Celery)
canton-sandbox6865Canton LocalNet — full Daml Ledger API endpoint
postgres5432Job history, party registry, deployed contract log
redis6379Celery job queue and session state cache

Required environment variables

VariableExampleNotes
ANTHROPIC_API_KEYsk-ant-…Required if using Claude as the LLM
CANTON_LEDGER_HOSTlocalhost:6865Canton participant node gRPC endpoint
POSTGRES_URLpostgres://ginie:pass@postgres:5432/ginieJob and party storage
REDIS_URLredis://redis:6379Celery broker URL
SECRET_KEYrandom 32-byte hexFastAPI session signing key
💡
Canton SDK inside Docker
The ginie-api Docker image ships with Canton SDK 3.4 and dpm pre-installed. No additional SDK setup is needed when running via docker-compose.
SDK & Self-Hosting

Ginie-1 (Air-Gapped)

Ginie-1 is a Canton-native open-weight language model, fine-tuned on Daml with RLCF using real Canton compiler feedback as the reward signal. Available from M4.

🔷
Who Ginie-1 is for
Ginie-1 is for regulated institutions — banks, asset managers, infrastructure providers — who cannot route financial contract specifications through an external API. Ginie-1 runs fully air-gapped: no network call, no data leaving your infrastructure, no third-party LLM dependency.
AttributeValue
Base modelMistral 7B or Qwen 2.5-Coder (configurable)
TrainingSFT 3-epoch + 5-round RLCF on Canton compiler feedback
Target accuracy≥95% first-pass compile rate on ginie-eval benchmark
Runtime formatGGUF / ONNX — CPU inference, no GPU required
DeploymentSingle Docker image — pull and run on your own server
LicenseApache 2.0 — weights published on HuggingFace
CostFree — no API key, no per-call billing after deployment
bash
# Pull and start Ginie-1
docker pull blockxai/ginie-1:latest
docker run -p 8001:8001 blockxai/ginie-1:latest

# Use Ginie-1 as the LLM in the SDK
client = GinieClient(llm="ginie1", llm_host="http://localhost:8001")

Benchmark: ginie-eval

Ginie-1 is evaluated against ginie-eval — a 50-prompt benchmark covering all 10 standard contract templates at two difficulty levels (standard and complex). Metrics reported:

  • Compile rate — percentage of first-pass compilations without Fix Agent
  • Audit pass rate — percentage passing all 5 security gates
  • Ledger correctness — percentage producing a verifiable live Contract ID
$ ginie-eval --model ginie1 --prompts 50
Running ginie-eval v1.0 against Ginie-1...
────────────────────────────────────────
Compile rate (first-pass): 96.0%
Audit pass rate:           94.0%
Ledger correctness:        92.0%
────────────────────────────────────────
Benchmark complete · 50/50 prompts processed