mirror of
https://github.com/nearai/ironclaw.git
synced 2026-09-03 08:06:01 +08:00
* fix(llm): route DeepSeek and Gemini through dedicated rig-core clients (#3201, #3225) DeepSeek thinking-mode (#3201) and Gemini API-key tool calling (#3225) both failed deterministically on the second LLM turn: - DeepSeek: HTTP 400 "The reasoning_content in the thinking mode must be passed back to the API" - Gemini: HTTP 400 "Function call is missing a thought_signature in functionCall parts" Both providers were configured in `providers.json` as `protocol: "open_ai_completions"`, which dispatched them through rig-core's generic OpenAI client. That client silently strips `reasoning_content` from assistant messages and `thought_signature` from tool calls when serializing the next turn — so the field that the upstream API requires to be echoed back was never sent. rig-core actually has dedicated `deepseek::Client` and `gemini::Client` implementations that handle the round-trip correctly: - `deepseek.rs:500-527` — captures `reasoning_content` from the response and writes it back onto the last assistant message in the next request. - `gemini/completion.rs:1016` — round-trips `thought_signature` on every `ToolCall` via `ToolCall.signature`. Add `ProviderProtocol::DeepSeek` and `ProviderProtocol::Gemini` variants plus matching factory branches in `create_registry_provider`, and update the two registry entries to use them. Both factories follow the same shape as `create_anthropic_from_registry` and wrap the rig-core client in our existing `RigAdapter` — no new HTTP code, no agent-loop changes. The `default_base_url` for both entries is now empty so the dedicated clients use their built-in endpoints (`api.deepseek.com` / `generativelanguage.googleapis.com`) rather than the OpenAI-compat shims. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(llm): also route OpenRouter through dedicated rig-core client Same bug class as DeepSeek (#3201) and Gemini (#3225): OpenRouter was configured as `protocol: "open_ai_completions"`, dispatching it through rig-core's generic OpenAI client. That client strips OpenRouter's `reasoning`, `reasoning_details` (Summary / Encrypted / Text), and per-tool-call signatures when serializing the next turn — breaking tool calling for every thinking-mode model OpenRouter exposes (Claude with thinking, OpenAI o-series, DeepSeek-R1, Gemini 2.5+, Qwen QwQ, …). rig-core's dedicated OpenRouter client (`openrouter/completion.rs`) round-trips all of it correctly, including the `reasoning_details` -> `tool_call.signature` mapping at lines 290-308. Add `ProviderProtocol::OpenRouter`, a `create_openrouter_from_registry` factory that preserves OpenRouter attribution headers (`HTTP-Referer`, `X-Title`), and update the registry entry. Extend the regression test to lock the routing for all three providers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci: trigger refs/pull/3326/head regeneration * fix(llm): round-trip reasoning + signatures through RigAdapter Addresses review feedback on PR #3326. The original PR routed DeepSeek, Gemini, and OpenRouter through rig-core's dedicated clients, but the fix only worked inside rig-core. IronClaw's RigAdapter sits between the agent loop and rig-core and was dropping AssistantContent::Reasoning (DeepSeek `reasoning_content`) and per-tool-call `signature` (Gemini `thought_signature`) on the response → IronClaw conversion. On the next request it rebuilt rig messages without either field, so the provider rejected the follow-up turn — same HTTP 400s the PR claimed to fix. Round-trip both fields end-to-end: - Add `ChatMessage::reasoning` and `ToolCall.signature` (skip-serialized when None) plus `ToolCompletionResponse.reasoning` to carry artifacts out of the provider. - Update `RigAdapter::extract_response` to capture both, and `convert_messages` to push `AssistantContent::Reasoning` and `ToolCall.signature` back when rebuilding rig messages on the next turn. - Plumb response.reasoning through dispatcher, job worker, container worker, routine engine, and the orchestrator-worker proxy via a new `ChatMessage::with_reasoning` builder. Other review fixes: - Set `can_list_models: false` for Gemini in providers.json — setup wizard and web list-models handler don't speak native Gemini, so exposing the button reliably falls back to manual entry. - Add `extra_headers_env: OPENROUTER_EXTRA_HEADERS` so users of the built-in `openrouter` backend can configure HTTP-Referer / X-Title attribution headers. - New `sanitize_gemini_base_url` discards the legacy `…/v1beta/openai` shim URL persisted by pre-3225 installs in `llm_builtin_overrides[gemini].base_url`. Without this, upgraded users would hit `…/v1beta/openai/v1beta/models/...:generateContent`. - Include `provider_id` in extra-header warning logs (OpenRouter + OpenAI-compat). Regression tests: - `reasoning_and_signature_round_trip_through_chat_message` simulates the 2-turn tool loop end-to-end. - `chat_message_with_reasoning_drops_empty_input` locks the empty-input contract so we don't echo `reasoning_content: ""`. - `sanitize_gemini_base_url_*` cover legacy-shim discard, empty input, and custom-endpoint pass-through. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
451 lines
13 KiB
JSON
451 lines
13 KiB
JSON
[
|
|
{
|
|
"id": "openai",
|
|
"aliases": [
|
|
"open_ai"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"api_key_env": "OPENAI_API_KEY",
|
|
"api_key_required": true,
|
|
"base_url_env": "OPENAI_BASE_URL",
|
|
"model_env": "OPENAI_MODEL",
|
|
"default_model": "gpt-5-mini",
|
|
"description": "OpenAI GPT models (direct API)",
|
|
"unsupported_params": ["temperature"],
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_openai_api_key",
|
|
"key_url": "https://platform.openai.com/api-keys",
|
|
"display_name": "OpenAI",
|
|
"can_list_models": true
|
|
}
|
|
},
|
|
{
|
|
"id": "anthropic",
|
|
"aliases": [
|
|
"claude"
|
|
],
|
|
"protocol": "anthropic",
|
|
"api_key_env": "ANTHROPIC_API_KEY",
|
|
"api_key_required": true,
|
|
"base_url_env": "ANTHROPIC_BASE_URL",
|
|
"model_env": "ANTHROPIC_MODEL",
|
|
"default_model": "claude-sonnet-4-20250514",
|
|
"description": "Anthropic Claude models (direct API)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_anthropic_api_key",
|
|
"key_url": "https://console.anthropic.com/settings/keys",
|
|
"display_name": "Anthropic",
|
|
"can_list_models": true
|
|
}
|
|
},
|
|
{
|
|
"id": "ollama",
|
|
"aliases": [],
|
|
"protocol": "ollama",
|
|
"default_base_url": "http://localhost:11434",
|
|
"base_url_env": "OLLAMA_BASE_URL",
|
|
"model_env": "OLLAMA_MODEL",
|
|
"default_model": "llama3",
|
|
"description": "Local Ollama instance (no API key needed)",
|
|
"setup": {
|
|
"kind": "ollama",
|
|
"display_name": "Ollama",
|
|
"can_list_models": true
|
|
}
|
|
},
|
|
{
|
|
"id": "openai_compatible",
|
|
"aliases": [
|
|
"openai-compatible",
|
|
"compatible"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"base_url_env": "LLM_BASE_URL",
|
|
"base_url_required": true,
|
|
"api_key_env": "LLM_API_KEY",
|
|
"api_key_required": false,
|
|
"model_env": "LLM_MODEL",
|
|
"default_model": "default",
|
|
"extra_headers_env": "LLM_EXTRA_HEADERS",
|
|
"description": "Custom OpenAI-compatible endpoint (vLLM, LiteLLM, etc.)",
|
|
"setup": {
|
|
"kind": "open_ai_compatible",
|
|
"secret_name": "llm_compatible_api_key",
|
|
"display_name": "OpenAI-compatible",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "github_copilot",
|
|
"aliases": [
|
|
"github-copilot",
|
|
"githubcopilot",
|
|
"copilot"
|
|
],
|
|
"protocol": "github_copilot",
|
|
"default_base_url": "https://api.githubcopilot.com",
|
|
"api_key_env": "GITHUB_COPILOT_TOKEN",
|
|
"api_key_required": true,
|
|
"model_env": "GITHUB_COPILOT_MODEL",
|
|
"default_model": "gpt-4o",
|
|
"extra_headers_env": "GITHUB_COPILOT_EXTRA_HEADERS",
|
|
"description": "GitHub Copilot Chat API (OAuth token from IDE sign-in)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_github_copilot_token",
|
|
"key_url": "https://docs.github.com/en/copilot",
|
|
"display_name": "GitHub Copilot",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "tinfoil",
|
|
"aliases": [],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://inference.tinfoil.sh/v1",
|
|
"api_key_env": "TINFOIL_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "TINFOIL_MODEL",
|
|
"default_model": "kimi-k2-5",
|
|
"description": "Tinfoil private inference (hardware-attested TEE)",
|
|
"unsupported_params": ["temperature"],
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_tinfoil_api_key",
|
|
"key_url": "https://tinfoil.sh",
|
|
"display_name": "Tinfoil",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "openrouter",
|
|
"aliases": [
|
|
"open_router"
|
|
],
|
|
"protocol": "open_router",
|
|
"default_base_url": "",
|
|
"api_key_env": "OPENROUTER_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "OPENROUTER_MODEL",
|
|
"extra_headers_env": "OPENROUTER_EXTRA_HEADERS",
|
|
"default_model": "openai/gpt-4o",
|
|
"description": "OpenRouter multi-provider gateway (200+ models, preserves reasoning across turns)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_openrouter_api_key",
|
|
"key_url": "https://openrouter.ai/settings/keys",
|
|
"display_name": "OpenRouter",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "groq",
|
|
"aliases": [],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.groq.com/openai/v1",
|
|
"api_key_env": "GROQ_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "GROQ_MODEL",
|
|
"default_model": "llama-3.3-70b-versatile",
|
|
"description": "Groq LPU inference (ultra-fast)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_groq_api_key",
|
|
"key_url": "https://console.groq.com/keys",
|
|
"display_name": "Groq",
|
|
"can_list_models": true,
|
|
"models_filter": "chat"
|
|
}
|
|
},
|
|
{
|
|
"id": "nvidia",
|
|
"aliases": [
|
|
"nvidia_nim",
|
|
"nim"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://integrate.api.nvidia.com/v1",
|
|
"api_key_env": "NVIDIA_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "NVIDIA_MODEL",
|
|
"default_model": "meta/llama-3.3-70b-instruct",
|
|
"description": "NVIDIA NIM API (high-performance inference)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_nvidia_api_key",
|
|
"key_url": "https://build.nvidia.com",
|
|
"display_name": "NVIDIA NIM",
|
|
"can_list_models": true
|
|
}
|
|
},
|
|
{
|
|
"id": "venice",
|
|
"aliases": [
|
|
"venice_ai",
|
|
"veniceai"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.venice.ai/api/v1",
|
|
"api_key_env": "VENICE_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "VENICE_MODEL",
|
|
"default_model": "llama-3.3-70b",
|
|
"description": "Venice.ai privacy-focused inference",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_venice_api_key",
|
|
"key_url": "https://venice.ai/settings/api",
|
|
"display_name": "Venice.ai",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "together",
|
|
"aliases": [
|
|
"together_ai",
|
|
"togetherai"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.together.xyz/v1",
|
|
"api_key_env": "TOGETHER_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "TOGETHER_MODEL",
|
|
"default_model": "meta-llama/Llama-3-70b-chat-hf",
|
|
"description": "Together AI inference",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_together_api_key",
|
|
"key_url": "https://api.together.ai/settings/api-keys",
|
|
"display_name": "Together AI",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "fireworks",
|
|
"aliases": [
|
|
"fireworks_ai"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.fireworks.ai/inference/v1",
|
|
"api_key_env": "FIREWORKS_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "FIREWORKS_MODEL",
|
|
"default_model": "accounts/fireworks/models/llama-v3p1-70b-instruct",
|
|
"description": "Fireworks AI inference",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_fireworks_api_key",
|
|
"key_url": "https://fireworks.ai/api-keys",
|
|
"display_name": "Fireworks AI",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "deepseek",
|
|
"aliases": [
|
|
"deep_seek"
|
|
],
|
|
"protocol": "deep_seek",
|
|
"default_base_url": "",
|
|
"api_key_env": "DEEPSEEK_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "DEEPSEEK_MODEL",
|
|
"default_model": "deepseek-chat",
|
|
"description": "DeepSeek inference API (preserves reasoning_content for thinking-mode models)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_deepseek_api_key",
|
|
"key_url": "https://platform.deepseek.com/api_keys",
|
|
"display_name": "DeepSeek",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "zai",
|
|
"aliases": [
|
|
"bigmodel"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.z.ai/api/paas/v4",
|
|
"api_key_env": "ZAI_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "ZAI_MODEL",
|
|
"default_model": "glm-5",
|
|
"description": "Z.AI GLM inference API",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_zai_api_key",
|
|
"key_url": "https://z.ai/manage-apikey/apikey-list",
|
|
"display_name": "Z.AI",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "cerebras",
|
|
"aliases": [],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.cerebras.ai/v1",
|
|
"api_key_env": "CEREBRAS_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "CEREBRAS_MODEL",
|
|
"default_model": "llama-3.3-70b",
|
|
"description": "Cerebras wafer-scale inference",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_cerebras_api_key",
|
|
"key_url": "https://cloud.cerebras.ai",
|
|
"display_name": "Cerebras",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "sambanova",
|
|
"aliases": [
|
|
"samba_nova"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.sambanova.ai/v1",
|
|
"api_key_env": "SAMBANOVA_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "SAMBANOVA_MODEL",
|
|
"default_model": "Meta-Llama-3.1-70B-Instruct",
|
|
"description": "SambaNova Cloud inference",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_sambanova_api_key",
|
|
"key_url": "https://cloud.sambanova.ai/apis",
|
|
"display_name": "SambaNova",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "gemini",
|
|
"aliases": [
|
|
"google_gemini",
|
|
"google"
|
|
],
|
|
"protocol": "gemini",
|
|
"default_base_url": "",
|
|
"api_key_env": "GEMINI_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "GEMINI_MODEL",
|
|
"default_model": "gemini-2.5-flash",
|
|
"description": "Google Gemini native API (preserves thought_signature on tool calls)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_gemini_api_key",
|
|
"key_url": "https://aistudio.google.com/app/apikey",
|
|
"display_name": "Google Gemini",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "ionet",
|
|
"aliases": [
|
|
"io_net",
|
|
"io.net"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.intelligence.io.solutions/api/v1",
|
|
"api_key_env": "IONET_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "IONET_MODEL",
|
|
"default_model": "deepseek-coder-v2-instruct",
|
|
"description": "io.net Intelligence API",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_ionet_api_key",
|
|
"key_url": "https://cloud.io.net/intelligence",
|
|
"display_name": "io.net",
|
|
"can_list_models": true
|
|
}
|
|
},
|
|
{
|
|
"id": "mistral",
|
|
"aliases": [
|
|
"mistral_ai",
|
|
"mistralai"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.mistral.ai/v1",
|
|
"api_key_env": "MISTRAL_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "MISTRAL_MODEL",
|
|
"default_model": "mistral-large-latest",
|
|
"description": "Mistral AI API",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_mistral_api_key",
|
|
"key_url": "https://console.mistral.ai/api-keys",
|
|
"display_name": "Mistral",
|
|
"can_list_models": true
|
|
}
|
|
},
|
|
{
|
|
"id": "yandex",
|
|
"aliases": [
|
|
"yandex_ai_studio",
|
|
"yandexgpt",
|
|
"yandex_gpt"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://ai.api.cloud.yandex.net/v1",
|
|
"api_key_env": "YANDEX_API_KEY",
|
|
"api_key_required": true,
|
|
"model_env": "YANDEX_MODEL",
|
|
"extra_headers_env": "YANDEX_EXTRA_HEADERS",
|
|
"default_model": "yandexgpt-lite",
|
|
"description": "Yandex AI Studio (YandexGPT)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_yandex_api_key",
|
|
"key_url": "https://aistudio.yandex.ru/platform/folders/",
|
|
"display_name": "Yandex AI Studio",
|
|
"can_list_models": true
|
|
}
|
|
},
|
|
{
|
|
"id": "minimax",
|
|
"aliases": [
|
|
"mini_max"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"default_base_url": "https://api.minimax.io/v1",
|
|
"api_key_env": "MINIMAX_API_KEY",
|
|
"api_key_required": true,
|
|
"base_url_env": "MINIMAX_BASE_URL",
|
|
"model_env": "MINIMAX_MODEL",
|
|
"default_model": "MiniMax-M2.7",
|
|
"description": "MiniMax API (MiniMax-M2.7, MiniMax-M2.7-highspeed, MiniMax-M2.5 and MiniMax-M2.5-highspeed models)",
|
|
"setup": {
|
|
"kind": "api_key",
|
|
"secret_name": "llm_minimax_api_key",
|
|
"key_url": "https://platform.minimax.io",
|
|
"display_name": "MiniMax",
|
|
"can_list_models": false
|
|
}
|
|
},
|
|
{
|
|
"id": "cloudflare",
|
|
"aliases": [
|
|
"cloudflare_ai",
|
|
"cf_ai"
|
|
],
|
|
"protocol": "open_ai_completions",
|
|
"api_key_env": "CLOUDFLARE_API_KEY",
|
|
"api_key_required": true,
|
|
"base_url_env": "CLOUDFLARE_BASE_URL",
|
|
"model_env": "CLOUDFLARE_MODEL",
|
|
"default_model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
|
"description": "Cloudflare Workers AI",
|
|
"setup": {
|
|
"kind": "open_ai_compatible",
|
|
"secret_name": "llm_cloudflare_api_key",
|
|
"display_name": "Cloudflare Workers AI",
|
|
"can_list_models": false
|
|
}
|
|
}
|
|
]
|