DEV Community

Cover image for Giá GitHub Copilot: Những Điều Đội API Cần Biết
Sebastian Petrus
Sebastian Petrus

Posted on • Originally published at apidog.com

Giá GitHub Copilot: Những Điều Đội API Cần Biết

Mô hình thanh toán của GitHub Copilot đã thay đổi nhiều lần trong năm qua. Từ tháng này, tính năng Copilot code review trên pull request bắt đầu tiêu thụ GitHub Actions minutes từ tài khoản thanh toán sở hữu repository. Với các nhóm API, điều này có nghĩa là bạn cần theo dõi đồng thời ba chỉ số: Copilot seats, premium requests và Actions minutes.

Dùng thử Apidog hôm nay

Bài viết này tập trung vào cách ước tính chi phí, cấu hình workflow để giảm lãng phí và tổ chức lại quy trình API để các bước spec, contract test và AI review không nằm rải rác trên nhiều dashboard thanh toán.

TL;DR

  • Copilot hiện có ba nhóm chi phí chính:
    • License theo seat
    • Premium requests
    • GitHub Actions minutes cho Copilot code review
  • Copilot code review trên PR chạy như một GitHub Action ẩn và tiêu thụ Actions minutes của tổ chức.
  • Repository API thường tốn nhiều hơn vì PR lớn hơn: openapi.yaml, generated client, handler và contract test.
  • Premium requests áp dụng cho các tác vụ agentic như Workspace, agent mode và Copilot Spaces.
  • Hãy đặt spending limit trước chu kỳ thanh toán tiếp theo.
  • Với repository API đang hoạt động, nên dự trù khoảng 400–800 Actions minutes/tháng/repository cho Copilot review, sau đó đo lại sau 30 ngày.

1. Ba chỉ số Copilot cần theo dõi

Trước đây Copilot chủ yếu là chi phí theo seat. Hiện tại bạn cần tách thành ba phần.

Chỉ số 1: License theo seat

Đây là khoản phí cố định:

Gói Giá
Copilot Business $10/user/month
Copilot Enterprise $19/user/month

Khoản này bao gồm:

  • Chat
  • Inline autocomplete
  • Multi-line suggestions
  • IDE integration
  • Truy cập nhóm model tiêu chuẩn

Seat là phần dễ dự báo nhất, nhưng cũng dễ bị cấp phát thừa nhất.

Việc nên làm:

  1. Xuất danh sách người dùng Copilot mỗi quý.
  2. Kiểm tra người dùng không hoạt động.
  3. Thu hồi seat khỏi tài khoản không còn dùng.
  4. So sánh số seat với số developer thực sự viết code hằng tuần.

Công thức đơn giản:

seat_cost = active_users × seat_price
Enter fullscreen mode Exit fullscreen mode

Ví dụ:

Copilot Business:   active_users × $10
Copilot Enterprise: active_users × $19
Enter fullscreen mode Exit fullscreen mode

Chỉ số 2: Premium requests

Premium request là đơn vị GitHub dùng cho các tính năng tốn tài nguyên hơn.

Các tác vụ thường bị tính premium request gồm:

  • Agent mode
  • Workspace
  • Copilot Spaces
  • Chọn model ngoài mặc định

Bảng tham chiếu hiện tại:

Tính năng Chi phí theo premium request
Chat với model mặc định Miễn phí cho gói trả phí
Inline autocomplete Miễn phí cho gói trả phí
Agent mode với model mặc định 1 request
Workspace với model mặc định 1 request
Chọn Claude Sonnet 4.5 Hệ số 1.5x
Chọn GPT-5.5 Hệ số 2x
Chọn GPT-5.5 Pro Hệ số 6x
Truy vấn Copilot Spaces 1 request/truy vấn

Hạn mức bao gồm:

Gói Premium requests bao gồm
Copilot Business 300 requests/seat/month
Copilot Enterprise 1.000 requests/seat/month

Phần vượt mức hiện được tính:

$0.04 / premium request
Enter fullscreen mode Exit fullscreen mode

