<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hamza Khan</title>
    <description>The latest articles on DEV Community by Hamza Khan (@hamza_khan_d2f1854314be1f).</description>
    <link>https://dev.to/hamza_khan_d2f1854314be1f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3699130%2F2d79f7cb-2b22-432d-9745-7c27f26b2b5e.png</url>
      <title>DEV Community: Hamza Khan</title>
      <link>https://dev.to/hamza_khan_d2f1854314be1f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hamza_khan_d2f1854314be1f"/>
    <language>en</language>
    <item>
      <title>3 Prompt Engineering Techniques That Unlock Better AI Reasoning</title>
      <dc:creator>Hamza Khan</dc:creator>
      <pubDate>Sun, 11 Jan 2026 20:56:09 +0000</pubDate>
      <link>https://dev.to/hamza_khan_d2f1854314be1f/3-prompt-engineering-techniques-that-unlock-better-ai-reasoning-22ab</link>
      <guid>https://dev.to/hamza_khan_d2f1854314be1f/3-prompt-engineering-techniques-that-unlock-better-ai-reasoning-22ab</guid>
      <description>&lt;h2&gt;
  
  
  Steering the AI: A Developer's Guide to Prompt Engineering
&lt;/h2&gt;

&lt;p&gt;If you've ever felt frustrated by an LLM giving you surface-level answers or completely missing the point, you're not alone. The good news? You don't need to retrain the model or tweak its weights. You just need better prompts.&lt;/p&gt;

&lt;p&gt;Prompt engineering is your steering wheel for Large Language Models. Small adjustments to how you phrase instructions can completely transform the quality of output you get back.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Exactly Is Prompt Engineering?
&lt;/h2&gt;

&lt;p&gt;LLMs are incredibly powerful, but they're not mind readers. They need clear direction to deliver what you actually want.&lt;/p&gt;

&lt;p&gt;Think of prompt engineering as the art and science of crafting instructions that help the model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Think through problems step-by-step&lt;/strong&gt; instead of jumping to conclusions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Follow specific constraints&lt;/strong&gt; you've defined for the task&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stay focused&lt;/strong&gt; on what actually matters&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid shallow or generic responses&lt;/strong&gt; that waste your time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's the key insight: you're not modifying the model's underlying parameters—you're simply changing the instructions. And that changes &lt;em&gt;everything&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;It's the fastest, lowest-effort way to get dramatically better results from any LLM, whether you're using GPT, Claude, Gemini, or any other model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three Techniques That Unlock Better Reasoning
&lt;/h2&gt;

&lt;p&gt;What makes AI coding assistants so powerful isn't just their ability to generate code—it's their ability to &lt;em&gt;reason through it&lt;/em&gt;. This same reasoning capability applies to math problems, logic puzzles, debugging sessions, and any multi-step challenge.&lt;/p&gt;

&lt;p&gt;Let's explore three prompting techniques that significantly boost an LLM's reasoning abilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Chain of Thought (CoT): Show Your Work
&lt;/h3&gt;

&lt;p&gt;Chain of Thought is the simplest and most widely adopted technique in the prompt engineering toolkit.&lt;/p&gt;

&lt;p&gt;Instead of asking the LLM to jump straight to the answer, you nudge it to reason step by step—just like showing your work in a math class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it works:&lt;/strong&gt; When the model articulates its reasoning process, it can catch logical errors and arrive at more accurate conclusions. It's the difference between guessing and understanding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simple example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Standard prompt:
"What is 15% of 80?"

Chain of Thought prompt:
"What is 15% of 80? Let's think step by step."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That tiny addition—"Let's think step by step"—can unlock reasoning capabilities that zero-shot prompting would completely miss.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-world coding example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Debug this function. First, explain what it's supposed to do, 
then identify potential issues, and finally suggest fixes."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro tip:&lt;/strong&gt; You can also provide an example of step-by-step reasoning (few-shot CoT) to guide the model's thinking pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Calculate 23% of 150.

Example: To find 15% of 80:
1. Convert 15% to decimal: 15/100 = 0.15
2. Multiply: 0.15 × 80 = 12
3. Answer: 12

Now solve for 23% of 150 using the same approach."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Self-Consistency: Democracy of Answers
&lt;/h3&gt;

&lt;p&gt;Chain of Thought is powerful, but it has a weakness: inconsistency.&lt;/p&gt;

