Continue.dev Integration

Continue.dev is the leading open-source AI code assistant for VS Code and JetBrains IDEs. By integrating AnyAPI with Continue.dev, you get access to the best language models for coding assistance, autocomplete, chat, and code generation directly in your IDE.

Overview

Continue.dev provides comprehensive AI coding features:
  • AI Autocomplete - Smart code completion as you type
  • AI Chat - Conversational coding assistance in your IDE
  • Code Actions - Quick fixes and refactoring suggestions
  • Documentation - Auto-generate comments and docs
  • Test Generation - Create comprehensive test suites

Smart Autocomplete

Intelligent code completion powered by AI

AI Chat

Conversational coding help in your IDE

Code Actions

Quick fixes and intelligent refactoring

Multi-Model

Access multiple AI models for different tasks

Installation

VS Code Extension

Install Continue.dev from the VS Code marketplace:
  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for “Continue”
  4. Click Install

JetBrains IDEs

For IntelliJ IDEA, PyCharm, WebStorm, etc.:
  1. Open IDE Settings (Ctrl+Alt+S)
  2. Go to Plugins
  3. Search for “Continue”
  4. Install and Restart

Configuration

Basic Setup

Configure Continue.dev to use AnyAPI:
  1. Open Continue Settings:
    • In VS Code: Ctrl+Shift+P → “Continue: Open Settings”
    • Or click the Continue icon in the sidebar
  2. Create/Edit config.json:
    {
      "models": [
        {
          "title": "AnyAPI GPT-4",
          "provider": "openai",
          "model": "gpt-4o",
          "apiKey": "your-anyapi-key",
          "apiBase": "https://api.anyapi.ai/v1"
        }
      ],
      "tabAutocompleteModel": {
        "title": "AnyAPI GPT-4 Mini",
        "provider": "openai", 
        "model": "gpt-4o-mini",
        "apiKey": "your-anyapi-key",
        "apiBase": "https://api.anyapi.ai/v1"
      }
    }
    

Environment Variables

Set up environment variables for security:
# Add to your shell profile (.bashrc, .zshrc, etc.)
export ANYAPI_KEY="your-anyapi-key"
export ANYAPI_BASE_URL="https://api.anyapi.ai/v1"
Then reference in config:
{
  "models": [
    {
      "title": "AnyAPI GPT-4",
      "provider": "openai",
      "model": "gpt-4o",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "$ANYAPI_BASE_URL"
    }
  ]
}

Multi-Model Configuration

Optimized Model Setup

Configure different models for different tasks:
{
  "models": [
    {
      "title": "GPT-4 for Complex Tasks",
      "provider": "openai",
      "model": "gpt-4o",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are an expert programmer. Provide detailed, well-documented code solutions."
    },
    {
      "title": "Claude for Code Review", 
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20241022",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are a senior code reviewer. Focus on code quality, best practices, and potential issues."
    },
    {
      "title": "Gemini for Documentation",
      "provider": "gemini",
      "model": "gemini-pro",
      "apiKey": "$ANYAPI_KEY", 
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are a technical writer. Create clear, comprehensive documentation."
    }
  ],
  "tabAutocompleteModel": {
    "title": "GPT-4 Mini for Autocomplete",
    "provider": "openai",
    "model": "gpt-4o-mini",
    "apiKey": "$ANYAPI_KEY",
    "apiBase": "https://api.anyapi.ai/v1"
  },
  "embeddingsProvider": {
    "provider": "openai",
    "model": "text-embedding-3-large",
    "apiKey": "$ANYAPI_KEY",
    "apiBase": "https://api.anyapi.ai/v1"
  }
}

Model Selection Rules

