Make your first request

Five steps from a new account to a model’s answer, in about five minutes. You need a card for credit, and Python 3.9 or later, Node.js 18 or later, or just cURL.

Create your account

Sign up with your email and a password, or with Google. We email you a code to confirm the address, and your workspace opens as soon as you enter it.

The console then walks you through your profile, billing and your first key. Every step can be skipped and finished later.

Add credit

Requests are paid from prepaid credit, so there is no subscription and no surprise bill. In the console, open Billing, add your billing details and a card, then buy credit, from $10.

Prices for each model are on the pricing page. You pay for the input and output tokens of each request, as reported in its usage.

Create an API key

Open API keys in the console and create a key. It is shown once, so copy it before you close the page. Then keep it in an environment variable, out of your code:

export MARSCOMPUTE_API_KEY="paste-your-key-here"

One key reaches every model. You can limit a key to one model when you create it, and revoke it at any time.

Install a client

The API follows the OpenAI chat completions format, so the official OpenAI SDKs work as they are. Install one, or use cURL.

pip install openai

Send your first request

Point the client at https://api.marscompute.ai/v1, use your MarsCompute key, and name a model. For TypeScript, save the file as quickstart.mjs and run node quickstart.mjs.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.marscompute.ai/v1",
    api_key=os.environ["MARSCOMPUTE_API_KEY"],
)

completion = client.chat.completions.create(
    model="qwen3-30b-a3b-instruct-2507",
    messages=[
        {"role": "user", "content": "Explain mixture-of-experts in one paragraph."}
    ],
    max_tokens=256,
)
print(completion.choices[0].message.content)
print(completion.usage)

The answer is in choices[0].message.content. usage holds the input and output tokens you are charged for, and every response carries an x-request-id header to quote if you ask us about a request.

To try another model, change model. Most models reason before they answer and need a max_tokens of at least 2,048, so raise it or leave it out for the default of 65,536. See Reasoning and tokens.

Stream the answer

Set stream to receive the answer as it is written. The last chunk carries usage. With an SDK, add this to the same file:

stream = client.chat.completions.create(
    model="qwen3-30b-a3b-instruct-2507",
    messages=[{"role": "user", "content": "Count from one to five in words."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    if chunk.usage:
        print("\n", chunk.usage)

Next steps

Ready to build?

Create your account and make your first request today.