refactor(config)!: retire the old OpenAI API selector (#6615)
Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
This commit is contained in:
1 parent
e3a1af2ed3
commit
5c1083df7f
14 files changed
+112
-141
No files matched your search
@@ -1463,14 +1463,6 @@ In `config.json`, set `providers.<name>.api` for the built-in `custom` provider
|
||||
|
||||
`supportedApis` must contain at least one of `chat_completions`, `responses`, or `anthropic_messages`. `preferredApi` must belong to that list and defaults to its first entry. Auto presets inherit this default; explicit presets can only use protocols in the connection's list. Before removing a protocol used by an explicit preset, update that preset first.
|
||||
|
||||
### Legacy OpenAI API selector migration
|
||||
|
||||
If your configuration uses `providers.openai.apiType` (or `api_type`), save it with a version that supports the migration before upgrading further. Saving replaces the old field with `api`: `chat_completions` or `responses` becomes a single-API declaration, while `auto` keeps automatic selection. If both fields are present, `api` takes precedence, including `api: null`.
|
||||
|
||||
The migration also accepts the `NANOBOT_PROVIDERS__OPENAI__API_TYPE` and `NANOBOT_PROVIDERS__OPENAI__APITYPE` environment variables.
|
||||
|
||||
The old field is accepted in the first release containing this migration and the immediately following release. The third release will require the current `api` format.
|
||||
|
||||
### Preset request API
|
||||
|
||||
Leave API selection on **Auto** unless your service requires a specific protocol. To change it, open **Settings → Models → a preset → Advanced options → API connection**. Choose **Responses**, **Chat Completions**, or **Anthropic Messages** from the available options. Hover, focus, or tap a setting label for help. Credentials and endpoint URLs stay in the provider; two presets sharing a provider can select different APIs.
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ Replace `OpenAICompatProvider(api_type=...)` with `OpenAICompatProvider(model_ap
|
||||
ModelAPICapabilities(supported_apis=("responses",), preferred_api="responses")
|
||||
```
|
||||
|
||||
API types and automatic selection rules are defined in `nanobot.providers.model_api`. The registry owns `ProviderSpec`, model metadata, and provider declarations; it also re-exports the API types. The temporary `apiType` configuration migration applies to JSON configuration and Settings inputs; it does not preserve the old Python constructor arguments.
|
||||
API types and automatic selection rules are defined in `nanobot.providers.model_api`. The registry owns `ProviderSpec`, model metadata, and provider declarations; it also re-exports the API types. JSON configuration and Settings inputs use the `api` object; the old `apiType` field no longer selects a request API.
|
||||
|
||||
## Adding a Transcription Provider
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ Verify:
|
||||
OPENAI_API_KEY="sk-..." nanobot agent -m "Hello!"
|
||||
```
|
||||
|
||||
If your shell cannot use inline environment variables, set `OPENAI_API_KEY` first and then run `nanobot agent -m "Hello!"`. Leave API selection on Auto unless you need a specific API in the preset's **Advanced options**; see [preset API settings](./configuration.md#preset-request-api). If your configuration still uses `apiType`, follow the [migration instructions](./configuration.md#legacy-openai-api-selector-migration).
|
||||
If your shell cannot use inline environment variables, set `OPENAI_API_KEY` first and then run `nanobot agent -m "Hello!"`. Leave API selection on Auto unless you need a specific API in the preset's **Advanced options**; see [preset API settings](./configuration.md#preset-request-api).
|
||||
|
||||
## Recipe: Anthropic Direct
|
||||
|
||||
|
||||
+1
-1
@@ -364,7 +364,7 @@ For a named custom provider serving Anthropic Messages, set `providers.<name>.ap
|
||||
|
||||
</details>
|
||||
|
||||
Replace the model with a model ID available to your account. Leave API selection on Auto unless you need to choose Chat Completions or Responses in the preset's **Advanced options**. See [preset API settings](./configuration.md#preset-request-api) for WebUI and JSON configuration. `providers.openai.api` sets the connection default; explicit presets override it. If your configuration still uses `apiType`, follow the [migration instructions](./configuration.md#legacy-openai-api-selector-migration).
|
||||
Replace the model with a model ID available to your account. Leave API selection on Auto unless you need to choose Chat Completions or Responses in the preset's **Advanced options**. See [preset API settings](./configuration.md#preset-request-api) for WebUI and JSON configuration. `providers.openai.api` sets the connection default; explicit presets override it.
|
||||
|
||||
### DeepSeek
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Older versions cannot read newly saved SQLite display history. A downgrade is no
|
||||
|
||||
Legacy proxy configuration migration remains supported in 0.4.x and is removed in 0.5.0. Review the migrated shared proxy and per-service choices before saving; a browser's proxy settings are separate from the gateway's. See [Configuration](../configuration.md).
|
||||
|
||||
v0.4.0 is the first stable release with the temporary OpenAI `apiType` / `api_type` → `api` migration. It remains supported for the immediately following release; its exact tag must be recorded when that release is allocated. Save configurations in the current `api` format during this window. The third release containing this change will no longer accept the old selector. This is a separate compatibility window from the 0.4.x JSONL/proxy window. See [API selector migration](../configuration.md#legacy-openai-api-selector-migration).
|
||||
v0.4.0 and v0.4.1 include the temporary OpenAI `apiType` / `api_type` → `api` conversion. Save configurations that use an explicit old selection in the current `api` format before upgrading beyond v0.4.1; update launcher environment variables separately. The old `auto` default needs no action. This compatibility window is separate from the 0.4.x JSONL/proxy window.
|
||||
|
||||
### Installation and platform boundaries
|
||||
|
||||
|
||||
+1
-3
@@ -82,9 +82,7 @@ Retain legacy model JSONL, WebUI JSONL / segments and per-feature proxy migratio
|
||||
|
||||
### OpenAI API selector compatibility window
|
||||
|
||||
The temporary `providers.openai.apiType` / `api_type` conversion lasts exactly two consecutive releases: the first containing `nanobot/config/provider_api_migration.py` and the next. Record the first and final supported tags in release notes. Config saves write `api`; there is no legacy runtime selector.
|
||||
|
||||
Before the third release, remove `provider_api_migration.py`, its import, `ProvidersConfig._migrate_legacy_api_type`, the legacy settings query conversion in `nanobot/webui/settings_models.py` and migration-specific tests. Update configuration docs and release notes to require the current format. Keep current-format routing, settings and persistence regressions.
|
||||
v0.4.0 and v0.4.1 included automatic conversion of `providers.openai.apiType` / `api_type`. The first release without conversion must note in its release notes that users can save old configuration with v0.4.1 and must update launcher environment variables separately.
|
||||
|
||||
### TUI preflight without a release tag
|
||||
|
||||
|
||||
Reference in new issue
Block a user