Getting Started

LLM Resayil is an OpenAI-compatible API that lets you access 45+ open-source and cloud LLM models with flexible billing. Any OpenAI SDK works seamlessly by overriding the base URL.

Setup in 5 Steps

  1. Subscribe at /billing/plans — choose a plan or start your free 7-day trial
  2. Create API Key at /api-keys — click "Create Key" and save it (shown only once)
  3. Make your first call:
bash
curl https://llm.resayil.io/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.2:3b",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
  1. Track usage at /dashboard

How do I authenticate API requests?

Every API request requires authentication using your API key in the Authorization header.

Header Format

bash
Authorization: Bearer YOUR_API_KEY

Getting Your API Key

Visit /api-keys to create and manage keys. Your key is shown only once at creation — store it securely.

Key Limits by Plan

Plan Max API Keys
Starter 1 key
Basic 2 keys
Pro 3 keys
Enterprise Unlimited

Security Best Practices

  • Never commit API keys to version control — use environment variables
  • Rotate keys regularly
  • Use separate keys per application or environment
  • Revoke keys immediately if compromised
  • Omit keys from error messages and logs
Authentication Error: Missing or invalid API key returns 401 Unauthorized

How do I send a chat completion request?

The base URL for all API requests is:

https://llm.resayil.io/api/v1

POST /api/v1/chat/completions

Send messages to a model and get a completion response. Supports streaming via the stream parameter.

Request Parameters

Parameter Type Required Description
model string Yes Model ID from GET /api/v1/models
messages array Yes Array of message objects: {"role": "user|assistant", "content": "text"}
stream boolean No Default false. Set to true for Server-Sent Events streaming
temperature number No Sampling temperature (0–2), default 1.0
max_tokens integer No Maximum tokens to generate

Example Request

bash
curl https://llm.resayil.io/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.2:3b",
    "messages": [
      {"role": "user", "content": "What is 2 + 2?"}
    ],
    "temperature": 0.7,
    "max_tokens": 100
  }'

Example Response

json
{
  "id": "chatcmpl-abc123def456",
  "object": "chat.completion",
  "created": 1740000000,
  "model": "llama3.2:3b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "2 + 2 equals 4."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 9,
    "total_tokens": 33
  }
}

GET /api/v1/models

List all available models. Returns an array of model objects with metadata.

Example Response

json
{
  "object": "list",
  "data": [
    {
      "id": "llama3.2:3b",
      "object": "model",
      "owned_by": "meta",
      "context_window": 8192,
      "credit_cost_multiplier": 1,
      "is_active": true
    },
    {
      "id": "qwen2.5:7b",
      "object": "model",
      "owned_by": "alibaba",
      "context_window": 131072,
      "credit_cost_multiplier": 1,
      "is_active": true
    },
    {
      "id": "claude-3-sonnet-cloud",
      "object": "model",
      "owned_by": "anthropic",
      "context_window": 200000,
      "credit_cost_multiplier": 2,
      "is_active": true
    }
  ]
}

Which AI models are available?

Access 45+ LLM models spanning local open-source and cloud providers. Fetch available models using:

bash
curl https://llm.resayil.io/api/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

Model Families

Family Provider Description
Llama Meta General-purpose chat and reasoning
Qwen Alibaba Multilingual chat and coding
Gemma Google Lightweight and efficient
DeepSeek DeepSeek AI Code and reasoning specialists
Mistral Mistral AI Fast, European open models
GLM Zhipu AI Chinese + English bilingual

Credit Costs

Model Type Credits per Token
Local models 1 credit
Cloud models 2 credits

Each API request consumes credits based on total tokens (prompt + completion) multiplied by the model's credit multiplier. Check your model list response for the credit_cost_multiplier field.

Billing & Credits

LLM Resayil uses a credit-based system. Each subscription plan includes monthly credits, and additional credits can be purchased via top-up packs.

Credit Costs by Model Type

Model Type Credits per Token
Local models (Llama, Qwen, etc.) 1 credit
Cloud models (Claude, GPT, etc.) 2 credits

Monthly Plans

Plan Monthly Price Credits Included Rate Limit
Starter 15 KWD 5,000 10 req/min
Basic 25 KWD 15,000 10 req/min
Pro 45 KWD 50,000 30 req/min
Enterprise Contact sales Custom 60 req/min

Free Trial

New accounts receive a 7-day free trial with 5,000 trial credits. No payment method required.

Credit Top-ups

When your monthly credits run out, purchase additional credits:

Credits Price
5,000 2 KWD
15,000 5 KWD
50,000 15 KWD
Out of Credits: API requests return 402 Payment Required when your account credits are depleted. Top up at /billing/plans to resume access.

Monitoring Usage

Track your credit balance and usage breakdown in your dashboard.

What are the API rate limits?

API requests are rate-limited on a per-key basis using a rolling 1-minute window.

