API Documentation

Build with SwisserAI API

OpenAI-compatible API with built-in FiveM expertise. Use it with Cursor, Continue, Roo Code, or any OpenAI client.

Important: Managing API Costs

Tools like Roo Code and Cursor send the entire conversation history with each request to produce high-quality results. This means token usage grows significantly as conversations get longer.

Our recommendation: Prompt for one thing at a time and start fresh conversations regularly, rather than keeping long conversations going. This keeps your API costs predictable.

OpenAI Compatible

Drop-in replacement for OpenAI API. Works with any client that supports the OpenAI chat completions endpoint.

FiveM Expertise Built-in

Every request includes our specialized FiveM knowledge - QBCore, ESX, natives, NUI design patterns, and more.

Tool Use Support

Full support for function calling and tool use. Perfect for AI coding assistants like Roo Code or Cursor.

IDE Integration

Works with Cursor, Continue, Roo Code, Windsurf and any tool supporting OpenAI-compatible APIs.

Quick Start

1

Get your API Key

Create an API key in your account settings. Keep it secure - it provides full access to your account.

Go to Settings
2

Make your first request

curl https://ai.swisser.dev/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "swisserai-free",
    "messages": [
      {"role": "user", "content": "Create a QBCore job system"}
    ]
  }'

IDE & Tool Integrations

SwisserAI works with any tool that supports OpenAI-compatible APIs. Here are setup guides for popular options.

Cursor

Pro/Business Required

AI-first code editor with built-in AI features. Requires Pro or Business subscription for custom models.

🔄

Continue.dev

Free

Open-source AI code assistant for VS Code and JetBrains. Free to use with any OpenAI-compatible API.

🦘

Roo Code

Free

Autonomous AI coding agent for VS Code. Works great with SwisserAI for FiveM development.

🏄

Windsurf

Extension Required

The AI-powered VS Code fork by Codeium. Use the OpenAI Chat extension for custom providers.

Note: GitHub Copilot and Cody (Sourcegraph) do not support custom OpenAI-compatible providers in their standard plans. Enterprise users may have limited options.

Error Handling

Handle API errors gracefully with proper status code checking:

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://ai.swisser.dev/v1',
});

try {
  const response = await client.chat.completions.create({
    model: 'swisserai-free',
    messages: [{ role: 'user', content: 'Hello' }],
  });
  console.log(response.choices[0].message.content);
} catch (error) {
  if (error instanceof OpenAI.APIError) {
    switch (error.status) {
      case 401:
        console.error('Invalid API key - check your credentials');
        break;
      case 402:
        console.error('Insufficient credits - top up at /settings/billing');
        break;
      case 429:
        console.error('Rate limit exceeded - wait before retrying');
        break;
      case 500:
        console.error('Server error - retry after a moment');
        break;
      default:
        console.error('API error:', error.message);
    }
  }
}

API Reference

Base URL

https://ai.swisser.dev/v1

Available Models

ModelDescriptionBest For
swisserai-freeStandard model with FiveM expertiseGeneral FiveM development
swisserai-premiumAdvanced model (requires premium tier)Complex scripts, production code

Endpoints

POST
/v1/chat/completions

Create a chat completion. Supports streaming and tool use.

GET
/v1/models

List available models.

Error Codes

CodeMeaningSolution
400Bad RequestCheck your request format and parameters
401Invalid API KeyVerify your API key is correct and active
402Insufficient CreditsAdd credits to your account at /settings/billing
429Rate Limit ExceededWait before retrying, or upgrade your tier
500Server ErrorRetry after a moment. Contact support if persistent

SwisserAI Extensions

You can pass additional parameters in the swisserai object to customize behavior:

{
  "model": "swisserai-free",
  "messages": [...],
  "swisserai": {
    "framework": "qbcore",    // or "esx", "qbox", "standalone"
    "proMode": false,         // Enable modular architecture mode
    "ragEnabled": true        // Enable RAG context (default: true)
  }
}

Rate Limits

Rate limits are based on your subscription tier:

TierRequests / Hour
Free30
Hobby50
Pro100
Team150

Ready to get started?

Create your API key and start building FiveM scripts with AI assistance today.

API Documentation | SwisserAI - FiveM AI Code Assistant | SwisserAI