Công thức ước tính:

premium_overage = max(0, requests_used - included_requests) × $0.04
Enter fullscreen mode Exit fullscreen mode

Với nhóm API, các prompt dễ tạo premium usage cao thường là:

Tạo lại OpenAPI client từ spec mới
Enter fullscreen mode Exit fullscreen mode
Viết contract test cho endpoint này
Enter fullscreen mode Exit fullscreen mode
Refactor handler và cập nhật test tương ứng
Enter fullscreen mode Exit fullscreen mode

Một prompt duy nhất có thể tạo ra nhiều bước nội bộ, nên một yêu cầu của người dùng có thể dẫn đến nhiều premium requests.


Chỉ số 3: GitHub Actions minutes cho Copilot code review

Đây là thay đổi mới dễ gây bất ngờ nhất.

Khi Copilot tự động review một pull request, quá trình review chạy trên hạ tầng GitHub Actions. Vì vậy, thời gian chạy của review bị trừ vào Actions minutes của tổ chức.

Cần lưu ý:

  • Số phút này dùng chung với quota GitHub Actions hiện có.
  • Đây không phải quota riêng cho Copilot.
  • Repository private tiêu thụ Actions minutes.
  • Repository public thường không làm phát sinh chi phí Actions minutes tương tự.

Hạn mức tham chiếu:

Gói GitHub Actions minutes Linux
Team 3.000 minutes/month
Enterprise 50.000 minutes/month

Một Copilot review trên PR API thường tiêu thụ:

2–6 minutes/review
Enter fullscreen mode Exit fullscreen mode

Với PR lớn, nhiều file hoặc cần nhiều ngữ cảnh repository hơn, con số có thể lên đến:

~15 minutes/review
Enter fullscreen mode Exit fullscreen mode

Công thức ước tính:

review_minutes = prs_per_month × average_review_minutes
Enter fullscreen mode Exit fullscreen mode

Ví dụ:

50 PRs/month × 4 minutes = 200 Actions minutes/month
Enter fullscreen mode Exit fullscreen mode

Nếu bạn có ba repository API tương tự:

200 × 3 = 600 Actions minutes/month
Enter fullscreen mode Exit fullscreen mode

2. Vì sao repository API thường tốn nhiều hơn?

Repository API thường tiêu thụ nhiều Copilot và Actions hơn repository frontend nhỏ vì ba lý do.

1. Pull request lớn hơn

Một thay đổi API thường đụng đến nhiều loại file:

openapi.yaml
generated clients
server handlers
contract tests
integration tests
Enter fullscreen mode Exit fullscreen mode

Copilot review phải đọc diff lớn hơn, nên thời gian chạy lâu hơn.

2. Generated code làm tăng kích thước diff

Nhiều nhóm vẫn commit generated clients vào repository.

Ví dụ:

