feat(llm): add custom providers and dynamic API routing - #36
Merged
Conversation
yaukwan
marked this pull request as draft
February 19, 2026 01:56
yaukwan
marked this pull request as ready for review
February 19, 2026 02:24
yaukwan
marked this pull request as draft
February 19, 2026 03:03
yaukwan
marked this pull request as ready for review
February 19, 2026 11:39
added 8 commits
February 19, 2026 20:22
- Add .idea directory to .gitignore for JetBrains IDE support - Document custom provider configuration in config.mdx - Add migration guide from legacy keys to custom providers - Document all supported API types (anthropic, openai_completions, openai_responses)
- Add provider ID validation (length, invalid characters) - Add base URL validation in config loading - Extend needs_onboarding() to check all legacy env keys - Add provider-specific env var detection - Add tests for onboarding logic
- Add get_provider() method to retrieve provider config by ID - Make config field public for API access - Refactor get_api_key() to use provider config instead of hardcoded keys - Remove hardcoded provider key matches in favor of dynamic lookup
- Extract provider ID from model name (e.g., 'my_openai/gpt-4o' -> 'my_openai') - Route API calls based on provider config api_type field - Add call_openai_responses() for OpenAI Responses API support - Add convert_messages_to_openai_responses() message converter - Add parse_openai_responses_response() response parser - Update all provider calls to use dynamic base_url from config - Add convert_image_openai_responses() for image handling in Responses API
yaukwan
force-pushed
the
setup-provider-detection
branch
from
February 19, 2026 13:02
35e6027 to
921c0b7
Compare
rktmeister
pushed a commit
to rktmeister/spacebot
that referenced
this pull request
Mar 11, 2026
feat(llm): add custom providers and dynamic API routing
pasogott
pushed a commit
to pasogott/spacebot
that referenced
this pull request
Aug 15, 2026
Task spacedriveapp#36. Spawning with worktree_mode "create" provisioned or reused a task-<number> worktree and passed its id to the worker link, but the update that bound the worker to the task wrote only worker_id and status. The task never learned its worktree: on this instance 1 of 33 tasks carried a worktree_id while five task worktrees sat on disk unreferenced. The bind now records worktree_id, and resolution consults the task's binding before falling back to the task-<number> name. That makes the persisted binding authoritative and the naming convention the compatibility key for tasks that predate it, rather than the only mechanism. backfill_worktree_bindings reconnects existing tasks at startup from worktrees the caller supplies, so the task store does not reach into the project tables. The revision it writes states the binding was inferred from the name rather than observed at provision time, which is what keeps an inferred binding distinguishable from a real one. It skips tasks that already have a binding, so a rename cannot steal one and a second pass appends nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The current setup flow and provider routing still assume a fixed set of legacy keys (
anthropic_key,openai_key, etc.). This makes setup-mode detection brittle and limits support for custom providers, custom base URLs, and multiple API protocols.What Changed
1) Provider model and config loading
LlmConfigviaproviders: HashMap<String, ProviderConfig>.ApiType(anthropic,openai_completions,openai_responses) andProviderConfig(api_type,base_url,api_key,name).[llm.provider.<id>].base_url.2) Backward compatibility + setup behavior
anthropic,openai,openrouter).load_from_env()now builds provider entries from environment keys (same behavior as TOML loading path).needs_onboarding()now checks a broader set of legacy provider env keys and provider-related env signals so setup mode is more accurate.3) Runtime routing and API integration
LlmManagerto resolve provider data throughget_provider()and dynamicget_api_key().SpacebotModelto route by model prefix (<provider_id>/<model>) and select call path fromApiType.base_urlinstead of hardcoded endpoints.4) API and docs updates
.gitignore(test_config.rs,.idea).Compatibility Notes
anthropic.<provider_id>/<model>.Validation
Added tests
src/config.rstests for:ApiTypeand provider config deserializationRecommended checks for reviewers