Skip to content

How to Use Claude Outside Claude Code: API, OpenRouter, GitHub Copilot, and Third-Party Tools

Problem

I wanted to use Claude outside the Claude Code desktop application. When I checked Reddit, I found I wasn’t alone.

A user posted: “Is there a way to use Claude without the Claude Code app? I heard there were changes to API usage policies.”

Another replied: “You can use the Claude API directly and GitHub Copilot’s hosted Claude APIs.”

But when I dug deeper, I found confusion about what actually works and how much it costs. One person said API access was “banned” while another said “it’s not banned, you just have to pay for it.”

I needed to figure out: what are my real options for using Claude models outside the Claude Code app, and what does each approach actually cost?

What I Discovered

After researching and testing, I found four main approaches:

  1. Direct Anthropic API - Use Anthropic’s official API directly
  2. OpenRouter - An API gateway that offers Claude models
  3. GitHub Copilot - Now supports Claude models as a provider option
  4. Third-Party CLI Tools - Tools like OpenCode with custom authentication

Each requires an API key and charges per token rather than a flat subscription fee. Let me break down each option.

Option 1: Direct Anthropic API Access

What It Is

Direct API access to Claude models through Anthropic’s platform. You pay per token for input and output.

How I Set It Up

First, I created an Anthropic account and generated an API key:

Terminal window
# Install the Anthropic SDK
pip install anthropic

Then I created a simple test script:

test_claude_api.py
import anthropic
client = anthropic.Anthropic(
api_key="your-api-key-here" # Replace with your key
)
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude!"}
]
)
print(message.content)

Pros

  • Direct access to all Claude models (Opus, Sonnet, Haiku)
  • Full control over parameters (temperature, max_tokens, etc.)
  • No middleman - fastest response times
  • Official documentation and support

Cons

  • Need to handle authentication yourself
  • Must implement your own interface (CLI, web app, etc.)
  • Pay-as-you-go can be unpredictable if not monitored

Cost Breakdown

Direct Anthropic API Pricing (as of 2026):
┌─────────────────────────────────────────────────────────────┐
│ Model │ Input (per 1M tokens) │ Output (per 1M tokens)│
├───────────────┼───────────────────────┼────────────────────────┤
│ Claude Opus 4 │ $15.00 │ $75.00 │
│ Claude Sonnet │ $3.00 │ $15.00 │
│ Claude Haiku │ $0.25 │ $1.25 │
└─────────────────────────────────────────────────────────────┘

For comparison, a typical coding session might use:

Example Session Cost (Sonnet):
- Input: 50,000 tokens = $0.15
- Output: 20,000 tokens = $0.30
- Total: $0.45 per session
Monthly estimate (20 sessions): ~$9.00

Option 2: OpenRouter (API Gateway)

What It Is

OpenRouter is a unified API gateway that provides access to multiple AI models, including Claude, through a single interface. It acts as a middleman between you and various AI providers.

How I Set It Up

First, I created an OpenRouter account and got an API key:

Terminal window
# Install requests if needed
pip install requests

Then I tested the API:

test_openrouter.py
import requests
response = requests.post(
url="https://openrouter.ai/api/v1/chat/completions",
headers={
"Authorization": "Bearer YOUR_OPENROUTER_KEY",
"Content-Type": "application/json",
},
json={
"model": "anthropic/claude-sonnet-4",
"messages": [
{"role": "user", "content": "Hello, Claude!"}
]
}
)
print(response.json())

Pros

  • Single API key for multiple models (Claude, GPT-4, Llama, etc.)
  • Easy to switch between models
  • Often has competitive pricing
  • Good for experimentation and comparison

Cons

  • Extra layer adds slight latency
  • Dependent on OpenRouter’s uptime
  • May have rate limits during peak times

Cost Comparison

OpenRouter Claude Pricing (as of 2026):
┌─────────────────────────────────────────────────────────────┐
│ Model │ Input (per 1M tokens) │ Output (per 1M tokens)│
├───────────────┼───────────────────────┼────────────────────────┤
│ Claude Opus 4 │ ~$15.00 │ ~$75.00 │
│ Claude Sonnet │ ~$3.00 │ ~$15.00 │
│ Claude Haiku │ ~$0.25 │ ~$1.25 │
└─────────────────────────────────────────────────────────────┘
Note: Prices may vary slightly based on demand

One advantage: OpenRouter shows you the exact cost before you make a request, which helps with budgeting.

Option 3: GitHub Copilot with Claude

What It Is

GitHub Copilot now supports Claude models as an alternative to OpenAI models. This works in VS Code, JetBrains IDEs, and on GitHub.com.

How I Set It Up

I already had a GitHub Copilot subscription. To switch to Claude:

  1. Open VS Code
  2. Go to Settings > GitHub Copilot
  3. Change the model provider to “Claude (Anthropic)”

Or in the GitHub Copilot Chat:

# In the chat panel:
@workspace Use Claude Sonnet to help me with this code

Pros

  • Seamless IDE integration
  • No separate API key management
  • Works with existing Copilot subscription ($10/month for individuals)
  • Good for code completion and chat

Cons

  • Limited to supported IDEs
  • Less control over model parameters
  • Requires GitHub Copilot subscription
  • May not support all Claude models

Cost Analysis

GitHub Copilot Pricing:
┌──────────────────────────────────────────────────┐
│ Plan │ Monthly Cost │ Claude Access │
├─────────────┼──────────────┼─────────────────────┤
│ Individual │ $10/month │ Sonnet, Haiku │
│ Business │ $19/month │ All Claude models │
│ Enterprise │ $39/month │ All Claude models │
└──────────────────────────────────────────────────┘

