open-standards/mesh/mesh-rs/Cargo.toml
Transaction Science c1f316b28d mesh-openai: OpenAI-compatible API ingest
Every serving stack (vLLM, TGI, Ollama, llama.cpp server) and client SDK
speaks the OpenAI /v1/chat/completions wire format. Mesh's value is
orthogonal — serving under a joule ceiling + fidelity floor, sealing a
µJ-per-accepted-token receipt — but it has to meet the ecosystem on that
wire. New mesh-openai crate is the bridge:

- to_serve_request: OpenAI chat-completion -> Mesh ServeRequest. messages
  flattened to a content-addressed prompt hash; model + optional
  metadata.fidelity_floor -> fidelity floor; metadata.joule_ceiling_uj ->
  the ceiling (caller default otherwise). Returns the prompt text too,
  since the engine needs it while ServeRequest keeps only the hash.
- chat_completion_response: builds the OpenAI response, with energy in
  usage.energy {uj, uj_per_accepted_token, provenance} — the dimension
  OpenAI's usage block has no field for.
- fidelity_for_model heuristic (frontier->F4, mini/nano->F2, ...).

Ingest, not compete: OpenAI is the surface; Mesh adds the metered receipt.
Token counts are the engine tokenizer's job; an explicit ~chars/4 estimate
stands in only where a request omits them. 5 tests green, clippy clean.
Deps: mesh-schema + serde_json.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-25 21:35:19 -04:00

47 lines
1.5 KiB
TOML

[workspace]
resolver = "2"
members = [
"crates/mesh-schema",
"crates/mesh-meter",
"crates/mesh-receipt",
"crates/mesh-engine",
"crates/mesh-engine-gguf",
"crates/mesh-router",
"crates/mesh-core",
"crates/mesh-openai",
"crates/mesh-conformance",
]
[workspace.package]
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/transaction-science/open-standards"
rust-version = "1.85"
[workspace.dependencies]
# Mesh crates
mesh-schema = { path = "crates/mesh-schema" }
mesh-meter = { path = "crates/mesh-meter" }
mesh-receipt = { path = "crates/mesh-receipt" }
mesh-engine = { path = "crates/mesh-engine" }
mesh-router = { path = "crates/mesh-router" }
mesh-core = { path = "crates/mesh-core" }
# Family standards Mesh rides on (cross-workspace path deps).
jcp-schema = { path = "../../jcp/jcp-rs/crates/jcp-schema" }
jcp-grant = { path = "../../jcp/jcp-rs/crates/jcp-grant" }
# Optional: the family's honest energy meter (RAPL / NVML / Apple), behind `hw-meter`.
jouleclaw-energy = { path = "../../jouleclaw/jouleclaw-rs/crates/jouleclaw-energy" }
# Optional: the family's pure-Rust GGUF/Metal inference substrate, behind `gguf`.
jouleclaw-loader-gguf = { path = "../../jouleclaw/jouleclaw-rs/crates/jouleclaw-loader-gguf" }
# Shared third-party pins (match the family).
ed25519-dalek = { version = "2", features = ["rand_core"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
hex = "0.4"
[workspace.lints.clippy]
all = "warn"