Skip to content

refactor: flatten providers config to use type as active provider selector#485

Merged
avoidwork merged 2 commits into
mainfrom
feat/flatten-providers-config
Jun 30, 2026
Merged

refactor: flatten providers config to use type as active provider selector#485
avoidwork merged 2 commits into
mainfrom
feat/flatten-providers-config

Conversation

@avoidwork

@avoidwork avoidwork commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

Flatten the providers config in config.yaml by moving the type field from providers.openai.type to providers.type, making it the active provider selector with provider-specific configs as sibling keys.

Motivation

The current structure nests type inside each provider config (e.g., providers.openai.type: openai), which is redundant and does not scale well when adding new providers. Moving type to the providers level makes it clear which provider is active, and provider-specific configs live as sibling keys keyed by their type name.

Changes

  • config.yaml: Added type: openai at the providers level, removed type: openai from providers.openai
  • src/config/schemas.js: Removed type from _OpenaiProviderConfigSchema, added type enum to ProvidersSchema

Proposed Structure

Before:

providers:
  openai:
    type: openai
    base_url: https://api.openai.com/v1
    model: gpt-4o

After:

providers:
  type: openai
  openai:
    base_url: https://api.openai.com/v1
    model: gpt-4o

Testing

  • All 1209 tests pass
  • Lint passes (oxlint + oxfmt)
  • No code changes needed — existing dynamic access patterns (config?.providers?.[providerName]) are already compatible

Related

Closes #483

…ector

Move the 'type' field from providers.openai.type to providers.type,
making it the single source of truth for the active provider. Provider-
specific configs remain as sibling keys under providers.

- config.yaml: add providers.type, remove type from providers.openai
- schemas.js: remove type from _OpenaiProviderConfigSchema
- schemas.js: add type enum to ProvidersSchema
Keep the enum array form for easy future expansion, but only allow
'openai' until other providers are implemented.
@avoidwork avoidwork self-assigned this Jun 30, 2026
@avoidwork avoidwork merged commit e49ad85 into main Jun 30, 2026
2 checks passed
@avoidwork avoidwork deleted the feat/flatten-providers-config branch June 30, 2026 01:15
avoidwork added a commit that referenced this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: flatten providers config to use type as active provider selector

1 participant