pub enum ModelSource {
Local {
hf_repo: String,
hf_filename: String,
tokenizer_repo: String,
},
RemoteApi {
endpoint: String,
api_key_env: String,
api_key_envs: Vec<String>,
api_version: Option<String>,
protocol: ApiProtocol,
},
Ollama {
model_tag: String,
host: String,
},
Mlx {
hf_repo: String,
hf_weight_file: Option<String>,
},
VllmMlx {
endpoint: String,
model_name: String,
},
AppleFoundationModels {
use_case: Option<String>,
},
Proprietary {
provider: String,
endpoint: String,
auth: ProprietaryAuth,
protocol: ProprietaryProtocol,
},
Delegated {
hint: Option<String>,
},
}Expand description
How to access the model.
Variants§
Local
Local GGUF file via Candle backend.
RemoteApi
Remote API endpoint (OpenAI-compatible, Anthropic, etc.)
Fields
api_key_env: StringEnvironment variable name containing the API key (never the key itself). The env var value may contain comma-separated keys for load balancing.
api_key_envs: Vec<String>Additional environment variable names for load balancing across multiple keys. Each env var may also contain comma-separated keys.
protocol: ApiProtocolOllama
Ollama local server.
Mlx
Local MLX model via mlx-rs backend (Apple Silicon, safetensors format). Models from mlx-community on HuggingFace.
Fields
VllmMlx
Local vLLM-MLX server (Apple Silicon, OpenAI-compatible API). Routes through RemoteBackend with OpenAI protocol handler.
Fields
AppleFoundationModels
Apple’s on-device system model via the FoundationModels framework
(macOS 26+, Apple Silicon). Inference happens in-process through a
Swift shim — there is no HTTP, no API key, and no model file: the
OS owns the weights. Availability is checked at runtime via
@available(macOS 26.0, *); on older macOS or non-Apple-Silicon
hosts the backend reports UnsupportedMode and the router falls
through to the next candidate.
Fields
Proprietary
Proprietary provider with custom auth and protocol.
For vendor-specific APIs that aren’t generic OpenAI-compatible endpoints. Parslee is the first proprietary provider — custom auth (OAuth2), custom response format, multi-provider routing built into the API.
Fields
auth: ProprietaryAuthAuth configuration.
protocol: ProprietaryProtocolCustom protocol details.
Delegated
Inference is delegated to a host-registered runner. CAR does
not own the wire format — the runner (typically a JS / Python
host) translates the GenerateRequest to its provider’s API,
streams chunks back through the runner’s event callback, and
returns the final aggregated result.
Closes Parslee-ai/car-releases#24. Use this when the host already has an SDK relationship with a provider (Anthropic, OpenAI, GitHub Models, Vercel AI SDK) and wants CAR to sit in the lifecycle / policy / replay path without learning every provider’s wire format.
Routing requires that a runner has been registered via
crate::set_inference_runner (or its FFI equivalent —
registerInferenceRunner on JS, register_inference_runner
on Python, the InferenceRunner foreign trait on UniFFI,
inference.register_runner on the WebSocket protocol).
Without a runner, dispatch fails with InferenceFailed.
Trait Implementations§
Source§impl Clone for ModelSource
impl Clone for ModelSource
Source§fn clone(&self) -> ModelSource
fn clone(&self) -> ModelSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelSource
impl Debug for ModelSource
Source§impl<'de> Deserialize<'de> for ModelSource
impl<'de> Deserialize<'de> for ModelSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ModelSource
impl RefUnwindSafe for ModelSource
impl Send for ModelSource
impl Sync for ModelSource
impl Unpin for ModelSource
impl UnsafeUnpin for ModelSource
impl UnwindSafe for ModelSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more