Skip to main content

ProviderKind

Enum ProviderKind 

Source
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

Source

pub const ALL: [Self; 4]

Every kind, in the order the page offers them.

Source

pub fn id(self) -> &'static str

How the kind is written in the providers file.

Source

pub fn parse(id: &str) -> Option<Self>

The kind written as id, if there is one.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn wire(self) -> Wire

The shape this kind speaks by default.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ProviderKind

Source§

impl Debug for ProviderKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ProviderKind

Source§

impl PartialEq for ProviderKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProviderKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.