@@ -27,6 +27,7 @@ const CreateSchema = z.object({
2727 maxOutputTokens : z . string ( ) . optional ( ) ,
2828 capabilities : z . string ( ) . optional ( ) ,
2929 isHidden : z . string ( ) . optional ( ) ,
30+ pricingUnit : z . string ( ) . optional ( ) ,
3031} ) ;
3132
3233export const action = dashboardAction (
@@ -65,7 +66,7 @@ export const action = dashboardAction(
6566 return typedjson ( { error : "Invalid pricing tiers JSON" } , { status : 400 } ) ;
6667 }
6768
68- const { provider, description, contextWindow, maxOutputTokens, capabilities, isHidden } = parsed . data ;
69+ const { provider, description, contextWindow, maxOutputTokens, capabilities, isHidden, pricingUnit } = parsed . data ;
6970
7071 const model = await prisma . llmModel . create ( {
7172 data : {
@@ -79,6 +80,7 @@ export const action = dashboardAction(
7980 maxOutputTokens : maxOutputTokens ? parseInt ( maxOutputTokens ) || null : null ,
8081 capabilities : capabilities ? capabilities . split ( "," ) . map ( ( s ) => s . trim ( ) ) . filter ( Boolean ) : [ ] ,
8182 isHidden : isHidden === "on" ,
83+ pricingUnit : pricingUnit || null ,
8284 } ,
8385 } ) ;
8486
@@ -118,6 +120,7 @@ export default function AdminLlmModelNewRoute() {
118120 const [ maxOutputTokens , setMaxOutputTokens ] = useState ( "" ) ;
119121 const [ capabilities , setCapabilities ] = useState ( "" ) ;
120122 const [ isHidden , setIsHidden ] = useState ( false ) ;
123+ const [ pricingUnit , setPricingUnit ] = useState ( "tokens" ) ;
121124 const [ testInput , setTestInput ] = useState ( "" ) ;
122125 const [ tiers , setTiers ] = useState < TierData [ ] > ( [
123126 { name : "Standard" , isDefault : true , priority : 0 , conditions : [ ] , prices : { input : 0 , output : 0 } } ,
@@ -279,6 +282,23 @@ export default function AdminLlmModelNewRoute() {
279282 </ div >
280283 </ div >
281284
285+ < div className = "space-y-1" >
286+ < label className = "text-xs font-medium text-text-dimmed" > Pricing Unit</ label >
287+ < select
288+ name = "pricingUnit"
289+ value = { pricingUnit }
290+ onChange = { ( e ) => setPricingUnit ( e . target . value ) }
291+ className = "w-full rounded border border-grid-dimmed bg-charcoal-750 px-2 py-1.5 text-sm text-text-bright"
292+ >
293+ < option value = "" > (unset)</ option >
294+ { PRICING_UNITS . map ( ( u ) => (
295+ < option key = { u } value = { u } >
296+ { u }
297+ </ option >
298+ ) ) }
299+ </ select >
300+ </ div >
301+
282302 < label className = "flex items-center gap-2 text-xs text-text-dimmed" >
283303 < input
284304 type = "checkbox"
@@ -366,6 +386,8 @@ type TierData = {
366386 prices : Record < string , number > ;
367387} ;
368388
389+ const PRICING_UNITS = [ "tokens" , "characters" , "images" , "minutes" , "requests" , "free" ] ;
390+
369391const COMMON_USAGE_TYPES = [
370392 "input" ,
371393 "output" ,
0 commit comments