Bắt đầu/Bắt đầu nhanh

Bắt đầu nhanh

1. Chuẩn bị key có credit

Tạo key trong dashboard hoặc dùng chức năng reveal để lấy lại key. Key phải có prefix key_ và còn credit.

2. Gửi request theo chuẩn OpenAI

bash
curl https://dirtcheapai.com/api/v1/chat/completions 
  -H Content-Type: application/json 
  -H Authorization: Bearer key_xxx 
  -d '{
    model: claude-sonnet-4.6,
    messages: [
      { role: user, content: Viết hàm Python tính giai thừa. }
    ],
    max_tokens: 512
  }'

3. Bật streaming

bash
curl https://dirtcheapai.com/api/v1/chat/completions 
  -H Content-Type: application/json 
  -H Authorization: Bearer key_xxx 
  -N 
  -d '{
    model: claude-haiku-4.5,
    messages: [
      { role: user, content: Giải thích async và await thật dễ hiểu. }
    ],
    stream: true,
    max_tokens: 512
  }'

4. Xem model hiện có

bash
curl https://dirtcheapai.com/api/v1/models 
  -H Authorization: Bearer key_xxx

5. Kiểm tra số dư

bash
curl https://dirtcheapai.com/api/v1/balance 
  -H Authorization: Bearer key_xxx