Configure automatic model selection based on context:
{
  "models": [
    {
      "title": "Quick Code Help",
      "provider": "openai",
      "model": "gpt-4o-mini",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "maxTokens": 500,
      "temperature": 0.2
    },
    {
      "title": "Complex Problem Solving",
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20241022", 
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "maxTokens": 4000,
      "temperature": 0.1
    }
  ],
  "contextSelection": {
    "simple": "Quick Code Help",
    "complex": "Complex Problem Solving",
    "review": "Claude for Code Review"
  }
}

Features and Usage

AI Autocomplete

Configure intelligent code completion:
{
  "tabAutocompleteModel": {
    "title": "Fast Autocomplete",
    "provider": "openai",
    "model": "gpt-4o-mini",
    "apiKey": "$ANYAPI_KEY",
    "apiBase": "https://api.anyapi.ai/v1",
    "temperature": 0.1,
    "maxTokens": 500
  },
  "tabAutocompleteOptions": {
    "debounceDelay": 300,
    "maxPromptTokens": 1500,
    "prefixPercentage": 0.85,
    "multilineCompletions": "always"
  }
}
Usage:
  • Type code naturally
  • Press Tab to accept AI suggestions
  • Press Ctrl+Right Arrow for partial acceptance

AI Chat

Use conversational coding assistance:
{
  "allowAnonymousTelemetry": false,
  "models": [
    {
      "title": "Coding Assistant",
      "provider": "openai", 
      "model": "gpt-4o",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are an expert programming assistant. Help with code, debugging, architecture decisions, and best practices. Always provide working code examples when possible."
    }
  ]
}
Usage Examples:
👤 User: "How do I implement authentication in Express.js?"

🤖 AI: I'll help you implement authentication in Express.js using JWT tokens. Here's a complete solution:

```javascript
// auth.js - Authentication middleware
const jwt = require('jsonwebtoken');
const bcrypt = require('bcryptjs');

// Generate JWT token
const generateToken = (userId) => {
  return jwt.sign({ userId }, process.env.JWT_SECRET, { 
    expiresIn: '24h' 
  });
};

// Middleware to verify token
const authenticateToken = (req, res, next) => {
  const authHeader = req.headers['authorization'];
  const token = authHeader && authHeader.split(' ')[1];
  
  if (!token) {
    return res.status(401).json({ error: 'Access token required' });
  }
  
  jwt.verify(token, process.env.JWT_SECRET, (err, user) => {
    if (err) {
      return res.status(403).json({ error: 'Invalid token' });
    }
    req.user = user;
    next();
  });
};
👤 User: “Add password hashing to this user registration function” 🤖 AI: I’ll add secure password hashing using bcrypt:
const bcrypt = require('bcryptjs');

const registerUser = async (req, res) => {
  try {
    const { email, password } = req.body;
    
    // Hash password with salt rounds
    const saltRounds = 12;
    const hashedPassword = await bcrypt.hash(password, saltRounds);
    
    // Create user with hashed password
    const user = await User.create({
      email,
      password: hashedPassword
    });
    
    // Generate token for immediate login
    const token = generateToken(user.id);
    
    res.status(201).json({
      message: 'User registered successfully',
      token,
      user: { id: user.id, email: user.email }
    });
    
  } catch (error) {
    res.status(400).json({ error: error.message });
  }
};

### Code Actions

Quick fixes and refactoring with keyboard shortcuts:

**Common Actions**:
- `Ctrl+I`: Explain selected code
- `Ctrl+Shift+R`: Refactor selected code  
- `Ctrl+Shift+C`: Generate comments/documentation
- `Ctrl+Shift+T`: Generate tests for selected code

### Slash Commands

Use slash commands in chat for quick actions:

/edit - Edit selected code /comment - Add comments to code /test - Generate tests /fix - Fix bugs in code /optimize - Optimize performance /docs - Generate documentation /explain - Explain how code works /translate - Convert between languages

## Advanced Configuration

### Custom Context Providers

Add custom context for better AI assistance:

```json
{
  "contextProviders": [
    {
      "name": "codebase",
      "params": {
        "nRetrieve": 25,
        "nFinal": 5,
        "useReranking": true
      }
    },
    {
      "name": "diff", 
      "params": {}
    },
    {
      "name": "folder",
      "params": {
        "folders": ["src", "tests", "docs"]
      }
    },
    {
      "name": "git",
      "params": {
        "branches": ["main", "develop"]
      }
    },
    {
      "name": "google",
      "params": {
        "serperApiKey": "$SERPER_API_KEY"
      }
    }
  ]
}

