postIntegrationsOpenrouterWebhook method
Receive OpenRouter Broadcast traces as usage rows
OpenRouter's spend is invisible to every Hanzo money lens because those lenses read hanzo.cloud_usage and OpenRouter meters keys of its own. Point a Broadcast destination (Settings ▸ Observability ▸ Webhook) at this endpoint and each generation span becomes ONE row in that same ledger with provider openrouter, so one query answers what we spend everywhere. Enable the Cost and Identity field categories: cost is the money and identity carries openrouter.api_key_name, which is what says WHICH key spent it — it lands in account as openrouter/
Parameters:
- Map<String, Object> requestBody:
Implementation
Future<Map<String, Object>?> postIntegrationsOpenrouterWebhook({ Map<String, Object>? requestBody, }) async {
final response = await postIntegrationsOpenrouterWebhookWithHttpInfo( requestBody: requestBody, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return Map<String, Object>.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map<String, Object>'),);
}
return null;
}