Skip to main content
The Python SDK supports Python 3.8+ and works with both synchronous and asynchronous code.

Installation

Install with specific provider support
Or install the core SDK and add providers separately
Requirements:
  • Python 3.8+
  • OpenAI SDK: openai>=1.0.0 (optional)
  • Anthropic SDK: anthropic>=0.18.0 (optional)
  • Google (original): google-generativeai>=0.3.0 (optional)
  • Google (newer): google-genai>=0.1.0 (optional)

Quick start

OpenAI usage
Anthropic Claude Usage
Google Usage
The newer google-genai SDK is also supported:
Multi-Provider Usage

Error Handling

AmberTrace traces both successful calls and errors:

Disabling/Enabling Tracing

Check If Tracing Is Active

What’s Traced?

Successful Calls For each successful LLM API call, AmberTrace captures:
  • Request Data
    • Model name
    • Full conversation history (all messages)
    • Parameters (temperature, max_tokens, etc.)
  • Response Data
    • Response ID
    • Model used
    • Generated messages
    • Token usage (prompt, completion, total)
    • Finish reason
  • Metadata
    • Unique trace ID
    • Timestamp (ISO 8601 UTC)
    • Duration in milliseconds
    • SDK version
    • Environment tag (if configured)

Failed Calls

When an LLM call fails, AmberTrace traces:
  • Request data (same as above)
  • Error information:
    • Exception type
    • Error message
    • Error code (if available)