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.
이 페이지에는 HTTP 엔드포인트 참고 사항과 직접 cURL, Python 및 Node.js 요청 예제만 포함되어 있습니다.
엔드포인트 요약
| Endpoint | Summary |
|---|
POST /v1/chat/completions | 다중 턴 대화, 도구 호출 및 선택적 스트리밍을 위한 표준 채팅 완료 엔드포인트입니다. |
POST /v1/responses | 구조화된 출력, 다중 모드 입력 및 향후 기능 확장을 위한 최신 통합 응답 엔드포인트입니다. |
POST /v1/chat/completions
다중 턴 대화, 도구 호출 및 선택적 스트리밍을 위한 표준 채팅 완료 엔드포인트입니다.
요청사항
- 권한 부여로 인증: Bearer ; 핵심 페이로드 필드는 모델과 메시지입니다.
- 메시지는 시스템, 사용자 및 보조자 기록을 순서대로 보존해야 합니다. SSE 출력에 대해 stream=true를 추가하십시오.
- OpenAI 호환 게이트웨이의 경우 이는 일반적으로 시작하기에 가장 안전한 기본 텍스트 엔드포인트입니다.
응답 메모
- 동기 출력은 일반적으로 choice[0].message.content에서 읽습니다.
- 도구 호출이 활성화되면 tool_calls와 후속 도구 교환을 함께 처리합니다.
- 스트리밍 모드는 하나의 완전한 JSON 응답이 아닌 SSE 청크를 반환합니다.
Examples
cURL
chat.completions
curl --request POST \
--url https://api.tokenops.ai/v1/chat/completions \
--header 'Authorization: Bearer ${YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4.1-mini",
"messages": [
{ "role": "system", "content": "You are a concise API assistant." },
{ "role": "user", "content": "Give me a contact form field definition." }
]
}'
Python
requests
import requests
response = requests.post(
'https://api.tokenops.ai/v1/chat/completions',
headers={
'Authorization': 'Bearer ${YOUR_API_KEY}',
'Content-Type': 'application/json'
},
json={
'model': 'gpt-4.1-mini',
'messages': [
{'role': 'system', 'content': 'You are a concise API assistant.'},
{'role': 'user', 'content': 'Give me a contact form field definition.'}
]
},
timeout=60
)
print(response.json())
Node.js
fetch
const response = await fetch('https://api.tokenops.ai/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer ${YOUR_API_KEY}',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-4.1-mini',
messages: [
{ role: 'system', content: 'You are a concise API assistant.' },
{ role: 'user', content: 'Give me a contact form field definition.' }
]
})
})
console.log(await response.json())
응답 예시(200)
response
{
"id": "chatcmpl_123",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "{\"name\":\"email\",\"type\":\"string\"}"
}
}
]
}
POST /v1/responses
구조화된 출력, 다중 모드 입력 및 향후 기능 확장을 위한 최신 통합 응답 엔드포인트입니다.
요청사항
- 여전히 Bearer 인증을 사용하지만 기본 페이로드 형태는 메시지보다는 입력 및 지침에 중점을 둡니다.
- 텍스트 및 구조화된 출력에 대해 하나의 끝점 모양을 원하는 경우 레거시 chat.completions보다 이를 선호합니다.
- 최신 응답 형식과 다중 모드 기능은 일반적으로 여기에 먼저 표시됩니다.
응답 메모
- 소비자는 일반적으로Choices[0].message 대신output[] 또는output_text에서 읽습니다.
- 워크플로가 비동기식이거나 도구 기반이 되면 일반적으로 이 끝점은 더 풍부한 상태 필드를 노출합니다.
- 마이그레이션 작업에는 필드 매핑, 재시도 및 서버 측 로깅이 포함되어야 합니다.
Examples
cURL
responses
curl --request POST \
--url https://api.tokenops.ai/v1/responses \
--header 'Authorization: Bearer ${YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4.1-mini",
"input": "Return a JSON contact form field definition."
}'
Python
requests
import requests
response = requests.post(
'https://api.tokenops.ai/v1/responses',
headers={
'Authorization': 'Bearer ${YOUR_API_KEY}',
'Content-Type': 'application/json'
},
json={
'model': 'gpt-4.1-mini',
'input': 'Return a JSON contact form field definition.'
},
timeout=60
)
print(response.json())
Node.js
fetch
const response = await fetch('https://api.tokenops.ai/v1/responses', {
method: 'POST',
headers: {
Authorization: 'Bearer ${YOUR_API_KEY}',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-4.1-mini',
input: 'Return a JSON contact form field definition.'
})
})
console.log(await response.json())
응답 예시(200)
response
{
"id": "resp_123",
"status": "completed",
"output": [
{
"type": "output_text",
"text": "{\"name\":\"email\",\"type\":\"string\"}"
}
]
}