Skip to main content

Module convert

Module convert 

Source
Expand description

Shared conversion logic for LiteLLM and OpenRouter JSON.

This module is included via #[path] in build.rs so the same parsing logic runs at compile time and runtime. It depends only on serde, serde_json, and sibling types.

Structs§

ConvertedEntry
Intermediate representation used by both build.rs and runtime.
RawLiteLLMEntry
Raw LiteLLM entry as it appears in the JSON.

Functions§

convert_litellm_entry
Convert a single LiteLLM JSON entry into our intermediate representation.
parse_litellm_json
Parse the full LiteLLM JSON blob and return converted entries.
parse_mode
Map a LiteLLM mode string to a mode tag.
parse_provider
Map a LiteLLM litellm_provider string to a provider tag.
strip_provider_prefix
Strip known provider prefixes to get the canonical model ID.