pub enum Provider {
ClaudeCode,
Codex,
Copilot,
Gemini,
OpenCode,
Cursor,
Hermes,
Grok,
Unknown,
}Expand description
Supported AI coding assistant providers.
Used both to tag a parsed session with its source assistant and to route
per-provider usage aggregation. Provider::Unknown is the fallback when a
model name matches none of the known prefixes.
§Examples
use vct_core::models::Provider;
assert_eq!(Provider::from_model_name("claude-sonnet-4"), Provider::ClaudeCode);
assert_eq!(Provider::ClaudeCode.display_name(), "Claude");Variants§
ClaudeCode
Anthropic Claude Code.
Codex
OpenAI Codex CLI (also matches raw gpt-* / o1 / o3 model names).
Copilot
GitHub Copilot CLI.
Gemini
Google Gemini CLI.
OpenCode
OpenCode.
Cursor
Cursor CLI / IDE.
Hermes
Hermes.
Grok
xAI Grok CLI.
Unknown
Model name matched no known provider prefix.
Implementations§
Source§impl Provider
impl Provider
Sourcepub const fn from_model_name(model: &str) -> Self
pub const fn from_model_name(model: &str) -> Self
Detects the AI provider from a model name using byte-level prefix matching.
Recognizes the claude, copilot, gemini, and grok prefixes, and
treats gpt* / o1* / o3* model names as Provider::Codex.
Matching is case-sensitive (lowercase) and operates directly on the
UTF-8 bytes, so it stays const and allocation-free. Returns
Provider::Unknown when no prefix matches.
§Examples
use vct_core::models::Provider;
assert_eq!(Provider::from_model_name("gpt-4-turbo"), Provider::Codex);
assert_eq!(Provider::from_model_name("o3-mini"), Provider::Codex);
assert_eq!(Provider::from_model_name("gemini-2.0-flash"), Provider::Gemini);
assert_eq!(Provider::from_model_name("mystery-model"), Provider::Unknown);Sourcepub const fn display_name(&self) -> &'static str
pub const fn display_name(&self) -> &'static str
Returns the human-readable display name of the provider.
This is the same string produced by the std::fmt::Display impl.
Trait Implementations§
impl Copy for Provider
impl Eq for Provider
impl StructuralPartialEq for Provider
Auto Trait Implementations§
impl Freeze for Provider
impl RefUnwindSafe for Provider
impl Send for Provider
impl Sync for Provider
impl Unpin for Provider
impl UnsafeUnpin for Provider
impl UnwindSafe for Provider
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.