Installation
Requirements
- Python 3.9 or higher
- pip package manager
Install via pip
This installs both the Python library and the CLI tool.
Set Up API Keys
Configure API keys for the LLM providers you’ll use:
# OpenAI
export OPENAI_API_KEY="sk-..."
# Anthropic (Claude)
export ANTHROPIC_API_KEY="sk-ant-..."
# Google Gemini
export GOOGLE_API_KEY="..."
You only need API keys for the providers you’ll use. The SDK supports OpenAI, Anthropic, Gemini, xAI, OpenRouter, and Cerebras.
Using .env Files
Create a .env file in your project:
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
Load it in your code:
from dotenv import load_dotenv
load_dotenv()
Verify Installation
Test the Python SDK:
from osmosis_ai import osmosis_reward
@osmosis_reward
def test_fn(solution_str: str, ground_truth: str, extra_info: dict = None) -> float:
return 1.0
print(test_fn("hello", "hello")) # Output: 1.0
Test the CLI:
Troubleshooting
Import Error: Make sure you installed osmosis-ai (not osmosis-sdk)
CLI Not Found: Reinstall and verify PATH
pip install --force-reinstall osmosis-ai
which osmosis
API Key Error: Verify environment variables are set
import os
print(os.getenv("OPENAI_API_KEY"))
Next Steps