OpenAI SDK Compatibility
Mavera’s Chat API is fully compatible with OpenAI SDKs. This means you can use the official OpenAI libraries in any language — just change the base URL.
Quick Setup
from openai import OpenAI
client = OpenAI(
api_key="mvra_live_your_key_here",
base_url="https://app.mavera.io/api/v1",
)
Mavera-Specific Fields
While the base API is OpenAI-compatible, Mavera adds specific fields:
| Field | Description | How to Pass |
|---|
persona_id | ID of persona to use | Python: extra_body, JS: direct field |
analysis_mode | Enable structured analysis | Python: extra_body, JS: direct field |
reasoning_effort | Control reasoning depth | Python: extra_body, JS: direct field |
Example with Mavera Fields
response = client.chat.completions.create(
model="mavera-1",
messages=[{"role": "user", "content": "Hello"}],
extra_body={
"persona_id": "YOUR_PERSONA_ID",
"analysis_mode": True,
},
)
REST API
For non-Chat endpoints (Mave, Focus Groups, etc.), use REST directly:
import requests
headers = {"Authorization": "Bearer mvra_live_your_key_here"}
# Mave Agent
response = requests.post(
"https://app.mavera.io/api/v1/mave/chat",
headers=headers,
json={"message": "Analyze market trends"}
)
# Focus Groups
response = requests.post(
"https://app.mavera.io/api/v1/focus-groups",
headers=headers,
json={...}
)
Language Support
| Language | SDK | Notes |
|---|
| Python | openai | Full support via extra_body |
| JavaScript | openai | Full support |
| TypeScript | openai | Full support with types |
| Go | go-openai | Requires custom fields |
| Ruby | ruby-openai | Requires custom fields |
| PHP | openai-php | Requires custom fields |
| Any | REST | Full control |
For languages without first-class Mavera support, you can always use the REST API directly.