텍스트
응답 생성
OpenAI Responses API 형식을 사용하여 응답을 생성합니다
모델 상세의 accepted_request_formats에 openai_responses가 포함되어 있으면 이 엔드포인트를 사용할 수 있습니다. 요청과 응답은 Responses API 형식을 사용합니다. 선택 필드와 지원 값은 모델에 따라 다릅니다.
요청 본문
사용할 모델의 ID입니다. 사용 가능한 옵션은 Models을 참조하세요.
재사용 가능한 prompt를 사용하거나 previous_response_id로 저장된 응답을 이어갈 때는 input을 생략할 수 있습니다.
대화를 구성하는 입력 항목들의 목록입니다.
각 항목은 다음 중 하나일 수 있습니다:
message: 역할과 내용을 가진 대화 메시지function_call: 함수 호출 요청function_call_output: 함수 호출의 출력
멀티모달 입력의 경우, message.content는 일반 문자열이거나 콘텐츠 블록의 배열일 수 있습니다. GPT-5.6 Terra 계열과 같이 이미지 지원 모델의 경우, URL이나 Base64 문자열을 일반 텍스트에 직접 포함시키지 말고 이미지를 input_image 블록으로 전달하세요.
예시 콘텐츠 블록:
{ "type": "input_text", "text": "Describe this image" }{ "type": "input_image", "image_url": "https://example.com/image.jpg" }{ "type": "input_image", "image_url": "data:image/png;base64,..." }
모델에 대한 시스템 지침(시스템 메시지와 동일).
생성할 최대 토큰 수입니다.
샘플링 온도입니다. 지원 값과 기본값은 선택한 모델에 따라 다릅니다.
모델이 호출할 수 있는 도구입니다. 지원 유형과 조합은 선택한 모델에 따라 다릅니다.
falsetrue이면 이벤트 스트림을 반환합니다.
대화를 이어갈 이전 응답의 ID입니다.
true나중에 검색하기 위해 응답을 저장할지 여부입니다.
false비동기 실행을 요청합니다. 지원 여부는 선택한 모델에 따라 다릅니다.
재사용 가능한 프롬프트 템플릿과 변수에 대한 참조입니다.
추적 목적으로 응답에 첨부할 메타데이터입니다.
텍스트 출력 설정입니다. text.format 지원 여부는 선택한 모델에 따라 다릅니다.
true여러 도구 호출을 병렬로 허용할지 여부입니다.
Nucleus 샘플링 매개변수 (0-1).
effort를 포함한 추론 옵션은 선택한 모델에 따라 다릅니다.
응답
응답의 고유 식별자입니다.
항상 response입니다.
응답이 생성된 Unix 타임스탬프입니다.
응답 상태: queued, in_progress, completed, incomplete, failed, cancelled. HTTP 요청이 성공해도 이 필드를 확인하세요.
모델이 생성한 출력 항목들의 목록입니다.
토큰 사용 통계입니다.
관련 엔드포인트
GET /v1/responses/{id}저장된 응답을 조회하며include,include_obfuscation,stream,starting_after를 지원합니다.DELETE /v1/responses/{id}저장된 응답을 삭제합니다. 생성을 취소하지는 않습니다.POST /v1/responses/compactresponse.compaction객체를 반환합니다.- 취소, input-items, input-tokens 엔드포인트는 현재 제공되지 않습니다.
요청
curl -X POST "https://api.tokenlab.sh/v1/responses" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"input": [
{"type": "message", "role": "user", "content": "Hello!"}
],
"max_output_tokens": 1000
}'from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.tokenlab.sh/v1"
)
response = client.responses.create(
model="gpt-5.6-terra",
input=[
{"type": "message", "role": "user", "content": "Hello!"}
],
max_output_tokens=1000
)
print(response.output)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-your-api-key',
baseURL: 'https://api.tokenlab.sh/v1'
});
const response = await client.responses.create({
model: 'gpt-5.6-terra',
input: [
{ type: 'message', role: 'user', content: 'Hello!' }
],
max_output_tokens: 1000
});
console.log(response.output);package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
payload := map[string]interface{}{
"model": "gpt-5.6-terra",
"input": []map[string]interface{}{
{"type": "message", "role": "user", "content": "Hello!"},
},
"max_output_tokens": 1000,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.tokenlab.sh/v1/responses", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer sk-your-api-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["output"])
}<?php
$ch = curl_init('https://api.tokenlab.sh/v1/responses');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer sk-your-api-key'
],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-5.6-terra',
'input' => [
['type' => 'message', 'role' => 'user', 'content' => 'Hello!']
],
'max_output_tokens' => 1000
])
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data['output']);비전 입력 예시
이미지 지원 모델을 사용하려면 이미지를 message.content 안에 input_image 블록으로 넣으세요. image_url 값은 공개 URL이거나 Base64 데이터 URL일 수 있습니다.
{
"model": "gpt-5.6-terra",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "Please describe this image."
},
{
"type": "input_image",
"image_url": "https://example.com/demo.jpg"
}
]
}
]
}{
"model": "gpt-5.6-terra",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "Please describe this image."
},
{
"type": "input_image",
"image_url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..."
}
]
}
]
}응답
{
"id": "resp_abc123",
"object": "response",
"created_at": 1706000000,
"status": "completed",
"model": "gpt-5.6-terra",
"output": [
{
"id": "msg_abc123",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}
]
}
],
"usage": {
"input_tokens": 10,
"output_tokens": 12,
"total_tokens": 22
}
}인증
BearerAuth API 키 인증입니다. Dashboard > API > API Keys에서 API 키를 생성하거나 관리하십시오.
위치: header
헤더
요청별 전송 정책입니다. API 키 및 Workspace 기본값을 재정의합니다. 자동으로 TokenLab Verified를 먼저 시도하며, 출력, 요청 수락 또는 영구 리소스 생성 전에 Official 전용으로 한 번 전환될 수 있습니다.
허용 값
- "auto"
- "verified"
- "official"
요청 본문
application/json
응답
application/json
application/json
application/json