&lt;p&gt;Run the same CoT prompt multiple times (especially with higher temperature settings), and you might get different answers. Which one is correct?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Self-Consistency&lt;/strong&gt; embraces this variation strategically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The approach is simple:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Generate multiple reasoning paths for the same question (typically 5-10 attempts)&lt;/li&gt;
&lt;li&gt;Collect all the final answers&lt;/li&gt;
&lt;li&gt;Select the most common answer (majority voting)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The logic:&lt;/strong&gt; When in doubt, ask the model several times and trust the wisdom of the crowd.&lt;/p&gt;

&lt;p&gt;This technique often produces more robust results, especially for ambiguous or complex problems. Research shows it can improve accuracy by 10-30% on reasoning tasks compared to single-pass CoT.&lt;/p&gt;

&lt;p&gt;However, it focuses on the &lt;em&gt;final answer&lt;/em&gt; rather than evaluating the quality of the reasoning itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trade-offs to consider:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Higher accuracy&lt;/strong&gt; on complex reasoning tasks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More robust&lt;/strong&gt; against model inconsistencies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple API calls&lt;/strong&gt; = more latency and higher costs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not suitable&lt;/strong&gt; for creative tasks where diversity is desired&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt; Critical calculations, important decisions, or situations where accuracy matters more than speed or cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Implementation tip:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Pseudocode for Self-Consistency
&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt_with_cot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;extract_final_answer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;final_answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;most_common&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Tree of Thoughts (ToT): Exploring the Decision Tree
&lt;/h3&gt;

&lt;p&gt;While Self-Consistency varies the final answer, Tree of Thoughts varies the &lt;em&gt;reasoning steps themselves&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Instead of following a single linear path, ToT explores multiple branches at each decision point—like a chess player considering different moves before committing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;At each reasoning step, the model generates multiple possible next steps (typically 2-5 alternatives)&lt;/li&gt;
&lt;li&gt;These branches form a tree structure of possibilities&lt;/li&gt;
&lt;li&gt;A separate evaluation process (another LLM call or heuristic) determines which path looks most promising&lt;/li&gt;
&lt;li&gt;The model continues down the best path and repeats the process&lt;/li&gt;
&lt;li&gt;If a path hits a dead end, backtrack and try another branch&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Visual representation:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Problem
├─ Approach A
│  ├─ Step A1 (best)
│  │  └─ Solution
│  └─ Step A2
└─ Approach B
   ├─ Step B1
   └─ Step B2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the most sophisticated of the three techniques. It's particularly useful for complex problems where there are multiple valid approaches and the "best" path isn't obvious upfront.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Strategic planning and architecture decisions&lt;/li&gt;
&lt;li&gt;Complex debugging with multiple potential root causes&lt;/li&gt;
&lt;li&gt;Creative problem-solving where exploration adds value&lt;/li&gt;
&lt;li&gt;Game-playing or optimization problems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Design a database schema for a social media app.

At each step:
1. Generate 3 different approaches
2. Evaluate each based on scalability, simplicity, and performance
3. Choose the best path forward
4. Continue until complete

Start by considering different ways to model user relationships."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important note:&lt;/strong&gt; ToT requires more sophisticated orchestration—you'll likely need to write code to manage the tree exploration, evaluation, and backtracking rather than relying on a single prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the Right Technique
&lt;/h2&gt;

&lt;p&gt;Here's a practical decision framework:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technique&lt;/th&gt;
&lt;th&gt;Use When&lt;/th&gt;
&lt;th&gt;Trade-off&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Chain of Thought&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Default for any reasoning task&lt;/td&gt;
&lt;td&gt;Single call, good baseline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Self-Consistency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Need high confidence, can afford multiple calls&lt;/td&gt;
&lt;td&gt;5-10x cost, better accuracy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tree of Thoughts&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Complex problems with multiple valid paths&lt;/td&gt;
&lt;td&gt;Requires orchestration code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Quick decision tree:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does it need reasoning? → Use &lt;strong&gt;CoT&lt;/strong&gt; at minimum&lt;/li&gt;
&lt;li&gt;Is accuracy critical? → Add &lt;strong&gt;Self-Consistency&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Are there multiple valid approaches worth exploring? → Consider &lt;strong&gt;ToT&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical Tips for Implementation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Start simple, then scale up&lt;/strong&gt;&lt;br&gt;
Begin with basic CoT prompts. Only add complexity when you hit limitations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Measure the improvement&lt;/strong&gt;&lt;br&gt;
Track metrics before and after applying these techniques. Sometimes the added complexity isn't worth it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Combine techniques&lt;/strong&gt;&lt;br&gt;
You can use CoT &lt;em&gt;within&lt;/em&gt; Self-Consistency, or use Self-Consistency at each node of a Tree of Thoughts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Adjust temperature settings&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CoT: Use moderate temperature (0.3-0.7) for consistent reasoning&lt;/li&gt;
&lt;li&gt;Self-Consistency: Higher temperature (0.7-1.0) to get diverse paths&lt;/li&gt;
&lt;li&gt;ToT: Vary based on exploration vs. exploitation needs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Prompt engineering isn't just about being polite to AI or adding "please" to your requests. It's about understanding how to structure instructions so the model can leverage its full reasoning capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The best part?&lt;/strong&gt; These techniques work across different models and domains. Whether you're generating code, analyzing data, solving logic puzzles, or debugging complex systems, better prompts lead to better results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start today:&lt;/strong&gt; Add "Let's think step by step" to your next complex prompt and watch the quality improve. It's a small change that makes a massive difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Turn
&lt;/h2&gt;

