Skip to main content

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:
FieldDescriptionHow to Pass
persona_idID of persona to usePython: extra_body, JS: direct field
analysis_modeEnable structured analysisPython: extra_body, JS: direct field
reasoning_effortControl reasoning depthPython: 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

LanguageSDKNotes
PythonopenaiFull support via extra_body
JavaScriptopenaiFull support
TypeScriptopenaiFull support with types
Gogo-openaiRequires custom fields
Rubyruby-openaiRequires custom fields
PHPopenai-phpRequires custom fields
AnyRESTFull control
For languages without first-class Mavera support, you can always use the REST API directly.