Quick Start

Drop-in OpenAI-API compatible endpoint & Stable Diffusion API

My API KeysRoleplayCoding

Chat Completions (OpenAI Compatible)

1curl https://api.arliai.com/v1/chat/completions \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
4-d '{
5"model": "TEXT_GENERATION_MODEL",
6"messages": [
7  {"role": "system", "content": "You are a helpful assistant."},
8  {"role": "user", "content": "Hello!"},
9  {"role": "assistant", "content": "Hi!, how can I help you today?"},
10  {"role": "user", "content": "Say hello!"}
11],
12"repetition_penalty": 1.1,
13"temperature": 0.7,
14"top_p": 0.9,
15"top_k": 40,
16"max_completion_tokens": 1024,
17"stream": false
18}'

Please log in to test this example with your API key.

NOTE: Some models might not accept system prompts. Replace YOUR_ARLIAI_API_KEY with your actual key.

Completions (OpenAI Compatible)

1curl https://api.arliai.com/v1/completions \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
4-d '{
5"model": "TEXT_GENERATION_MODEL",
6"prompt": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are an assistant AI.<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nHello there!<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
7"repetition_penalty": 1.1,
8"temperature": 0.7,
9"top_p": 0.9,
10"top_k": 40,
11"max_completion_tokens": 1024,
12"stream": false
13}'

Please log in to test this example with your API key.

NOTE: Make sure to use the suggested prompt format for each model when using completions. Example shown is Llama 3 Instruct format. Replace YOUR_ARLIAI_API_KEY with your actual key.

Embeddings (OpenAI Compatible)

1curl https://api.arliai.com/v1/embeddings \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
4-d '{
5  "model": "EMBEDDING_MODEL_NAME",
6  "input": [
7    "The food was delicious.",
8    "The service was slow."
9  ],
10  "encoding_format": "float"
11}'

Please log in to test this example with your API key.

NOTE: Send exactly one of input or messages. Up to 20 inputs or conversations are allowed per request. For multimodal embeddings, use messages with base64 image data URIs. The response includes usage.prompt_tokens. List available models with GET /v1/embedding-models. Replace placeholders with actual values.

Text-to-Image Generation (SDNext API)

1curl https://api.arliai.com/sdapi/v1/txt2img \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
4-d '{
5  "prompt": "A photo of an astronaut riding a horse on the moon",
6  "negative_prompt": "ugly, blurry, low quality",
7  "steps": 30,
8  "sampler_name": "Default",
9  "width": 1024,
10  "height": 1024,
11  "sd_model_checkpoint": "IMAGE_GENERATION_MODEL",
12  "seed": -1,
13  "cfg_scale": 7
14}'

Please log in to test this example with your API key.

NOTE: Send parameters as JSON in the request body. The sd_model_checkpoint and prompt fields are required. The generated image(s) will be returned in the images array as base64 encoded strings. Max steps is 40. Replace YOUR_ARLIAI_API_KEY and model names as needed.

Image-to-Image Generation (SDNext API)

1# First, get your base64 encoded image string, e.g., using:
2# base64 input_image.png | tr -d '\n' > image.b64
3# Then copy the content of image.b64 into the init_images array below
4
5curl https://api.arliai.com/sdapi/v1/img2img \
6-H "Content-Type: application/json" \
7-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
8-d '{
9  "init_images": ["YOUR_BASE64_ENCODED_IMAGE_STRING_HERE"],
10  "prompt": "Make the horse blue",
11  "negative_prompt": "ugly, blurry, low quality, text, watermark",
12  "steps": 30,
13  "sampler_name": "Default",
14  "width": 1024,
15  "height": 1024,
16  "sd_model_checkpoint": "IMAGE_GENERATION_MODEL",
17  "seed": -1,
18  "cfg_scale": 7,
19  "denoising_strength": 0.75
20}'

NOTE: The sd_model_checkpoint, prompt, and init_images fields are required. init_images must be an array containing at least one base64 encoded string of your initial image. Max steps is 40. Replace placeholders with actual data.

Upscale Image (SDNext API)

1# First, get your base64 encoded image string, e.g., using:
2# base64 input_image.png | tr -d '\n' > image.b64
3# Then copy the content of image.b64 into the image field below
4
5curl https://api.arliai.com/sdapi/v1/extra-single-image \
6-H "Content-Type: application/json" \
7-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
8-d '{
9  "image": "YOUR_BASE64_ENCODED_IMAGE_STRING_HERE",
10  "upscaler_1": "R-ESRGAN 4x+",
11  "upscaling_resize": 2
12}'

NOTE: The image field is required and must contain the base64 encoded string of the image you want to upscale. The upscaled image is returned in the image field (not an array) as a base64 encoded string. Replace placeholders with actual data.