Gemini / ChatGPT / Claude APIでの戻り値の例

各API にそれぞれ「こんにちは」のメッセージを投げた時の戻り値です

● Gemini

{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "こんにちは! 何かお手伝いできることはありますか? \n"
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 0,
      "safetyRatings": [
        {
          "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_HATE_SPEECH",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_HARASSMENT",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
          "probability": "NEGLIGIBLE"
        }
      ]
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 2,
    "candidatesTokenCount": 11,
    "totalTokenCount": 13
  },
  "modelVersion": "gemini-1.5-flash-001"
}

● ChatGPT

{
    "id": "chatcmpl-ATdccrP607V8JZQgryBdx72k0FD85",
    "object": "chat.completion",
    "created": 1731627182,
    "model": "gpt-4o-mini-2024-07-18",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "こんにちは!今日はどんなことをお話ししましょうか?",
                "refusal": null
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 8,
        "completion_tokens": 14,
        "total_tokens": 22,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "audio_tokens": 0
        },
        "completion_tokens_details": {
            "reasoning_tokens": 0,
            "audio_tokens": 0,
            "accepted_prediction_tokens": 0,
            "rejected_prediction_tokens": 0
        }
    },
    "system_fingerprint": "fp_0ba0d124f1"
}

● Claude

{
    "id": "msg_01BfFT8n2WeqqB47em3zig7x",
    "type": "message",
    "role": "assistant",
    "model": "claude-3-haiku-20240307",
    "content": [
        {
            "type": "text",
            "text": "はい、こんにちは。どのようなことでお手伝いできますでしょうか?"
        }
    ],
    "stop_reason": "end_turn",
    "stop_sequence": null,
    "usage": {
        "input_tokens": 12,
        "output_tokens": 31
    }
}
No.2569
11/15 08:36

edit