Skip to content

feat: add API key support for custom OpenAI-compatible providers#906

Closed
unn-Known1 wants to merge 2 commits into
tinyhumansai:mainfrom
unn-Known1:fix/pr905-style-and-cleanup
Closed

feat: add API key support for custom OpenAI-compatible providers#906
unn-Known1 wants to merge 2 commits into
tinyhumansai:mainfrom
unn-Known1:fix/pr905-style-and-cleanup

Conversation

@unn-Known1
Copy link
Copy Markdown
Contributor

Summary

This PR adds API key authentication support for custom OpenAI-compatible model backends. It introduces a new UI component for configuring base URL and API key, extends the configuration schema to persist credentials, and threads the API key parameter through provider factory functions and all construction callsites.

Changes Made

Frontend UI

  • New CustomModelSection component in settings for configuring custom OpenAI-compatible providers
  • Added API key and base URL inputs with save functionality
  • Integrated into LocalModelDebugPanel settings page

Backend Configuration

  • Extended Config struct with api_key field
  • Extended LocalAiConfig with base_url and api_key fields
  • Added api_key to model settings update schema
  • Config snapshot includes API key for frontend retrieval

Provider Integration

  • Threaded api_key parameter through all provider factory functions
  • Updated create_backend_inference_provider to use OpenAI-compatible provider when API key is set
  • Updated all callsites to pass API key
  • Simplified authentication style in routing factory

Code Quality

  • Fixed Prettier import order in LocalModelDebugPanel.tsx
  • Removed stray blank line before CustomModelSection
  • Removed scratch.js (outdated debugging file)
  • Fixed Rust formatting in providers/ops.rs

Files Changed

File Change
app/src/components/settings/panels/local-model/CustomModelSection.tsx New component
app/src/components/settings/panels/LocalModelDebugPanel.tsx Added CustomModelSection
app/src/utils/tauriCommands/config.ts Added api_key to interface
src/openhuman/config/schema/types.rs Added api_key to Config
src/openhuman/config/schema/local_ai.rs Added base_url, api_key
src/openhuman/config/ops.rs Handle api_key in patches
src/openhuman/config/schemas.rs Schema updates
src/openhuman/providers/ops.rs Provider API key support
src/openhuman/routing/factory.rs Routing with API key
src/openhuman/agent/... Agent integration
src/openhuman/threads/ops.rs Thread title generation
src/openhuman/channels/... Channel startup
src/openhuman/learning/... LinkedIn enrichment
src/openhuman/tools/... Tool delegate

Closes #867

Testing

  • Manual testing with custom OpenAI-compatible endpoint
  • Verify API key is properly threaded through providers
  • Verify config persistence
  • Add Vitest unit tests for CustomModelSection (future)

@unn-Known1 unn-Known1 requested a review from a team April 24, 2026 21:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@unn-Known1 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 56 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 24 minutes and 56 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ed522af-c0c9-491e-9b87-9190df106fdc

📥 Commits

Reviewing files that changed from the base of the PR and between d2f0457 and 04f3f28.

📒 Files selected for processing (17)
  • app/src/components/settings/panels/LocalModelDebugPanel.tsx
  • app/src/components/settings/panels/local-model/CustomModelSection.tsx
  • app/src/utils/tauriCommands/config.ts
  • src/openhuman/agent/harness/session/builder.rs
  • src/openhuman/agent/triage/routing.rs
  • src/openhuman/channels/routes.rs
  • src/openhuman/channels/runtime/startup.rs
  • src/openhuman/config/ops.rs
  • src/openhuman/config/schema/local_ai.rs
  • src/openhuman/config/schema/types.rs
  • src/openhuman/config/schemas.rs
  • src/openhuman/learning/linkedin_enrichment.rs
  • src/openhuman/local_ai/ops.rs
  • src/openhuman/providers/ops.rs
  • src/openhuman/routing/factory.rs
  • src/openhuman/threads/ops.rs
  • src/openhuman/tools/impl/agent/delegate.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Show loading overlay over account webviews during first-time load

1 participant