API Key Setup & Usage
All API requests require authentication via an API Key. OfoxAI uses a unified API Key that works across all three protocols.
Getting Your API Key
- Sign up and log in to the OfoxAI Console
- Go to Settings → API Keys
- Click Create New Key
- Copy and securely store your API Key
The API Key is only displayed once at creation time. Make sure to save it securely. If lost, you’ll need to create a new one.
Authentication Methods
The authentication method varies slightly depending on the protocol you use:
OpenAI Compatible
The OpenAI compatible protocol uses the Authorization header:
Authorization: Bearer <your OFOXAI_API_KEY>from openai import OpenAI
client = OpenAI(
base_url="https://api.ofox.io/v1",
api_key="<your OFOXAI_API_KEY>"
)Environment Variable Configuration
We recommend using environment variables to manage your API Key to avoid hardcoding:
.env
OFOX_API_KEY=<your OFOXAI_API_KEY>
# You can also set protocol-specific environment variables
OPENAI_API_KEY=<your OFOXAI_API_KEY>
OPENAI_BASE_URL=https://api.ofox.io/v1
ANTHROPIC_API_KEY=<your OFOXAI_API_KEY>
ANTHROPIC_BASE_URL=https://api.ofox.io/anthropic
GEMINI_API_KEY=<your OFOXAI_API_KEY>
GEMINI_BASE_URL=https://api.ofox.io/geminiSecurity Best Practices
- Use environment variables — Never hardcode API Keys in your source code
- Rotate keys regularly — We recommend rotating every 90 days
- Separate environments — Use different API Keys for development and production
- Monitor usage — Regularly check API usage and anomalous calls in the console
- Limit scope — Create separate API Keys for different projects for easier tracking and management. In the key menu, use IP Whitelist to allow only your servers, and limit the key’s models and spending
Never commit API Keys to Git repositories or expose them in client-side code. Use .gitignore to exclude .env files.
Last updated on