API Reference
Log In
API Reference

Meter AI Image Operation

Submit image generation/editing metadata for metering and billing purposes.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

AI image operation metadata including image counts, resolution, and image-specific attributes

The AI image operation metadata

string | null

Unique identifier for this specific AI image transaction. Used for deduplication, correlation with request/response pairs, and transaction lookup in Revenium analytics. If not provided, a UUID will be auto-generated. For best practices, generate a UUID in your application before making the AI call and use the same ID when submitting to Revenium. You can use either 'spanId' (recommended) or 'transactionId'.

string | null

Optional trace identifier to group multiple related AI image calls that belong to the same overall user request or workflow. For example, if a single user query triggers multiple AI calls (e.g., generation + variation), use the same traceId for all calls to analyze them together in Revenium's analytics. Leave null for standalone operations.

string
required

The AI model identifier used for this image operation. Should match the exact model name from your AI provider (e.g., 'dall-e-3', 'dall-e-2', 'stable-diffusion-xl'). This is used for cost calculation, performance analytics, and model comparison reporting in Revenium. Valid model names in Revenium for proper cost estimate can be verified using the sources/ai/models endpoint.

string
required

The underlying AI provider/vendor whose model is actually processing the request. This identifies which company's AI model is being used, regardless of how you're accessing it (direct API, proxy, or gateway).

Common values: 'OpenAI' (for DALL-E), 'Stability AI' (for Stable Diffusion), 'Midjourney', 'Adobe'.

Custom values are accepted but may affect analytics categorization. If using Revenium middleware, this is typically auto-populated from the AI provider's API response.

string
required

The timestamp when your application sent the request to the AI provider, in ISO 8601 format with UTC timezone (e.g., '2025-03-02T15:04:05Z'). This is used to calculate request duration and analyze usage patterns over time. Set this to the time immediately before calling the AI provider's API.

string
required

The timestamp when the AI image operation finished, in ISO 8601 format with UTC timezone. This is when the complete response (image URLs or base64 data) was received. Used to calculate total request duration.

int64
required

The total duration of the AI image request in milliseconds, from request start to completion. Calculated as (responseTime - requestTime). This includes network latency, AI processing time, and any mediation/gateway overhead. Used for performance analytics and SLA monitoring.

string | null
enum

The type of operation performed

string | null

Technical classification of the specific image operation. Valid values: 'generation', 'edit', 'variation', 'upscale', 'inpainting'. Invalid values will be rejected with HTTP 400. Recommended for billing routing - missing values are accepted with a warning.

double | null

The total cost in USD for this image operation. Typically leave null to let Revenium automatically calculate the total based on image count, resolution, and current pricing. Only provide a value if you have custom pricing agreements or want to override Revenium's cost calculation. If provided, this will override Revenium's automatic calculation.

string
enum

The type of cost being tracked. Currently always 'AI' for AI image costs. This field is used internally by Revenium to categorize different types of metered usage. You typically do not need to set this field as it defaults to 'AI'.

Allowed:
string | null

The name of the subscriber's organization from your system to allow Revenium to track usage & costs by company. i.e. AcmeCorp. If several subscriberIds have the same organizationName, Revenium's reporting will show usage for the entire organization broken down by subscriberId. This field is used for lookup and auto-creation of organizations in Revenium.

string | null

Unique identifier of the subscription from your own system that you wish to use to correlate usage between Revenium & your application.

string | null

The name of the product from your system that you wish to use to correlate usage between Revenium & your application. This field is used for lookup and auto-creation of products in Revenium.

string | null

The AI agent that is making the request

string | null

Deployment environment where this AI image operation was executed. Used for filtering and analyzing usage patterns across different deployment stages. Common values: 'production', 'staging', 'development', 'test'. Leave null if not tracking by environment.

string | null

Cloud region or geographic location where this AI image operation was processed. Used for analyzing latency patterns, compliance requirements, and regional cost differences. Examples: 'us-east-1', 'eu-west-1', 'ap-southeast-2'. Leave null if not tracking by region.

string | null

Parent transaction ID for hierarchical tracing. When an AI image operation is part of a larger workflow or spawned by another AI call, this field references the parent's spanId/transactionId. Used to build transaction trees and understand call hierarchies in complex multi-step AI workflows. Leave null for root-level transactions. You can use either 'parentSpanId' (recommended) or 'parentTransactionId'.

string | null

Human-readable name for this transaction. Provides context about what this AI image operation is doing in business terms. Examples: 'Generate Product Image', 'Create Marketing Banner', 'Edit Background'. Used in trace visualization for better readability. Falls back to taskType if not provided.

int32 | null

Retry attempt number for this AI image operation. 0 indicates the first attempt (no retry), 1 indicates first retry, 2 indicates second retry, etc. Used for analyzing failure rates and retry patterns. Each retry attempt should be a separate transaction with incrementing retryNumber and the same traceId. Leave null or set to 0 for first attempts.

string | null

Categorical identifier for grouping similar workflows (e.g., 'product_image_generation', 'marketing_assets'). Enables trace-level analytics and anomaly detection within workflow cohorts. Must contain only alphanumeric characters, hyphens, and underscores. Max 128 characters. Defaults to 'uncategorized' if not provided or invalid. All transactions in the same trace must have the same traceType.

string | null

