Skip to content

feat(embed): add /embed/scatter route for iframe embedding#311

Open
functionstackx wants to merge 1 commit intomasterfrom
claude/issue-269-20260505-0421
Open

feat(embed): add /embed/scatter route for iframe embedding#311
functionstackx wants to merge 1 commit intomasterfrom
claude/issue-269-20260505-0421

Conversation

@functionstackx
Copy link
Copy Markdown
Contributor

Closes #269.

Adds a stable, public-contract embed surface at /embed/scatter so partner sites can iframe the inference scatter chart.

URL contract (long-term-stable)

/embed/scatter?model=<dbKey>&isl=<n>&osl=<n>&precisions=<csv>&gpus=<csv>&y=<metric>&chart=<e2e|interactivity>
  • model — DB model key (dsr1, llama70b, dsv4, …). Default dsr1.
  • isl / osl — sequence input/output token lengths. Default 8192 / 1024.
  • precisions — comma-separated precision keys. Default fp4.
  • gpus — comma-separated hwKeys (e.g. b300_sglang,gb300_dynamo-sglang).
  • y — y-axis metric (tpPerGpu, costh, tpPerMw, …). Default tpPerGpu.
  • charte2e (default) or interactivity.

Embed-only chrome

  • Header / Footer hidden via ChromeGate on /embed/*.
  • Small “SemiAnalysis InferenceX →” attribution link at the bottom-right that deep-links to the canonical /inference URL with equivalent internal params.
  • Robots noindex, nofollow on the route.

CSP / framing (next.config.ts headers)

  • /embed/*: Content-Security-Policy: frame-ancestors *
  • All other routes: frame-ancestors 'self' + X-Frame-Options: SAMEORIGIN (non-framable)

Verified via curl -I.

Analytics

  • embed_view on mount with chart_type, model, sequence, precisions, gpus, y_metric, referrer, embed_host
  • embed_attribution_clicked on the canonical-link CTA

Verification

Check Result
pnpm typecheck
pnpm lint ✅ 0 warnings, 0 errors
pnpm fmt
pnpm test:unit ✅ 1749 passing
Cypress embed-scatter.cy.ts ✅ 7/7
Cypress inference-chart.cy.ts ✅ 9/9 (no regression)
Cypress sanity.cy.ts ✅ 5/5 (no regression)
Playwright /embed/scatter @1280px ✅ chart renders real data
Playwright /embed/scatter @600px ✅ legend stacks below chart
Playwright ?y=costh ✅ cost axis renders
curl -I /embed/scatter frame-ancestors *, no X-Frame-Options
curl -I /inference frame-ancestors 'self' + SAMEORIGIN

Generated with Claude Code

Adds a stable, public-contract embed surface at /embed/scatter so partner
sites can iframe the inference scatter chart. Closes #269.

URL contract (long-term-stable, lives in lib/embed-params.ts):
  /embed/scatter?model=<dbKey>&isl=<n>&osl=<n>&precisions=<csv>
                &gpus=<csv>&y=<metric>&chart=<e2e|interactivity>

Embed-only chrome:
- Header / Footer hidden via ChromeGate on /embed/*
- Small "SemiAnalysis InferenceX -> " attribution link at the bottom-right
  that deep-links to the equivalent /inference URL
- robots noindex, nofollow

CSP / framing (next.config.ts headers()):
- /embed/*: frame-ancestors *
- everything else: frame-ancestors 'self' + X-Frame-Options: SAMEORIGIN

Analytics:
- embed_view on mount with referrer + host
- embed_attribution_clicked on the canonical-link CTA

Translation seeds the internal g_*/i_* url-state cache before the
providers' lazy useState initializers fire, so the chart mounts already
pointed at the requested embed params.

Co-authored-by: functionstackx <functionstackx@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inferencemax-app Ready Ready Preview, Comment May 5, 2026 4:47am

Request Review

@1280px
Copy link
Copy Markdown

1280px commented May 5, 2026

This project sounds pretty interesting, not going to lie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embeddable charts

2 participants