Martian Documentation

Martian provides unified access to 200+ AI models through a single API, enabling you to select the most effective model for your use case while maintaining compatibility with popular frameworks.

Key Benefits

  • Access to 200+ models from leading providers
  • Compatibility with OpenAI and Anthropic APIs
  • Intelligent model routing with cost optimization

For example, simply populate the model field when making requests:

curl https://api.withmartian.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MARTIAN_API_KEY" \
  -d '{
    "model": "openai/gpt-4.1-nano",
    "messages": [
      {
        "role": "user",
        "content": "What is Olympus Mons?"
      }
    ]
  }'

Monitoring & Analytics

Track your usage and optimize costs through the Martian Dashboard:

  • Real-time Usage: Monitor API calls, tokens, and costs
  • Model Performance: Compare accuracy and latency across models
  • Cost Analysis: Identify savings opportunities with smart routing
  • Request History: Debug and analyze API interactions

Getting started

Get your API key from the Martian Dashboard and start making requests immediately. Our API is fully compatible with existing OpenAI and Anthropic SDKs, requiring minimal code changes.

API References

Available Models

Browse 200+ AI models from OpenAI, Anthropic, Google, and more.

Authentication

Learn how to authenticate your API requests with API keys.

Error Handling

Understand error codes and how to handle API errors properly.

Resources

Integrations

SDK and code editor integrations for OpenAI, Anthropic, Cursor, Cline, Aider, and more.

Code Examples

Practical examples and code snippets for common use cases, from basic chat to advanced tool use.

Support

Get help with integration, troubleshooting, and best practices. Access dashboard and community support.

Getting Help

Martian provides the following resources to help you use the API:

Ready to get started? Grab your API key and make your first request in under three minutes!