#[non_exhaustive]pub struct OpenAiCompat {
pub supports_store: bool,
pub supports_developer_role: bool,
pub supports_reasoning_effort: bool,
pub supports_thinking_control: bool,
pub supports_usage_in_streaming: bool,
pub max_tokens_field: MaxTokensField,
pub requires_tool_result_name: bool,
pub requires_assistant_after_tool_result: bool,
pub thinking_format: ThinkingFormat,
pub supports_prompt_cache_key: bool,
}Expand description
Compatibility flags for OpenAI-compatible providers. Different providers have different quirks even though they share the same base API.
Marked #[non_exhaustive]: this is the crate’s most literal instance of a
growing quirk list — every new provider difference adds a flag, and without
the attribute each one is a downstream break. Construct from a preset
(OpenAiCompat::openai, OpenAiCompat::deepseek, …) or
Default::default and adjust fields. New flags carry #[serde(default)]
so persisted configs keep deserializing.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.supports_store: boolSupports the store parameter for conversation persistence.
supports_developer_role: boolSupports developer role (system-level instructions).
supports_reasoning_effort: boolSupports reasoning_effort parameter.
supports_thinking_control: boolSupports DeepSeek-style thinking mode control.
supports_usage_in_streaming: boolIncludes usage data in streaming responses.
max_tokens_field: MaxTokensFieldWhich field name to use for max tokens.
requires_tool_result_name: boolTool results must include a name field.
requires_assistant_after_tool_result: boolMust insert an assistant message after tool results.
thinking_format: ThinkingFormatHow thinking/reasoning content is formatted in streaming.
supports_prompt_cache_key: boolAccepts OpenAI’s prompt_cache_key for routing cache lookups.
Off by default: the field is OpenAI’s, and a strict compat server that validates unknown keys would reject the whole request rather than ignore it. Providers that cache automatically (DeepSeek, Groq) lose nothing by leaving this off — they were never reading it.
Implementations§
Source§impl OpenAiCompat
impl OpenAiCompat
Sourcepub fn meta() -> Self
pub fn meta() -> Self
Compat flags for the Meta Model API (Muse Spark).
OpenAI-compatible chat completions. Meta documents reasoning_effort
(default medium server-side) and streamed usage via
stream_options.include_usage; max_tokens is deprecated in favor of
max_completion_tokens.
Sourcepub fn openrouter() -> Self
pub fn openrouter() -> Self
Compat flags for OpenRouter.
Trait Implementations§
Source§impl Clone for OpenAiCompat
impl Clone for OpenAiCompat
Source§fn clone(&self) -> OpenAiCompat
fn clone(&self) -> OpenAiCompat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more