clients/typescript/**
clients/python/**
clients/java/**
Enter fullscreen mode Exit fullscreen mode

Nếu PR cập nhật spec và regenerate toàn bộ client, Copilot review sẽ đọc cả phần generated diff đó, dù giá trị review ở phần này thường thấp.

3. Nhiều scanner cùng chạy trên một PR

Một PR có thể đồng thời kích hoạt:

  • Copilot review
  • CodeQL
  • Snyk
  • Custom security scanner
  • Contract test
  • Integration test

Copilot review là phần mới được thêm vào bill, nhưng nó chạy cùng nhóm Actions minutes với các bước còn lại.


3. Cách ước tính chi phí Copilot hằng tháng

Hãy tính theo ba lớp: seat, premium request và Actions minutes.

Bước 1: Tính seat cost

seat_cost = active_users × seat_price
Enter fullscreen mode Exit fullscreen mode

Ví dụ với 10 developer dùng Copilot Enterprise:

10 × $19 = $190/month
Enter fullscreen mode Exit fullscreen mode

Bước 2: Tính premium request overage

Ước lượng usage theo nhóm người dùng:

Kiểu người dùng Premium requests/tháng ước tính
Chủ yếu chat và autocomplete ~150
Dùng Workspace/agent mode thường xuyên ~600–800

Với Copilot Business:

included_requests = seats × 300
Enter fullscreen mode Exit fullscreen mode

Với Copilot Enterprise:

included_requests = seats × 1.000
Enter fullscreen mode Exit fullscreen mode

Công thức:

premium_overage = max(0, requests_used - included_requests) × $0.04
Enter fullscreen mode Exit fullscreen mode

Ví dụ:

requests_used = 4.000
included_requests = 3.000
overage = (4.000 - 3.000) × $0.04
        = $40
Enter fullscreen mode Exit fullscreen mode

Việc nên làm ngay:

  • Đặt spending limit ở cấp organization.
  • Không để mặc định không giới hạn.
  • Theo dõi nhóm dùng agent mode nhiều nhất.

Bước 3: Tính Actions minutes cho Copilot review

Dùng mức trung bình 4 phút cho mỗi PR API cỡ vừa:

review_minutes = prs_per_month × 4
Enter fullscreen mode Exit fullscreen mode

Nếu vượt quota Actions còn lại:

review_overage = max(0, review_minutes - actions_quota_remaining) × $0.008
Enter fullscreen mode Exit fullscreen mode

Áp dụng cho Linux private repositories theo mức được nêu trong bài gốc.

Ví dụ nhóm 10 developer, 200 PRs/tháng:

review_minutes = 200 × 4
               = 800 minutes/month
Enter fullscreen mode Exit fullscreen mode

Nếu vẫn nằm trong quota Enterprise thì chi phí review phát sinh có thể là:

$0
Enter fullscreen mode Exit fullscreen mode

Tổng ước tính:

seat_cost       = $190
premium_overage = $40
review_overage  = $0
total           = ~$230/month
Enter fullscreen mode Exit fullscreen mode

Với nhóm nhỏ hơn trên Copilot Business và GitHub Team, quota thấp hơn nên nguy cơ vượt mức sẽ cao hơn.


4. Tối ưu workflow CI để giảm Actions minutes

Ba thay đổi dưới đây thường giúp giảm chi phí ngay mà không làm mất giá trị review.

4.1. Bỏ qua Copilot review cho bot PRs

Các PR từ Dependabot hoặc Renovate thường là update dependency tự động. Không phải lúc nào cũng cần Copilot review.

Ví dụ workflow:

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  copilot-review:
    if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
    runs-on: ubuntu-latest
    steps:
      - uses: github/copilot-review@v1
Enter fullscreen mode Exit fullscreen mode

Nếu tổ chức có bot nội bộ, thêm vào điều kiện:

if: >
  github.actor != 'dependabot[bot]' &&
  github.actor != 'renovate[bot]' &&
  github.actor != 'internal-release-bot'
Enter fullscreen mode Exit fullscreen mode

4.2. Không review generated clients

Nếu repository commit generated clients, hãy loại chúng khỏi trigger review.

Ví dụ cấu trúc repository:

apis/openapi.yaml
internal/handlers/**
tests/contract/**
clients/typescript/**
clients/python/**
Enter fullscreen mode Exit fullscreen mode

Bạn thường muốn review:

apis/**
internal/**
tests/**
Enter fullscreen mode Exit fullscreen mode

Và bỏ qua:

clients/**
Enter fullscreen mode Exit fullscreen mode

4.3. Giới hạn Copilot review bằng path filter

Chỉ chạy review khi PR thay đổi các file quan trọng với API behavior.

Ví dụ:

on:
  pull_request:
    paths:
      - 'apis/**/*.yaml'
      - 'cmd/**'
      - 'internal/**'
      - 'tests/**'
Enter fullscreen mode Exit fullscreen mode

Cách này giúp Copilot tập trung vào:

  • API spec
  • Handler logic
  • Test coverage
  • Contract behavior

Thay vì tốn phút cho generated code hoặc file không liên quan.


5. Bốn kiểm soát governance nên bật