&lt;p&gt;What prompting techniques have you found most effective? Have you experimented with any of these approaches? Share your experiences and learnings in the comments below—I'd love to hear what's working for you!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Resources to dive deeper:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.promptingguide.ai/techniques/cot" rel="noopener noreferrer"&gt;Chain-of-Thought Guide&lt;/a&gt; - Practical examples and techniques&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.promptingguide.ai/techniques/consistency" rel="noopener noreferrer"&gt;Self-Consistency Tutorial&lt;/a&gt; - Implementation guide&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/princeton-nlp/tree-of-thought-llm" rel="noopener noreferrer"&gt;Tree of Thoughts GitHub&lt;/a&gt; - Official implementation with code and prompts&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.promptingguide.ai/techniques/tot" rel="noopener noreferrer"&gt;Tree of Thoughts Guide&lt;/a&gt; - Step-by-step implementation tutorial&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Found this helpful? Follow me for more AI engineering insights and practical LLM techniques.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>promptengineering</category>
      <category>agents</category>
      <category>llm</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>Complete Guide to Setting Up Claude Code Router with Qwen on macOS</title>
      <dc:creator>Hamza Khan</dc:creator>
      <pubDate>Sat, 10 Jan 2026 20:52:41 +0000</pubDate>
      <link>https://dev.to/hamza_khan_d2f1854314be1f/complete-guide-to-setting-up-claude-code-router-with-qwen-on-macos-a89</link>
      <guid>https://dev.to/hamza_khan_d2f1854314be1f/complete-guide-to-setting-up-claude-code-router-with-qwen-on-macos-a89</guid>
      <description>&lt;p&gt;A complete guide to setting up Claude Code Router (CCR) as a middleware layer to use Qwen's free AI models with Claude Code on macOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use This Setup
&lt;/h2&gt;

&lt;p&gt;Claude Code Router redirects Claude Code requests to alternative AI providers like Qwen, giving you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code's agentic coding capabilities&lt;/li&gt;
&lt;li&gt;Free, open-source models with zero API costs&lt;/li&gt;
&lt;li&gt;Full control over your AI provider&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Claude Code requires Node.js 18 or higher. Check your version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you need to install or update Node.js, download it from &lt;a href="https://nodejs.org" rel="noopener noreferrer"&gt;nodejs.org&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Install Required Tools
&lt;/h2&gt;

&lt;p&gt;Install Qwen Code, Claude Code, and Claude Code Router globally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @qwen-code/qwen-code@latest
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @anthropic-ai/claude-code @musistudio/claude-code-router
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Authenticate with Qwen OAuth
&lt;/h2&gt;

&lt;p&gt;Qwen Code uses OAuth authentication which is the recommended method for using Qwen models. This provides free access with a quota of 60 requests/minute and 2,000 requests/day.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start the authentication flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;qwen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will automatically open your browser to complete the OAuth login.&lt;/p&gt;

&lt;h3&gt;
  
  
  Complete browser login
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Log in with your qwen.ai account (create one if needed)&lt;/li&gt;
&lt;li&gt;Click "Confirm" to authorize access&lt;/li&gt;
&lt;li&gt;The CLI will confirm successful authentication&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Credentials stored locally
&lt;/h3&gt;

&lt;p&gt;After authorization, your OAuth credentials are automatically saved to &lt;code&gt;/Users/YOUR_USERNAME/.qwen/oauth_creds.json&lt;/code&gt; and you won't need to log in again. The credentials will be automatically refreshed when needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting your access token for Claude Code Router
&lt;/h3&gt;

&lt;p&gt;After successful authentication, you need to extract the access token from the OAuth credentials file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /Users/YOUR_USERNAME/.qwen/oauth_creds.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;YOUR_USERNAME&lt;/code&gt; with your actual macOS username.&lt;/p&gt;

&lt;p&gt;This will display a JSON file similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"access_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-long-access-token-here"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"refresh_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-refresh-token-here"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"token_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bearer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"resource_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"portal.qwen.ai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"expiry_date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1767490948168&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the value of &lt;code&gt;access_token&lt;/code&gt; (the long string after &lt;code&gt;"access_token":&lt;/code&gt;). You'll need this token in the next step when configuring Claude Code Router.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The access token is automatically managed by Qwen Code and refreshes as needed. However, for Claude Code Router integration, you'll need to manually update the token in the router configuration if it expires.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Configure the Router
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create the configuration directory
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.claude-code-router
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create the configuration file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/.claude-code-router/config.json &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
{
  "LOG": true,
  "LOG_LEVEL": "info",
  "HOST": "127.0.0.1",
  "PORT": 3456,
  "API_TIMEOUT_MS": 600000,
  "Providers": [
    {
      "name": "qwen",
      "api_base_url": "https://portal.qwen.ai/v1/chat/completions",
      "api_key": "YOUR_ACCESS_TOKEN_HERE",
      "models": [
        "qwen3-coder-plus",
        "qwen3-coder-plus",
        "qwen3-coder-plus"
      ]
    }
  ],
  "Router": {
    "default": "qwen,qwen3-coder-plus",
    "background": "qwen,qwen3-coder-plus",
    "think": "qwen,qwen3-coder-plus",
    "longContext": "qwen,qwen3-coder-plus",
    "longContextThreshold": 60000,
    "webSearch": "qwen,qwen3-coder-plus"
  }
}
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Replace &lt;code&gt;YOUR_ACCESS_TOKEN_HERE&lt;/code&gt; with the access token you copied from &lt;code&gt;/Users/YOUR_USERNAME/.qwen/oauth_creds.json&lt;/code&gt; in Step 2.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration Breakdown
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LOG settings&lt;/strong&gt; — Enable console output for debugging&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HOST/PORT&lt;/strong&gt; — Local address where CCR listens (127.0.0.1:3456)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API_TIMEOUT_MS&lt;/strong&gt; — Maximum wait time for API responses (10 minutes)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Providers&lt;/strong&gt; — Defines Qwen API connection and available models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Router&lt;/strong&gt; — Specifies which model handles each task type&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: Start the Router
&lt;/h2&gt;

&lt;p&gt;Launch Claude Code Router:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ccr restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see console logs confirming successful startup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Launch Claude Code
&lt;/h2&gt;

&lt;p&gt;Open the interactive CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ccr code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test with a simple message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; Hello Claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should receive a response from Qwen3-Coder-Plus.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;404 errors&lt;/strong&gt; — Verify your api_base_url and access token are correct.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connection timeouts&lt;/strong&gt; — Check your network connection and Qwen's service status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Router won't start&lt;/strong&gt; — Look for port conflicts or JSON syntax errors in your config file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model not responding&lt;/strong&gt; — Ensure the model name in your config matches exactly with Qwen's available models.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Advanced Configuration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Using Different Models
&lt;/h3&gt;

&lt;p&gt;Update the models array in the config to try different Qwen models:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="s2"&gt;"qwen3-coder-plus"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="s2"&gt;"qwen2.5-coder-32b-instruct"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="s2"&gt;"qwq-32b-preview"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adding Multiple Providers
&lt;/h3&gt;

&lt;p&gt;You can configure multiple AI providers in the same config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Providers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"qwen"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"api_base_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://portal.qwen.ai/v1/chat/completions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"YOUR_QWEN_TOKEN"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"another-provider"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"api_base_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.example.com/v1/chat/completions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"YOUR_OTHER_KEY"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adjusting Timeout Settings
&lt;/h3&gt;

&lt;p&gt;For longer-running tasks, increase the timeout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"API_TIMEOUT_MS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;900000&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;minutes&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;With this setup, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Claude Code's full capabilities powered by Qwen models&lt;/li&gt;
&lt;li&gt;Update the configuration file to try different models&lt;/li&gt;
&lt;li&gt;Add multiple providers for different use cases&lt;/li&gt;
&lt;li&gt;Work seamlessly from your terminal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The router handles everything behind the scenes while you maintain Claude Code's familiar interface and workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.claude.com" rel="noopener noreferrer"&gt;Claude Code Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://qwen.ai" rel="noopener noreferrer"&gt;Qwen Models Portal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/musistudio/claude-code-router" rel="noopener noreferrer"&gt;Claude Code Router GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>claude</category>
      <category>coding</category>
      <category>ai</category>
      <category>claudecode</category>
    </item>
  </channel>
</rss>
