Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(models): allow to set input/output/total price without restrictions (#1029)

Marc Klingen41b19582ccee
diff --git a/src/server/api/routers/models.ts b/src/server/api/routers/models.ts
index 587a4bfc0d..247571f8d0 100644
--- a/src/server/api/routers/models.ts
+++ b/src/server/api/routers/models.ts
@@ -85,29 +85,18 @@ export const modelRouter = createTRPCRouter({
}),
create: protectedProjectProcedure
.input(
- z
- .object({
- projectId: z.string(),
- modelName: z.string(),
- matchPattern: z.string(),
- startDate: z.date().optional(),
- inputPrice: z.number().positive().optional(),
- outputPrice: z.number().positive().optional(),
- totalPrice: z.number().positive().optional(),
- unit: z.enum(["TOKENS", "CHARACTERS"]),
- tokenizerId: z.enum(["openai", "claude"]).optional(),
- tokenizerConfig: z
- .record(z.union([z.string(), z.number()]))
- .optional(),
- })
- .refine(
- ({ inputPrice, outputPrice, totalPrice }) =>
- (!!inputPrice && !!outputPrice) || !!totalPrice,
- {
- message:
- "Either inputPrice and outputPrice or totalPrice needs to be set",
- },
- ),
+ z.object({
+ projectId: z.string(),
+ modelName: z.string(),
+ matchPattern: z.string(),
+ startDate: z.date().optional(),
+ inputPrice: z.number().positive().optional(),
+ outputPrice: z.number().positive().optional(),
+ totalPrice: z.number().positive().optional(),
+ unit: z.enum(["TOKENS", "CHARACTERS"]),
+ tokenizerId: z.enum(["openai", "claude"]).optional(),
+ tokenizerConfig: z.record(z.union([z.string(), z.number()])).optional(),
+ }),
)
.mutation(async ({ input, ctx }) => {
throwIfNoAccess({