Skip to content

kstonekuan/deepclaude

Β 
Β 

Repository files navigation

DeepClaude 🧠

Enhance Claude's capabilities with Extended Thinking - a unified API and chat interface for powerful reasoning and generation.

GitHub license Rust API Status

Getting Started β€’ Features β€’ API Usage β€’ Documentation β€’ Self-Hosting β€’ Contributing

Table of Contents

Overview

DeepClaude is a high-performance LLM inference API that harnesses Claude 3.7 Sonnet's Extended Thinking capabilities. It provides a streamlined interface for accessing advanced reasoning and generation capabilities while maintaining complete control over your API keys and data.

Features

πŸš€ Advanced Reasoning - Access Claude's Extended Thinking capabilities for transparent step-by-step reasoning, powered by a high-performance Rust API

πŸ”’ Private & Secure - End-to-end security with local API key management. Your data stays private

βš™οΈ Highly Configurable - Customize thinking parameters, output length, and more to match your needs

🌟 Open Source - Free and open-source codebase. Contribute, modify, and deploy as you wish

πŸ€– Enhanced Intelligence - Leverage structured thinking processes for better problem-solving and content generation

πŸ”‘ Managed BYOK API - Use your own API keys with our managed infrastructure for complete control

Why Extended Thinking?

Claude 3.7 Sonnet's Extended Thinking feature provides unprecedented transparency into the model's reasoning process, allowing it to tackle complex problems with structured, step-by-step thinking.

Extended Thinking enables Claude to:

  • Break down complex problems into manageable components
  • Explore multiple approaches and evaluate their merits
  • Catch and correct errors in its own reasoning
  • Consider edge cases and limitations
  • Document its entire thought process for transparency

DeepClaude provides a streamlined interface to these capabilities with:

  • Configurable thinking budgets to control depth of reasoning
  • Seamless integration with streaming for real-time thought visibility
  • Support for large context windows and extended outputs
  • Complete control with your own API keys

Getting Started

Prerequisites

  • Rust 1.75 or higher
  • Anthropic API key (with access to Claude 3.7 Sonnet)

Installation

  1. Clone the repository:
git clone https://github.com/getasterisk/deepclaude.git
cd deepclaude
  1. Build the project:
cargo build --release

Configuration

Create a config.toml file in the project root:

[server]
host = "127.0.0.1"
port = 3000

[pricing]
# Configure pricing settings for usage tracking

API Usage

See API Docs

Basic Example

import requests

response = requests.post(
    "http://127.0.0.1:1337/",
    headers={
        "X-Anthropic-API-Token": "<YOUR_ANTHROPIC_API_KEY>"
    },
    json={
        "messages": [
            {"role": "user", "content": "How many 'r's in the word 'strawberry'?"}
        ],
        "anthropic_config": {
            "body": {
                "thinking": {
                    "type": "enabled",
                    "budget_tokens": 16000
                }
            }
        }
    }
)

print(response.json())

Streaming Example

import asyncio
import json
import httpx

async def stream_response():
    async with httpx.AsyncClient() as client:
        async with client.stream(
            "POST",
            "http://127.0.0.1:1337/",
            headers={
                "X-Anthropic-API-Token": "<YOUR_ANTHROPIC_API_KEY>"
            },
            json={
                "stream": True,
                "messages": [
                    {"role": "user", "content": "How many 'r's in the word 'strawberry'?"}
                ],
                "anthropic_config": {
                    "body": {
                        "thinking": {
                            "type": "enabled",
                            "budget_tokens": 16000
                        }
                    }
                }
            }
        ) as response:
            response.raise_for_status()
            async for line in response.aiter_lines():
                if line:
                    if line.startswith('data: '):
                        data = line[6:]
                        try:
                            parsed_data = json.loads(data)
                            if 'content' in parsed_data:
                                for block in parsed_data.get('content', []):
                                    if block.get('content_type') == 'thinking':
                                        print("\n[THINKING] ", block.get('thinking', ''))
                                    elif block.get('content_type') == 'text':
                                        print(block.get('text', ''), end='', flush=True)
                            else:
                                print(data, flush=True)
                        except json.JSONDecodeError:
                            pass

if __name__ == "__main__":
    asyncio.run(stream_response())

Configuration Options

The API supports extensive configuration through the request body:

{
    "stream": false,
    "verbose": false,
    "system": "Optional system prompt",
    "messages": [...],
    "anthropic_config": {
        "headers": {
            "anthropic-version": "2023-06-01",
            "anthropic-beta": "output-128k-2025-02-19"
        },
        "body": {
            "model": "claude-3-7-sonnet-20250219",
            "max_tokens": 32000,
            "thinking": {
                "type": "enabled",
                "budget_tokens": 16000
            }
        }
    }
}

Self-Hosting

DeepClaude can be self-hosted on your own infrastructure. Follow these steps:

  1. Configure environment variables or config.toml
  2. Build the Docker image or compile from source
  3. Deploy to your preferred hosting platform

Security

  • No data storage or logged
  • BYOK (Bring Your Own Keys) architecture
  • Regular security audits and updates

Contributing

We welcome contributions! Please see our Contributing Guidelines for details on:

  • Code of Conduct
  • Development process
  • Submitting pull requests
  • Reporting issues

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

DeepClaude is a free and open-source project by Asterisk. Special thanks to:

  • Anthropic for Claude's capabilities and Extended Thinking feature
  • The open-source community for their continuous support

Made with ❀️ by Asterisk

About

A high-performance LLM inference API and Chat UI that integrates DeepSeek R1's CoT reasoning traces with Anthropic Claude models.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 100.0%