Skip to content

feat: integrate gonka.ai decentralized inference (gateway-first, native follow-up) #3602

@bug-ops

Description

@bug-ops

Summary

Integrate gonka.ai, a decentralized AI inference network on a Cosmos-SDK chain that routes LLM requests to a peer-to-peer pool of GPU operators. Two access paths, shipped in two phases:

Phase Path Auth Onboarding Code impact
1 (MVP) GonkaGate (https://api.gonkagate.com/v1) Bearer gp-... Sign up at gonkagate.com, top up USD Zero new Rust code — reuse existing CompatibleProvider
2 (follow-up) Native gonka network (node1/2/3.gonka.ai) ECDSA-signed headers per request inferenced CLI for keys + GNK staking New GonkaProvider in zeph-llm

Phase 1 — GonkaGate (MVP)

CompatibleProvider already speaks OpenAI Chat Completions. Phase 1 is wizard + config + docs only:

  • Wizard option "Gonka (decentralized — via GonkaGate)" pre-fills name = "gonkagate", base_url = "https://api.gonkagate.com/v1"
  • Vault key: ZEPH_COMPATIBLE_GONKAGATE_API_KEY (existing convention)
  • Docs page, default.toml template, spec entry, playbook, coverage-status row

Phase 2 — Native gonka transport

New module crates/zeph-llm/src/gonka/:

  • RequestSigner — ECDSA over secp256k1 via k256 crate, bech32 address derivation
  • EndpointPool — round-robin over node URLs with fail-skip
  • GonkaProvider — wraps OpenAiProvider for body building / response decoding, owns its own signed reqwest send path
  • Headers per request: Authorization (base64 ECDSA sig), X-Requester-Address (bech32), X-Timestamp (nanoseconds)
  • Signature input: payload_hash_hex || timestamp_ns_str || transfer_address, then sha256 then sign
  • Wallet generation stays out of zeph — user runs inferenced keys add and zeph imports the exported private key into the age vault
  • New vault keys: ZEPH_GONKA_PRIVATE_KEY, ZEPH_GONKA_ADDRESS

Strategy decisions (recorded)

  • Gateway-first: Phase 1 ships as MVP; Phase 2 lands in a follow-up minor release.
  • Hybrid wallet: reuse inferenced CLI for key generation (no Cosmos wallet code in zeph for now).
  • Issue layout: epic + child issues, one PR per issue, < 30 min review each.

Child issues

Phase 1 — Gateway MVP (release blockers)

Phase 2 — Native transport (release blockers)

Phase 2 — Follow-up (next minor release)

Sequencing

Phase 1:  #3603 (parallel) → #3604 → #3605 → #3606 → release
Phase 2:  (#3607 + #3609 + #3610 in parallel) → #3608 → #3611 → #3612 → #3613 → release
Follow-up: #3614 → next minor release

Epic-level acceptance

A fresh user runs zeph init, picks Gonka (gateway), pastes a gp-... API key, and gets a chat reply on the first prompt within 5 minutes. Phase 2 acceptance: a user with inferenced installed runs the wizard's "native" branch and gets a chat reply against node1.gonka.ai.

Reference

Risks

  1. Signature scheme drift (High) — Python reference may use hybrid_timestamp_ns(); live testnet probe gates issue feat(zeph-llm): RequestSigner with k256 + bech32 + Python-derived fixtures #3609 merge.
  2. Body canonicalisation (Medium) — sign byte-identity via reqwest::body(Vec<u8>); fixture tests cover Unicode + nested JSON.
  3. Clock skew (Medium) — CI VMs drift; doctor subcommand checks NTP.
  4. inferenced CLI breaking changes (Medium) — pin MIN_INFERENCED_VERSION.
  5. Testnet bech32 prefix (Low) — gonka_chain_prefix config field exposed.

Out of scope

  • Native Rust Cosmos wallet (BIP39/BIP32). Use inferenced externally.
  • GNK token purchase / faucet integration.
  • Multi-account support per process.
  • Vision input (gonka catalog is text-only at launch).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepicMilestone-level tracking issuellmzeph-llm crate (Ollama, Claude)size/LLarge PR (201-500 lines)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions