Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
e30228f
add-resource-tavily
zdql Oct 9, 2025
e53edfe
add tavily resource
zdql Oct 9, 2025
27dbd15
cleanup
zdql Oct 9, 2025
89b3451
db changes
alvaroechevarriacuesta Oct 10, 2025
3278e3f
implement refund logic for failed sora requests
alvaroechevarriacuesta Oct 10, 2025
af978d0
check in
alvaroechevarriacuesta Oct 13, 2025
54ecfe0
fix migrations
alvaroechevarriacuesta Oct 13, 2025
7c6a514
fix with new atomic logic
alvaroechevarriacuesta Oct 13, 2025
b4f7f93
tested
alvaroechevarriacuesta Oct 13, 2025
0ec1dc2
increase api route limit to 4mb
sragss Oct 14, 2025
56b1dc0
Merge pull request #562 from Merit-Systems/sragss/fix-img-template
sragss Oct 14, 2025
e799344
remove openrouter/auto
zdql Oct 14, 2025
8b1b227
fix model price
zdql Oct 14, 2025
b3998c5
Merge branch 'master' into br/add-resource-tavily
zdql Oct 14, 2025
0cded6c
format
zdql Oct 14, 2025
293fd59
Merge pull request #541 from Merit-Systems/br/add-resource-tavily
rsproule Oct 15, 2025
63a38e4
add E2b, fix tavily
zdql Oct 15, 2025
2ac0348
format
zdql Oct 15, 2025
c1ae0cf
Merge pull request #565 from Merit-Systems/br/add-resource-e2b
zdql Oct 15, 2025
9b98dc1
add long tail tavily routes
zdql Oct 15, 2025
3fd58d0
Merge pull request #567 from Merit-Systems/br/add-resource-e2b
zdql Oct 15, 2025
6facf82
fix laggy integ
zdql Oct 15, 2025
34d7c38
feat: add 'claude-sonnet-4-5' to Anthropic and OpenRouter provoder mo…
qibinlou Oct 15, 2025
949ea98
rm migrations until finalized
alvaroechevarriacuesta Oct 15, 2025
b0a9890
some additional work on the table. Refunds working with x402
alvaroechevarriacuesta Oct 15, 2025
a2aec60
keep track of echo video gen that are non x402
alvaroechevarriacuesta Oct 15, 2025
8392323
log errors on echo video gen, store total cost not rawtransaction cost
alvaroechevarriacuesta Oct 15, 2025
aa1f762
Merge remote-tracking branch 'origin/master' into aec/refund
alvaroechevarriacuesta Oct 15, 2025
05e59cf
download only available for 1 hour according to docs
alvaroechevarriacuesta Oct 15, 2025
30cc7a9
use shared object
fmhall Oct 15, 2025
926aff1
Merge pull request #570 from Merit-Systems/mason/cleanup-fix
rsproule Oct 15, 2025
6d16752
clean abstraction
zdql Oct 15, 2025
c610ce6
cleanup error handling
zdql Oct 15, 2025
afdaba6
Merge pull request #566 from Merit-Systems/br/add-resource-tavily
zdql Oct 16, 2025
600d6aa
Merge pull request #568 from qibinlou/leo/add-sonnet-4.5-support
rsproule Oct 16, 2025
447a30a
bump sdk versions for sonnet 4.5
rsproule Oct 16, 2025
22150b4
fix filename
rsproule Oct 16, 2025
5d63e2f
provider smoke test
rsproule Oct 16, 2025
877125d
increase timeout to 15m
rsproule Oct 16, 2025
4b1f540
Merge pull request #571 from Merit-Systems/rfs/bump-version-smoke
rsproule Oct 16, 2025
d5b2b05
Add Groq provider support
dhvll Oct 16, 2025
c0056c0
update the tests
rsproule Oct 16, 2025
d7b3728
path
rsproule Oct 16, 2025
208135b
optimize this docker a bit
rsproule Oct 16, 2025
f27762a
docker 1
rsproule Oct 16, 2025
793861c
revert docker
rsproule Oct 16, 2025
2eb0e31
Merge pull request #578 from Merit-Systems/rfs/bump-version-smoke
rsproule Oct 16, 2025
08c29d9
big boxes for gha
rsproule Oct 16, 2025
1b6daa1
revert docker
rsproule Oct 16, 2025
d98d37f
Merge pull request #579 from Merit-Systems/rfs/big-box
rsproule Oct 16, 2025
cfd90d6
Refactor GroqProvider and update Groq model costs
dhvll Oct 16, 2025
f6dc1b5
update test name or
rsproule Oct 16, 2025
ee90834
rm timeouts
rsproule Oct 16, 2025
17c237c
rm timeouts
rsproule Oct 16, 2025
28d9751
rm openai timeout
rsproule Oct 16, 2025
5dab845
Add Groq provider integration and update SDK dependencies
dhvll Oct 16, 2025
21cd217
Merge pull request #577 from dhvll/master
rsproule Oct 17, 2025
3719252
fix sdk build issues + add tests
rsproule Oct 17, 2025
46fc77b
lock
rsproule Oct 17, 2025
1847e34
bump versions
rsproule Oct 17, 2025
813fc82
mr lock
rsproule Oct 17, 2025
f2202a8
update groq models with correct names
rsproule Oct 17, 2025
395d070
gdmmit alv
rsproule Oct 17, 2025
9584440
Merge pull request #582 from Merit-Systems/rfs/groq-takeover
rsproule Oct 17, 2025
ca3ea92
Merge pull request #548 from Merit-Systems/aec/refund
rsproule Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/app/server/src/services/AccountingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,19 @@ export const getCostPerToken = (
if (!modelPrice) {
throw new Error(`Pricing information not found for model: ${model}`);
}
if (modelPrice.input_cost_per_token < 0 || modelPrice.output_cost_per_token < 0) {
throw new Error(`Invalid pricing for model: ${model}`);
}

return new Decimal(modelPrice.input_cost_per_token)
const cost = new Decimal(modelPrice.input_cost_per_token)
.mul(inputTokens)
.plus(new Decimal(modelPrice.output_cost_per_token).mul(outputTokens));

if (cost.lessThan(0)) {
throw new Error(`Invalid cost for model: ${model}`);
}

return cost;
};