Custom Slash Commands

Define project-specific commands:
{
  "slashCommands": [
    {
      "name": "review",
      "description": "Perform comprehensive code review",
      "step": {
        "name": "Code Review",
        "prompt": "Please perform a thorough code review of the selected code. Check for:\n1. Code quality and best practices\n2. Potential bugs or security issues\n3. Performance optimizations\n4. Readability and maintainability\n5. Test coverage suggestions\n\nProvide specific feedback and recommendations."
      }
    },
    {
      "name": "api",
      "description": "Generate REST API endpoint",
      "step": {
        "name": "API Generation",
        "prompt": "Generate a complete REST API endpoint based on the description. Include:\n1. Route definition\n2. Request/response schemas\n3. Validation middleware\n4. Error handling\n5. Unit tests\n6. API documentation\n\nUse modern Node.js/Express patterns."
      }
    },
    {
      "name": "component", 
      "description": "Create React component",
      "step": {
        "name": "React Component",
        "prompt": "Create a React component based on the description. Include:\n1. TypeScript interfaces\n2. Props validation\n3. Proper hooks usage\n4. Error boundaries\n5. Unit tests with React Testing Library\n6. Storybook stories\n\nFollow React best practices and modern patterns."
      }
    }
  ]
}

Workspace-Specific Settings

Configure per-project settings:
// .continue/config.json in project root
{
  "models": [
    {
      "title": "Project-Specific Assistant",
      "provider": "openai",
      "model": "gpt-4o",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are working on a React TypeScript project with Node.js backend. Use modern ES6+ syntax, TypeScript best practices, and focus on performance and security."
    }
  ],
  "contextProviders": [
    {
      "name": "codebase",
      "params": {
        "nRetrieve": 30,
        "nFinal": 8
      }
    }
  ],
  "docs": [
    {
      "title": "Project Documentation",
      "startUrl": "http://localhost:3000/docs"
    }
  ]
}

Integration Examples

React Development

Optimized configuration for React projects:
{
  "models": [
    {
      "title": "React Expert",
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20241022",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are a React expert. Use modern React patterns including hooks, functional components, TypeScript, and performance best practices. Always provide working, production-ready code."
    }
  ],
  "slashCommands": [
    {
      "name": "hook",
      "description": "Create custom React hook",
      "step": {
        "name": "Custom Hook",
        "prompt": "Create a custom React hook with:\n1. TypeScript types\n2. Proper dependency management\n3. Error handling\n4. JSDoc documentation\n5. Unit tests\n\nFollow React hooks best practices."
      }
    },
    {
      "name": "component",
      "description": "Create React component with full setup",
      "step": {
        "name": "React Component",
        "prompt": "Create a complete React component including:\n1. TypeScript interface for props\n2. Functional component with hooks\n3. CSS/styled-components styling\n4. Unit tests with React Testing Library\n5. Storybook story\n6. JSDoc comments\n\nUse modern React patterns and accessibility best practices."
      }
    }
  ]
}

Node.js Backend Development

