Skip to content

Widget Integration

Add live AI rankings to any website with a single script tag. Four widget types are available, each rendered in an isolated Shadow DOM so they never conflict with your styles.

Setup

Add the widget script to your page. It is under 15 KB gzipped and has zero dependencies.

html
<script src="https://cdn.lmmarketcap.com/widget.js" async></script>

The script auto-discovers any elements with a data-aimc-widget attribute and renders them. It also watches for dynamically added elements, so widgets work with single-page apps too.

Live Widget Previews

Customize the preview, toggle between light and dark themes, adjust dimensions, and copy the embed code directly.

Ranking Ticker

Horizontal scrolling bar showing top models with scores. Great for sidebars and dashboards.

Embed Code
<script src="https://cdn.lmmarketcap.com/widget.js" async></script>
<div
  data-aimc-widget="ranking-ticker"
  data-category="coding"
  data-limit="5"
  data-theme="light"
  style="width: 700px; height: 60px;"
></div>

Model Card

Single model stats card with score, rank, provider, and pricing details.

Claude 3.5 SonnetAnthropic
94.2
+2.17d change
#1 in LLM
Quality
#1
Adoption
#3
Input $/1M
$3.00
Output $/1M
$15.00
Powered by LM Market Cap
Embed Code
<script src="https://cdn.lmmarketcap.com/widget.js" async></script>
<div
  data-aimc-widget="model-card"
  data-model="claude-3-5-sonnet"
  data-show-pricing="true"
  data-theme="light"
  style="width: 320px; height: 340px;"
></div>

Comparison Table

Side-by-side comparison of 2-3 models showing scores, rankings, and pricing.

Claude 3.5 SonnetGPT-4oGemini 2.0 Pro
ProviderAnthropicOpenAIGoogle
Score94.292.891.5
Rank#1#2#3
Quality#1#2#3
Adoption#3#1#4
Input $/1M$3.00$2.50$1.25
Output $/1M$15.00$10.00$5.00
Powered by LM Market Cap
Embed Code
<script src="https://cdn.lmmarketcap.com/widget.js" async></script>
<div
  data-aimc-widget="comparison-table"
  data-models="claude-3-5-sonnet,gpt-4o,gemini-2-0-pro"
  data-category="coding"
  data-theme="light"
  style="width: 700px; height: 360px;"
></div>

1. Ranking Ticker

A compact horizontal ticker showing the top models in a category. Great for blog sidebars, dashboards, or news sites.

html
<div
  data-aimc-widget="ranking-ticker"
  data-category="coding"
  data-limit="5"
  data-theme="light"
></div>

Attributes

AttributeRequiredDefaultDescription
data-categoryYes--Category slug (coding, image-generation, video-generation)
data-limitNo5Number of models to show (1-20)
data-themeNoautoColor theme: light, dark, or auto
data-refreshNo300Auto-refresh interval in seconds (0 to disable)

2. Model Card

A detailed card for a single model showing its score, rank, pricing, and key signals. Perfect for model profile pages or review sites.

html
<div
  data-aimc-widget="model-card"
  data-model="claude-3-5-sonnet"
  data-show-pricing="true"
  data-theme="light"
></div>

Attributes

AttributeRequiredDefaultDescription
data-modelYes--Model slug
data-show-pricingNotrueShow pricing section
data-show-signalsNofalseShow signal breakdown
data-themeNoautoColor theme: light, dark, or auto

3. Comparison Table

A side-by-side comparison of 2-4 models. Shows scores, pricing, and key differences. Ideal for "vs" pages and decision-making tools.

html
<div
  data-aimc-widget="comparison-table"
  data-models="claude-3-5-sonnet,gpt-4o"
  data-category="coding"
  data-theme="light"
></div>

Attributes

AttributeRequiredDefaultDescription
data-modelsYes--Comma-separated model slugs (2-4)
data-categoryNoauto-detectedCategory for score context
data-show-pricingNotrueShow pricing rows
data-themeNoautoColor theme: light, dark, or auto

4. Category Leaderboard

A full leaderboard table for a category. Includes rank, score, trend indicators, and links to model profiles. Works well as the main content on a rankings page.

html
<div
  data-aimc-widget="category-leaderboard"
  data-category="coding"
  data-limit="10"
  data-theme="light"
></div>

Attributes

AttributeRequiredDefaultDescription
data-categoryYes--Category slug
data-limitNo10Number of models to show (1-50)
data-show-trendNotrueShow 7-day rank change
data-themeNoautoColor theme: light, dark, or auto

Customization

Themes

All widgets support light, dark, and auto themes. The auto theme reads the user's system preference. You can also set a global theme:

html
<script>
  window.__AIMC_CONFIG__ = {
    theme: "dark",
    themeColors: {
      primary: "#6366f1",
      background: "#0a0a0a",
    },
  };
</script>
<script src="https://cdn.lmmarketcap.com/widget.js" async></script>

Programmatic API

For SPAs and dynamic content, use the programmatic API:

javascript
// Initialize with config
AIMarketCapWidget.init({
  apiKey: "YOUR_API_KEY",
  theme: "dark",
});

// Manually render a new widget
const el = document.getElementById("my-widget");
await AIMarketCapWidget.render(el);

// Refresh data
await AIMarketCapWidget.refresh(el);

// Clean up
AIMarketCapWidget.destroy(el);

// Or destroy all widgets
AIMarketCapWidget.destroyAll();

Caching

The widget SDK caches API responses for 5 minutes by default. You can change this globally:

javascript
window.__AIMC_CONFIG__ = {
  cacheTTL: 600000, // 10 minutes in milliseconds
};

WordPress Integration

For WordPress sites, add the script in your theme's functions.php and use shortcodes or the block editor.

Option 1: functions.php

php
// Add to your theme's functions.php
function aimc_enqueue_widget() {
    wp_enqueue_script(
        'aimc-widget',
        'https://cdn.lmmarketcap.com/widget.js',
        array(),
        '1.0.0',
        true // Load in footer
    );
}
add_action('wp_enqueue_scripts', 'aimc_enqueue_widget');

Option 2: Custom HTML Block

In the WordPress block editor, add a "Custom HTML" block and paste:

html
<script src="https://cdn.lmmarketcap.com/widget.js" async></script>
<div data-aimc-widget="category-leaderboard" data-category="coding" data-limit="10"></div>

Next Steps