Những thiết lập này thường mất ít thời gian nhưng giúp tránh bill bất ngờ.

5.1. Đặt spending limit ở cấp organization

Không nên để mặc định không giới hạn.

Quy trình đề xuất:

  1. Xem chi phí Copilot và Actions tháng trước.
  2. Chọn mức ngân sách chấp nhận được.
  3. Đặt limit thấp hơn khoảng 20%.
  4. Kiểm tra lại sau 30 ngày.

5.2. Bật cảnh báo premium request

GitHub gửi cảnh báo ở các mốc:

50%
75%
90%
Enter fullscreen mode Exit fullscreen mode

Không nên chỉ để email trong inbox cá nhân.

Nên route cảnh báo vào:

  • Slack
  • Microsoft Teams
  • Incident tool
  • FinOps channel

5.3. Dùng label để kích hoạt review có chọn lọc

Thay vì chạy Copilot review trên mọi PR, có thể chỉ chạy khi PR có label:

review-please
Enter fullscreen mode Exit fullscreen mode

Mô hình này phù hợp với:

  • PR thay đổi API behavior
  • PR có logic phức tạp
  • PR đụng đến security-sensitive handler
  • PR có migration hoặc breaking change

Cách này có thể giảm đáng kể số lượt review không cần thiết.


5.4. Rollout theo team

Không nên bật toàn bộ tính năng Copilot Enterprise cho cả organization cùng lúc.

Cách an toàn hơn:

  1. Chọn một team API nhỏ.
  2. Bật tính năng mới.
  3. Theo dõi 30 ngày.
  4. Đo premium requests và Actions minutes.
  5. Mở rộng nếu chi phí và chất lượng review hợp lý.

6. Đặt Apidog vào workflow API như thế nào?

Apidog không thay thế Copilot. Vai trò phù hợp hơn là giữ spec, mock và contract test trong cùng một workflow để Copilot chỉ review những PR đã vượt qua kiểm tra rẻ hơn.

Một workflow thực tế:

  1. Developer cập nhật API spec.
  2. Request examples và collection được lưu cùng repository.
  3. Contract test chạy với Apidog mock server.
  4. CI chạy apidog-cli để validate contract.
  5. Chỉ khi contract validation pass, Copilot review mới chạy.

Luồng đề xuất:

OpenAPI spec change
        ↓
Apidog mock + contract validation
        ↓
apidog-cli in CI
        ↓
Copilot code review
        ↓
Merge
Enter fullscreen mode Exit fullscreen mode

Lý do nên đặt contract validation trước Copilot review:

  • Contract test thường nhanh hơn.
  • Lỗi spec nên fail sớm.
  • Copilot review là bước tốn Actions minutes hơn.
  • AI review nên tập trung vào handler logic và test coverage, không phải lỗi contract cơ bản.

Ví dụ logic CI ở mức khái niệm:

jobs:
  contract-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run API contract validation
        run: apidog-cli validate

  copilot-review:
    needs: contract-test
    if: success()
    runs-on: ubuntu-latest
    steps:
      - uses: github/copilot-review@v1
Enter fullscreen mode Exit fullscreen mode

Mục tiêu là fail nhanh ở bước rẻ hơn, rồi mới dùng Copilot review cho phần đáng review.


7. Theo dõi gì trong chu kỳ billing tiếp theo?

Nên kiểm tra theo ba giai đoạn.

Ngày 1–7

Premium request usage thường vẫn thấp.

Việc cần làm:

  • Ghi baseline usage.
  • Kiểm tra số seat active.
  • Xác nhận spending limit đã bật.

Ngày 14–21

Người dùng nặng bắt đầu vượt hạn mức included requests.

Việc cần làm:

  • Kiểm tra ai dùng agent mode nhiều.
  • Xem premium request overage.
  • Điều chỉnh model hoặc workflow nếu cần.

Ngày 28–30

Actions minutes từ Copilot review bắt đầu rõ hơn trên bill.

