Skip to content

feat(zeph-llm): GonkaProvider chat/chat_stream/embed via signed transport (#3611)#3622

Merged
bug-ops merged 1 commit intomainfrom
gonka-provider-chat-stream-embed
May 5, 2026
Merged

feat(zeph-llm): GonkaProvider chat/chat_stream/embed via signed transport (#3611)#3622
bug-ops merged 1 commit intomainfrom
gonka-provider-chat-stream-embed

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 5, 2026

Summary

  • Add GonkaProvider implementing LlmProvider::chat, chat_stream, embed, embed_batch over secp256k1-signed HTTP
  • Body construction delegates to an inner OpenAiProvider; each request is signed with a fresh nanosecond timestamp and routed through EndpointPool with automatic mark-failed cooldown on errors
  • Streaming reuses openai_sse_to_stream after the signed POST
  • Add EndpointPool::next_indexed() for correct per-slot mark-failed in retry loops
  • Wrap key_bytes in Zeroizing<Vec<u8>> in RequestSigner::from_hex to zero intermediate heap allocation
  • 10 wiremock integration tests: chat, streaming, embed, embed_batch, retry, exhaustion, context-length 400, timestamp freshness on retry

Tool-calling (chat_with_tools, chat_typed) deferred to #3612.

Test plan

  • cargo nextest run -p zeph-llm --features "zeph-llm/gonka" --config-file .github/nextest.toml — all 33 gonka tests pass
  • cargo nextest run --workspace --features full --lib --bins --config-file .github/nextest.toml — 9269 tests pass
  • cargo clippy --workspace --features full -- -D warnings — clean
  • cargo +nightly fmt --check — clean

Closes #3611
Part of epic #3602

…ransport (#3611)

Implement GonkaProvider covering the non-tools subset of LlmProvider:
chat, chat_stream, embed, and embed_batch over a secp256k1-signed
request loop across an EndpointPool.

- Add crates/zeph-llm/src/gonka/provider.rs with GonkaProvider:
  body constructed via OpenAI-compatible serialisation, signed per-request
  with fresh nanosecond timestamp, endpoint rotation with mark-failed
  cooldown on HTTP errors, streaming via openai_sse_to_stream
- Add crates/zeph-llm/src/gonka/tests.rs with 10 wiremock integration
  tests covering chat, streaming, embed, embed_batch, retry, exhaustion,
  400/context-length, timestamp freshness on retry
- Extend EndpointPool with next_indexed() for correct per-slot mark-failed
- Make now_ns() pub(crate) to avoid timestamp duplication in provider
- Wrap key_bytes in Zeroizing<Vec<u8>> in RequestSigner::from_hex to
  zero intermediate heap allocation holding the raw private key
- Add zeroize as optional dep under gonka feature in zeph-llm

Closes #3611
@github-actions github-actions Bot added documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes dependencies Dependency updates enhancement New feature or request size/XL Extra large PR (500+ lines) labels May 5, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 5, 2026 22:34
@bug-ops bug-ops merged commit a0f1a76 into main May 5, 2026
32 checks passed
@bug-ops bug-ops deleted the gonka-provider-chat-stream-embed branch May 5, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(zeph-llm): GonkaProvider chat / chat_stream / embed (signed transport)

1 participant