Skip to content

docs: periodic token budget reset & guardrail member budgets#78

Merged
hMED22 merged 4 commits into
mainfrom
ahmednemdil/tokens-and-members-budgets
Jul 21, 2026
Merged

docs: periodic token budget reset & guardrail member budgets#78
hMED22 merged 4 commits into
mainfrom
ahmednemdil/tokens-and-members-budgets

Conversation

@hMED22

@hMED22 hMED22 commented Jul 21, 2026

Copy link
Copy Markdown
Member

What

Documents two new spending-control features:

Custom API Keys — periodic budget reset

  • New Periodic Budget Reset section covering balance_reset_period / balance_reset_amount.
  • Documented both in the dashboard (Spending Limit → Reset allowance / Resets → Daily/Weekly/Monthly/Never) and through the API.
  • Behaviour notes: reset auto-enables the budget, starts-full semantics, midnight Europe/Paris reset timing, and setting the period back to none.
  • Added a best-practice bullet for recurring allowances (e.g. a $10/day CI key).

Guardrails — per-member budget cap

  • New Budget cap section: turn on Member budget, set a Budget + Per period (daily/weekly/monthly).
  • Documents cap behaviour (per-member not shared, soft cap, counts real usage only) and how it resolves across member/role levels.
  • Note that budgets are ignored on token-attached guardrails — use a token budget instead.

Users & Organisation

  • Guardrails summary now mentions per-member spend caps.

Verification

  • All four custom-api-keys.mdx Python snippets pass against staging (4 passed), including the new periodic-reset snippet.
  • Cross-checked the dashboard-facing wording against the actual UI (Create/Edit API Key, Create Guardrail, and Members → Custom Tokens dialogs).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated Custom API Keys docs with a new “Periodic Budget Reset” section, including configuration for both the dashboard and custom token API, valid balance_reset_period options (including none), balance_reset_amount requirements, and reset behavior/timing (automatic active_balance enforcement and Paris midnight schedule).
    • Expanded Guardrails docs to include per-member budget caps (daily/weekly/monthly), real-usage counting rules, soft-cap behavior (including in-flight requests), and clarified how budget caps are resolved versus model access and rate limits (token-attached guardrails ignore member budgets).
    • Refreshed Guardrails flow details (optional per-member budget step) and related links guidance.

hMED22 and others added 2 commits July 21, 2026 14:12
Add coverage for two new spending-control features:

- Custom API Keys: periodic budget reset (balance_reset_period /
  balance_reset_amount), documented both in the dashboard (Spending
  Limit → Reset allowance / Resets) and via the API.
- Guardrails: per-member budget caps (Member budget → Budget / Per),
  including how the cap behaves and how it resolves across member/role
  levels, plus a note that budgets are ignored on token-attached
  guardrails.
- Users & Organisation: mention member spend caps in the guardrails
  summary.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c11b7a6-b6b6-4dd6-ac2d-1e88d79dd5a1

📥 Commits

Reviewing files that changed from the base of the PR and between ca17195 and 3d62dd3.

📒 Files selected for processing (1)
  • v3/general/custom-api-keys.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • v3/general/custom-api-keys.mdx

Walkthrough

The documentation adds periodic reset configuration for custom API key budgets and documents per-member budget caps within guardrails, including setup, enforcement, resolution, and usage rules. Related organization terminology and metadata timestamps are also updated.

Changes

Budget controls documentation

Layer / File(s) Summary
Periodic token budget resets
v3/general/custom-api-keys.mdx
Documents dashboard and API setup, reset fields and schedules, active_balance behavior, disabling resets, recurring allowance best practices, and updated metadata.
Member budget guardrails
v3/organization/guardrails.mdx, v3/organization/users-organisation.mdx
Adds member budget setup and cap behavior, clarifies usage and inheritance rules, distinguishes token and member budgets, updates guardrail terminology, and refreshes metadata.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • edenai/docs#51: Related organization documentation covering guardrails and users/organization navigation.

Poem

A bunny found budgets, hopping in time,
Resetting each token on schedule divine.
Guardrails now measure what members may spend,
With caps and clear rules from beginning to end.
“Docs are in order!” the rabbit declares.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main documentation changes: periodic token budget resets and guardrail member budgets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ahmednemdil/tokens-and-members-budgets

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@v3/general/custom-api-keys.mdx`:
- Around line 139-164: Replace the YOUR_API_KEY placeholder with <api_key> in
the Authorization headers of both the Python requests example and the cURL
example, preserving the documented Bearer header format.

In `@v3/organization/users-organisation.mdx`:
- Line 65: Update the guardrails description to clarify that token-level
resolution applies to model/provider access and rate limits, while budget caps
do not resolve at the token level and token-attached budget settings are
ignored. Preserve the existing token → member → role → organisation resolution
wording for the settings it supports, and reference the relevant budget-cap
limitation if available.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b4030c74-e5e2-4439-8237-aa433860c3d3

📥 Commits

Reviewing files that changed from the base of the PR and between aaf25fe and e99f891.

📒 Files selected for processing (3)
  • v3/general/custom-api-keys.mdx
  • v3/organization/guardrails.mdx
  • v3/organization/users-organisation.mdx

Comment on lines +139 to +164
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}

response = requests.post(
"https://api.edenai.run/v2/user/custom_token/",
headers=headers,
json={
"name": "team-daily",
"token_type": "api_token",
"balance_reset_amount": "10.00",
"balance_reset_period": "daily"
}
)
```

```bash cURL
curl -X POST https://api.edenai.run/v2/user/custom_token/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "team-daily",
"balance_reset_amount": "10.00",
"balance_reset_period": "daily"
}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the documented API-key placeholder.

Replace YOUR_API_KEY with <api_key> in both authorization examples. As per coding guidelines, use Authorization: Bearer <api_key> header format for API authentication in code examples.

🧰 Tools
🪛 Betterleaks (1.6.1)

[high] 157-158: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v3/general/custom-api-keys.mdx` around lines 139 - 164, Replace the
YOUR_API_KEY placeholder with <api_key> in the Authorization headers of both the
Python requests example and the cURL example, preserving the documented Bearer
header format.

Source: Coding guidelines

Comment thread v3/organization/users-organisation.mdx Outdated
The Users & Organisation guardrails summary implied all guardrail
settings resolve token → member → role. Per-member budget caps only
resolve at member/role levels (token-attached budgets are ignored), so
split the sentence to state the model-rule/rate-limit resolution and the
budget resolution separately.

Addresses CodeRabbit review feedback on PR #78.
@mintlify

mintlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
edenai 🟢 Ready View Preview Jul 21, 2026, 1:31 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
edenai 🟡 Building Jul 21, 2026, 1:31 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

The intro claimed a token budget is one-time "by default", but the
dashboard pre-selects a recurring Monthly reset whenever a spending
limit is enabled — "Never" (one-time) is an option, not the default.

- Reframe the intro so neither reset nor one-time is stated as the
  universal default.
- Note in the dashboard section that a frequency is always selected and
  defaults to Monthly, with Never for a one-time budget.
- Qualify the API field table: `none` is the default only when the
  field is omitted from the API request.
@hMED22
hMED22 merged commit 6aa60f3 into main Jul 21, 2026
5 checks passed
@hMED22
hMED22 deleted the ahmednemdil/tokens-and-members-budgets branch July 21, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant