-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat: add Mistral AI cost table and vendor integration #357
Merged
karthikscale3
merged 6 commits into
development
from
devin/1732215884-add-mistral-cost-table
Nov 21, 2024
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2e643d0
feat: add Mistral AI cost table and vendor integration
devin-ai-integration[bot] 4fe5b71
feat: add Mistral AI cost table
devin-ai-integration[bot] a6ff99c
fix: address PR comments for Mistral AI integration
devin-ai-integration[bot] 1090b64
feat: add Mistral handling in litellm condition and remove duplicate …
devin-ai-integration[bot] 6bb4960
Update model check to 'tral'
devin-ai-integration[bot] e819786
Update vendor detection to use 'tral' for Mistral models for consistency
devin-ai-integration[bot] 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
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -146,6 +146,49 @@ export const OPENAI_PRICING: Record<string, CostTableEntry> = { | |
|
||
}; | ||
|
||
export const MISTRAL_PRICING: Record<string, CostTableEntry> = { | ||
"mistral-large-latest": { | ||
input: 0.002, | ||
output: 0.006, | ||
}, | ||
"pixtral-large-latest": { | ||
input: 0.002, | ||
output: 0.006, | ||
}, | ||
"mistral-small-latest": { | ||
input: 0.0002, | ||
output: 0.0006, | ||
}, | ||
"codestral-latest": { | ||
input: 0.0002, | ||
output: 0.0006, | ||
}, | ||
"ministral-8b-latest": { | ||
input: 0.0001, | ||
output: 0.0001, | ||
}, | ||
"ministral-3b-latest": { | ||
input: 0.00004, | ||
output: 0.00004, | ||
}, | ||
"mistral-embed": { | ||
input: 0.0001, | ||
output: 0, | ||
}, | ||
"open-mistral-7b": { | ||
input: 0.00025, | ||
output: 0.00025, | ||
}, | ||
"open-mixtral-8x7b": { | ||
input: 0.0007, | ||
output: 0.0007, | ||
}, | ||
"open-mixtral-8x22b": { | ||
input: 0.002, | ||
output: 0.006, | ||
}, | ||
}; | ||
|
||
export const XAI_PRICING: Record<string, CostTableEntry> = { | ||
"grok-beta": { | ||
input: 0.005, | ||
|
@@ -338,6 +381,10 @@ export const LLM_VENDOR_APIS = [ | |
value: "PERPLEXITY_API_KEY", | ||
label: "Perplexity", | ||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed |
||
value: "MISTRAL_API_KEY", | ||
label: "Mistral", | ||
}, | ||
]; | ||
|
||
export const LLM_VENDORS = [ | ||
|
@@ -361,6 +408,10 @@ export const LLM_VENDORS = [ | |
value: "perplexity", | ||
label: "Perplexity", | ||
}, | ||
{ | ||
value: "mistral", | ||
label: "Mistral", | ||
}, | ||
]; | ||
|
||
export const SUPPORTED_VENDORS: Record<string, string> = { | ||
|
This file contains 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 |
---|---|---|
|
@@ -16,6 +16,7 @@ import { | |
CostTableEntry, | ||
GROQ_PRICING, | ||
LangTraceAttributes, | ||
MISTRAL_PRICING, | ||
OPENAI_PRICING, | ||
PERPLEXITY_PRICING, | ||
SpanStatusCode, | ||
|
@@ -527,7 +528,7 @@ export function calculatePriceFromUsage( | |
} else if (model.includes("claude")) { | ||
vendor = "anthropic"; | ||
} else if (model.includes("mistral")) { | ||
karthikscale3 marked this conversation as resolved.
Show resolved
Hide resolved
karthikscale3 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update this to "tral" |
||
vendor = "mistral"; // Assuming there is a MISTRAL_PRICING object | ||
vendor = "mistral"; | ||
karthikscale3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} else if (model.includes("grok")) { | ||
vendor = "xai"; | ||
} else if (model.includes("gemini")) { | ||
|
@@ -642,6 +643,8 @@ export function calculatePriceFromUsage( | |
costTable = GEMINI_PRICING[model]; | ||
} else if (vendor === "xai") { | ||
costTable = XAI_PRICING[model]; | ||
} else if (vendor === "mistral") { | ||
costTable = MISTRAL_PRICING[model]; | ||
} | ||
if (costTable) { | ||
const total = | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already handled in this file