Configuration for backend development:
{
  "models": [
    {
      "title": "Backend Expert",
      "provider": "openai",
      "model": "gpt-4o",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are a Node.js backend expert. Focus on scalable architecture, security, performance, and best practices. Use Express.js, TypeScript, and modern async/await patterns."
    }
  ],
  "slashCommands": [
    {
      "name": "endpoint",
      "description": "Create REST API endpoint",
      "step": {
        "name": "API Endpoint",
        "prompt": "Create a complete REST API endpoint with:\n1. Express.js route handler\n2. Input validation (Joi/Zod)\n3. Database operations\n4. Error handling middleware\n5. TypeScript types\n6. Unit and integration tests\n7. OpenAPI documentation\n\nFollow RESTful principles and security best practices."
      }
    },
    {
      "name": "middleware",
      "description": "Create Express middleware",
      "step": {
        "name": "Express Middleware",
        "prompt": "Create Express middleware with:\n1. TypeScript types\n2. Error handling\n3. Logging\n4. Input validation\n5. Security considerations\n6. Unit tests\n\nFollow middleware best practices."
      }
    }
  ]
}

Python Data Science

Configuration for Python data science work:
{
  "models": [
    {
      "title": "Data Science Expert",
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20241022",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "You are a Python data science expert. Use pandas, numpy, scikit-learn, and matplotlib/seaborn for analysis and visualization. Write clean, efficient, and well-documented code."
    }
  ],
  "slashCommands": [
    {
      "name": "analysis",
      "description": "Create data analysis workflow", 
      "step": {
        "name": "Data Analysis",
        "prompt": "Create a data analysis workflow including:\n1. Data loading and cleaning\n2. Exploratory data analysis\n3. Statistical analysis\n4. Visualizations\n5. Key insights summary\n6. Jupyter notebook format\n\nUse pandas, matplotlib, and seaborn best practices."
      }
    },
    {
      "name": "model",
      "description": "Create ML model pipeline",
      "step": {
        "name": "ML Pipeline",
        "prompt": "Create a machine learning pipeline with:\n1. Data preprocessing\n2. Feature engineering\n3. Model training and validation\n4. Hyperparameter tuning\n5. Model evaluation\n6. Prediction function\n\nUse scikit-learn and follow ML best practices."
      }
    }
  ]
}

Performance Optimization

Caching Configuration

Optimize performance with caching:
{
  "tabAutocompleteOptions": {
    "debounceDelay": 300,
    "maxPromptTokens": 1500,
    "prefixPercentage": 0.85,
    "suffixPercentage": 0.15,
    "maxSuffixTokens": 500,
    "template": "default",
    "multilineCompletions": "always"
  },
  "contextProviders": [
    {
      "name": "codebase",
      "params": {
        "nRetrieve": 25,
        "nFinal": 5,
        "useReranking": true,
        "cacheDuration": 3600
      }
    }
  ]
}

Request Optimization

Configure request settings for better performance:
{
  "models": [
    {
      "title": "Optimized Model",
      "provider": "openai",
      "model": "gpt-4o",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "requestOptions": {
        "timeout": 30000,
        "maxRetries": 3,
        "retryDelay": 1000
      },
      "maxTokens": 2000,
      "temperature": 0.1
    }
  ]
}

Monitoring and Analytics

Usage Tracking

Monitor Continue.dev usage and costs:
{
  "analytics": {
    "enabled": true,
    "trackUsage": true,
    "trackCosts": true,
    "exportMetrics": true
  },
  "telemetry": {
    "enabled": false,
    "anonymous": true
  }
}

Custom Metrics

Track custom metrics for your team:
// Custom metrics tracking
const metrics = {
  completionsAccepted: 0,
  chatQueries: 0,
  tokensUsed: 0,
  timesSaved: 0,
  errorsFixed: 0
};

// Track in your IDE extension
window.addEventListener('continue:completion:accepted', () => {
  metrics.completionsAccepted++;
});

window.addEventListener('continue:chat:query', () => {
  metrics.chatQueries++;
});

Best Practices

Security

Protect sensitive information:
{
  "rules": [
    {
      "include": ["**/*.{js,ts,py,java,cpp,c,h,hpp}"],
      "exclude": [
        "**/*.env*",
        "**/secrets/**",
        "**/*.key",
        "**/node_modules/**",
        "**/.git/**"
      ]
    }
  ],
  "systemMessage": "Never include passwords, API keys, or other sensitive information in code examples. Always use placeholder values."
}

