vtcode-llm
July 4, 2026 ยท View on GitHub
Root AGENTS.md | Canonical LLM provider trait, types, and implementations.
Key Modules
provider/ trait + shared types | providers/ per-provider impls | provider.rs re-exports | client.rs + optimized_client.rs | copilot/ (feature-gated) | open_responses/ | factory_types.rs + provider_config_types.rs config | system_prompt.rs injection | http_client.rs | types.rs shared types | utils.rs + single_response.rs + tool_bridge.rs + config_adapter.rs + rig_adapter.rs + provider_base.rs + error_display.rs + model_resolver.rs infra (merged from core)
Architecture Notes
- Canonical home for all provider code. Core's
llm/is a thin re-export layer + factory/CGP. system_prompt.rsprovides stub getters withOnceLocksetters; vtcode-core overrides at init.- Uses
compact_str::CompactString(aliasedCompactStrfromvtcode_core::types) for small string fields.
Dependencies
vtcode-commons (HTTP, CGP, types) | vtcode-config (provider config, timeouts) | vtcode-utility-tool-specs (schemas) | vtcode-exec-events | vtcode-macros
Coding Conventions
Providers in providers/<name>/mod.rs. Use anyhow::Result, tracing, not println!. Provider-specific types stay local; shared go in types.rs or provider/.
OpenAI-Compatible Providers
providers/openai_compat.rsowns the shared shell:OpenAiCompatSpec(per-provider consts/overrides) +OpenAiCompatCore<S>+impl_openai_compat_provider!. New compat providers implement a Spec (~50-200 lines), not a fullLLMProvider.- Model normalization happens in
core.prepare(), notconvert_request()โ payload tests must callpreparefirst.stream: trueis only inserted whenrequest.streamis set. - Providers with extra protocols (evolink Anthropic path, opencode) hand-write the provider over
OpenAiCompatCoreinstead of using the macro. - Registration contract: keep the type name and 7-arg
from_configconsumed byimpl_standard_provider_constructor!in vtcode-core.