OpenAI SDK Compatible
OfoxAI is fully compatible with the OpenAI SDK. Migrating from a direct OpenAI connection requires changing just two parameters: base_url and api_key.
Migration Steps
Just Change Two Lines of Code
Python
from openai import OpenAI
# Before: direct OpenAI connection
# client = OpenAI(api_key="sk-openai-xxx")
# Now: through OfoxAI
client = OpenAI(
base_url="https://api.ofox.ai/v1", # Added
api_key="<your OFOXAI_API_KEY>" # Replaced
)
# Everything else stays the same!
response = client.chat.completions.create(
model="openai/gpt-4o", # Add provider prefix
messages=[{"role": "user", "content": "Hello!"}]
)Model Naming
OfoxAI uses the provider/model-name format for model identifiers:
| OpenAI Original Name | OfoxAI Model ID |
|---|---|
gpt-4o | openai/gpt-4o |
gpt-4o-mini | openai/gpt-4o-mini |
gpt-5.2 | openai/gpt-5.2 |
text-embedding-3-small | openai/text-embedding-3-small |
Through OfoxAI, you can also access models from other providers:
| Additional Models | Description |
|---|---|
anthropic/claude-sonnet-4.5 | Claude Sonnet 4 |
google/gemini-3-flash-preview | Gemini 3 Flash |
deepseek/deepseek-chat | DeepSeek V3 |
Compatibility
OfoxAI supports the following OpenAI API features:
| Feature | Status |
|---|---|
| Chat Completions | ✅ Fully compatible |
| Streaming | ✅ Fully compatible |
| Function Calling | ✅ Fully compatible |
| JSON Mode | ✅ Fully compatible |
| Vision (image input) | ✅ Fully compatible |
| Embeddings | ✅ Fully compatible |
| Models List | ✅ Fully compatible |
| Images Generation | ✅ Fully compatible |
Framework Integration
LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.ofox.ai/v1",
api_key="<your OFOXAI_API_KEY>",
model="openai/gpt-4o"
)LlamaIndex
from llama_index.llms.openai import OpenAI
llm = OpenAI(
api_base="https://api.ofox.ai/v1",
api_key="<your OFOXAI_API_KEY>",
model="openai/gpt-4o"
)Vercel AI SDK
import { createOpenAI } from '@ai-sdk/openai'
const ofoxai = createOpenAI({
baseURL: 'https://api.ofox.ai/v1',
apiKey: '<your OFOXAI_API_KEY>'
})
const model = ofoxai('openai/gpt-4o')Any framework or tool that supports the OpenAI SDK can integrate with OfoxAI by changing the base_url.
Last updated on