#5893 [Engine] API key changes when unloading and reloading a model, invalidating existing API clients

open · @squishey123 · 4 comentários · No GitHub

Server & APIModels & quantsSecurityWindows

Descrição



## Description

I've found that unloading and subsequently reloading a model in Strata invalidates the API key previously used to connect to its local serving API.

This breaks existing integrations, including Unsloth Studio's custom OpenAI-compatible provider connection.

I also want to explain why I'm connecting to Strata's direct serving API rather than using the API connection information exposed through the Strata UI.

### Why I'm using the direct serving API

My goal is to use Strata as a local inference backend for Unsloth Studio, including Unsloth's automatic context management and compaction functionality.

The API connection information exposed through Strata's UI does not appear to provide the context-window metadata that Unsloth needs to correctly identify the model's loaded context size.

Specifically, the Strata desktop-facing API endpoint at `http://127.0.0.1:47831` returns model information without the context-window metadata, whereas the underlying serving API at `http://127.0.0.1:18500` exposes `meta.n_ctx` through its `/v1/models` response.

Unsloth recognizes this metadata and uses it to determine the available context window and calculate its automatic compaction threshold.

Without that information, Unsloth cannot reliably determine the model's actual serving context window through the UI-exposed connection.

This is why I investigated connecting directly to the underlying serving API. It is not an attempt to circumvent Strata's intended interface or bypass its functionality; it is an attempt to make an existing integration work correctly with context-window reporting.

## Steps to reproduce

1. Start a model in Strata and enable its local API server.
2. Connect an external API client using the API key associated with the active serving instance.
3. Verify that requests authenticate successfully.
4. Unload the model.
5. Reload the model.
6. Attempt another request using the previously working API key.

## Actual behavior

The old API key no longer authenticates. Requests fail with an authentication error.

I was able to restore connectivity by locating the active native-instance configuration file, retrieving its updated API key, and replacing the old key in the external client.

This suggests that the API key is regenerated or otherwise changed when the serving instance is restarted or recreated.

## Expected behavior

Ideally, one of the following:

- The API key remains stable across model unload/reload operations.
- Strata provides a supported mechanism for external applications to retrieve the current API key.
- The UI exposes the currently active API credentials after a model reload.
- Strata provides the necessary context-window metadata through its UI-exposed API, allowing integrations such as Unsloth to use the normal connection path without accessing the underlying serving API.

Stable credentials would be particularly useful for applications that maintain persistent connections to Strata.

## Environment

- Windows 11
- Strata desktop application `v0.2.11`
- Strata engine `0.1.57`
- Local native serving instance
- Desktop-facing API endpoint: `http://127.0.0.1:47831`
- Direct serving API endpoint: `http://127.0.0.1:18500`
- External client: Unsloth Studio custom OpenAI-compatible provider

## Workaround

I created a helper script that identifies the active Strata serving process, locates its native-instance configuration file, and copies the current API key to the clipboard.

Updating the API key in Unsloth restores connectivity.

This workaround requires reading an internal configuration file and manually updating the external application, which is not an ideal user-facing solution.

## Questions

1. Is API key rotation during model unload/reload intentional?
2. Is there an officially supported way to retrieve the current serving API key?
3. Could Strata offer a persistent API key or credential-management interface intended for external integrations?
4. Could the context-window metadata currently available through the underlying serving API also be exposed through the UI-facing API?
5. Is there an officially supported way for external applications to access the underlying serving API without relying on internal configuration files?

I can provide additional logs and reproduction details if needed.

No site

Links install, modelos, releases.