Delete page "Home"
parent
5eba76e60f
commit
85c2b7eeda
1 changed files with 0 additions and 32 deletions
32
Home.md
32
Home.md
|
|
@ -1,32 +0,0 @@
|
|||
# go-ratelimit Wiki
|
||||
|
||||
Token counting, model quotas, and sliding window rate limiter. Module: `forge.lthn.ai/core/go-ratelimit`
|
||||
|
||||
## Architecture
|
||||
|
||||
Provides rate limiting primitives for AI model API calls. Tracks token usage per model, enforces quotas, and implements sliding window algorithms.
|
||||
|
||||
### Features
|
||||
|
||||
- **Token counting**: Estimate token usage before API calls
|
||||
- **Model quotas**: Per-model rate limits with configurable windows
|
||||
- **Sliding window**: Smooth rate limiting without burst spikes
|
||||
- **YAML config**: Load quota definitions from configuration files
|
||||
|
||||
### Usage
|
||||
|
||||
```go
|
||||
limiter := ratelimit.New(ratelimit.Config{
|
||||
Models: map[string]ratelimit.ModelQuota{
|
||||
"claude-opus-4": {TokensPerMinute: 100000, RequestsPerMinute: 60},
|
||||
},
|
||||
})
|
||||
|
||||
if limiter.Allow("claude-opus-4", estimatedTokens) {
|
||||
// proceed with API call
|
||||
}
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `gopkg.in/yaml.v3` — Configuration parsing
|
||||
Loading…
Add table
Reference in a new issue