pub enum ProviderKind {
Ollama,
OpenRouter,
MimoTokenPlan,
KimiCode,
}Expand description
A kind of provider QCode knows how to ask.
Every one of them speaks the Anthropic message shape at /v1/messages and the OpenAI one at
/v1/chat/completions, under ProviderKind::api_root, which is why a harness can be
pointed straight at them in its own shape and no translating endpoint is built.
The last two are ready-made: picking one fills in where it answers, where its API sits for each shape, which header its key goes in and the models it offers, so the person types their key and nothing else. Each of those facts was asked of the real service with a real key (2026-09-23) and the addresses are the ones the maker’s own pages name.
Variants§
Ollama
An ollama server, the person’s own or one on their network.
OpenRouter
OpenRouter.
MimoTokenPlan
Xiaomi MiMo’s Token Plan, the subscription. Its keys (tp-…) are not the pay-as-you-go
account’s (sk-… at api.xiaomimimo.com) and neither is accepted by the other’s address.
KimiCode
Kimi Code, Moonshot’s coding subscription.
Implementations§
Source§impl ProviderKind
impl ProviderKind
Sourcepub fn suggested_base(self) -> &'static str
pub fn suggested_base(self) -> &'static str
The address the page offers when this kind is picked. An ollama server is usually the
machine QCode runs on; the others are the service’s own, and for a ready-made one the
first of its regions.
Sourcepub fn suggested_tag(self) -> Option<&'static str>
pub fn suggested_tag(self) -> Option<&'static str>
The tag the page offers for a ready-made kind, so that a person who only has a key to give is not stopped by a name they had no reason to think about. Kinds whose address is the person’s own offer none: two ollama servers are what a tag tells apart.
Sourcepub fn regions(self) -> &'static [Region]
pub fn regions(self) -> &'static [Region]
The addresses a ready-made kind can be picked at; empty for a kind whose address is written by hand.
Sourcepub fn needs_key(self) -> bool
pub fn needs_key(self) -> bool
Whether this kind is reached with a key. An ollama server on the person’s own network asks for none, which is why a profile on one carries no secret into a container at all.
Sourcepub fn key_header(self) -> (&'static str, &'static str)
pub fn key_header(self) -> (&'static str, &'static str)
The header a key goes in, and what stands in front of it there.
Each is the header the maker’s own instructions name: Xiaomi’s show api-key, Kimi’s
Claude Code page sets ANTHROPIC_API_KEY, which Claude Code sends as x-api-key. Both
services were seen to accept Authorization: Bearer too, in both shapes, but the header a
service documents is the one it will keep accepting.
Sourcepub fn api_root(self, wire: Wire) -> &'static str
pub fn api_root(self, wire: Wire) -> &'static str
Where this kind’s API sits under the address a person knows it by, for a request of
shape wire — which is not always the address itself, and not always the same place for
both shapes.
OpenRouter is known as https://openrouter.ai, and that is the address its page names,
but its API answers under /api: https://openrouter.ai/api/v1/messages. The same path
without it is the website, which answers a message with 200 and a page of HTML — a
harness reading that as a model’s answer is told nothing true about what went wrong. An
ollama server answers at its own root. Xiaomi’s Token Plan answers the Anthropic shape
under /anthropic and the OpenAI one at its root, and its /anthropic/v1/models is a
404; Kimi Code answers both under /coding.
Sourcepub fn api_address(self, base: &str, wire: Wire, path: &str) -> String
pub fn api_address(self, base: &str, wire: Wire, path: &str) -> String
The address path of this kind’s API sits at under base, for a request of shape
wire: under api_root, whichever of the kind’s roots base was
written with. OpenRouter’s own instructions for Claude Code name
https://openrouter.ai/api as the base, and Xiaomi’s name …/anthropic for one shape and
…/v1 for the other, so a person who copied any of those must be sent neither to
/api/api nor, asking in the other shape, to /anthropic/v1/chat/completions.
Sourcepub fn published(self) -> &'static [Published]
pub fn published(self) -> &'static [Published]
The models a ready-made kind is known to offer, each with the window its maker publishes and where that was read. Empty for a kind whose models are only known by asking.
Sourcepub fn claims_are_served(self) -> bool
pub fn claims_are_served(self) -> bool
Whether the window this kind claims for a model is the window a harness gets.
Not for an ollama server: its record said 262 144 while its endpoints cut prompts at about three thousand, which is why only a measured window is handed to a harness there. A ready-made service is the maker’s own endpoint, and what it or its maker says it gives is what it was built to give; a harness told nothing would assume a window of its own instead, which is a guess about somebody else’s model.
Trait Implementations§
Source§impl Clone for ProviderKind
impl Clone for ProviderKind
impl Copy for ProviderKind
Source§impl Debug for ProviderKind
impl Debug for ProviderKind
impl Eq for ProviderKind
Source§impl PartialEq for ProviderKind
impl PartialEq for ProviderKind
impl StructuralPartialEq for ProviderKind
Auto Trait Implementations§
impl Freeze for ProviderKind
impl RefUnwindSafe for ProviderKind
impl Send for ProviderKind
impl Sync for ProviderKind
impl Unpin for ProviderKind
impl UnsafeUnpin for ProviderKind
impl UnwindSafe for ProviderKind
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<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