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

Documentation Index

Fetch the complete documentation index at: https://docs.apigo.ai/llms.txt

Use this file to discover all available pages before exploring further.

推奨エンドポイント

最低限のお願い

{
  "model": "gpt-4.1",
  "input": "Extract order fields.",
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "order",
      "schema": {
        "type": "object",
        "properties": {
          "order_id": { "type": "string" },
          "amount": { "type": "number" }
        },
        "required": ["order_id", "amount"],
        "additionalProperties": false
      }
    }
  }
}

cURLの例

curl https://maas.apigo.ai/v1/responses \
  -H "Authorization: Bearer $YOUR API KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1",
    "input": "Extract order fields.",
    "response_format": {
      "type": "json_schema",
      "json_schema": {
        "name": "order",
        "schema": {
          "type": "object",
          "properties": {
            "order_id": { "type": "string" },
            "amount": { "type": "number" }
          },
          "required": ["order_id", "amount"],
          "additionalProperties": false
        }
      }
    }
  }'

Python の例

from openai import OpenAI

client = OpenAI(
    base_url="https://maas.apigo.ai/v1",
    api_key="<YOUR API KEY>",
)

response = client.responses.create(
    model="gpt-4.1",
    input="Extract order fields.",
    response_format={
        "type": "json_schema",
        "json_schema": {
            "name": "order",
            "schema": {
                "type": "object",
                "properties": {
                    "order_id": {"type": "string"},
                    "amount": {"type": "number"},
                },
                "required": ["order_id", "amount"],
                "additionalProperties": False,
            },
        },
    },
)

print(response.output_text)

Node.js の例

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://maas.apigo.ai/v1",
  apiKey: process.env.YOUR API KEY,
});

const response = await client.responses.create({
  model: "gpt-4.1",
  input: "Extract order fields.",
  response_format: {
    type: "json_schema",
    json_schema: {
      name: "order",
      schema: {
        type: "object",
        properties: {
          order_id: { type: "string" },
          amount: { type: "number" }
        },
        required: ["order_id", "amount"],
        additionalProperties: false
      }
    }
  }
});

console.log(response.output_text);

ベストプラクティス

  • スキーマを小さく厳密に保つ
  • オブジェクトに additionalProperties: false を設定する
  • モデルがスキーマに従っている場合でも、最終ペイロードをサーバー側で検証します。