forked from TellezAnto/ethereum-inference-network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.ts
More file actions
47 lines (45 loc) · 1.15 KB
/
middleware.ts
File metadata and controls
47 lines (45 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Here we declare the middleware for x402
import { paymentMiddleware } from "x402-next";
// Para desarrollo en testnet
export const middleware = paymentMiddleware(
(process.env.PAYMENT_RECEIVING_WALLET_ADDRESS ||
"0x0000000000000000000000000000000000000000") as `0x${string}`,
{
"/api/asi/chat/completions": {
price: "$0.009",
network: "base-sepolia",
config: {
description: "ASI chat inference",
mimeType: "application/json",
maxTimeoutSeconds: 30,
outputSchema: {
type: "object",
properties: {
inference: { type: "string" },
},
},
},
},
"/api/open-router/**": {
price: "$0.009",
network: "base-sepolia",
config: {
description: "Open Router inference",
mimeType: "application/json",
maxTimeoutSeconds: 30,
outputSchema: {
type: "object",
properties: {
url: { type: "string" },
},
},
},
},
},
{
url: "https://x402.org/facilitator",
},
);
export const config = {
matcher: ["/api/asi/:path*", "/api/open-router/:path*"],
};