Skip to main content

Module provider

Module provider 

Source
Expand description

Providers: the model services a person adds themselves, and what QCode asks each of them.

A provider is the person’s own tag, a kind, an address, the shape it speaks, the models it was last seen to offer and the key it is reached with. Every kind QCode knows speaks the Anthropic message shape and the OpenAI one directly, so a harness is pointed at the address in the shape it speaks itself — Claude Code the one, opencode the other — and nothing translates in between.

Three rules run through everything here.

The key lives apart. It is written to providers.toml in QCode’s data folder, with mode 600 in a folder of mode 700, and never into the settings file, which people copy between machines and paste into reports. It is a Key, which has no Display and whose Debug is the last four characters, so nothing can print it by accident.

Nothing goes out unasked. Every request passes through Web, the seam a test stands in for; no test in this crate can reach the network, and the page says where a request will go before the person presses the thing that sends it.

What a server claims is not what it gives. A model’s record can say 262 144 tokens while the endpoint a harness really uses pins the window to 4 096 and throws the front of every larger prompt away without a word. ask::measure finds that edge by watching where the reported input token count stops growing, and the page shows both numbers.

Re-exports§

pub use ask::Answer;
pub use ask::Ask;
pub use ask::AskError;
pub use ask::Method;
pub use ask::Reached;
pub use ask::Secret;
pub use ask::Web;
pub use relay::Activity;
pub use relay::Event as RelayEvent;
pub use relay::Listener as RelayListener;
pub use relay::Route;
pub use relay::Upstream;

Modules§

ask
Asking a provider what it can do, over a seam a test can stand in for.
relay
The relay that lets a harness inside a container talk to a provider without the provider’s key ever entering that container.

Structs§

Key
A provider’s key.
Lineup
A named order of one provider’s models: which one to try first, and what to fall back to.
Model
One model of a provider, with both of its context figures and what it costs.
PermissionProblem
A place that lets others on this machine read what is in it.
ProviderEntry
A provider as the file holds it.
Providers
The providers a person has added, and where they are kept.
Published
A model a ready-made provider offers, as its maker publishes it: the window it gives and the page that says so, so that a figure QCode did not ask the service for always says where it was read.
Region
One of the addresses a ready-made provider answers at, which is a choice of where in the world the person’s subscription lives rather than of anything they could type better themselves.
Tag
A provider’s tag, checked.

Enums§

AddError
Why a provider could not be added or renamed.
Measured
What a server was seen to accept, as opposed to what its model claims.
Price
What a model costs: nothing to use, or money out of the account it is reached with.
ProviderKind
A kind of provider QCode knows how to ask.
TagError
Why a name cannot be a tag. Positions are counted from one, the way a person counts the letters of the name they just typed.
Wire
The shape of the request a provider is sent, and of the answer that comes back.

Constants§

CRAMPED
The window below which a coding agent loses its own instructions. Measured against the owner’s server, whose compatibility endpoints pinned the window to 4096 and cut prompts at about 2 050 and 3 012 input tokens.

Functions§

permission_problems
What is wrong with how wide the permissions of path and its folder are, read from the disk as it is now.
trim_base
An address with the trailing slashes taken off, so that joining a path to it never doubles one. A person pasting an address from a browser brings the slash with them.