export const getImageModelCost = (
Expand Down
7 changes: 0 additions & 7 deletions packages/sdk/ts/src/supported-models/chat/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export type OpenRouterModel =
| 'openai/o4-mini'
| 'openai/o4-mini-high'
| 'opengvlab/internvl3-14b'
| 'openrouter/auto'
| 'perplexity/r1-1776'
| 'perplexity/sonar'
| 'perplexity/sonar-deep-research'
Expand Down Expand Up @@ -1752,12 +1751,6 @@ export const OpenRouterModels: SupportedModel[] = [
output_cost_per_token: 4e-7,
provider: 'OpenRouter',
},
{
model_id: 'openrouter/auto',
input_cost_per_token: -1,
output_cost_per_token: -1,
provider: 'OpenRouter',
},
{
model_id: 'perplexity/r1-1776',
input_cost_per_token: 0.000002,
Expand Down
8 changes: 8 additions & 0 deletions templates/next-image/src/app/api/edit-image/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ const providers = {
gemini: handleGoogleEdit,
};

export const config = {
api: {
bodyParser: {
sizeLimit: '4mb',
},
},
};
Comment on lines +20 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export const config with bodyParser configuration is incompatible with Next.js App Router and will be ignored.

View Details
📝 Patch Details
diff --git a/templates/next-image/next.config.ts b/templates/next-image/next.config.ts
index 59692f72..fa32ad5e 100644
--- a/templates/next-image/next.config.ts
+++ b/templates/next-image/next.config.ts
@@ -2,6 +2,11 @@ import type { NextConfig } from 'next';
 
 const nextConfig: NextConfig = {
   transpilePackages: ['@merit-systems/echo-next-sdk'],
+  experimental: {
+    serverActions: {
+      bodySizeLimit: '4mb',
+    },
+  },
 };
 
 export default nextConfig;
diff --git a/templates/next-image/src/app/api/edit-image/route.ts b/templates/next-image/src/app/api/edit-image/route.ts
index 11c52b38..eb619a5f 100644
--- a/templates/next-image/src/app/api/edit-image/route.ts
+++ b/templates/next-image/src/app/api/edit-image/route.ts
@@ -17,14 +17,6 @@ const providers = {
   gemini: handleGoogleEdit,
 };
 
-export const config = {
-  api: {
-    bodyParser: {
-      sizeLimit: '4mb',
-    },
-  },
-};
-
 export async function POST(req: Request) {
   try {
     const body = await req.json();

Analysis

Invalid bodyParser configuration in App Router route handler

What fails: The export const config with bodyParser.sizeLimit in templates/next-image/src/app/api/edit-image/route.ts is silently ignored in Next.js App Router, leaving the 4MB body size limit unenforced.

How to reproduce:

# Check Next.js version and App Router structure:
cd templates/next-image && cat package.json | grep '"next"'  # Shows Next.js 15.4.7
ls src/app/api/edit-image/  # Shows App Router structure

Result: The export const config from Pages Router API (pages/api/) does not work in App Router (src/app/api/). Body size limits are not enforced, potentially allowing requests larger than intended 4MB limit.

Expected: In App Router, body size limits should be configured globally via experimental.serverActions.bodySizeLimit in next.config.ts per Next.js App Router discussions and official documentation.


export async function POST(req: Request) {
try {
const body = await req.json();
Expand Down
8 changes: 8 additions & 0 deletions templates/next-image/src/app/api/generate-image/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ const providers = {
gemini: handleGoogleGenerate,
};

export const config = {
api: {
bodyParser: {
sizeLimit: '4mb',
},
},
};
Comment on lines +22 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const config = {
api: {
bodyParser: {
sizeLimit: '4mb',
},
},
};
// Note: export const config is not supported in App Router.
// Body size limits should be handled through server configuration or middleware.
// The default Next.js body size limit (1MB) applies to this route.

The export const config with bodyParser configuration is incompatible with Next.js App Router and will be ignored.

View Details

Analysis

export const config with bodyParser ignored in App Router route handler

What fails: templates/next-image/src/app/api/generate-image/route.ts uses export const config = { api: { bodyParser: { sizeLimit: '4mb' } } } which is incompatible with Next.js App Router and silently ignored

How to reproduce:

  1. Check file path: src/app/api/ structure indicates App Router
  2. Configuration uses Pages Router syntax documented only for pages/api/ routes
  3. Body size limit not enforced - requests default to 1MB limit instead of intended 4MB

Result: The 4MB size limit configuration is silently ignored, potentially causing failures for large image generation requests that exceed the default 1MB limit

Expected: App Router Route Handlers don't support export const config per Next.js App Router migration docs and GitHub issue #57501 - body limits must be configured at server/middleware level


export async function POST(req: Request) {
try {
const body = await req.json();
Expand Down
Loading