gproxy-protocol
Wire-format types and endpoint metadata for the OpenAI, Anthropic Claude, and Google Gemini APIs.
gproxy-protocol is the protocol layer used by
GPROXY. It provides serializable request,
response, streaming-event, and shared operation types without coupling them to
an HTTP client or server implementation. Dependencies are serde, serde_json,
and http — nothing else, and it builds for wasm32.
Usage
[]
= "=2.3.2"
use ;
let key = content_generation;
assert_eq!;
// Method + path for this operation against the target provider.
let target = request_target?;
Layout
gproxy_protocol::openai— chat completions, responses, embeddings, images, models, conversations, compaction.gproxy_protocol::claude— messages, count tokens, models.gproxy_protocol::gemini— generateContent, embeddings, caching, batch, count tokens, models.- Root re-exports — the shared taxonomy:
Provider,Operation,OperationGroup,OperationKind,ContentGenerationKind,OperationKey, plusEndpoint/HttpMethod/request_targetendpoint metadata.
These modules model provider wire shapes only. Conversion between them lives
in gproxy-transform.
Compatibility
The crate version tracks the GPROXY release it ships with, so a minor bump can
carry additive wire-type changes. Public wire structs and enums are
#[non_exhaustive]: construct named structs through their generated
Type::builder() or the gproxy_protocol::wire! helper, and include a wildcard
arm when matching enums. Lockstep GPROXY crates use exact dependency versions;
downstreams that combine protocol and transform should pin the same exact
version as well.
OperationKey protects the operation/kind invariant. Its fields are private;
read them with operation() / kind() and construct keys with
content_generation, provider, or checked try_new.
request_target accepts a raw model id, encodes it as one path/query component,
and returns a structured error for inconsistent or unsupported combinations.
License
Licensed under the MIT License.