You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@openmeter/sdk

Package Overview
Dependencies
Maintainers
2
Versions
1110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openmeter/sdk

Client for OpenMeter: Real-Time and Scalable Usage Metering

1.0.0-beta.219
latest
Source
npmnpm
Version published
Weekly downloads
5.6K
4.07%
Maintainers
2
Weekly downloads
 
Created
Source

OpenMeter JavaScript SDK

Install

npm install --save @openmeter/sdk

Configuration for accessing the OpenMeter API

To use the OpenMeter SDK on your backend, you need to configure baseUrl and apiKey for OpenMeter Cloud:

import { OpenMeter } from '@openmeter/sdk'

const openmeter = new OpenMeter({
  baseUrl: 'https://openmeter.cloud',
  apiKey: 'om_...',
})

Configuration for accessing the OpenMeter Portal API

To use the OpenMeter Portal SDK on your frontend, you need to configure it use a portal token in your configuration:

import { OpenMeter } from '@openmeter/sdk/portal'

const openmeter = new OpenMeter({
  baseUrl: 'https://openmeter.cloud',
  portalToken: 'om_portal_...',
})

Configuration for accessing the OpenMeter React SDK

To use the OpenMeter React SDK for the portal API, you need to configure a Portal Client and a React Context:

import {
  OpenMeter,
  OpenMeterProvider,
  useOpenMeter,
} from '@openmeter/sdk/react'

function App() {
  // get portal token from your backend
  const openmeter = new OpenMeter({
    baseUrl: 'https://openmeter.cloud',
    portalToken,
  })

  return (
    <OpenMeterProvider value={openmeter}>
      <UsageComponent />
      {/* ... */}
    </OpenMeterProvider>
  )
}

function UsageComponent() {
  // get openmeter client from context
  const openmeter = useOpenMeter()

  // ...
}

FAQs

Package last updated on 01 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts