Skip to content

Instantly share code, notes, and snippets.

@steebchen
Created January 25, 2026 17:28
Show Gist options
  • Select an option

  • Save steebchen/be1e7bc484fcae86104aff7c1d61bca1 to your computer and use it in GitHub Desktop.

Select an option

Save steebchen/be1e7bc484fcae86104aff7c1d61bca1 to your computer and use it in GitHub Desktop.
Claude Sonnet 4 with OpenCode via LLM Gateway

Claude Sonnet 4 with OpenCode via LLM Gateway

Model Overview

  • Model ID: claude-sonnet-4-20250514
  • Provider: Anthropic
  • Strengths: Balanced speed and quality, daily coding tasks
  • Context: 200K tokens

Configuration

Add to ~/.config/opencode/config.json:

{
  "provider": "openai-compatible",
  "apiKey": "your-llmgateway-api-key",
  "baseUrl": "https://api.llmgateway.io/v1",
  "model": "claude-sonnet-4-20250514"
}

Or via environment:

export OPENCODE_PROVIDER="openai-compatible"
export OPENCODE_API_KEY="your-llmgateway-api-key"
export OPENCODE_BASE_URL="https://api.llmgateway.io/v1"
export OPENCODE_MODEL="claude-sonnet-4-20250514"

Usage

opencode --model claude-sonnet-4-20250514 "write unit tests for this module"

Best Use Cases

  • Daily coding assistance
  • Writing tests
  • Documentation generation
  • Code explanations
  • Quick refactoring

Pricing Tier

Mid-tier - excellent balance of cost and capability for regular use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment