DEV Community

FuturMix
FuturMix

Posted on

BYOK Guide: Use Your Own API Key with Cursor, Roo Code, and Cline

AI code editors like Cursor, Roo Code, and Cline are powerful — but their built-in pricing can add up. Most of these tools support "bring your own key" (BYOK), letting you route API calls through your own endpoint.

Here's how to set up each tool with a custom API gateway.

Why BYOK?

  • Cost control: Pay per token instead of flat subscriptions
  • Model flexibility: Switch between Claude, GPT, and Gemini without changing tools
  • No rate limits: Your usage, your limits
  • Unified billing: One dashboard for all model costs

Cursor

Cursor supports custom API endpoints through its settings:

  1. Open SettingsModels
  2. Under OpenAI API Key, enter your gateway key
  3. Set OpenAI API Base to your gateway URL:
   https://futurmix.ai/v1
Enter fullscreen mode Exit fullscreen mode
  1. Select your preferred model from the dropdown

Now Cursor routes all AI requests through your gateway.

Roo Code (VS Code Extension)

Roo Code has built-in support for OpenAI-compatible providers:

  1. Open Roo Code settings in VS Code
  2. Select OpenAI Compatible as the provider
  3. Configure:
    • Base URL: https://futurmix.ai/v1
    • API Key: Your gateway key
    • Model ID: claude-sonnet-4-5-20250929

That's it — Roo Code will now use your custom endpoint for all completions.

Cline (VS Code Extension)

Cline also supports OpenAI-compatible endpoints:

  1. Open Cline settings
  2. Choose OpenAI Compatible as the API provider
  3. Enter:
    • Base URL: https://futurmix.ai/v1
    • API Key: Your gateway key
    • Model ID: claude-sonnet-4-5-20250929

Continue (VS Code / JetBrains)

Edit your config.json:

{
  "models": [
    {
      "title": "Claude Sonnet 4.5",
      "provider": "openai",
      "model": "claude-sonnet-4-5-20250929",
      "apiBase": "https://futurmix.ai/v1",
      "apiKey": "your-gateway-key"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Claude Code (Terminal)

Claude Code supports custom API endpoints via environment variables:

export ANTHROPIC_BASE_URL=https://futurmix.ai
export ANTHROPIC_API_KEY=your-gateway-key
claude
Enter fullscreen mode Exit fullscreen mode

Note: Claude Code uses the Anthropic /v1/messages format, not OpenAI format. Your gateway needs to support both.

Comparing BYOK vs Built-in Pricing

Cursor Pro BYOK via Gateway
Monthly cost $20/month fixed Pay per token
Light usage (~$5/mo) Overpaying Save 75%
Heavy usage (~$50/mo) Underpaying Pay actual cost
Model choice Limited 22+ models
Provider lock-in Yes No

The break-even point depends on your usage. For most developers doing moderate AI-assisted coding, BYOK is cheaper.

Quick Setup Cheat Sheet

# Works with most OpenAI-SDK-based tools
export OPENAI_API_BASE=https://futurmix.ai/v1
export OPENAI_API_KEY=your-gateway-key

# For Anthropic-native tools (Claude Code, Claude Desktop)
export ANTHROPIC_BASE_URL=https://futurmix.ai
export ANTHROPIC_API_KEY=your-gateway-key
Enter fullscreen mode Exit fullscreen mode

What to Look for in an API Gateway

When choosing a gateway for BYOK:

  1. OpenAI compatibility — Must support /v1/chat/completions
  2. Model coverage — Claude, GPT, Gemini at minimum
  3. Reliability — Look for SLA guarantees
  4. No data retention — Your code shouldn't be stored
  5. Transparent pricing — No hidden markups

What BYOK setup are you using? Share your config in the comments.

Top comments (0)