MARA Cloud inference APIs are designed to be fully compatible with OpenAI client libraries, making it easy to integrate MARA Cloud into your existing applications. If you already use the OpenAI Python or JavaScript SDK, all you need to change is the base URL and API key.
Setup
Install the OpenAI client library:
bash
pip install openaiClient configuration
Initialize the OpenAI client with your MARA Cloud credentials:
python
from openai import OpenAI
client = OpenAI(
base_url="https://bczfskny6zqw.poweredby.snova.ai/v1",
api_key="your-mara-api-key",
)Don't have an API key? Follow the API Keys and URLs page to generate one.
Non-streaming completions
python
completion = client.chat.completions.create(
model="MiniMax-M2.5",
messages=[
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"},
],
)
print(completion.choices[0].message.content)Streaming completions
python
completion = client.chat.completions.create(
model="MiniMax-M2.5",
messages=[
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"},
],
stream=True,
)
for chunk in completion:
print(chunk.choices[0].delta.content, end="")Note: In streaming mode, the API returns chunks that may contain multiple tokens. When calculating metrics like tokens per second, ensure you account for all tokens in each chunk.
Unsupported OpenAI parameters
The following OpenAI parameters are not currently supported and will be ignored:
| Parameter | Description |
|---|---|
logprobs, top_logprobs | Log probabilities for output tokens |
n | Number of completions to generate |
presence_penalty, frequency_penalty | Repetition control penalties |
logit_bias | Token likelihood adjustments |
seed | Deterministic output seeding |
Notable differences
| Feature | MARA Cloud | OpenAI |
|---|---|---|
temperature range | 0 to 1 | 0 to 2 |
top_k parameter | Supported | Not available |
Next steps
- Switching to MARA Cloud - Migrate your existing OpenAI integration to MARA Cloud.
- Text Generation - Learn about text generation capabilities.
- Function Calling & JSON Mode - Build structured workflows with tool use and JSON outputs.