-
Notifications
You must be signed in to change notification settings - Fork 772
Rate limits and budgets #1366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
narengogi
wants to merge
26
commits into
main
Choose a base branch
from
feature/ratelimits-and-budgets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rate limits and budgets #1366
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ef99ad6
Rate limits and budgets
narengogi 6d123db
remvoe bindings
narengogi d55ecf8
remove kv
narengogi 169e7d2
Merge remote-tracking branch 'upstream/main' into feature/ratelimits-…
narengogi 8407df1
rebase
narengogi 1d99b8a
Apply suggestion from @matter-code-review[bot]
narengogi 1c3d5c5
Apply suggestion from @matter-code-review[bot]
narengogi 2b379fb
Apply suggestion from @matter-code-review[bot]
narengogi 0bb75dd
Apply suggestion from @matter-code-review[bot]
narengogi 05e42a3
handle settings
narengogi 00c00e8
handle redis rate limiter tokens rate limiting when tokens to decreme…
narengogi a29315e
remove cache backend changes
narengogi 9cc932d
remove unused imports
narengogi 2505510
update settings example
narengogi bc56171
update settings initializer
narengogi 99f6262
dont hardcode id
narengogi d331fd8
remove unused variable
narengogi f4cdbe3
handle nulls
narengogi d2ca7ef
remove import
narengogi b372b2f
delete transfer encoding for node
narengogi a30cfff
extend redis client backend to support redis specific functionality
narengogi ec153fb
dont crash on unhandled promise rejections and other changes like ren…
narengogi 451e6d2
Merge remote-tracking branch 'upstream/main' into feature/ratelimits-…
narengogi ba11027
fix conf.example
narengogi 06ae963
Merge remote-tracking branch 'upstream/main' into feature/ratelimits-…
narengogi 421897e
Merge remote-tracking branch 'upstream/main' into feature/ratelimits-…
narengogi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| const organisationDetails = { | ||
| id: '00000000-0000-0000-0000-000000000000', | ||
| name: 'Portkey self hosted', | ||
| settings: { | ||
| debug_log: 1, | ||
| is_virtual_key_limit_enabled: 1, | ||
| allowed_guardrails: ['BASIC'], | ||
| }, | ||
| workspaceDetails: {}, | ||
| defaults: { | ||
| metadata: null, | ||
| }, | ||
| usageLimits: [], | ||
| rateLimits: [], | ||
| organisationDefaults: { | ||
| input_guardrails: null, | ||
| }, | ||
| }; | ||
|
|
||
| const transformIntegrations = (integrations: any) => { | ||
| return integrations.map((integration: any) => { | ||
| return { | ||
| id: '1234567890', //need to do consistent hashing for caching | ||
| ai_provider_name: integration.provider, | ||
| model_config: { | ||
| ...integration.credentials, | ||
| }, | ||
| ...(integration.credentials?.apiKey && { | ||
| key: integration.credentials.apiKey, | ||
| }), | ||
| slug: integration.slug, | ||
| usage_limits: null, | ||
| status: 'active', | ||
| integration_id: '1234567890', | ||
| object: 'virtual-key', | ||
| integration_details: { | ||
| id: '1234567890', | ||
| slug: integration.slug, | ||
| usage_limits: integration.usage_limits, | ||
| rate_limits: integration.rate_limits, | ||
| models: integration.models, | ||
| }, | ||
| }; | ||
| }); | ||
| }; | ||
|
|
||
| let settings: any = undefined; | ||
narengogi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| try { | ||
| // @ts-expect-error | ||
| const settingsFile = await import('./settings.json'); | ||
| if (settingsFile) { | ||
| settings = {}; | ||
narengogi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| settings.organisationDetails = organisationDetails; | ||
| if (settingsFile.integrations) { | ||
| settings.integrations = transformIntegrations(settingsFile.integrations); | ||
| } | ||
| } | ||
| } catch (error) { | ||
| console.log( | ||
| 'WARNING: Unable to import settings from the path, please make sure the file exists', | ||
| error | ||
| ); | ||
| } | ||
|
|
||
| export { settings }; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "integrations": [ | ||
| { | ||
| "provider": "anthropic", | ||
| "slug": "dev_team_anthropic", | ||
| "credentials": { | ||
| "apiKey": "sk-ant-" | ||
| }, | ||
| "rate_limits": [ | ||
| { | ||
| "type": "requests", | ||
| "unit": "rph", | ||
| "value": 3 | ||
| } | ||
| ], | ||
| "usage_limits": [ | ||
| { | ||
| "type": "tokens", | ||
| "credit_limit": 1000000, | ||
| "periodic_reset": "weekly" | ||
| } | ||
| ], | ||
| "models": [ | ||
| { | ||
| "slug": "claude-3-7-sonnet-20250219", | ||
| "status": "active", | ||
| "pricing_config": null | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.