Skip to content

Conversation

@fran3cc
Copy link

@fran3cc fran3cc commented Jan 26, 2026

Related GitHub Issue

Closes: #10962

Description

This PR adds Keywords AI as a new LLM provider in Roo Code, integrating their OpenAI-compatible gateway API with optional observability controls.

Key Implementation Details:

  1. Provider Handler (src/api/providers/keywordsai.ts):

    • Created KeywordsAiHandler extending OpenAiHandler to leverage the OpenAI-compatible gateway
    • Injects disable_log: true into request body when logging is disabled via the getExtraRequestParams() hook
    • Sets custom header X-KeywordsAI-Source: RooCode-Extension for tracking
  2. Base Handler Enhancement (src/api/providers/openai.ts):

    • Added protected getExtraRequestParams() method to allow subclasses to inject provider-specific body parameters
    • This pattern enables Keywords AI (and future providers) to add custom parameters without duplicating the entire request flow
  3. Model Fetching (src/api/providers/fetchers/keywordsai.ts):

    • Implemented getKeywordsAiModels() to fetch available models from Keywords AI API
    • Integrated with the router models caching system
  4. Provider Settings (packages/types/src/provider-settings.ts):

    • Added keywordsaiSchema with keywordsaiApiKey, keywordsaiBaseUrl, and keywordsaiEnableLogging fields
    • Added keywordsai to provider types and model ID mappings
  5. UI Components (webview-ui/src/components/settings/providers/KeywordsAI.tsx):

    • Created settings UI with API key, base URL, and "Enable Logging" checkbox
    • Integrated with model picker using router models
  6. Model Selection Logic (webview-ui/src/components/ui/hooks/useSelectedModel.ts):

    • Added dedicated keywordsai case in switch statement to properly use router models
    • Follows the same pattern as other dynamic providers (openrouter, requesty, unbound, etc.)
  7. Type Fixes:

    • Added keywordsai: {} to RouterModels type and test mocks
    • Fixed TypeScript compilation errors to ensure check-types passes

Design Choices:

  • Used inheritance (KeywordsAiHandler extends OpenAiHandler) rather than composition to minimize code duplication
  • Gateway-only approach: Only implements the chat completions gateway with optional logging control, no tracing features
  • Consistent with existing dynamic provider patterns for maintainability

Test Procedure

Manual Testing Steps:

  1. Configuration:

    • Go to Settings → Providers → Keywords AI
    • Enter API key (or leave empty if using default)
    • Optionally configure base URL (defaults to https://api.keywordsai.co/api/)
    • Toggle "Enable Logging" checkbox
    • Click "Refresh Models" to fetch available models
  2. Model Selection:

    • Select Keywords AI as provider
    • Verify model picker shows available models from Keywords AI API
    • Select a model (e.g., gpt-4o)
  3. Chat Functionality:

    • Start a chat conversation
    • Verify requests are sent to Keywords AI gateway
    • Check that chat completions work correctly
  4. Logging Control:

    • With "Enable Logging" enabled: Verify requests include observability data
    • With "Enable Logging" disabled: Verify disable_log: true is sent in request body
  5. Type Checking:

    • Run pnpm check-types (or turbo check-types)
    • Verify no TypeScript errors

Testing Environment:

  • Node.js 20.19.2
  • VS Code Extension environment
  • Keywords AI API access (API key required)

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required.

Documentation Needed:

  • Add Keywords AI to the list of supported providers on the Roo Code website/documentation
  • Document Keywords AI provider configuration steps (API key, base URL, enable logging)
  • Add Keywords AI to any provider comparison tables or feature lists

Get in Touch

.francccc0303 (discord)
Will contact

@fran3cc fran3cc requested review from cte, jr and mrubens as code owners January 26, 2026 07:54
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Documentation Improvements or additions to documentation Enhancement New feature or request labels Jan 26, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 26, 2026

Rooviewer Clock   See task on Roo Cloud

Reviewed the Keywords AI provider integration. The implementation is well-structured and follows existing patterns for dynamic providers. Found one minor issue:

  • Hardcoded strings in KeywordsAI.tsx should use i18n translation function t()

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Add Keywords AI as LLM provider with gateway API and observability

1 participant