revenium-python-sdk 0.10.1__tar.gz → 0.12.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {revenium_python_sdk-0.10.1/revenium_python_sdk.egg-info → revenium_python_sdk-0.12.0}/PKG-INFO +43 -5
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/README.md +41 -3
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/pyproject.toml +7 -2
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/__init__.py +2 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/enforcement.py +304 -46
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/fields.py +14 -7
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/wire_guards.py +20 -1
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/resources/ai.py +25 -4
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/ai_create_completion_params.py +8 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/proxy/guardrail.py +57 -13
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/proxy/middleware.py +15 -1
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0/revenium_python_sdk.egg-info}/PKG-INFO +43 -5
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_python_sdk.egg-info/requires.txt +1 -1
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/LICENSE +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/cache_tokens.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/call_context.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/call_ownership.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/closable_scope.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/config.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/context.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/decorators.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/delivery_circuit.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/error_text.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/exceptions.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/failed_calls.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/json_safe.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/langchain_settings.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/load_diagnostics.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/log_sanitize.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/metering.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/metering_buffer.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/metering_pool.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/metering_status.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/metering_submission.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/outcomes.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/package_versions.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/parse_failures.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/patch_registry.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/perplexity_cost.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/perplexity_usage_metadata.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/prompt_extraction.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/responses_status.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/secret_shapes.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/selective_metering.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/shutdown_signals.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/sse_body_tap.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/subscriber.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/tool_event_transport.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/usage_iterations.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/vendor_model_aliases.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/LICENSE +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_base_client.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_client.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_compat.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_constants.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_exceptions.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_files.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_models.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_qs.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_resource.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_response.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_streaming.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_types.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_logs.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_proxy.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_reflection.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_resources_proxy.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_streams.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_sync.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_transform.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_typing.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_utils/_utils.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/_version.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/context.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/decorator.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/py.typed +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/resources/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/resources/apis.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/resources/events.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/ai_create_audio_params.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/ai_create_image_params.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/ai_create_video_params.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/api_meter_request_params.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/api_meter_response_params.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/event_create_params.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_metering/types/metering_response_resource.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/agentic_outcomes.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/bedrock_adapter.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/bedrock_model_names.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/bedrock_transport.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/config.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/inference_profiles.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/prompt_extractor.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/provider.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/raw_response.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/stream_create.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/anthropic/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/fal/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/fal/_call.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/fal/_metering.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/fal/_queue.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/fal/config.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/fal/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/fal/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/common/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/common/exceptions.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/common/protocols.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/common/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/common/types.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/common/utils.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/config.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/google_ai/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/google_ai/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/google_ai/provider.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/prompt_extractor.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/vertex_ai/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/vertex_ai/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/google/vertex_ai/provider.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/_metadata.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/_retry.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/anthropic_driver.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/budget_errors.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/litellm_driver.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/ollama_driver.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/openai_driver.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/openai_embedding_driver.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/griptape/universal_driver.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/job_context.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/job_history.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/job_type_economics.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/config.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/context.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/decorators.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/hooks.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/integrations/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/integrations/crewai.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/client/validation.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/proxy/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/litellm/proxy/_metering_owner.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/ollama/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/ollama/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/ollama/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/audio.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/azure_config.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/azure_model_resolver.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/config.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/exceptions.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/_abandoned_runs.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/_model_call.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/_perplexity_cost_capture.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/_prompt_capture.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/_text_completion_usage.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/_utils.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/langchain/unified_handler.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/prompt_extractor.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/provider.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/raw_response.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/openai/xai_usage.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/_metering_scope.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/middleware.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/patching.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/perplexity_sdk.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/provider.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/raw_response.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/streaming.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/perplexity/trace_fields.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/webhooks/__init__.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/webhooks/_verify.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_python_sdk.egg-info/SOURCES.txt +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_python_sdk.egg-info/dependency_links.txt +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_python_sdk.egg-info/top_level.txt +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/setup.cfg +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/tests/test_metering.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/tests/test_metering_dispatch_timestamps.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/tests/test_patch_coverage.py +0 -0
- {revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/tests/test_release_verify_ticket.py +0 -0
{revenium_python_sdk-0.10.1/revenium_python_sdk.egg-info → revenium_python_sdk-0.12.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: revenium-python-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: The official Revenium Python SDK — unified AI metering middleware for OpenAI, Anthropic, Google, Ollama, LiteLLM, Perplexity, and fal.ai.
|
|
5
5
|
Author-email: Revenium <support@revenium.io>
|
|
6
6
|
License: MIT
|
|
@@ -105,7 +105,7 @@ Requires-Dist: langchain-perplexity; python_version >= "3.10" and extra == "dev"
|
|
|
105
105
|
Requires-Dist: langchain-cohere; python_version >= "3.10" and extra == "dev"
|
|
106
106
|
Requires-Dist: langchain-huggingface; python_version >= "3.10" and extra == "dev"
|
|
107
107
|
Requires-Dist: openai>=1.0.0; extra == "dev"
|
|
108
|
-
Requires-Dist: litellm
|
|
108
|
+
Requires-Dist: litellm<1.106,>=1.40.0; extra == "dev"
|
|
109
109
|
Requires-Dist: fal-client>=0.13.0; extra == "dev"
|
|
110
110
|
Requires-Dist: perplexityai>=0.1.0; extra == "dev"
|
|
111
111
|
Requires-Dist: google-genai>=0.1.0; extra == "dev"
|
|
@@ -192,12 +192,12 @@ Some billable provider calls are not metered at all: see [Calls the SDK does not
|
|
|
192
192
|
The calls below are billed by the provider (some, such as batch and fine-tuning jobs, when the job runs rather than when you call them), but the SDK records no usage for them: nothing reaches Revenium and nothing is logged. On every build a test compares this list with the SDK's inventory of the public calls of the OpenAI, Anthropic, Perplexity, Gemini, Ollama, LiteLLM and fal clients, boto3's Bedrock Runtime client, and the Vertex AI model, session, batch prediction, tuning and context-cache classes, on the provider versions the SDK is tested on. Calls reached another way, for example LangChain classes that call their own vendor SDK, are outside that check, except LangChain embeddings, listed by hand below; wrapping one with `wrap()` logs a warning. Sync and async forms are folded into one name, and the `with_raw_response` and `with_streaming_response` forms of a listed call are not metered either. To record any of these calls, wrap it with `@meter_tool` (see [Tool Metering](#tool-metering)).
|
|
193
193
|
|
|
194
194
|
<!-- not-metered:start -->
|
|
195
|
-
- **OpenAI** (`OpenAI` and `AsyncOpenAI` clients): `batches.create`, `beta.agents.sessions.create`, `beta.agents.sessions.events.create`, `beta.agents.sessions.events.stream`, `beta.agents.sessions.stream`, `beta.agents.sessions.update`, `beta.chatkit.sessions.create`, `beta.realtime.connect`, `beta.responses.compact`, `beta.responses.connect`, `beta.responses.create`, `beta.threads.create_and_run`, `beta.threads.create_and_run_poll`, `beta.threads.create_and_run_stream`, `beta.threads.runs.create`, `beta.threads.runs.create_and_poll`, `beta.threads.runs.create_and_stream`, `beta.threads.runs.stream`, `beta.threads.runs.submit_tool_outputs`, `beta.threads.runs.submit_tool_outputs_and_poll`, `beta.threads.runs.submit_tool_outputs_stream`, `completions.create`, `decisions.create`, `evals.runs.create`, `fine_tuning.alpha.graders.run`, `fine_tuning.jobs.create`, `images.create_variation`, `images.edit`, `images.generate`, `live.connect`, `live.create`, `live.forks.connect`, `live.sessions.accept`, `live.sessions.fork`, `live.sideband.connect`, `realtime.calls.accept`, `realtime.calls.create`, `realtime.connect`, `responses.compact`, `responses.connect`, `videos.create`, `videos.create_and_poll`, `videos.create_character`, `videos.edit`, `videos.extend`, `videos.remix`
|
|
195
|
+
- **OpenAI** (`OpenAI` and `AsyncOpenAI` clients): `batches.create`, `beta.agents.sessions.create`, `beta.agents.sessions.events.create`, `beta.agents.sessions.events.stream`, `beta.agents.sessions.stream`, `beta.agents.sessions.update`, `beta.chatkit.sessions.create`, `beta.realtime.connect`, `beta.responses.compact`, `beta.responses.connect`, `beta.responses.create`, `beta.threads.create_and_run`, `beta.threads.create_and_run_poll`, `beta.threads.create_and_run_stream`, `beta.threads.runs.create`, `beta.threads.runs.create_and_poll`, `beta.threads.runs.create_and_stream`, `beta.threads.runs.stream`, `beta.threads.runs.submit_tool_outputs`, `beta.threads.runs.submit_tool_outputs_and_poll`, `beta.threads.runs.submit_tool_outputs_stream`, `completions.create`, `decisions.create`, `evals.runs.create`, `fine_tuning.alpha.graders.run`, `fine_tuning.jobs.create`, `images.create_variation`, `images.edit`, `images.generate`, `live.connect`, `live.create`, `live.forks.connect`, `live.sessions.accept`, `live.sessions.fork`, `live.sideband.connect`, `realtime.calls.accept`, `realtime.calls.create`, `realtime.connect`, `realtime.translations.connect`, `responses.compact`, `responses.connect`, `videos.create`, `videos.create_and_poll`, `videos.create_character`, `videos.edit`, `videos.extend`, `videos.remix`
|
|
196
196
|
- **Anthropic** (`Anthropic` and `AsyncAnthropic` clients): `beta.deployments.run`, `beta.dreams.create`, `beta.environments.work.poller`, `beta.environments.work.worker`, `beta.messages.batches.create`, `beta.sessions.create`, `beta.sessions.events.send`, `beta.sessions.events.stream`, `beta.sessions.events.tool_runner`, `beta.sessions.threads.events.stream`, `messages.batches.create`
|
|
197
197
|
- **Google Gemini** (`google.genai` `Client` and `Client.aio`): `batches.create`, `batches.create_embeddings`, `caches.create`, `caches.update`, `file_search_stores.import_file`, `file_search_stores.upload_to_file_search_store`, `interactions.create`, `live.connect`, `live.music.connect`, `models.edit_image`, `models.recontext_image`, `models.segment_image`, `models.upscale_image`, `triggers.run`, `tunings.tune`
|
|
198
198
|
- **Google Vertex AI** (`vertexai` classes): `batch_prediction.BatchPredictionJob.submit`, `caching.CachedContent.create`, `caching.CachedContent.update`, `language_models.ChatModel.tune_model`, `language_models.ChatModel.tune_model_rlhf`, `language_models.ChatSession.send_message`, `language_models.ChatSession.send_message_async`, `language_models.ChatSession.send_message_streaming`, `language_models.ChatSession.send_message_streaming_async`, `language_models.CodeChatModel.tune_model`, `language_models.CodeChatSession.send_message`, `language_models.CodeChatSession.send_message_async`, `language_models.CodeChatSession.send_message_streaming`, `language_models.CodeChatSession.send_message_streaming_async`, `language_models.CodeGenerationModel.batch_predict`, `language_models.CodeGenerationModel.predict`, `language_models.CodeGenerationModel.predict_async`, `language_models.CodeGenerationModel.predict_streaming`, `language_models.CodeGenerationModel.predict_streaming_async`, `language_models.CodeGenerationModel.tune_model`, `language_models.TextEmbeddingModel.batch_predict`, `language_models.TextEmbeddingModel.deploy_tuned_model`, `language_models.TextEmbeddingModel.tune_model`, `language_models.TextGenerationModel.batch_predict`, `language_models.TextGenerationModel.predict`, `language_models.TextGenerationModel.predict_async`, `language_models.TextGenerationModel.predict_streaming`, `language_models.TextGenerationModel.predict_streaming_async`, `language_models.TextGenerationModel.tune_model`, `language_models.TextGenerationModel.tune_model_rlhf`, `preview.caching.CachedContent.create`, `preview.caching.CachedContent.update`, `preview.vision_models.ImageCaptioningModel.get_captions`, `preview.vision_models.ImageGenerationModel.upscale_image`, `preview.vision_models.ImageQnAModel.ask_question`, `preview.vision_models.ImageSegmentationModel.segment_image`, `preview.vision_models.ImageTextModel.ask_question`, `preview.vision_models.ImageTextModel.get_captions`, `preview.vision_models.MultiModalEmbeddingModel.get_embeddings`, `preview.vision_models.WatermarkVerificationModel.verify_image`, `tuning.sft.train`, `vision_models.ImageCaptioningModel.get_captions`, `vision_models.ImageGenerationModel.upscale_image`, `vision_models.ImageQnAModel.ask_question`, `vision_models.ImageTextModel.ask_question`, `vision_models.ImageTextModel.get_captions`, `vision_models.MultiModalEmbeddingModel.get_embeddings`
|
|
199
199
|
- **AWS Bedrock** (boto3 bedrock-runtime client; Claude models are metered when REVENIUM_BEDROCK_TRANSPORT is on): `apply_guardrail`, `converse`, `converse_stream`, `invoke_guardrail_checks`, `invoke_model`, `invoke_model_with_response_stream`, `start_async_invoke`
|
|
200
|
-
- **Perplexity** (`Perplexity` and `AsyncPerplexity` clients): `async_.chat.completions.create`, `browser.sessions.create`, `contextualized_embeddings.create`, `embeddings.create`, `responses.create`, `search.create`
|
|
200
|
+
- **Perplexity** (`Perplexity` and `AsyncPerplexity` clients): `async_.chat.completions.create`, `batches.create`, `browser.sessions.create`, `contextualized_embeddings.create`, `decisions.create`, `embeddings.create`, `responses.create`, `search.create`
|
|
201
201
|
- **LiteLLM** (the `litellm` module): `aadapter_completion`, `aadapter_generate_content`, `acode_interpreter_tool`, `acompact_responses`, `acreate_batch`, `acreate_fine_tuning_job`, `acreate_run`, `acreate_sandbox`, `adapter_completion`, `adecisions`, `agenerate_content`, `aimage_edit`, `aimage_generation`, `aimage_variation`, `aingest`, `anthropic_interface.messages.acreate`, `anthropic_interface.messages.create`, `anthropic_messages`, `anthropic_messages_handler`, `aocr`, `aquery`, `arealtime_calls`, `arerank`, `aresponses`, `aresponses_api_with_mcp`, `aresponses_with_retries`, `arun_code`, `arun_thread`, `arun_thread_stream`, `asearch`, `aspeech`, `asystemone`, `atranscription`, `avideo_create_character`, `avideo_edit`, `avideo_extension`, `avideo_generation`, `avideo_remix`, `compact_responses`, `config_completion`, `create_batch`, `create_fine_tuning_job`, `create_run`, `decisions`, `image_edit`, `image_generation`, `image_variation`, `ingest`, `nlp_cloud_chat_completion`, `ocr`, `query`, `replicate_chat_completion`, `rerank`, `responses`, `responses_with_retries`, `run_thread`, `run_thread_stream`, `search`, `speech`, `systemone`, `transcription`, `video_create_character`, `video_edit`, `video_extension`, `video_generation`, `video_remix`
|
|
202
202
|
- **Ollama** (`Client`, `AsyncClient` and the `ollama` module): `systemone`, `web_fetch`, `web_search`
|
|
203
203
|
- **fal.ai** (`SyncClient`, `AsyncClient` and the `fal_client` module): `realtime`, `realtime_async`, `ws_connect`, `ws_connect_async`
|
|
@@ -1209,6 +1209,17 @@ used, because it would make each call a trace of its own, and neither is a sessi
|
|
|
1209
1209
|
id LiteLLM minted itself under its `missing_session_id: generate` policy. The
|
|
1210
1210
|
deprecated callback reads only `x-revenium-trace-id` and `x-claude-code-session-id`.
|
|
1211
1211
|
|
|
1212
|
+
**Trace name.** The guardrail takes a record's trace name from
|
|
1213
|
+
`x-revenium-trace-name`. Without that header it takes the trace name the caller
|
|
1214
|
+
gave LiteLLM, `metadata.trace_name` in the request body (`litellm_metadata.trace_name`
|
|
1215
|
+
on `/v1/messages`), the same field LiteLLM passes to its own logging integrations.
|
|
1216
|
+
Failing both, it uses the gateway's `REVENIUM_TRACE_NAME`, and failing that, the
|
|
1217
|
+
LiteLLM session id that became the trace id (see above), so a session the caller
|
|
1218
|
+
did not title is still named. A call that sends its own `x-revenium-trace-id` is
|
|
1219
|
+
never named after its LiteLLM session. A name over 256 characters is cut to 256. A call
|
|
1220
|
+
with no LiteLLM session and no name has no trace name. The deprecated callback
|
|
1221
|
+
reads only the header and `REVENIUM_TRACE_NAME`.
|
|
1222
|
+
|
|
1212
1223
|
**Organization caps and the organization header.** By default the
|
|
1213
1224
|
`x-revenium-organization-name` header (and the retired `x-revenium-organization-id`)
|
|
1214
1225
|
wins over the calling virtual key's team alias, for the budget check and the record
|
|
@@ -1793,6 +1804,7 @@ characters, and `product_name` at 224. Other text fields are sent as given.
|
|
|
1793
1804
|
| `agent` | AI agent or bot identifier | Distinguish between multiple AI agents or automation workflows |
|
|
1794
1805
|
| `response_quality_score` | Custom quality rating (0.0-1.0) | Track user satisfaction or automated quality metrics for model performance analysis |
|
|
1795
1806
|
| `effort` | Reasoning effort level requested of the model (free-form string, max 16 chars, `^[A-Za-z0-9_-]+$`) | Report what share of AI spend is high-effort reasoning, and compare cost per effort level |
|
|
1807
|
+
| `entrypoint` | How the coding assistant that made the call was launched, such as `cli`, `sdk-py` or `claude-vscode` (completions only, 1 to 64 chars, `^[A-Za-z0-9._-]+$`) | Split coding-assistant spend between the terminal, the SDKs and the editor or chat integrations |
|
|
1796
1808
|
|
|
1797
1809
|
**Example:**
|
|
1798
1810
|
|
|
@@ -1827,7 +1839,7 @@ string, not an enum -- vendor vocabularies differ and drift, so `low`, `medium`,
|
|
|
1827
1839
|
`high`, `xhigh` and `ultra` are all real values, and a level this SDK release has
|
|
1828
1840
|
never heard of is passed through untouched rather than rejected or rewritten. The
|
|
1829
1841
|
Revenium backend rule is at most 16 characters, matching `^[A-Za-z0-9_-]+$`; a
|
|
1830
|
-
value outside it is left off the record with a WARNING, and the call is still
|
|
1842
|
+
value outside it, an empty one included, is left off the record with a WARNING, and the call is still
|
|
1831
1843
|
recorded with its tokens and cost. It is distinct from the reported reasoning token count,
|
|
1832
1844
|
which measures the tokens actually spent rather than the level requested.
|
|
1833
1845
|
|
|
@@ -1835,6 +1847,15 @@ Set it per call in `usage_metadata` on any provider integration. In LiteLLM prox
|
|
|
1835
1847
|
mode, where per-call attribution travels as request headers rather than
|
|
1836
1848
|
`usage_metadata`, send `x-revenium-effort` instead.
|
|
1837
1849
|
|
|
1850
|
+
**Coding-assistant entrypoint:** `entrypoint` records how the coding assistant
|
|
1851
|
+
that made a completion was launched. Claude Code sends `cli`, `sdk-cli`,
|
|
1852
|
+
`sdk-ts`, `sdk-py`, `claude-vscode` or `claude-in-slack`; any other value of
|
|
1853
|
+
the same shape is sent as given, not rewritten. A value that is empty, longer
|
|
1854
|
+
than 64 characters or holds anything but letters, digits, dots, hyphens and
|
|
1855
|
+
underscores is left off the record with a WARNING, and the call is still
|
|
1856
|
+
recorded. It is sent on completions only; image, video and audio calls ignore
|
|
1857
|
+
it, and the LiteLLM proxy does not read it.
|
|
1858
|
+
|
|
1838
1859
|
**Deprecation notice:** The legacy field aliases `organizationId`, `organization_id`, `productId`, and `product_id` are accepted by this SDK only as an input-layer convenience and emit a `DeprecationWarning`. The Revenium backend no longer accepts them — they are translated to `organizationName` / `productName` before the wire call. Migrate to `organization_name` / `organizationName` and `product_name` / `productName` now; the input-layer aliases will be removed in the next major release.
|
|
1839
1860
|
|
|
1840
1861
|
**API Reference:** [Complete metadata field documentation](https://revenium.readme.io/reference/meter_ai_completion)
|
|
@@ -2357,6 +2378,23 @@ if roster:
|
|
|
2357
2378
|
|
|
2358
2379
|
`fetch_enforcement_rule_roster` takes `page`, `size`, `search` and `band` (`BLOCKED`, `WARNED`, `UNDER`, `ALL`); the server does the filtering, sorting, banding and paging, and the three band counts always describe the whole roster rather than the page you asked for. Both calls return `None` rather than raising when the team has no such compiled rule, the rule has no reading yet, or the enforcement API cannot be reached — the same fail-open posture as the rest of the circuit breaker. An empty `rule_id` raises `ValueError`.
|
|
2359
2380
|
|
|
2381
|
+
### Reading Advisory Budgets
|
|
2382
|
+
|
|
2383
|
+
Notify-only per-person budgets (alerts) never block a call, so the cost-limit cache does not carry them. `fetch_advisory_budgets()` reads them on demand, like the two calls above: it sends `include=advisory` on the team-wide enforcement read, which the API serves from 2.25.0, and returns only the advisory rows.
|
|
2384
|
+
|
|
2385
|
+
```python
|
|
2386
|
+
from revenium_middleware._core import fetch_advisory_budgets
|
|
2387
|
+
|
|
2388
|
+
budgets = fetch_advisory_budgets() # list of advisory rows, [] if none, None on failure
|
|
2389
|
+
|
|
2390
|
+
for budget in budgets or []:
|
|
2391
|
+
print(f"{budget['name']} (reading at {budget.get('readingAt')})")
|
|
2392
|
+
for person in budget.get("groupBreakdown") or []:
|
|
2393
|
+
print(f" {person['groupValue']}: ${person['currentValue']}")
|
|
2394
|
+
```
|
|
2395
|
+
|
|
2396
|
+
Each row has `source` `ANOMALY` and `action` `NOTIFY`, groups by `SUBSCRIBER` with a per-person `groupBreakdown`, and carries `readingAt` when the current window has a reading. The call returns `[]` when the team has no advisory budgets and `None` when the enforcement API cannot be reached.
|
|
2397
|
+
|
|
2360
2398
|
The background poller is unaffected: it keeps reading the **whole team's** rules every `REVENIUM_CB_POLL_INTERVAL_SECONDS`. That is deliberate. The server computes the department-budget maps team-wide and attaches them to the team-wide read, so a poll narrowed to a single rule would stop receiving them and department budgets would quietly stop blocking anyone. Narrowing is an explicit, opt-in inspection call and never the refresh.
|
|
2361
2399
|
|
|
2362
2400
|
### End-to-End Example
|
|
@@ -76,12 +76,12 @@ Some billable provider calls are not metered at all: see [Calls the SDK does not
|
|
|
76
76
|
The calls below are billed by the provider (some, such as batch and fine-tuning jobs, when the job runs rather than when you call them), but the SDK records no usage for them: nothing reaches Revenium and nothing is logged. On every build a test compares this list with the SDK's inventory of the public calls of the OpenAI, Anthropic, Perplexity, Gemini, Ollama, LiteLLM and fal clients, boto3's Bedrock Runtime client, and the Vertex AI model, session, batch prediction, tuning and context-cache classes, on the provider versions the SDK is tested on. Calls reached another way, for example LangChain classes that call their own vendor SDK, are outside that check, except LangChain embeddings, listed by hand below; wrapping one with `wrap()` logs a warning. Sync and async forms are folded into one name, and the `with_raw_response` and `with_streaming_response` forms of a listed call are not metered either. To record any of these calls, wrap it with `@meter_tool` (see [Tool Metering](#tool-metering)).
|
|
77
77
|
|
|
78
78
|
<!-- not-metered:start -->
|
|
79
|
-
- **OpenAI** (`OpenAI` and `AsyncOpenAI` clients): `batches.create`, `beta.agents.sessions.create`, `beta.agents.sessions.events.create`, `beta.agents.sessions.events.stream`, `beta.agents.sessions.stream`, `beta.agents.sessions.update`, `beta.chatkit.sessions.create`, `beta.realtime.connect`, `beta.responses.compact`, `beta.responses.connect`, `beta.responses.create`, `beta.threads.create_and_run`, `beta.threads.create_and_run_poll`, `beta.threads.create_and_run_stream`, `beta.threads.runs.create`, `beta.threads.runs.create_and_poll`, `beta.threads.runs.create_and_stream`, `beta.threads.runs.stream`, `beta.threads.runs.submit_tool_outputs`, `beta.threads.runs.submit_tool_outputs_and_poll`, `beta.threads.runs.submit_tool_outputs_stream`, `completions.create`, `decisions.create`, `evals.runs.create`, `fine_tuning.alpha.graders.run`, `fine_tuning.jobs.create`, `images.create_variation`, `images.edit`, `images.generate`, `live.connect`, `live.create`, `live.forks.connect`, `live.sessions.accept`, `live.sessions.fork`, `live.sideband.connect`, `realtime.calls.accept`, `realtime.calls.create`, `realtime.connect`, `responses.compact`, `responses.connect`, `videos.create`, `videos.create_and_poll`, `videos.create_character`, `videos.edit`, `videos.extend`, `videos.remix`
|
|
79
|
+
- **OpenAI** (`OpenAI` and `AsyncOpenAI` clients): `batches.create`, `beta.agents.sessions.create`, `beta.agents.sessions.events.create`, `beta.agents.sessions.events.stream`, `beta.agents.sessions.stream`, `beta.agents.sessions.update`, `beta.chatkit.sessions.create`, `beta.realtime.connect`, `beta.responses.compact`, `beta.responses.connect`, `beta.responses.create`, `beta.threads.create_and_run`, `beta.threads.create_and_run_poll`, `beta.threads.create_and_run_stream`, `beta.threads.runs.create`, `beta.threads.runs.create_and_poll`, `beta.threads.runs.create_and_stream`, `beta.threads.runs.stream`, `beta.threads.runs.submit_tool_outputs`, `beta.threads.runs.submit_tool_outputs_and_poll`, `beta.threads.runs.submit_tool_outputs_stream`, `completions.create`, `decisions.create`, `evals.runs.create`, `fine_tuning.alpha.graders.run`, `fine_tuning.jobs.create`, `images.create_variation`, `images.edit`, `images.generate`, `live.connect`, `live.create`, `live.forks.connect`, `live.sessions.accept`, `live.sessions.fork`, `live.sideband.connect`, `realtime.calls.accept`, `realtime.calls.create`, `realtime.connect`, `realtime.translations.connect`, `responses.compact`, `responses.connect`, `videos.create`, `videos.create_and_poll`, `videos.create_character`, `videos.edit`, `videos.extend`, `videos.remix`
|
|
80
80
|
- **Anthropic** (`Anthropic` and `AsyncAnthropic` clients): `beta.deployments.run`, `beta.dreams.create`, `beta.environments.work.poller`, `beta.environments.work.worker`, `beta.messages.batches.create`, `beta.sessions.create`, `beta.sessions.events.send`, `beta.sessions.events.stream`, `beta.sessions.events.tool_runner`, `beta.sessions.threads.events.stream`, `messages.batches.create`
|
|
81
81
|
- **Google Gemini** (`google.genai` `Client` and `Client.aio`): `batches.create`, `batches.create_embeddings`, `caches.create`, `caches.update`, `file_search_stores.import_file`, `file_search_stores.upload_to_file_search_store`, `interactions.create`, `live.connect`, `live.music.connect`, `models.edit_image`, `models.recontext_image`, `models.segment_image`, `models.upscale_image`, `triggers.run`, `tunings.tune`
|
|
82
82
|
- **Google Vertex AI** (`vertexai` classes): `batch_prediction.BatchPredictionJob.submit`, `caching.CachedContent.create`, `caching.CachedContent.update`, `language_models.ChatModel.tune_model`, `language_models.ChatModel.tune_model_rlhf`, `language_models.ChatSession.send_message`, `language_models.ChatSession.send_message_async`, `language_models.ChatSession.send_message_streaming`, `language_models.ChatSession.send_message_streaming_async`, `language_models.CodeChatModel.tune_model`, `language_models.CodeChatSession.send_message`, `language_models.CodeChatSession.send_message_async`, `language_models.CodeChatSession.send_message_streaming`, `language_models.CodeChatSession.send_message_streaming_async`, `language_models.CodeGenerationModel.batch_predict`, `language_models.CodeGenerationModel.predict`, `language_models.CodeGenerationModel.predict_async`, `language_models.CodeGenerationModel.predict_streaming`, `language_models.CodeGenerationModel.predict_streaming_async`, `language_models.CodeGenerationModel.tune_model`, `language_models.TextEmbeddingModel.batch_predict`, `language_models.TextEmbeddingModel.deploy_tuned_model`, `language_models.TextEmbeddingModel.tune_model`, `language_models.TextGenerationModel.batch_predict`, `language_models.TextGenerationModel.predict`, `language_models.TextGenerationModel.predict_async`, `language_models.TextGenerationModel.predict_streaming`, `language_models.TextGenerationModel.predict_streaming_async`, `language_models.TextGenerationModel.tune_model`, `language_models.TextGenerationModel.tune_model_rlhf`, `preview.caching.CachedContent.create`, `preview.caching.CachedContent.update`, `preview.vision_models.ImageCaptioningModel.get_captions`, `preview.vision_models.ImageGenerationModel.upscale_image`, `preview.vision_models.ImageQnAModel.ask_question`, `preview.vision_models.ImageSegmentationModel.segment_image`, `preview.vision_models.ImageTextModel.ask_question`, `preview.vision_models.ImageTextModel.get_captions`, `preview.vision_models.MultiModalEmbeddingModel.get_embeddings`, `preview.vision_models.WatermarkVerificationModel.verify_image`, `tuning.sft.train`, `vision_models.ImageCaptioningModel.get_captions`, `vision_models.ImageGenerationModel.upscale_image`, `vision_models.ImageQnAModel.ask_question`, `vision_models.ImageTextModel.ask_question`, `vision_models.ImageTextModel.get_captions`, `vision_models.MultiModalEmbeddingModel.get_embeddings`
|
|
83
83
|
- **AWS Bedrock** (boto3 bedrock-runtime client; Claude models are metered when REVENIUM_BEDROCK_TRANSPORT is on): `apply_guardrail`, `converse`, `converse_stream`, `invoke_guardrail_checks`, `invoke_model`, `invoke_model_with_response_stream`, `start_async_invoke`
|
|
84
|
-
- **Perplexity** (`Perplexity` and `AsyncPerplexity` clients): `async_.chat.completions.create`, `browser.sessions.create`, `contextualized_embeddings.create`, `embeddings.create`, `responses.create`, `search.create`
|
|
84
|
+
- **Perplexity** (`Perplexity` and `AsyncPerplexity` clients): `async_.chat.completions.create`, `batches.create`, `browser.sessions.create`, `contextualized_embeddings.create`, `decisions.create`, `embeddings.create`, `responses.create`, `search.create`
|
|
85
85
|
- **LiteLLM** (the `litellm` module): `aadapter_completion`, `aadapter_generate_content`, `acode_interpreter_tool`, `acompact_responses`, `acreate_batch`, `acreate_fine_tuning_job`, `acreate_run`, `acreate_sandbox`, `adapter_completion`, `adecisions`, `agenerate_content`, `aimage_edit`, `aimage_generation`, `aimage_variation`, `aingest`, `anthropic_interface.messages.acreate`, `anthropic_interface.messages.create`, `anthropic_messages`, `anthropic_messages_handler`, `aocr`, `aquery`, `arealtime_calls`, `arerank`, `aresponses`, `aresponses_api_with_mcp`, `aresponses_with_retries`, `arun_code`, `arun_thread`, `arun_thread_stream`, `asearch`, `aspeech`, `asystemone`, `atranscription`, `avideo_create_character`, `avideo_edit`, `avideo_extension`, `avideo_generation`, `avideo_remix`, `compact_responses`, `config_completion`, `create_batch`, `create_fine_tuning_job`, `create_run`, `decisions`, `image_edit`, `image_generation`, `image_variation`, `ingest`, `nlp_cloud_chat_completion`, `ocr`, `query`, `replicate_chat_completion`, `rerank`, `responses`, `responses_with_retries`, `run_thread`, `run_thread_stream`, `search`, `speech`, `systemone`, `transcription`, `video_create_character`, `video_edit`, `video_extension`, `video_generation`, `video_remix`
|
|
86
86
|
- **Ollama** (`Client`, `AsyncClient` and the `ollama` module): `systemone`, `web_fetch`, `web_search`
|
|
87
87
|
- **fal.ai** (`SyncClient`, `AsyncClient` and the `fal_client` module): `realtime`, `realtime_async`, `ws_connect`, `ws_connect_async`
|
|
@@ -1093,6 +1093,17 @@ used, because it would make each call a trace of its own, and neither is a sessi
|
|
|
1093
1093
|
id LiteLLM minted itself under its `missing_session_id: generate` policy. The
|
|
1094
1094
|
deprecated callback reads only `x-revenium-trace-id` and `x-claude-code-session-id`.
|
|
1095
1095
|
|
|
1096
|
+
**Trace name.** The guardrail takes a record's trace name from
|
|
1097
|
+
`x-revenium-trace-name`. Without that header it takes the trace name the caller
|
|
1098
|
+
gave LiteLLM, `metadata.trace_name` in the request body (`litellm_metadata.trace_name`
|
|
1099
|
+
on `/v1/messages`), the same field LiteLLM passes to its own logging integrations.
|
|
1100
|
+
Failing both, it uses the gateway's `REVENIUM_TRACE_NAME`, and failing that, the
|
|
1101
|
+
LiteLLM session id that became the trace id (see above), so a session the caller
|
|
1102
|
+
did not title is still named. A call that sends its own `x-revenium-trace-id` is
|
|
1103
|
+
never named after its LiteLLM session. A name over 256 characters is cut to 256. A call
|
|
1104
|
+
with no LiteLLM session and no name has no trace name. The deprecated callback
|
|
1105
|
+
reads only the header and `REVENIUM_TRACE_NAME`.
|
|
1106
|
+
|
|
1096
1107
|
**Organization caps and the organization header.** By default the
|
|
1097
1108
|
`x-revenium-organization-name` header (and the retired `x-revenium-organization-id`)
|
|
1098
1109
|
wins over the calling virtual key's team alias, for the budget check and the record
|
|
@@ -1677,6 +1688,7 @@ characters, and `product_name` at 224. Other text fields are sent as given.
|
|
|
1677
1688
|
| `agent` | AI agent or bot identifier | Distinguish between multiple AI agents or automation workflows |
|
|
1678
1689
|
| `response_quality_score` | Custom quality rating (0.0-1.0) | Track user satisfaction or automated quality metrics for model performance analysis |
|
|
1679
1690
|
| `effort` | Reasoning effort level requested of the model (free-form string, max 16 chars, `^[A-Za-z0-9_-]+$`) | Report what share of AI spend is high-effort reasoning, and compare cost per effort level |
|
|
1691
|
+
| `entrypoint` | How the coding assistant that made the call was launched, such as `cli`, `sdk-py` or `claude-vscode` (completions only, 1 to 64 chars, `^[A-Za-z0-9._-]+$`) | Split coding-assistant spend between the terminal, the SDKs and the editor or chat integrations |
|
|
1680
1692
|
|
|
1681
1693
|
**Example:**
|
|
1682
1694
|
|
|
@@ -1711,7 +1723,7 @@ string, not an enum -- vendor vocabularies differ and drift, so `low`, `medium`,
|
|
|
1711
1723
|
`high`, `xhigh` and `ultra` are all real values, and a level this SDK release has
|
|
1712
1724
|
never heard of is passed through untouched rather than rejected or rewritten. The
|
|
1713
1725
|
Revenium backend rule is at most 16 characters, matching `^[A-Za-z0-9_-]+$`; a
|
|
1714
|
-
value outside it is left off the record with a WARNING, and the call is still
|
|
1726
|
+
value outside it, an empty one included, is left off the record with a WARNING, and the call is still
|
|
1715
1727
|
recorded with its tokens and cost. It is distinct from the reported reasoning token count,
|
|
1716
1728
|
which measures the tokens actually spent rather than the level requested.
|
|
1717
1729
|
|
|
@@ -1719,6 +1731,15 @@ Set it per call in `usage_metadata` on any provider integration. In LiteLLM prox
|
|
|
1719
1731
|
mode, where per-call attribution travels as request headers rather than
|
|
1720
1732
|
`usage_metadata`, send `x-revenium-effort` instead.
|
|
1721
1733
|
|
|
1734
|
+
**Coding-assistant entrypoint:** `entrypoint` records how the coding assistant
|
|
1735
|
+
that made a completion was launched. Claude Code sends `cli`, `sdk-cli`,
|
|
1736
|
+
`sdk-ts`, `sdk-py`, `claude-vscode` or `claude-in-slack`; any other value of
|
|
1737
|
+
the same shape is sent as given, not rewritten. A value that is empty, longer
|
|
1738
|
+
than 64 characters or holds anything but letters, digits, dots, hyphens and
|
|
1739
|
+
underscores is left off the record with a WARNING, and the call is still
|
|
1740
|
+
recorded. It is sent on completions only; image, video and audio calls ignore
|
|
1741
|
+
it, and the LiteLLM proxy does not read it.
|
|
1742
|
+
|
|
1722
1743
|
**Deprecation notice:** The legacy field aliases `organizationId`, `organization_id`, `productId`, and `product_id` are accepted by this SDK only as an input-layer convenience and emit a `DeprecationWarning`. The Revenium backend no longer accepts them — they are translated to `organizationName` / `productName` before the wire call. Migrate to `organization_name` / `organizationName` and `product_name` / `productName` now; the input-layer aliases will be removed in the next major release.
|
|
1723
1744
|
|
|
1724
1745
|
**API Reference:** [Complete metadata field documentation](https://revenium.readme.io/reference/meter_ai_completion)
|
|
@@ -2241,6 +2262,23 @@ if roster:
|
|
|
2241
2262
|
|
|
2242
2263
|
`fetch_enforcement_rule_roster` takes `page`, `size`, `search` and `band` (`BLOCKED`, `WARNED`, `UNDER`, `ALL`); the server does the filtering, sorting, banding and paging, and the three band counts always describe the whole roster rather than the page you asked for. Both calls return `None` rather than raising when the team has no such compiled rule, the rule has no reading yet, or the enforcement API cannot be reached — the same fail-open posture as the rest of the circuit breaker. An empty `rule_id` raises `ValueError`.
|
|
2243
2264
|
|
|
2265
|
+
### Reading Advisory Budgets
|
|
2266
|
+
|
|
2267
|
+
Notify-only per-person budgets (alerts) never block a call, so the cost-limit cache does not carry them. `fetch_advisory_budgets()` reads them on demand, like the two calls above: it sends `include=advisory` on the team-wide enforcement read, which the API serves from 2.25.0, and returns only the advisory rows.
|
|
2268
|
+
|
|
2269
|
+
```python
|
|
2270
|
+
from revenium_middleware._core import fetch_advisory_budgets
|
|
2271
|
+
|
|
2272
|
+
budgets = fetch_advisory_budgets() # list of advisory rows, [] if none, None on failure
|
|
2273
|
+
|
|
2274
|
+
for budget in budgets or []:
|
|
2275
|
+
print(f"{budget['name']} (reading at {budget.get('readingAt')})")
|
|
2276
|
+
for person in budget.get("groupBreakdown") or []:
|
|
2277
|
+
print(f" {person['groupValue']}: ${person['currentValue']}")
|
|
2278
|
+
```
|
|
2279
|
+
|
|
2280
|
+
Each row has `source` `ANOMALY` and `action` `NOTIFY`, groups by `SUBSCRIBER` with a per-person `groupBreakdown`, and carries `readingAt` when the current window has a reading. The call returns `[]` when the team has no advisory budgets and `None` when the enforcement API cannot be reached.
|
|
2281
|
+
|
|
2244
2282
|
The background poller is unaffected: it keeps reading the **whole team's** rules every `REVENIUM_CB_POLL_INTERVAL_SECONDS`. That is deliberate. The server computes the department-budget maps team-wide and attaches them to the team-wide read, so a poll narrowed to a single rule would stop receiving them and department budgets would quietly stop blocking anyone. Narrowing is an explicit, opt-in inspection call and never the refresh.
|
|
2245
2283
|
|
|
2246
2284
|
### End-to-End Example
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "revenium-python-sdk"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.12.0"
|
|
8
8
|
description = "The official Revenium Python SDK — unified AI metering middleware for OpenAI, Anthropic, Google, Ollama, LiteLLM, Perplexity, and fal.ai."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -141,7 +141,12 @@ dev = [
|
|
|
141
141
|
# tests/test_patch_coverage.py and tests/entry_points import every provider
|
|
142
142
|
# SDK unconditionally, so a missing one fails the run instead of skipping.
|
|
143
143
|
"openai>=1.0.0",
|
|
144
|
-
|
|
144
|
+
# Below 1.106: litellm 1.106.0 imports mcp inside completion() for any call
|
|
145
|
+
# that carries tools but declares mcp only under its proxy and mcp extras
|
|
146
|
+
# (mcp>=2.2), while crewai 1.15 pins mcp~=1.28, so installing mcp here
|
|
147
|
+
# makes pip resolve crewai back to 1.6. Lift the bound when litellm ships
|
|
148
|
+
# the import behind its extra again or declares mcp as a core dependency.
|
|
149
|
+
"litellm>=1.40.0,<1.106",
|
|
145
150
|
"fal-client>=0.13.0",
|
|
146
151
|
"perplexityai>=0.1.0",
|
|
147
152
|
"google-genai>=0.1.0",
|
{revenium_python_sdk-0.10.1 → revenium_python_sdk-0.12.0}/revenium_middleware/_core/__init__.py
RENAMED
|
@@ -13,6 +13,7 @@ from .metering_submission import submit_ai_event
|
|
|
13
13
|
from .exceptions import BudgetExceededError
|
|
14
14
|
from .enforcement import (
|
|
15
15
|
check_enforcement,
|
|
16
|
+
fetch_advisory_budgets,
|
|
16
17
|
fetch_enforcement_rule,
|
|
17
18
|
fetch_enforcement_rule_roster,
|
|
18
19
|
is_circuit_breaker_enabled,
|
|
@@ -71,6 +72,7 @@ __all__ = [
|
|
|
71
72
|
# Enforcement / circuit breaker
|
|
72
73
|
"BudgetExceededError",
|
|
73
74
|
"check_enforcement",
|
|
75
|
+
"fetch_advisory_budgets",
|
|
74
76
|
"fetch_enforcement_rule",
|
|
75
77
|
"fetch_enforcement_rule_roster",
|
|
76
78
|
"is_circuit_breaker_enabled",
|