Skip to main content

When to Use This

You’re already using the OpenAI Python or JavaScript SDK and want to switch to Mavera with:
  • Minimal code changes (often 2–3 lines)
  • Preserved behavior for input, streaming, tools, and structured outputs
  • New capabilities (personas, analysis mode) injected via extra parameters
Mavera’s API is OpenAI-compatible: same SDK interface, same Responses API. You change the base URL, add persona_id, and optionally use Mavera-specific fields like analysis_mode.

What Stays the Same


What Changes


Step-by-Step Migration

1. Get a Mavera API Key

Create an API key at app.mavera.io/settings/developer. Keys start with mvra_live_.

2. Get a Persona ID

Every Mavera request should include a persona_id for audience-aware responses. List personas and pick one:

3. Update Environment Variables

4. Change Client Configuration

5. Add persona_id to Requests

Python quirk: The OpenAI Python SDK’s type definitions don’t include persona_id, so you must pass it via extra_body. The SDK forwards unknown kwargs to the API. JavaScript/TypeScript: You can add persona_id (and other Mavera fields) directly to the request object.

Mavera-Specific Fields Reference


Non-Chat Endpoints: Use REST

Mavera has non-OpenAI endpoints (Mave Agent, Focus Groups, Video Analysis, etc.) that don’t use the OpenAI SDK. Call them directly with fetch, requests, or httpx.

Migration Checklist

  • Create Mavera account and API key
  • List personas and pick a default persona_id
  • Note your current model usage (e.g. gpt-4) — Mavera uses mavera-1
  • Set base_url / baseURL to https://app.mavera.io/api/v1
  • Set api_key / apiKey to Mavera key
  • Replace model name with mavera-1
  • Add persona_id to all response calls (Python: extra_body, JS: direct)
  • Add MAVERA_API_KEY to env (or repoint OPENAI_API_KEY)
  • Update any config files or secrets managers
  • Run a simple response (no streaming)
  • Run a streaming response
  • Test tools/function calling if used
  • Test structured outputs if used
  • Verify usage.credits_used in responses

Common Gotchas

You must pass persona_id in extra_body, not as a top-level kwarg. client.responses.create(..., persona_id="x") will not work — use extra_body={"persona_id": "x"}.
The OpenAI types don’t include persona_id. Use as any or extend the types, or pass via a wrapper that adds Mavera fields before the SDK call.
Mavera uses credits, not token-based pricing. Each response includes usage.credits_used. See Credits.
Mavera rate limits differ by tier. See Rate Limits. If you were batching heavily on OpenAI, you may need to throttle.

See Also

Quickstart: Chat

First Mavera request with persona

SDKs Overview

Python, JavaScript, Go, and REST usage

Responses API

Full feature set: streaming, tools, analysis mode

Persona Selection

How to choose the right persona