OpenAI-API compatible endpoint & Stable Diffusion-style image API
My API KeysRoleplayCoding1curl 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.
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.
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.
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, prompt, width, and height fields are required. The generated image(s) are returned in the images array as base64 encoded strings. steps is limited by the model maxSteps (default 40), cfg_scale by maxCfgScale, and batch_size by maxBatchSize. SDNext models use sampler_name; vLLM-Omni models use a fixed sampler and translate width/height to size, steps to num_inference_steps, and cfg_scale to guidance_scale. Replace YOUR_ARLIAI_API_KEY and model names as needed.
1curl https://api.arliai.com/v1/images/generations \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
4-d '{
5 "model": "IMAGE_GENERATION_MODEL",
6 "prompt": "A photo of an astronaut riding a horse on the moon",
7 "negative_prompt": "ugly, blurry, low quality",
8 "size": "1024x1024",
9 "n": 1,
10 "seed": 42,
11 "num_inference_steps": 30,
12 "guidance_scale": 3.0,
13 "flow_shift": 5.0,
14 "extra_params": {"uncond_skip_layers": [22], "slg_start": 0.01, "slg_stop": 1.0},
15 "response_format": "b64_json"
16}'NOTE: vLLM-Omni models accept the OpenAI Images API at /v1/images/generations and /v1/images/edits. model is required and must have a healthy vLLM-Omni server. Use prompt, negative_prompt, size, n, seed, num_inference_steps, guidance_scale, true_cfg_scale, flow_shift, extra_params, output_format, and response_format. n must be 1-10 and cannot exceed the model maxBatchSize. Images are returned in data[].b64_json. Edits accept multipart image/image[] plus optional mask_image or reference_image, or JSON base64 images; flow_shift and extra_params are text-to-image only.
1curl https://api.arliai.com/v1/images/edits \
2-H "Authorization: Bearer YOUR_ARLIAI_API_KEY" \
3-F "model=IMAGE_GENERATION_MODEL" \
4-F "prompt=Turn the background into a sunset" \
5-F "image=@input.png" \
6-F "size=1024x1024" \
7-F "strength=0.7" \
8-F "response_format=b64_json"NOTE: POST /v1/images/edits requires model and a model whose supportsImg2Img capability is not false. Send multipart image/image[] plus optional mask_image or reference_image, or JSON base64 image, images, or init_images. Edits accept prompt, negative_prompt, size, n, num_inference_steps, guidance_scale, true_cfg_scale, strength, seed, output_format, and response_format. flow_shift and extra_params are not applied to edits.
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, init_images, width, and height fields are required. init_images must be an array containing at least one base64 encoded string of your initial image. steps is limited by the model maxSteps (default 40). vLLM-Omni models require supportsImg2Img and are translated to the multipart OpenAI edits endpoint; sending a mask to an SDNext model also requires supportsInpaint. Replace placeholders with actual data.
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. Upscaling is served by SD.Next upscaler models; vLLM-Omni models do not provide upscaling. Replace placeholders with actual data.