MarsAI
Sign in Get Started

MarsAI developer library

Guides for building with the API

Concrete setup and implementation notes for MarsAI. Every article carries a review date and links to the live model catalog or pricing page where the details can change.

01

Connect OpenCode to MarsAI

Add MarsAI as an OpenAI compatible provider, map a public model ID and test the connection before starting an agent session.

03

Keep context across routed model calls

Conversation history belongs in the client. Route affinity keeps one session on one healthy target, but it cannot recreate messages that were omitted.

04

Troubleshoot MarsAI API errors

Use the status and error body to decide whether a request needs a configuration change, more credits or a bounded retry.

How these guides are maintained

Review dates move only after the instructions and examples are checked against the running PHP gateway. The model catalog and rates remain the source for model-specific details. If a command no longer matches the current client, send the page URL and the failing step through the contact form.