agentskit.js

applyCarbonTable

Auto-generated API reference for applyCarbonTable.

Function: applyCarbonTable()

applyCarbonTable(candidates, options?): RouterCandidate[]

Defined in: adapters/src/carbon.ts:99

Decorate a list of router candidates with gCO2PerKtok from a carbon table. Returns a new list β€” does not mutate the input.

const candidates = applyCarbonTable([
  { id: 'openai-eu',   adapter: openai({...}), region: 'swedencentral', cost: 0.6 },
  { id: 'anthropic-us', adapter: anthropic({...}), region: 'us-east-1',   cost: 0.5 },
])

const router = createRouter({ candidates, policy: 'green-cost' })

#Parameters

#candidates

RouterCandidate[]

#options?

ApplyCarbonOptions = \{\}

#Returns

RouterCandidate[]

Explore nearby

✎ Edit this page on GitHubΒ·Found a problem? Open an issue β†’Β·How to contribute β†’

On this page