1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//! Codex Convert Proxy Library
//!
//! A library for converting between OpenAI Responses API (used by Codex)
//! and Chat Completions API (used by Chinese LLM providers).
//!
//! # Overview
//!
//! Codex 0.118+ only supports the Responses API, but Chinese LLM providers
//! (GLM, Kimi, DeepSeek, MiniMax) only support the Chat Completions API.
//! This library provides bidirectional conversion between these formats.
//!
//! # Features
//!
//! - `lib`: Provider trait + implementations + conversion + types (for embedding
//! the conversion logic in other Rust applications)
//! - `server` (default): Full Pingora-based proxy binary (implies `lib`, adds
//! config parsing, the HTTP server, CLI, and logging)
//! - `telemetry`: OpenTelemetry tracing/metrics exporters
//!
//! # Usage (as library)
//!
//! ```ignore
//! use codex_convert_proxy::{
//! response_to_chat, chat_to_response, chat_to_response_with_context,
//! chat_chunk_to_response_events, event_to_sse,
//! Provider, GLMProvider, create_provider,
//! StreamState, ResponseRequestContext, ResponseStreamEvent,
//! types::response_api::{ResponseRequest, InputItemOrString},
//! util::parse_sse,
//! };
//! ```
//!
//! # Providers
//!
//! Each Chinese LLM provider may have slightly different API requirements.
//! Use the appropriate provider when converting:
//!
//! - [`GLMProvider`] - For Zhipu AI GLM models
//! - [`KimiProvider`] - For Moonshot AI Kimi models
//! - [`DeepSeekProvider`] - For DeepSeek models
//! - [`MiniMaxProvider`] - For MiniMax models
//! - [`DefaultProvider`] - Generic fallback for any OpenAI-compatible provider
//! (used automatically by [`create_provider`] when the provider name is
//! not in the built-in registry)
// Core modules (always available)
// Conversion modules (require the `lib` feature for the Provider trait)
// Re-export main types
pub use ;
pub use *;
// Re-export convert functions (requires the `lib` feature)
pub use ;
// Re-export streaming types for library consumers
pub use ResponseRequestContext;
pub use ;
// Re-export stats
pub use ;
// Providers module (`lib` feature)
pub use ;
// Config module (`server` feature - parsing backend definitions)
pub use ;
// Server functionality (server feature - Pingora proxy)
pub use CodexProxy;
// CLI binary support (full feature implies binary)
pub use ;
// Logging (server/binary feature - requires tracing-subscriber and tracing-appender)
// Telemetry (`telemetry` feature)
pub use TelemetryConfig;