메인 콘텐츠로 건너뛰기

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
        }
      }
    }
  }'

파이썬 예제

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 설정
  • 모델이 스키마를 잘 따르는 경우에도 서버 측에서 최종 페이로드를 검증합니다.