Human-readable label for individual trace instances (e.g., 'Marketing Campaign Q4'). Enables finding specific workflow executions. Can contain any UTF-8 string. Max 256 characters. All transactions in the same trace must have the same traceName.

string | null

Identifier for multi-agent framework team or squad (e.g., ARK, CrewAI). Used to group AI operations by agent team for analytics and cost tracking. Free-form string, max 256 characters.

string | null

Human-readable name for the squad type (e.g., 'Loan Processing', 'Document Analysis'). Used for display in the UI and analytics grouping. If squadId is provided without squadName, squadId will be used as the display name.

string | null

The agent's role within this squad execution (e.g., 'Document Extractor', 'Credit Checker'). Used to identify the purpose of each agent's contribution to the squad workflow.

string | null
^(?!types$|conversion-funnel$)[a-zA-Z0-9][a-zA-Z0-9._-]{0,254}$

Unique identifier for the agentic job instance. Used to correlate all AI operations within a single job execution. Should be unique per job run (e.g., UUID or meaningful ID like 'loan-123-processing').

string | null

Human-readable name for the agentic job. Used for display in the UI and analytics grouping. If agenticJobId is provided without agenticJobName, the ID will be used as the display name.

string | null

Category or type of the agentic job. Normalized to lowercase on ingest to prevent data fragmentation. Used for grouping jobs by type in analytics and ROI calculations.

string | null

Version identifier for the job definition. Used to track job evolution and compare performance across versions.

string | null

Error message or reason if the AI image operation failed. Include this field when the AI provider returns an error (e.g., content policy violation, rate limit exceeded, invalid parameters). Used for error rate analytics and debugging. Leave null for successful operations.

int32 | null

HTTP error code if the operation failed (e.g., 429, 503, 500). Used with billingSkipped to determine no-charge scenarios (e.g., OpenAI flex tier 429 = no charge).

subscriber
string | null

Identifier of the Revenium middleware package or SDK that captured and submitted this AI image metadata. This field is AUTOMATICALLY SET by Revenium's middleware packages (e.g., 'revenium-openai-python', 'revenium-stability-node'). You typically should NOT manually set this field. It is used for analytics to track which integration methods are being used and for debugging middleware-specific issues.

string | null

The routing or aggregation layer used to access the AI model. This identifies whether you're calling the AI provider directly or through an intermediary service.

Common values: 'DIRECT', 'LITELLM', 'OPENROUTER', 'PORTKEY', or provider names when calling directly.

Custom values are accepted for specialized routing layers or gateways. This field is used for integration tracking and analytics.

string | null

Optional category to group related AI tasks for cost and performance analysis. Use consistent values to compare metrics across different models or vendors performing the same type of work. Examples: 'image-generation', 'product-photos', 'marketing-assets', 'avatar-creation'. This is freeform text - choose values that match your use cases.

int32 | null

Number of images requested in the API call.

int32
required

Number of images actually generated/returned. Required for all image operations.

string | null

Image resolution (e.g., '1024x1024', '1792x1024', '512x512').

string | null

Image quality setting (e.g., 'standard', 'hd'). HD typically costs 2x standard.

string | null

Image style for DALL-E 3 (e.g., 'vivid', 'natural'). Does not affect pricing.

string | null

Output format for the generated image (e.g., 'url', 'b64_json'). Does not affect pricing. Used for analytics only.

boolean | null

Whether a source image was provided for this operation. True for edit/variation/inpaint operations, false for pure generation. Used to distinguish generation from modification operations in analytics.

string | null

Links this operation to a source transaction (e.g., variation links to original generation). Used for lineage tracking in analytics.

boolean | null

Whether DALL-E 3 revised the original prompt. DALL-E 3 automatically rewrites prompts for safety and quality. Used for analytics only.

string | null

Input prompts/messages for this image generation. JSON-serialized array of messages in the same format as the LLM endpoint. Used for prompt analytics and cost attribution.

string | null

Output response content or metadata (e.g., generated image URLs, dimensions). Used for analytics and audit trail.

boolean | null

Indicates if prompts were truncated due to size limits.

string
enum

How this operation should be billed. For images this is always PER_IMAGE. Routes cost calculation in backend.

Allowed:
boolean | null

If true, backend returns $0 cost. Set for free tier, rate-limited requests (429 on flex), or other no-charge scenarios.

string | null
enum

Reason why billing was skipped.

Allowed:
string | null
enum

Pricing tier for batch discounts. BATCH = 50% discount, STANDARD = normal pricing.

Allowed:
string | null

Service tier requested by user (e.g., 'priority', 'default', 'flex').

string | null

Actual service tier used for billing. May differ from requested if downgraded. Backend uses this for cost calculation.

string | null

Google priority tier for Vertex AI pricing. 'best_effort' = -30%, 'on_demand' = base rate, 'committed' = -20%. Only applies to Google providers.

Headers
string
length between 1 and 255
^[!-~]+$

Optional Stripe-style retry-safety key. If present, the response (status + body) is cached keyed by (tenant, key). Identical retries replay the cached response; body mismatch returns 409 idempotency_key_mismatch; a concurrent in-flight call returns 409 idempotency_key_in_progress with Retry-After: 1. Must be 1-255 printable ASCII characters; UUID v4 recommended. See https://docs.revenium.io/integrations/idempotency for full behavior.

string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
*/*