Skip to main content

Anosys.ai

AnoSys SDK for OpenAI

Automatically capture and send OpenAI API calls to AnoSys for monitoring, analytics, and observability.

Features

  • Automatic OpenAI Instrumentation - Captures instrumented OpenAI API calls via OpenTelemetry
  • Streaming Support - Detects and logs streaming responses
  • OpenTelemetry Semantic Conventions - Follows Gen AI standards
  • Error Tracking - Captures exceptions with full stack traces

Installation

Requires Python 3.10 or later.

pip install anosys-sdk-openai

Quick Start

import os
from openai import OpenAI
from anosys_sdk_openai import AnosysOpenAILogger

os.environ["OPENAI_API_KEY"] = "your-openai-key"
os.environ["ANOSYS_API_KEY"] = "your-anosys-key"

# Initialize (do once at startup)
AnosysOpenAILogger()

# Use OpenAI normally - instrumented calls are logged
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"}
    ]
)
print(response.choices[0].message.content)

Streaming

Streaming is automatically detected and logged:

stream = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Write a haiku"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Custom Function Logging

You can also log custom functions using decorators from the core package:

from anosys_sdk_core import anosys_logger

@anosys_logger(source="my_app")
def process_response(response):
    return response.choices[0].message.content

What Data is Captured?

Following OpenTelemetry Gen AI standards:

  • gen_ai.system - Always "openai"
  • gen_ai.request.model - Model requested
  • gen_ai.response.model - Model that responded
  • gen_ai.request.temperature - Temperature parameter
  • gen_ai.usage.input_tokens - Input token count
  • gen_ai.usage.output_tokens - Output token count
  • Request/response messages
  • Timestamps and duration
  • Error details

Environment Variables

Variable Required Description
ANOSYS_API_KEY Yes Your AnoSys API key
OPENAI_API_KEY Yes Your OpenAI API key

License

Apache 2.0

Content controls

See the content-controls reference for encryption coverage, default columns, size limits, and limitations. Encryption is opt-in and applies to selected string fields; it does not encrypt the complete record.

Collection follows one level for every AnoSys SDK: ANOSYS_COLLECTION_LEVEL=full (default), metadata (no prompts, completions or tool data) or off, a project .anosys file can only lower it, and ANOSYS_DISABLE=1 stops all sending. Without an API key nothing is sent. Telemetry is sent in the background and never delays your calls. See the data-collection policy.

Metadata

Release files for anosys-sdk-openai 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anosys-sdk-openai 1.2.0
File Size Uploaded Provenance Actions
anosys_sdk_openai-1.2.0.tar.gz 27.1 kB Without provenance Details for anosys_sdk_openai-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anosys-sdk-openai 1.2.0
File Interpreter ABI Platform Actions
anosys_sdk_openai-1.2.0-py3-none-any.whl Python 3 none any Details for anosys_sdk_openai-1.2.0-py3-none-any.whl

Total release size: 48.4 kB

Release files / anosys_sdk_openai-1.2.0.tar.gz

Download URL anosys_sdk_openai-1.2.0.tar.gz
Size 27.1 kB
Tags Source
SHA-256 checksum
How to use checksums
28f4e25f7ef16a5064fcfbc5bf6e55baf8a6d447cf45fd116382ddf347505eb5
BLAKE2b-256 checksum
How to use checksums
ae8b155c12d6406e43c7551989b40634940fd0d3c264e57a887f3a24091e71a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / anosys_sdk_openai-1.2.0-py3-none-any.whl

Download URL anosys_sdk_openai-1.2.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fef64e0c4b1d18cd0fe74e403ea9c83d7f60dc9e4d89ba6a821039ecd87603d
BLAKE2b-256 checksum
How to use checksums
815dcf1e2d1fe289fb361342faa4bafef5d4afc90bc30ff2a0be4cc06df62ebd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for anosys-sdk-openai 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page