Installation
Requirements
- Python 3.8 or higher
- An InfraPrism account (sign up free)
- An API key from your LLM provider (OpenAI, Anthropic, or Azure)
Install the SDK
Install InfraPrism using pip:
pip install infraprism
Or with Poetry:
poetry add infraprism
Or with your requirements.txt:
infraprism>=1.0.0
Get Your API Key
- Log in to the InfraPrism Dashboard
- Navigate to Settings → API Keys
- Click Create API Key
- Copy your key (it starts with
ip-)
Security Note: Store your API key securely. Never commit it to version control.
Set Environment Variables
We recommend using environment variables for your API keys:
# InfraPrism API key
export INFRAPRISM_API_KEY="ip-your-key-here"
# Your LLM provider key
export OPENAI_API_KEY="sk-your-openai-key"
# or
export ANTHROPIC_API_KEY="sk-ant-your-anthropic-key"
You can also use a .env file with a library like python-dotenv:
INFRAPRISM_API_KEY=ip-your-key-here
OPENAI_API_KEY=sk-your-openai-key
Verify Installation
Test that everything is set up correctly:
from infraprism import InfraPrismOpenAI
# Creates a tracked OpenAI client
client = InfraPrismOpenAI()
# Make a test call
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Say hello!"}],
entity_type="test",
entity_id="installation-test",
)
print(response.choices[0].message.content)
If successful, you’ll see the response and the call will appear in your InfraPrism dashboard within seconds.
Next Steps
- Quick Start Guide - Build your first tracked integration
- Configuration - Customize SDK behavior
- Cost Attribution - Learn about entity tagging