Skip to content

chore(ai): rename the openai-compatible provider options key - #186

Merged
mrsibe merged 1 commit into
mainfrom
chore/ai-openai-compatible-key
Sep 30, 2026
Merged

mrsibe merged 1 commit into
mainfrom
chore/ai-openai-compatible-key

Conversation

@mrsibe

@mrsibe mrsibe commented Sep 30, 2026

Copy link
Copy Markdown
Owner

What

One constant: PROVIDER_OPTIONS_KEY 'openai-compatible' → 'openaiCompatible'.

AI SDK 7 deprecates the kebab-case providerOptions key for @ai-sdk/openai-compatible. The provider still reads it, but it logs a deprecation warning on every call and files providerMetadata under the old key.

The constant already served as both the provider name and the options key, and the provider derives the metadata key from whichever key the caller sends, so one change keeps all three consistent:

export const PROVIDER_OPTIONS_KEY = 'openaiCompatible'

Verification: real provider, captured fetch, three cases

Not a constant test — the actual request body and the actual warning stream:

key='openai-compatible'  reasoning_effort=low  + DeprecationWarning
key='openaiCompatible'   reasoning_effort=low  (no warning)
key=<none>               no reasoning field

Behaviour is unchanged and the warning is gone. The reasoning configuration still reaches the request as reasoning_effort.

The providerMetadata consequence, covered

Because the provider namespaces providerMetadata by the options key, this moves providerMetadata['openai-compatible'] → providerMetadata['openaiCompatible']. Two things make that safe, and the second is a test rather than a promise:

  1. A repository-wide search for providerMetadata in src/ returns nothing — no UI, logging or debug consumer depends on either key.

  2. test/connectionCapabilities.test.ts now drives the real provider through a mocked SSE response and asserts:

    assert.deepEqual(Object.keys(await result.providerMetadata), [PROVIDER_OPTIONS_KEY])

    plus that the constant is literally openaiCompatible. Reverting to the deprecated key now fails a test instead of only emitting a warning.

Scope

Only src/main/models/protocols/openaiCompletions.ts and its test. name, baseURL and apiKey are untouched; the provider id and request shape do not change.

Verified

  • npm run typecheck — clean
  • npm test — 472/472 pass (471 + the metadata-shape test)
  • npm run build — OK

No dependency, native addon, packaging or schema change, so no packaged smoke — agreed with the reviewer, and consistent with CONTRIBUTING's rule (packaged checks are for Electron main/preload, dependencies, native addons, packaging, DB init or build config).

Follow-up

The streamObject deprecation migration is next, separately, and not stacked on this: characterization tests for QuizService / AnkiCardService / MindMapService first (partial-object order and visibility, progress callback count and timing, the final object, provider-error propagation, abort behaviour), then the migration.

AI SDK 7 deprecates the kebab-case `providerOptions` key for
`@ai-sdk/openai-compatible`. The provider still reads it, but it logs a
deprecation warning on every call and files `providerMetadata` under the old
key. The constant already served as both the provider name and the options key,
so it now holds the camelCase form and both follow from it.

Verified against the real provider with a capturing fetch, same request in all
three cases:

  key='openai-compatible'  reasoning_effort=low  + DeprecationWarning
  key='openaiCompatible'   reasoning_effort=low  (no warning)
  key=<none>               no reasoning field

Nothing in this repository reads `providerMetadata` (a repository-wide search
for it in `src/` returns nothing), so moving the key from
`providerMetadata['openai-compatible']` to `providerMetadata['openaiCompatible']`
has no UI, logging or debug consumer. `test/connectionCapabilities.test.ts` now
pins the metadata key anyway, through a mocked SSE response, so a revert to the
deprecated key fails a test instead of only warning.

Verified: typecheck clean, 472/472 tests pass, `npm run build` OK. No dependency,
native addon, packaging or schema change, so no packaged smoke was needed.
@github-actions github-actions Bot added the skip-changelog Exclude from generated release notes label Sep 30, 2026
@mrsibe
mrsibe merged commit 807c878 into main Sep 30, 2026
1 check passed
@mrsibe
mrsibe deleted the chore/ai-openai-compatible-key branch September 30, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Exclude from generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant