df018121a4
Cycle 2 PR 1 (#14418). Introduces providers/ package with ProviderProfile ABC and auto-discovery registry, then wires ChatCompletionsTransport to delegate to profiles via a clean single-path method. Provider profiles (8 providers): - nvidia: default_max_tokens=16384 - kimi + kimi-cn: OMIT_TEMPERATURE, thinking + top-level reasoning_effort - openrouter: provider_preferences, full reasoning_config passthrough - nous: product tags, reasoning with Nous-specific disabled omission - deepseek: base_url + env_vars - qwen-oauth: vl_high_resolution extra_body, metadata top-level api_kwargs Transport integration: - _build_kwargs_from_profile() replaces the entire legacy flag-based assembly when provider_profile param is passed - Single path: no dual-execution, no overwrites, no legacy fallthrough - build_api_kwargs_extras() returns (extra_body, top_level) tuple to handle Kimi's top-level reasoning_effort vs OpenRouter's extra_body Auth types: api_key | oauth_device_code | oauth_external | copilot | aws (expanded from the lossy 'oauth' to match real Hermes auth modes). 64 new tests: - 30 profile unit tests (registry, all 8 profiles, auth types) - 19 transport parity tests (pin legacy flag-based behavior) - 15 profile wiring tests (verify profile path = legacy path)
31 lines
904 B
Python
31 lines
904 B
Python
"""OpenCode provider profiles (Zen + Go).
|
|
|
|
Both use per-model api_mode routing:
|
|
- OpenCode Zen: Claude → anthropic_messages, GPT-5/Codex → codex_responses,
|
|
everything else → chat_completions (this profile)
|
|
- OpenCode Go: MiniMax → anthropic_messages, GLM/Kimi → chat_completions
|
|
(this profile)
|
|
"""
|
|
|
|
from providers import register_provider
|
|
from providers.base import ProviderProfile
|
|
|
|
opencode_zen = ProviderProfile(
|
|
name="opencode-zen",
|
|
aliases=("opencode", "opencode_zen", "zen"),
|
|
env_vars=("OPENCODE_ZEN_API_KEY",),
|
|
base_url="https://opencode.ai/zen/v1",
|
|
default_aux_model="gemini-3-flash",
|
|
)
|
|
|
|
opencode_go = ProviderProfile(
|
|
name="opencode-go",
|
|
aliases=("opencode_go",),
|
|
env_vars=("OPENCODE_GO_API_KEY",),
|
|
base_url="https://opencode.ai/zen/go/v1",
|
|
default_aux_model="glm-5",
|
|
)
|
|
|
|
register_provider(opencode_zen)
|
|
register_provider(opencode_go)
|