unbound-claude-code
Version:
Claude Code with Unbound integration - Drop-in replacement for Claude Code with multi-provider routing and cost optimization
31 lines (27 loc) • 983 B
JavaScript
/**
* Unbound Code Interceptor Loader
*
* This loader is injected into Claude Code to initialize the Unbound interceptor
* and redirect API calls to the Unbound API.
*/
const path = require('path');
// Determine the correct path to the interceptor based on how we're loaded
let interceptorPath;
if (__filename.includes('node_modules')) {
// Loaded from node_modules
interceptorPath = path.join(__dirname, 'interceptor.js');
} else {
// Loaded from development/build directory
interceptorPath = path.join(__dirname, 'interceptor.js');
}
try {
// Load the interceptor
const { initializeUnboundInterceptor } = require(interceptorPath);
// Initialize the interceptor for debugging
const interceptor = initializeUnboundInterceptor({
logLevel: process.env.UNBOUND_LOG_LEVEL || 'info'
});
} catch (error) {
console.error('Failed to load Unbound interceptor:', error.message);
// Don't exit - let Claude Code continue to work even if interceptor fails
}