feat: Add Forge as LLM provider - #116
Conversation
## Changes - Automated integration updates from manager loop. Files modified: nanobot/README.md nanobot/nanobot/config/schema.py nanobot/nanobot/providers/litellm_provider.py nanobot/nanobot/providers/registry.py
Ports three provider contributions that could not merge as submitted: #138 and #130 also touched new_ui/ and nanobot/, and #116 targeted nanobot/ only. Those trees were removed in the v2.0 refactor. The provider work itself applies unchanged to core/providers. ProvidersConfig reads each provider via getattr(providers, spec.name), so a ProviderSpec without a matching field is silently skipped — all three get both halves, as the ProvidersConfig docstring requires. Endpoints verified reachable: router.requesty.ai (200), api.minimax.io (401), api.forge.tensorblock.co (401). Also fixes a gateway bug #116 found in nanobot's provider that core had only half-fixed: spec.env_key was forced for gateways, but env_extras still used setdefault, so a stale ambient variable outranked the gateway the user picked. Dropped from the originals: the tests covering new_ui's requesty_models service and nanobot's registry. One of those imported "nanobot.config.schema", which now resolves to an unrelated PyPI package (nanobot-ai) when installed — it fails locally and skips in CI, testing nothing either way. Co-authored-by: Thibault Jaigu <thibault.jaigu@gmail.com> Co-authored-by: Yiiii0 <yiqiaozhou@outlook.com> Co-authored-by: octo-patch <octo-patch@github.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Ported to Your branch targeted
Your second change found a real bug here too. The if spec.is_gateway:
os.environ[spec.env_key] = api_key # gateway wins
else:
os.environ.setdefault(spec.env_key, api_key)
...
for env_name, env_val in spec.env_extras:
os.environ.setdefault(env_name, resolved) # gateway does NOT winA stale ambient variable outranked the gateway the user had selected. #159 applies the same rule to |
Description
Adds Forge as an OpenAI-compatible gateway provider in nanobot's provider registry, following the same pattern as AiHubMix.
Changes Made
nanobot/nanobot/providers/registry.py: AddedProviderSpecfor Forge withis_gateway=True,litellm_prefix="openai",strip_model_prefix=Truenanobot/nanobot/config/schema.py: Addedforgefield toProvidersConfignanobot/nanobot/providers/litellm_provider.py: Extendedenv_extrashandling to useos.environ[...](override) for gateways instead ofsetdefault, matching the primaryenv_keypattern at line 60nanobot/README.md: Added Forge to provider tableUsage
Checklist
I work at TensorBlock and will help maintain this integration.
About Forge
Forge is an open-source middleware service for unified AI model provider management. It routes requests across 40+ AI providers with access to thousands of models through a single OpenAI-compatible API.