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}'API キーでこの例をテストするにはログインしてください。
注:一部のモデルはシステムプロンプトを受け付けない場合があります。YOUR_ARLIAI_API_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}'API キーでこの例をテストするにはログインしてください。
注:補完を使用する場合は、各モデルの推奨プロンプト形式を使用してください。表示されている例はLlama 3 Instruct形式です。YOUR_ARLIAI_API_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}'API キーでこの例をテストするにはログインしてください。
注:input または messages のいずれか一方のみを指定してください。1 リクエストあたり最大 20 件の入力または会話を指定できます。マルチモーダル埋め込みでは、base64 画像データ URI を含む messages を使用してください。レスポンスには usage.prompt_tokens が含まれます。利用可能なモデルは GET /v1/embedding-models で取得できます。プレースホルダーは実際の値に置き換えてください。
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}'API キーでこの例をテストするにはログインしてください。
注:リクエストボディでパラメータをJSONとして送信します。sd_model_checkpointおよびpromptフィールドは必須です。生成された画像は、base64エンコードされた文字列としてimages配列で返されます。最大stepsは40です。必要に応じてYOUR_ARLIAI_API_KEYとモデル名を置き換えてください。
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}'注:sd_model_checkpoint、prompt、およびinit_imagesフィールドは必須です。init_imagesは、初期画像のbase64エンコードされた文字列を少なくとも1つ含む配列でなければなりません。最大stepsは40です。プレースホルダーを実際のデータに置き換えてください。
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}'注:imageフィールドは必須であり、アップスケールしたい画像のbase64エンコードされた文字列を含んでいる必要があります。アップスケールされた画像は、base64エンコードされた文字列としてimageフィールド(配列ではない)で返されます。プレースホルダーを実際のデータに置き換えてください。