Code Quality

Configure for high-quality code generation:
{
  "models": [
    {
      "title": "Quality-Focused Assistant",
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20241022",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "systemMessage": "Always write clean, maintainable code following these principles:\n1. Use meaningful variable and function names\n2. Add comprehensive error handling\n3. Include unit tests\n4. Add JSDoc/docstring comments\n5. Follow language-specific best practices\n6. Consider performance and security\n7. Make code readable and self-documenting"
    }
  ]
}

Team Configuration

Standardize settings across your team:
{
  "teamSettings": {
    "sharedModels": [
      {
        "title": "Team Standard",
        "provider": "openai",
        "model": "gpt-4o",
        "apiKey": "$TEAM_ANYAPI_KEY",
        "apiBase": "https://api.anyapi.ai/v1",
        "systemMessage": "Follow our team's coding standards and best practices..."
      }
    ],
    "enforcedRules": [
      "always-add-tests",
      "require-documentation",
      "security-first"
    ]
  }
}

Troubleshooting

Common Issues

Authentication Errors

Error: API key authentication failed
Solution: Verify your AnyAPI key is correct and has the necessary permissions.

Model Access Issues

Error: Model 'gpt-4o' not found
Solution: Check your AnyAPI subscription includes the requested model.

Slow Autocomplete

Issue: Autocomplete suggestions are slow
Solution:
  • Use gpt-4o-mini for autocomplete
  • Reduce maxPromptTokens
  • Increase debounceDelay

Debug Mode

Enable debug logging:
{
  "allowAnonymousTelemetry": false,
  "logs": {
    "level": "debug",
    "file": "~/.continue/logs/debug.log"
  }
}

Network Issues

Handle network connectivity problems:
{
  "models": [
    {
      "title": "Robust Model",
      "provider": "openai",
      "model": "gpt-4o",
      "apiKey": "$ANYAPI_KEY",
      "apiBase": "https://api.anyapi.ai/v1",
      "requestOptions": {
        "timeout": 60000,
        "maxRetries": 5,
        "retryDelay": 2000
      }
    }
  ]
}

Advanced Use Cases

Code Review Automation

Set up automated code review:
{
  "slashCommands": [
    {
      "name": "review-pr",
      "description": "Comprehensive PR review",
      "step": {
        "name": "PR Review",
        "prompt": "Review this pull request thoroughly:\n\n1. **Code Quality**\n   - Check for code smells\n   - Verify naming conventions\n   - Assess code organization\n\n2. **Security**\n   - Look for security vulnerabilities\n   - Check input validation\n   - Verify authentication/authorization\n\n3. **Performance**\n   - Identify performance bottlenecks\n   - Check for inefficient algorithms\n   - Suggest optimizations\n\n4. **Testing**\n   - Assess test coverage\n   - Verify test quality\n   - Suggest additional tests\n\n5. **Documentation**\n   - Check for missing documentation\n   - Verify code comments\n   - Suggest improvements\n\nProvide specific, actionable feedback with code examples where helpful."
      }
    }
  ]
}

Documentation Generation

Automate documentation creation:
{
  "slashCommands": [
    {
      "name": "docs-api",
      "description": "Generate API documentation",
      "step": {
        "name": "API Documentation",
        "prompt": "Generate comprehensive API documentation for the selected code:\n\n1. **Overview** - Brief description of the API\n2. **Endpoints** - List all endpoints with methods\n3. **Parameters** - Document all parameters with types\n4. **Response Examples** - Show example responses\n5. **Error Codes** - Document possible errors\n6. **Authentication** - Explain auth requirements\n7. **Rate Limits** - Document any limits\n8. **SDK Examples** - Show usage in different languages\n\nFormat as OpenAPI 3.0 specification."
      }
    }
  ]
}

Next Steps

For more information about Continue.dev, visit the official documentation.