Việc cần làm:

  • So sánh với tháng trước.
  • Tính minutes/PR.
  • Lọc bot PRs nếu chưa làm.
  • Loại generated clients khỏi review.
  • Tắt review ở repository không cần thiết.

8. Các lỗi phổ biến

Sau khi kiểm toán nhiều nhóm API, các lỗi lặp lại thường là:

8.1. Không đặt spending limit

Một vòng lặp agent có thể chạy lâu hơn dự kiến.

Luôn đặt limit.


8.2. Bật review trên mọi repository

Không phải repository nào cũng cần Copilot review.

Nên phân loại:

Loại repository Có nên bật review?
Core API
Public SDK generated Tùy trường hợp
Docs-only repo Thường không
Sandbox/prototype Thường không
Internal tooling nhỏ Tùy mức độ rủi ro

8.3. Review generated clients

Generated code thường tạo diff lớn nhưng giá trị review thấp.

Hãy lọc bằng path.


8.4. Review PR của bot

Dependabot, Renovate và bot update nội bộ có thể tạo nhiều PR nhỏ.

Hãy loại khỏi Copilot review mặc định.


8.5. Không có baseline

Nếu không có số liệu trước khi thay đổi workflow, bạn không biết mình có tiết kiệm được chi phí hay không.

Nên tải CSV billing của GitHub hằng tháng và lưu lại:

billing/YYYY-MM.csv
Enter fullscreen mode Exit fullscreen mode

Theo dõi tối thiểu:

Copilot seats
Premium requests
Actions minutes
Actions overage
PR count
Average review minutes per PR
Enter fullscreen mode Exit fullscreen mode

FAQ

Giá seat vẫn là $10/user?

Copilot Business là $10/user/month. Copilot Enterprise là $19/user/month. Copilot Pro cho cá nhân là $10/month. Gói seat cũng quyết định hạn mức premium requests được bao gồm.

Inline autocomplete có bị tính phí không?

Không. Chat với model mặc định và inline autocomplete không bị tính phí premium request trên các gói trả phí. Premium requests áp dụng cho các tính năng tốn tài nguyên hơn và lựa chọn model ngoài mặc định.

Điều gì xảy ra khi hết premium request?

Theo mặc định, request có thể bắt đầu thất bại do vượt hạn mức. Bạn có thể đặt spending limit để cho phép overage ở mức $0.04/request cho đến giới hạn đã cấu hình.

Actions minutes cho Copilot review có được thanh toán riêng không?

Không. Chúng dùng cùng pool GitHub Actions minutes với CI/CD còn lại. Vì vậy, cần theo dõi tổng Actions usage và điều chỉnh workflow trigger.

Có thể tắt hoàn toàn Copilot code review không?

Có. Organization admin có thể kiểm soát repository nào được bật Copilot review thông qua policy.

Copilot review có hoạt động với private API spec không?

Có. Với private repository, review tiêu thụ Actions minutes. Copilot đọc spec, handler và test như các file source khác.

Copilot review có dùng premium requests không?

Theo nội dung hiện tại, Copilot review tiêu thụ Actions minutes. Nó không được tính riêng như premium request. Tuy nhiên, đây là phần nên tiếp tục theo dõi trong các changelog của GitHub.


Checklist triển khai nhanh

Nếu bạn chỉ có 30 phút, hãy làm theo thứ tự này:

  1. Đặt organization spending limit.
  2. Xuất danh sách Copilot seats và thu hồi user không hoạt động.
  3. Lọc Dependabot/Renovate khỏi Copilot review.
  4. Thêm paths filter để bỏ qua generated clients.
  5. Đặt contract validation trước Copilot review.
  6. Tải CSV billing cuối tháng.
  7. Tính average_review_minutes_per_pr.
  8. Điều chỉnh lại sau 30 ngày.

Với nhóm API, mục tiêu không phải là tắt AI review. Mục tiêu là để AI review chạy đúng nơi: sau khi contract test đã pass, trên các file có giá trị review cao, và trong giới hạn chi phí mà nhóm kiểm soát được.

Top comments (0)