Skip to content

feat(ai): add server-side provider registry and openai_compatible adapter#3

Closed
flooryyyy wants to merge 1 commit intomainfrom
codex/create-server-side-ai-provider-registry
Closed

feat(ai): add server-side provider registry and openai_compatible adapter#3
flooryyyy wants to merge 1 commit intomainfrom
codex/create-server-side-ai-provider-registry

Conversation

@flooryyyy
Copy link
Copy Markdown
Owner

Motivation

  • Provide a pluggable server-side AI provider layer so the app can support multiple AI backends via configuration.
  • Add an OpenAI-compatible adapter to enable using arbitrary OpenAI-like endpoints with configurable baseUrl, apiKey, model, and extra headers.

Description

  • Add provider contracts and types in src/app/lib/ai/types.ts (AIProviderType, configs, AIProviderAdapter, chat request/message types).
  • Implement a provider registry in src/app/lib/ai/registry.ts with registerAIProvider, resolveAIProvider, and getRegisteredAIProviders for runtime resolution by provider type.
  • Implement an openai_compatible adapter in src/app/lib/ai/providers/openai-compatible.ts that normalizes baseUrl, posts to /chat/completions, sets Authorization: Bearer <apiKey>, includes configured model, and merges optional headers.
  • Add an AI module entrypoint src/app/lib/ai/index.ts which registers the built-in openai_compatible provider and re-exports types/registry APIs.
  • Add unit tests src/app/lib/ai/registry.test.ts validating provider resolution, URL/body construction, and header propagation.

Testing

  • Ran npm run test -- src/app/lib/ai/registry.test.ts and the test file passed (2 tests, 2 passed).
  • Ran npm run check (ESLint + tsc --noEmit) and it completed successfully.
  • Ran full vitest run as part of commit checks and the test suite completed successfully.

Codex Task

@flooryyyy flooryyyy closed this Apr 10, 2026
@flooryyyy flooryyyy deleted the codex/create-server-side-ai-provider-registry branch April 10, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant