メインコンテンツへスキップ

クイック統合

30以上の主要AIサービスプロバイダーにワンクリック接続 コード不要の移行 · インテリジェントルーティング · コスト最適化

コアコンセプト

EvoLink は非同期タスクアーキテクチャを採用しており、すべてのAIサービスはタスクとして処理されます:

タスク送信

リクエストを送信し、即座にタスクIDを取得

リアルタイム監視

進捗を照会し、ステータス更新を取得

結果取得

タスク完了後に最終結果を取得

前提条件

APIキーの取得

1

アカウント登録

EvoLink コンソールにアクセスして登録を完了してください
2

キーの作成

API管理ページに移動し、「新しいキー」をクリックしてください
3

キーの保存

生成されたAPIキーをコピーしてください(形式:sk-evo-xxxxxxxxxx
APIキーにはアカウントの全権限があります。安全に保管してください。漏洩した場合は、直ちにリセットしてください。

30秒で体験

画像生成の例

# 画像生成タスクを送信
curl -X POST https://api.evolink.ai/v1/images/generations \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -H "Content-Type: application/json" \\
  -d '{
    "model": "gpt-4o-image",
    "prompt": "A cute cat running on the grass at sunset with warm lighting"
  }'
即時レスポンス - タスク作成完了
{
  "created": 1757156493,
  "id": "task-unified-1757156493-imcg5zqt",
  "model": "gpt-4o-image",
  "object": "image.generation.task",
  "progress": 0,
  "status": "pending",
  "task_info": {
    "can_cancel": true,
    "estimated_time": 100
  },
  "type": "image",
  "usage": {
    "billing_rule": "per_call",
    "credits_reserved": 252,
    "estimated_cost": 0.252,
    "user_group": "default"
  }
}

タスクステータスの照会

# 返されたタスクIDを使用してステータスを照会
curl https://api.evolink.ai/v1/tasks/task-unified-1757156493-imcg5zqt \\
  -H "Authorization: Bearer YOUR_API_KEY"
タスク完了後のレスポンス
{
  "created": 1757156493,
  "id": "task-unified-1757156493-imcg5zqt",
  "model": "gpt-4o-image",
  "object": "image.generation.task",
  "progress": 100,
  "results": [
    "https://tempfile.aiquickdraw.com/s/generated_image_url.png"
  ],
  "status": "completed",
  "task_info": {
    "can_cancel": false
  },
  "type": "image"
}

マルチモーダルAI機能

🎨 画像生成

import requests

# GPT-4O Image 画像生成
response = requests.post(
    "https://api.evolink.ai/v1/images/generations",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "model": "gpt-4o-image",
        "prompt": "A beautiful sunset over the ocean with vibrant colors",
        "size": "1024x1024",
        "n": 1
    }
)

task = response.json()
print(f"Task ID: {task['id']}")
print(f"Estimated time: {task['task_info']['estimated_time']} seconds")

🎬 動画生成

import requests
import time

# Veo3-Fast 動画生成
def generate_video():
    # 動画生成タスクを送信
    response = requests.post(
        "https://api.evolink.ai/v1/videos/generations",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={
            "model": "veo3-fast",
            "prompt": "A cat chasing butterflies in the garden, slow motion",
            "aspect_ratio": "16:9"
        }
    )

    task = response.json()
    task_id = task['id']

    print(f"動画タスク作成完了: {task_id}")
    print(f"推定完了時間: {task['task_info']['estimated_time']} 秒")
    print(f"推定コスト: ${task['usage']['estimated_cost']}")

    return task_id

# タスク進捗の監視
def monitor_task(task_id):
    while True:
        response = requests.get(
            f"https://api.evolink.ai/v1/tasks/{task_id}",
            headers={"Authorization": "Bearer YOUR_API_KEY"}
        )

        task = response.json()
        status = task['status']
        progress = task['progress']

        print(f"Status: {status}, Progress: {progress}%")

        if status == "completed":
            return task['results'][0]  # results配列内の動画URL
        elif status == "failed":
            raise Exception(f"Task failed: {task.get('error')}")

        time.sleep(10)  # 10秒ごとに照会

# 使用例
task_id = generate_video()
video_url = monitor_task(task_id)
print(f"動画生成完了: {video_url}")

SDK クイック統合

Python SDK

import openai
import requests

class EvoLinkClient:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = "https://api.evolink.ai"
        self.headers = {"Authorization": f"Bearer {api_key}"}

    def create_image(self, model, prompt, **kwargs):
        """画像生成タスクを作成"""
        response = requests.post(
            f"{self.base_url}/v1/images/generations",
            headers=self.headers,
            json={"model": model, "prompt": prompt, **kwargs}
        )
        return response.json()

    def create_video(self, model, prompt, **kwargs):
        """動画生成タスクを作成"""
        response = requests.post(
            f"{self.base_url}/v1/videos/generations",
            headers=self.headers,
            json={"model": model, "prompt": prompt, **kwargs}
        )
        return response.json()

    def get_task(self, task_id):
        """タスクステータスを取得"""
        response = requests.get(
            f"{self.base_url}/v1/tasks/{task_id}",
            headers=self.headers
        )
        return response.json()

    def wait_for_completion(self, task_id, timeout=300):
        """タスク完了を待機"""
        import time
        start_time = time.time()

        while time.time() - start_time < timeout:
            task = self.get_task(task_id)

            if task['status'] == 'completed':
                return task
            elif task['status'] == 'failed':
                raise Exception(f"Task failed: {task.get('error')}")

            time.sleep(5)

        raise TimeoutError("タスク実行タイムアウト")

# 使用例
client = EvoLinkClient("YOUR_API_KEY")

# 画像を生成
task = client.create_image(
    model="gpt-4o-image",
    prompt="A modern intelligent office building"
)

result = client.wait_for_completion(task['id'])
print(f"Image URL: {result['results'][0]}")

JavaScript/Node.js

class EvoLinkClient {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseURL = 'https://api.evolink.ai';
  }

  async createImage(model, prompt, options = {}) {
    const response = await fetch(`${this.baseURL}/v1/images/generations`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ model, prompt, ...options })
    });

    return response.json();
  }

  async getTask(taskId) {
    const response = await fetch(`${this.baseURL}/v1/tasks/${taskId}`, {
      headers: { 'Authorization': `Bearer ${this.apiKey}` }
    });

    return response.json();
  }

  async waitForCompletion(taskId, timeout = 300000) {
    const startTime = Date.now();

    while (Date.now() - startTime < timeout) {
      const task = await this.getTask(taskId);

      if (task.status === 'completed') {
        return task;
      } else if (task.status === 'failed') {
        throw new Error(`Task failed: ${task.error}`);
      }

      await new Promise(resolve => setTimeout(resolve, 5000));
    }

    throw new Error('タスク実行タイムアウト');
  }
}

// 使用例
async function generateImage() {
  const client = new EvoLinkClient('YOUR_API_KEY');

  try {
    // タスクを作成
    const task = await client.createImage(
      'doubao-seedream-4.0',
      'An abstract art painting with rich colors'
    );

    console.log('タスク作成完了:', task.id);

    // 完了を待機
    const result = await client.waitForCompletion(task.id);
    console.log('画像生成完了:', result.results[0]);

  } catch (error) {
    console.error('生成失敗:', error.message);
  }
}

generateImage();

本番環境のベストプラクティス

エラーハンドリング戦略

import requests
from typing import Optional
import time

class EvoLinkError(Exception):
    """EvoLink API 例外基底クラス"""
    pass

class RateLimitError(EvoLinkError):
    """レート制限例外"""
    pass

class QuotaExhaustedError(EvoLinkError):
    """クォータ枯渇例外"""
    pass

def handle_api_call(func, *args, **kwargs):
    """統一API呼び出しエラーハンドリング"""
    max_retries = 3
    retry_delay = 1

    for attempt in range(max_retries):
        try:
            response = func(*args, **kwargs)

            if response.status_code == 200:
                return response.json()
            elif response.status_code == 429:
                # レート制限、待機してリトライ
                wait_time = int(response.headers.get('Retry-After', retry_delay))
                print(f"レート制限に達しました。{wait_time}秒後にリトライします...")
                time.sleep(wait_time)
                retry_delay *= 2
                continue
            elif response.status_code == 402:
                raise QuotaExhaustedError("アカウント残高不足です。チャージしてください")
            else:
                error_data = response.json()
                raise EvoLinkError(f"API呼び出し失敗: {error_data.get('error', {}).get('message')}")

        except requests.exceptions.RequestException as e:
            if attempt == max_retries - 1:
                raise EvoLinkError(f"ネットワークリクエスト失敗: {str(e)}")
            time.sleep(retry_delay)
            retry_delay *= 2

    raise EvoLinkError("最大リトライ回数に達しました")

# 使用例
try:
    result = handle_api_call(
        requests.post,
        "https://api.evolink.ai/v1/images/generations",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={"model": "gpt-4o-image", "prompt": "Test image"}
    )
    print("タスク作成成功:", result['id'])
except QuotaExhaustedError:
    print("コンソールでチャージしてください: https://evolink.ai/dashboard/billing")
except EvoLinkError as e:
    print(f"API呼び出し例外: {e}")

パフォーマンス最適化のヒント

import asyncio
import aiohttp

async def create_task_async(session, model, prompt):
    """非同期タスク作成"""
    async with session.post(
        "https://api.evolink.ai/v1/images/generations",
        json={"model": model, "prompt": prompt}
    ) as response:
        return await response.json()

async def batch_generate_images(prompts, model="gpt-4o-image"):
    """バッチ画像生成"""
    headers = {"Authorization": "Bearer YOUR_API_KEY"}

    async with aiohttp.ClientSession(headers=headers) as session:
        # すべてのタスクを同時に作成
        tasks = [
            create_task_async(session, model, prompt)
            for prompt in prompts
        ]
        results = await asyncio.gather(*tasks)

        # タスクIDリストを返す
        return [result['id'] for result in results]

# 使用例
prompts = [
    "Modern office design",
    "Natural landscape painting",
    "Abstract artwork",
    "Tech-style UI interface"
]

task_ids = asyncio.run(batch_generate_images(prompts))
print(f"{len(task_ids)} 件のタスクを作成しました")

モニタリングと分析

使用状況モニタリング

EvoLink コンソールにアクセスしてリアルタイムで確認:

リアルタイムモニタリング

  • API呼び出し統計
  • 成功率とエラー率
  • レスポンスタイム分析
  • 同時リクエスト監視

コスト分析

  • モデル別コスト分布
  • 日次/月次使用トレンド
  • コスト予測とアラート
  • クォータ使用状況

カスタムモニタリング

import logging
from datetime import datetime

class EvoLinkMonitor:
    def __init__(self):
        # ロギング設定
        logging.basicConfig(
            level=logging.INFO,
            format='%(asctime)s - %(levelname)s - %(message)s',
            handlers=[
                logging.FileHandler('evolink_api.log'),
                logging.StreamHandler()
            ]
        )
        self.logger = logging.getLogger(__name__)

    def log_task_creation(self, task_id, model, cost):
        """タスク作成をログ記録"""
        self.logger.info(f"Task created | ID:{task_id} | Model:{model} | Cost:${cost}")

    def log_task_completion(self, task_id, duration, status):
        """タスク完了をログ記録"""
        self.logger.info(f"Task completed | ID:{task_id} | Duration:{duration}s | Status:{status}")

    def log_error(self, error, context=""):
        """エラーをログ記録"""
        self.logger.error(f"API error | {context} | {str(error)}")

# 使用例
monitor = EvoLinkMonitor()

# API呼び出しで使用
start_time = time.time()
try:
    task = client.create_image("gpt-4o-image", "Test prompt")
    monitor.log_task_creation(
        task['id'],
        task['model'],
        task['usage']['estimated_cost']
    )

    result = client.wait_for_completion(task['id'])
    duration = time.time() - start_time
    monitor.log_task_completion(task['id'], int(duration), "completed")

except Exception as e:
    monitor.log_error(e, f"Task ID: {task.get('id', 'unknown')}")

ベストプラクティスまとめ

開発に関する推奨事項

  • 常にエラーハンドリングを実装する
  • 非同期プログラミングで効率を向上させる
  • 適切なタイムアウト値を設定する
  • 詳細な呼び出し情報をログに記録する

パフォーマンス最適化

  • バッチ処理でネットワークオーバーヘッドを削減
  • タスクプールで並行処理を管理
  • APIクォータの使用状況を監視
  • 頻繁に使用する結果をキャッシュ

セキュリティに関する考慮事項

  • APIキーを安全に保管
  • 環境変数で設定を管理
  • アクセスキーを定期的にローテーション
  • 異常な呼び出し動作を監視

コスト管理

  • 適切な予算上限を設定
  • 適切なモデルを選択
  • プロンプトの長さを最適化
  • 使用トレンドを監視

始める準備はできましたか?

今すぐAIクリエイションの旅を始めましょうお困りですか? 技術チームがいつでも専門的なサポートを提供いたします