If you already pay for Copilot, switching to Claude models costs nothing extra. This is often the most cost-effective option for individual developers.

Option 4: Third-Party CLI Tools (OpenCode)

What It Is

OpenCode is a community-maintained CLI tool that provides Claude-like functionality. There’s a workaround for authentication that some users employ.

The Authentication Workaround

I found this GitHub repository mentioned in discussions:

https://github.com/griffinmartin/opencode-claude-auth

This tool attempts to use Claude subscription credentials with OpenCode CLI.

Pros

  • Free if you have a Claude Pro subscription
  • CLI-based workflow familiar to developers
  • Can work with existing tools and scripts

Cons

  • Requires technical setup
  • May violate terms of service
  • Authentication methods can break
  • No official support

Important Warning

One Reddit user clarified: “You can use Claude with OpenCode or other tools, but to do that you need to pay for API usage.”

This means the “free” authentication workaround may not work as expected. I recommend checking the current status of these tools before relying on them.

Cost Comparison Table

Here’s a side-by-side comparison of all four approaches:

Claude Access Options Comparison:
┌─────────────────┬────────────────┬─────────────────┬─────────────────┐
│ Option │ Setup Effort │ Cost Model │ Best For │
├─────────────────┼────────────────┼─────────────────┼─────────────────┤
│ Direct API │ Medium │ Pay per token │ Custom apps │
│ │ │ ~$0.30/session │ Full control │
├─────────────────┼────────────────┼─────────────────┼─────────────────┤
│ OpenRouter │ Low │ Pay per token │ Experimentation │
│ │ │ ~$0.30/session │ Multi-model use │
├─────────────────┼────────────────┼─────────────────┼─────────────────┤
│ GitHub Copilot │ Very Low │ Flat $10/month │ IDE coding │
│ │ │ (unlimited) │ Individual devs │
├─────────────────┼────────────────┼─────────────────┼─────────────────┤
│ Third-Party CLI │ High │ Varies │ CLI workflows │
│ (OpenCode) │ │ May need API │ Advanced users │
└─────────────────┴────────────────┴─────────────────┴─────────────────┘

Decision Matrix

I made this flowchart to help decide which approach to use:

┌─────────────────────┐
│ Need Claude access? │
└──────────┬──────────┘
┌──────────▼──────────┐
│ Already have │
│ Copilot? │
└──────────┬──────────┘
┌────────────────┴────────────────┐
│ │
┌────────▼────────┐ ┌────────▼────────┐
│ YES │ │ NO │
│ Switch to Claude│ │ Need custom │
│ in settings │ │ integration? │
└─────────────────┘ └────────┬────────┘
┌────────────────┴────────────────┐
│ │
┌────────▼────────┐ ┌────────▼────────┐
│ YES │ │ NO │
│ Direct API │ │ Want to compare │
│ or OpenRouter │ │ multiple models?│
└─────────────────┘ └────────┬────────┘
┌────────────────────┴────────────────────┐
│ │
┌────────▼────────┐ ┌────────▼────────┐
│ YES │ │ NO │
│ OpenRouter │ │ Direct API │
│ (single key) │ │ (best prices) │
└─────────────────┘ └─────────────────┘

What I Recommend

Based on my research and testing, here’s what I suggest:

For Individual Developers

Start with GitHub Copilot ($10/month). If you code in VS Code or JetBrains, this is the simplest and most cost-effective option. The flat fee means no surprise API bills.

For Custom Applications

Use Direct Anthropic API. Build your own interface or integrate Claude into your application. The pay-per-token model gives you full control and transparency.

For Experimentation

Try OpenRouter. The single API key for multiple models makes it easy to compare Claude with GPT-4, Llama, and others. Great for research and prototyping.

For CLI Power Users

Proceed with caution on third-party tools. The authentication workarounds may not work consistently or may violate terms of service. Consider Direct API for reliable CLI usage.

Common Mistakes I Made

Mistake 1: Confusing subscription with API

I thought my $20/month Claude Pro subscription included API access. It doesn’t. These are separate payment models:

  • Subscription = flat fee for web/app access
  • API = pay-per-token for programmatic access

Mistake 2: Not monitoring token usage

With Direct API, I didn’t track my usage. I got a surprising bill one month. Now I set up usage alerts:

monitor_usage.py
import anthropic
client = anthropic.Anthropic()
# Check usage
usage = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=10,
messages=[{"role": "user", "content": "hi"}]
)
print(f"Input tokens: {usage.usage.input_tokens}")
print(f"Output tokens: {usage.usage.output_tokens}")

Mistake 3: Not comparing all options

I jumped to the Direct API first. Later, I realized GitHub Copilot would have been cheaper for my IDE-based coding workflow.

Summary

In this post, I explained four ways to use Claude outside the Claude Code desktop app:

  1. Direct Anthropic API - Best for custom applications and full control
  2. OpenRouter - Best for comparing multiple models with one API key
  3. GitHub Copilot - Best for IDE-based coding (flat $10/month)
  4. Third-Party CLI Tools - Proceed with caution; may not work reliably

The key insight from Reddit discussions: API access was never “banned” - you just need to pay for it separately from any subscription. Each approach has different trade-offs in setup effort, cost model, and use case fit.

For most developers, I recommend starting with GitHub Copilot if you already have it, or Direct API if you need programmatic access. OpenRouter is great for experimentation, and third-party CLI tools require extra caution.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments