{"id":786,"date":"2026-05-04T10:22:14","date_gmt":"2026-05-04T10:22:14","guid":{"rendered":"https:\/\/cyb3rjan.com\/?p=786"},"modified":"2026-05-04T14:22:40","modified_gmt":"2026-05-04T14:22:40","slug":"claude-code-on-deepseek-95-cheaper-same-interface","status":"publish","type":"post","link":"https:\/\/cyb3rjan.com\/index.php\/2026\/05\/04\/claude-code-on-deepseek-95-cheaper-same-interface\/","title":{"rendered":"Claude Code on DeepSeek \u2014 95% Cheaper, Same Interface"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Claude Code on DeepSeek \u2014 95% Cheaper, Same Interface<\/title>\n<style>\n  @import url('https:\/\/fonts.googleapis.com\/css2?family=Bitter:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&family=DM+Sans:wght@400;500&display=swap');\n\n  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\n  :root {\n    --accent: #0f6e8a;\n    --accent-light: rgba(15,110,138,0.12);\n    --code-bg: #1e1e1a;\n    --code-fg: #d4cfbe;\n    --code-comment: #7a7a6a;\n    --code-string: #a8c07a;\n    --code-key: #e0a070;\n    --border: rgba(128,128,128,0.25);\n  }\n\n  \/* body: NO background, NO color \u2014 let the theme handle it *\/\n  .blog-post-wrap {\n    font-family: 'DM Sans', sans-serif;\n    line-height: 1.7;\n    font-size: 17px;\n  }\n\n  .hero {\n    background: #0a1628;\n    color: #f7f5f0;\n    padding: 72px 24px 56px;\n    position: relative;\n    overflow: hidden;\n  }\n  .hero::before {\n    content: '';\n    position: absolute;\n    inset: 0;\n    background:\n      radial-gradient(ellipse 60% 50% at 80% 50%, rgba(15,110,138,0.18) 0%, transparent 70%),\n      repeating-linear-gradient(-45deg, transparent, transparent 40px, rgba(255,255,255,0.012) 40px, rgba(255,255,255,0.012) 41px);\n  }\n  .hero-inner {\n    max-width: 760px;\n    margin: 0 auto;\n    position: relative;\n  }\n  .hero-tag {\n    display: inline-block;\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 11px;\n    letter-spacing: 0.12em;\n    text-transform: uppercase;\n    color: #5bc8e0;\n    border: 1px solid #5bc8e0;\n    padding: 4px 10px;\n    border-radius: 3px;\n    margin-bottom: 24px;\n  }\n  .hero h1 {\n    font-family: 'Bitter', serif;\n    font-size: clamp(28px, 5vw, 46px);\n    font-weight: 600;\n    line-height: 1.2;\n    color: #f7f5f0;\n    margin-bottom: 20px;\n    max-width: 680px;\n  }\n  .hero-sub {\n    font-size: 18px;\n    color: rgba(247,245,240,0.65);\n    max-width: 580px;\n    line-height: 1.6;\n    margin-bottom: 32px;\n  }\n  .hero-meta {\n    display: flex;\n    align-items: center;\n    gap: 20px;\n    flex-wrap: wrap;\n  }\n  .hero-meta span {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 12px;\n    color: rgba(247,245,240,0.4);\n  }\n  .hero-meta span + span::before { content: '\u00b7'; margin-right: 20px; }\n\n  .blog-post-wrap .wrapper { max-width: 760px; margin: 0 auto; padding: 0 24px 96px; }\n  .blog-post-wrap .prose { padding-top: 48px; }\n  .blog-post-wrap .prose p { margin-bottom: 1.5rem; }\n  .blog-post-wrap .prose h2 {\n    font-family: 'Bitter', serif;\n    font-size: 26px;\n    font-weight: 600;\n    margin: 3rem 0 1rem;\n    padding-bottom: 10px;\n    border-bottom: 2px solid var(--accent);\n    display: inline-block;\n  }\n  .blog-post-wrap .prose h3 {\n    font-family: 'DM Sans', sans-serif;\n    font-size: 17px;\n    font-weight: 500;\n    margin: 2rem 0 0.75rem;\n  }\n  .blog-post-wrap .prose ul,\n  .blog-post-wrap .prose ol { padding-left: 1.5rem; margin-bottom: 1.5rem; }\n  .blog-post-wrap .prose li { margin-bottom: 0.5rem; }\n  .blog-post-wrap .prose strong { font-weight: 500; }\n  .blog-post-wrap .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }\n\n  .blog-post-wrap code {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 13.5px;\n    background: rgba(128,128,128,0.15);\n    border: 1px solid var(--border);\n    padding: 1px 6px;\n    border-radius: 4px;\n    color: var(--accent);\n  }\n\n  .blog-post-wrap .code-block {\n    background: var(--code-bg);\n    border-radius: 8px;\n    margin: 1.75rem 0;\n    overflow: hidden;\n    border: 1px solid #2e2e28;\n  }\n  .blog-post-wrap .code-block-header {\n    display: flex;\n    align-items: center;\n    padding: 10px 16px;\n    background: #161612;\n    border-bottom: 1px solid #2e2e28;\n  }\n  .blog-post-wrap .code-block-lang {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 11px;\n    letter-spacing: 0.08em;\n    text-transform: uppercase;\n    color: #5a5a4a;\n  }\n  .blog-post-wrap .code-block pre {\n    padding: 20px;\n    overflow-x: auto;\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 13px;\n    line-height: 1.7;\n    color: var(--code-fg);\n  }\n  .blog-post-wrap .code-block pre .c { color: var(--code-comment); font-style: italic; }\n  .blog-post-wrap .code-block pre .s { color: var(--code-string); }\n  .blog-post-wrap .code-block pre .k { color: var(--code-key); }\n  .blog-post-wrap .code-block pre .v { color: #8fc0d8; }\n\n  .blog-post-wrap .callout {\n    border-left: 3px solid var(--accent);\n    background: var(--accent-light);\n    padding: 16px 20px;\n    border-radius: 0 6px 6px 0;\n    margin: 1.75rem 0;\n  }\n  .blog-post-wrap .callout-title {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 11px;\n    letter-spacing: 0.1em;\n    text-transform: uppercase;\n    color: var(--accent);\n    margin-bottom: 6px;\n  }\n  .blog-post-wrap .callout p { margin: 0; font-size: 15px; }\n\n  .blog-post-wrap .callout.warn {\n    border-color: #b07010;\n    background: rgba(176,112,16,0.12);\n  }\n  .blog-post-wrap .callout.warn .callout-title { color: #c08020; }\n\n  .blog-post-wrap .price-grid {\n    display: grid;\n    grid-template-columns: 1fr 1fr;\n    gap: 12px;\n    margin: 1.75rem 0;\n  }\n  .blog-post-wrap .price-card {\n    border: 1px solid var(--border);\n    border-radius: 8px;\n    padding: 20px;\n    background: rgba(128,128,128,0.08);\n  }\n  .blog-post-wrap .price-card-label {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 11px;\n    letter-spacing: 0.08em;\n    text-transform: uppercase;\n    opacity: 0.5;\n    margin-bottom: 8px;\n  }\n  .blog-post-wrap .price-card-name {\n    font-size: 16px;\n    font-weight: 500;\n    margin-bottom: 12px;\n  }\n  .blog-post-wrap .price-card-price {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 22px;\n    font-weight: 500;\n    color: var(--accent);\n    margin-bottom: 4px;\n  }\n  .blog-post-wrap .price-card-sub {\n    font-size: 13px;\n    opacity: 0.5;\n  }\n  .blog-post-wrap .price-card.highlight {\n    border-color: var(--accent);\n    background: var(--accent-light);\n  }\n\n  .blog-post-wrap .spec-table {\n    width: 100%;\n    border-collapse: collapse;\n    margin: 1.75rem 0;\n    font-size: 15px;\n  }\n  .blog-post-wrap .spec-table th {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 11px;\n    letter-spacing: 0.08em;\n    text-transform: uppercase;\n    opacity: 0.5;\n    padding: 8px 12px;\n    text-align: left;\n    border-bottom: 1px solid var(--border);\n  }\n  .blog-post-wrap .spec-table td {\n    padding: 10px 12px;\n    border-bottom: 1px solid var(--border);\n    vertical-align: top;\n  }\n  .blog-post-wrap .spec-table tr:last-child td { border-bottom: none; }\n  .blog-post-wrap .spec-table td:first-child {\n    font-family: 'JetBrains Mono', monospace;\n    font-size: 13px;\n    opacity: 0.7;\n  }\n\n  .blog-post-wrap .divider { border: none; height: 1px; background: var(--border); margin: 3rem 0; }\n\n  .blog-post-wrap .footnote {\n    font-size: 14px;\n    opacity: 0.5;\n    border-top: 1px solid var(--border);\n    padding-top: 1.5rem;\n    margin-top: 3rem;\n    font-family: 'JetBrains Mono', monospace;\n  }\n<\/style>\n<\/head>\n<body>\n\n<div class=\"blog-post-wrap\">\n\n<div class=\"hero\">\n  <div class=\"hero-inner\">\n    <div class=\"hero-tag\">Claude Code \u00b7 Cost Optimization<\/div>\n    <h1>Claude Code on DeepSeek \u2014 95% Cheaper, Same Interface<\/h1>\n    <p class=\"hero-sub\">A four-line .bat file that redirects the Claude Code CLI to DeepSeek&#8217;s API \u2014 keeping the familiar interface while cutting costs dramatically.<\/p>\n    <div class=\"hero-meta\">\n      <span>May 2026<\/span>\n      <span>5 min read<\/span>\n      <span>Windows \u00b7 DeepSeek \u00b7 Claude Code CLI<\/span>\n    <\/div>\n  <\/div>\n<\/div>\n\n<div class=\"wrapper\">\n<div class=\"prose\">\n\n<p>After getting Claude Code running against a local Ollama instance, the next natural experiment was pointing it at <strong>DeepSeek&#8217;s API<\/strong> instead. The goal: keep the polished Claude Code interface and agentic loop, but swap out the model for something dramatically cheaper \u2014 without touching any Claude Code internals.<\/p>\n\n<p>Spoiler: it works, and it takes four lines of batch script.<\/p>\n\n<h2>Why DeepSeek?<\/h2>\n\n<p>DeepSeek offers an Anthropic-compatible API endpoint at <code>https:\/\/api.deepseek.com\/anthropic<\/code>. Because it speaks the same Messages API format that Claude Code expects, no proxy, adapter, or patching is needed. You just point the CLI at a different base URL and hand it a DeepSeek API key.<\/p>\n\n<p>The cost difference is significant:<\/p>\n\n<div class=\"price-grid\">\n  <div class=\"price-card\">\n    <div class=\"price-card-label\">Standard option<\/div>\n    <div class=\"price-card-name\">Claude Sonnet (Anthropic)<\/div>\n    <div class=\"price-card-price\">$3 \/ MTok<\/div>\n    <div class=\"price-card-sub\">input \u00b7 $15\/MTok output<\/div>\n  <\/div>\n  <div class=\"price-card highlight\">\n    <div class=\"price-card-label\">This setup<\/div>\n    <div class=\"price-card-name\">DeepSeek V3 \/ V4<\/div>\n    <div class=\"price-card-price\">~$0.14 \/ MTok<\/div>\n    <div class=\"price-card-sub\">input \u00b7 ~$0.28\/MTok output<\/div>\n  <\/div>\n<\/div>\n\n<p>For long coding sessions with large codebases \u2014 the exact use case Claude Code is built for \u2014 that difference adds up fast.<\/p>\n\n<h2>The batch file<\/h2>\n\n<p>The entire setup fits in a single <code>.bat<\/code> file. Save it anywhere on your PATH and call it instead of <code>claude<\/code>:<\/p>\n\n<div class=\"code-block\">\n  <div class=\"code-block-header\"><span class=\"code-block-lang\">bat<\/span><\/div>\n  <pre><span class=\"c\">:: claude-deepseek.bat<\/span>\n<span class=\"c\">:: Launches Claude Code CLI pointed at DeepSeek's Anthropic-compatible API<\/span>\n@echo off\nset <span class=\"k\">ANTHROPIC_BASE_URL<\/span>=<span class=\"s\">https:\/\/api.deepseek.com\/anthropic<\/span>\nset <span class=\"k\">ANTHROPIC_AUTH_TOKEN<\/span>=<span class=\"s\">YOUR_DEEPSEEK_API_KEY<\/span>\nset <span class=\"k\">ANTHROPIC_MODEL<\/span>=<span class=\"s\">deepseek-v3<\/span>\nset <span class=\"k\">ANTHROPIC_DEFAULT_SONNET_MODEL<\/span>=<span class=\"s\">deepseek-v3<\/span>\nclaude %*<\/pre>\n<\/div>\n\n<div class=\"callout warn\">\n  <div class=\"callout-title\">API key security<\/div>\n  <p>Never commit this file to a public repository. The API key is stored in plain text. Add the filename to your <code>.gitignore<\/code>, or store the key in a Windows environment variable and reference it as <code>%DEEPSEEK_API_KEY%<\/code>.<\/p>\n<\/div>\n\n<p>The <code>%*<\/code> at the end passes any arguments through to Claude Code unchanged, so flags like <code>--continue<\/code> or <code>--model<\/code> still work as expected.<\/p>\n\n<h2>How it works<\/h2>\n\n<p>Claude Code reads three environment variables before making any API call:<\/p>\n\n<table class=\"spec-table\">\n  <thead>\n    <tr><th>Variable<\/th><th>Purpose<\/th><\/tr>\n  <\/thead>\n  <tbody>\n    <tr>\n      <td>ANTHROPIC_BASE_URL<\/td>\n      <td>Overrides the API endpoint. Any server speaking the Anthropic Messages API format works here.<\/td>\n    <\/tr>\n    <tr>\n      <td>ANTHROPIC_AUTH_TOKEN<\/td>\n      <td>The API key sent in the Authorization header. DeepSeek validates this against your account.<\/td>\n    <\/tr>\n    <tr>\n      <td>ANTHROPIC_MODEL<\/td>\n      <td>The model string forwarded in the request body. Must match a model name DeepSeek recognizes.<\/td>\n    <\/tr>\n    <tr>\n      <td>ANTHROPIC_DEFAULT_SONNET_MODEL<\/td>\n      <td>Claude Code internally defaults to a Sonnet-class model for many operations. This variable overrides that default.<\/td>\n    <\/tr>\n  <\/tbody>\n<\/table>\n\n<p>Setting these four variables before invoking <code>claude<\/code> is all that is needed. The CLI never knows it is not talking to Anthropic.<\/p>\n\n<h2>Model naming<\/h2>\n\n<p>DeepSeek&#8217;s model names on their Anthropic-compatible endpoint follow their own convention. At time of writing:<\/p>\n\n<div class=\"code-block\">\n  <div class=\"code-block-header\"><span class=\"code-block-lang\">txt<\/span><\/div>\n  <pre>deepseek-v3          <span class=\"c\"># general-purpose, fast<\/span>\ndeepseek-r1          <span class=\"c\"># reasoning model, slower but stronger on complex tasks<\/span><\/pre>\n<\/div>\n\n<p>Check DeepSeek&#8217;s documentation for the current list \u2014 model names can change between API versions.<\/p>\n\n<h2>Limitations to be aware of<\/h2>\n\n<p>This approach works well for routine coding tasks, but there are a few things to keep in mind:<\/p>\n\n<ul>\n  <li><strong>Context window<\/strong> \u2014 DeepSeek V3 supports up to 128k tokens, which is sufficient for most projects but smaller than Claude&#8217;s 200k limit.<\/li>\n  <li><strong>Tool use fidelity<\/strong> \u2014 Claude Code relies heavily on tool\/function calling. DeepSeek is generally reliable here, but edge cases exist with complex nested tool calls.<\/li>\n  <li><strong>Model updates<\/strong> \u2014 DeepSeek updates their models more frequently than Anthropic. A model string that works today may behave differently after a silent update.<\/li>\n  <li><strong>Data privacy<\/strong> \u2014 Unlike the fully local Ollama setup, your code is still sent to an external API. Factor this in for sensitive or proprietary projects.<\/li>\n<\/ul>\n\n<div class=\"callout\">\n  <div class=\"callout-title\">Combine with local fallback<\/div>\n  <p>Keep both setups \u2014 a <code>claude-deepseek.bat<\/code> for cloud-backed sessions and a <code>claude-local.bat<\/code> pointing at Ollama on 192.168.1.10. Use DeepSeek for complex multi-file work, local Ollama for anything sensitive or offline.<\/p>\n<\/div>\n\n<h2>Getting a DeepSeek API key<\/h2>\n\n<p>Create an account at <a href=\"https:\/\/platform.deepseek.com\" target=\"_blank\" rel=\"noopener\">platform.deepseek.com<\/a>, navigate to API keys, and generate a new key. Top up credit as needed \u2014 the rates are low enough that a small amount goes a long way for coding sessions.<\/p>\n\n<hr class=\"divider\">\n\n<p>That is genuinely all there is to it. Four environment variables, one <code>.bat<\/code> file, and Claude Code works exactly as you would expect \u2014 file editing, multi-step reasoning, shell commands \u2014 just billed at a fraction of the usual cost.<\/p>\n\n<p class=\"footnote\">\/\/ tested on Windows 11 \u00b7 Claude Code CLI 1.x \u00b7 DeepSeek V4 via api.deepseek.com\/anthropic<\/p>\n\n<\/div>\n<\/div>\n\n<\/div><!-- \/.blog-post-wrap -->\n\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Claude Code on DeepSeek \u2014 95% Cheaper, Same Interface Claude Code \u00b7 Cost Optimization Claude Code on DeepSeek \u2014 95% Cheaper, Same Interface A four-line .bat file that redirects the Claude Code CLI to DeepSeek&#8217;s API \u2014 keeping the familiar interface while cutting costs dramatically. May 2026 5 min read Windows \u00b7 DeepSeek \u00b7 Claude [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":790,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,8],"tags":[],"class_list":["post-786","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-homelab","category-ai-tools"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/posts\/786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/comments?post=786"}],"version-history":[{"count":3,"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/posts\/786\/revisions"}],"predecessor-version":[{"id":826,"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/posts\/786\/revisions\/826"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/media\/790"}],"wp:attachment":[{"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/media?parent=786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/categories?post=786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cyb3rjan.com\/index.php\/wp-json\/wp\/v2\/tags?post=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}