AiFO AiFO مستندات AiFO
قیمت
Input: 1 USD · Output: 5 USD · per_1m_tokens
Context
نامشخص
Endpoint
POST /v1/chat/completions

کاربردها

  • تولید محتوای متنی خلاقانه با ورودی تصویر
  • پاسخ به سوالات کاربران با استفاده از متن و تصویر
  • ایجاد تعاملات متنی در برنامه‌های چت بات

نمونه درخواست

# Required: model, messages (text + optional image_url)
# Optional gateway parameters:
# temperature: optional, default: 1
# max_tokens: optional, default: 1024
# top_p: optional, default: 1
# frequency_penalty: optional, default: 0
# presence_penalty: optional, default: 0
# image_url in messages: optional (multimodal input)
curl https://api.haftominhonar.ir/v1/chat/completions \
  -H "Authorization: Bearer aifo_sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/claude-haiku-4.5","messages":[{"role":"user","content":[{"type":"text","text":"تصویری از یک منظره زیبا ارسال کنید و بپرسید: \"این تصویر چه احساسی را در شما برمی‌انگیزد؟\""},{"type":"image_url","image_url":{"url":"https://example.com/image.jpg"}}]}],"temperature":1,"max_tokens":1024,"top_p":1,"frequency_penalty":0,"presence_penalty":0}'
import requests

url = "https://api.haftominhonar.ir/v1/chat/completions"
headers = {
    "Authorization": "Bearer aifo_sk_live_YOUR_API_KEY",
    "Content-Type": "application/json",
}
# Required: model, messages
payload = {
  "model": "anthropic/claude-haiku-4.5",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "تصویری از یک منظره زیبا ارسال کنید و بپرسید: \"این تصویر چه احساسی را در شما برمی‌انگیزد؟\""
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/image.jpg"
          }
        }
      ]
    }
  ],
  "temperature": 1,
  "max_tokens": 1024,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0
}


# Optional gateway parameters:
# temperature: optional, default: 1
# max_tokens: optional, default: 1024
# top_p: optional, default: 1
# frequency_penalty: optional, default: 0
# presence_penalty: optional, default: 0
# image_url in messages: optional (multimodal input)

response = requests.post(url, headers=headers, json=payload)
print(response.json())
// Required: model, messages
const response = await fetch("https://api.haftominhonar.ir/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer aifo_sk_live_YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "model": "anthropic/claude-haiku-4.5",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "تصویری از یک منظره زیبا ارسال کنید و بپرسید: \"این تصویر چه احساسی را در شما برمی‌انگیزد؟\""
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/image.jpg"
          }
        }
      ]
    }
  ],
  "temperature": 1,
  "max_tokens": 1024,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0
}),
});


# Optional gateway parameters:
# temperature: optional, default: 1
# max_tokens: optional, default: 1024
# top_p: optional, default: 1
# frequency_penalty: optional, default: 0
# presence_penalty: optional, default: 0
# image_url in messages: optional (multimodal input)

const data = await response.json();
console.log(data);
import axios from "axios";

// Required: model, messages
const { data } = await axios.post(
  "https://api.haftominhonar.ir/v1/chat/completions",
  {
  "model": "anthropic/claude-haiku-4.5",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "تصویری از یک منظره زیبا ارسال کنید و بپرسید: \"این تصویر چه احساسی را در شما برمی‌انگیزد؟\""
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/image.jpg"
          }
        }
      ]
    }
  ],
  "temperature": 1,
  "max_tokens": 1024,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0
},
  {
    headers: {
      Authorization: "Bearer aifo_sk_live_YOUR_API_KEY",
      "Content-Type": "application/json",
    },
  },
);


# Optional gateway parameters:
# temperature: optional, default: 1
# max_tokens: optional, default: 1024
# top_p: optional, default: 1
# frequency_penalty: optional, default: 0
# presence_penalty: optional, default: 0
# image_url in messages: optional (multimodal input)

console.log(data);

پارامترها

ورودی‌ها — text/image

پارامترها

نام نوع الزامی/اختیاری پیش‌فرض توضیح
temperature number اختیاری 1 کنترل تنوع پاسخ‌ها
max_tokens number اختیاری 1024 حداکثر تعداد توکن‌های خروجی
top_p number اختیاری 1 نمونه‌گیری بر اساس توزیع احتمال
frequency_penalty number اختیاری 0 جریمه تکرار در پاسخ‌ها
presence_penalty number اختیاری 0 جریمه حضور در پاسخ‌ها

محدودیت‌ها و نکات

  • هزینه استفاده بر اساس تعداد توکن‌ها محاسبه می‌شود
  • ورودی صوتی پشتیبانی نمی‌شود
  • مدل فقط خروجی متنی تولید می‌کند

FAQ

هزینه استفاده از این API چگونه محاسبه می‌شود؟

هزینه بر اساس تعداد توکن‌های ورودی و خروجی محاسبه می‌شود.

آیا می‌توان از این API برای پردازش صوت استفاده کرد؟

خیر، این API از ورودی صوتی پشتیبانی نمی‌کند.

چگونه می‌توان به این API از طریق AiFO دسترسی داشت؟

با استفاده از کلید ارائه‌دهنده و اتصال به AiFO می‌توانید به این API دسترسی پیدا کنید.

مدل‌های مرتبط