Rate Limits by Plan

Plan Requests per Minute
Starter 10
Basic 10
Pro 30
Enterprise 60

Exceeding Limits

When you exceed your rate limit, the API returns a 429 Too Many Requests response:

json
{
  "error": {
    "code": "429",
    "message": "Rate limit exceeded. Max 10 requests per minute."
  }
}

Recommended Strategy

Implement exponential backoff when receiving 429 responses:

  • First retry: wait 1 second
  • Second retry: wait 2 seconds
  • Third retry: wait 4 seconds
  • And so on, doubling each time

Upgrade Your Plan

Need higher limits? upgrade your subscription or contact support for Enterprise tier options.

What errors can the API return?

All error responses follow this format:

json
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  }
}

Common Errors

401

Unauthorized

When it occurs: Missing, invalid, or expired API key.

Example response:

json
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key"
  }
}

Resolution: Verify your API key at /api-keys or generate a new one.

402

Payment Required

When it occurs: Account has insufficient credits to process the request.

Example response:

json
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits. Please top up your account."
  }
}

Resolution: Top up credits at /billing/plans.

429

Too Many Requests

When it occurs: You've exceeded your plan's rate limit within the current 1-minute window.

Example response:

json
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Max 10 requests per minute."
  }
}

Resolution: Retry with exponential backoff, or upgrade your plan for higher limits.

503

Service Unavailable

When it occurs: The API or a model service is temporarily unavailable.

Example response:

json
{
  "error": {
    "code": "service_unavailable",
    "message": "Model service is temporarily unavailable. Please retry shortly."
  }
}

Resolution: Wait a few moments and retry. Check system status for ongoing incidents.

Code Examples

Below are complete working examples in multiple languages and platforms. Replace YOUR_API_KEY with your actual key.

cURL

Make API calls directly from the command line:

bash
curl https://llm.resayil.io/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.2:3b",
    "messages": [
      {"role": "user", "content": "Tell me a joke."}
    ]
  }'

Python

Use the official OpenAI Python library with LLM Resayil:

python
# pip install openai
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://llm.resayil.io/api/v1"
)

response = client.chat.completions.create(
    model="llama3.2:3b",
    messages=[
        {"role": "user", "content": "Tell me a joke."}
    ]
)

print(response.choices[0].message.content)

JavaScript

Use the official OpenAI JavaScript library:

javascript
// npm install openai
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://llm.resayil.io/api/v1',
});

const completion = await client.chat.completions.create({
  model: 'llama3.2:3b',
  messages: [
    { role: 'user', content: 'Tell me a joke.' },
  ],
});

console.log(completion.choices[0].message.content);

n8n Workflow Integration

Integrate LLM Resayil into n8n workflows using the HTTP Request node:

  1. Add an HTTP Request node to your workflow
  2. Set Method to POST
  3. Set URL to https://llm.resayil.io/api/v1/chat/completions
  4. Go to Authentication tab, select Generic Credential Type
  5. Choose Header Auth:
    • Name: Authorization
    • Value: Bearer YOUR_API_KEY
  6. In the Body tab, set Content Type to JSON
  7. Paste the request body:
json

{
  "model": "llama3.2:3b",
  "messages": [
    {
      "role": "user",
      "content": "{{ $json.input }}"
    }
  ]
}
  1. To extract the response, reference:
    {{ $json.choices[0].message.content }}

Frequently Asked Questions

What models are available on LLM Resayil?

LLM Resayil provides access to 45+ AI models including Llama 3.2, DeepSeek V3.1 671B, Qwen 3.5 397B, GLM-4 Flash, and more. Local models run on our GPU server; cloud proxy models are routed through ollama.com.

Is LLM Resayil compatible with OpenAI's API?

Yes. LLM Resayil is fully OpenAI-compatible. Change your base URL to https://llm.resayil.io/api/v1 and use your LLM Resayil API key — no other code changes needed.

How do credits work?

Credits are consumed per token. Local models cost 1 credit/token; cloud models cost 2 credits/token. You can purchase top-ups: 5,000 credits for 2 KWD, 15,000 for 5 KWD, or 50,000 for 15 KWD.

What payment methods are accepted?

We accept KNET (Kuwait debit/credit cards) via MyFatoorah payment gateway. All payments are processed securely.

Can I use LLM Resayil for commercial projects?

Yes. There are no restrictions on commercial use. API access is pay-per-token with no monthly minimums.

What are the rate limits per tier?

Free tier: 10 requests/minute. Standard tier: 30 requests/minute. Premium tier: 60 requests/minute. Rate limits reset every minute.

How do I get started with the API?

Register at llm.resayil.io, go to your dashboard to create an API key, add credits via KNET, then set your base URL to https://llm.resayil.io/api/v1.

Is there a free trial?

New accounts receive a small credit allocation on signup to test the API. No credit card required to register.