엔드포인트
웹 검색
모델 ID 뒤에 :online을 붙이거나 web 플러그인, web_search_options를 써서 실시간 웹 결과와 URL 인용을 컨텍스트에 더하는 방법과 응답 구조, 검색 요금 계산, 오류를 설명합니다. 세 가지 방식을 각각 소개합니다.
플레이그라운드에서 사용해 보기웹 검색은 실시간 웹 결과를 모델의 컨텍스트에 추가하고 URL 인용을 반환합니다. 모든 텍스트 모델에서 세 가지 방법으로 켤 수 있습니다.
1. :online 변형
모든 모델 ID에 :online을 붙이세요.
{ "model": "openai/gpt-5-mini:online", "messages": [{ "role": "user", "content": "What happened in AI this week?" }] }
:online은 기본 모델과 같은 가격, 키 허용 목록, 요금제 규칙을 사용합니다. 모델 ID를 참고하세요.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.chat.completions.create({
"model": "openai/gpt-5-mini:online",
"messages": [
{
"role": "user",
"content": "What are the latest AI model releases this week?"
}
]
});
console.log(result.choices[0].message.content);
2. web 플러그인
플러그인으로 검색을 세부적으로 제어할 수 있습니다.
{
"model": "anthropic/claude-sonnet-4.5",
"messages": [{ "role": "user", "content": "Latest stable Node.js version?" }],
"plugins": [
{ "id": "web", "max_results": 5, "engine": "exa", "search_prompt": "Use these sources:" }
]
}
| 필드 | 타입 | 설명 |
|---|---|---|
plugins[].id | string | "web" |
max_results | integer | 삽입할 결과 수(기본값 5). |
engine | string | "native"(가능한 경우 제공자 자체 검색) 또는 "exa". 생략하면 가능한 경우 native를, 아니면 Exa를 사용합니다. |
search_prompt | string | 삽입된 결과 앞에 놓이는 텍스트. |
3. web_search_options
기본 검색을 지원하는 모델을 위한 OpenAI 스타일 옵션입니다.
{
"model": "openai/gpt-4o-search-preview",
"messages": [{ "role": "user", "content": "Who won yesterday's match?" }],
"web_search_options": { "search_context_size": "high" }
}
search_context_size는 "low", "medium", "high" 중 하나입니다. 가져오는 검색 콘텐츠의 양과 가격을 결정합니다.
응답
인용은 메시지의 annotations로 반환됩니다.
{
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "The latest LTS release is ... [nodejs.org](https://nodejs.org/en/blog)",
"annotations": [
{
"type": "url_citation",
"url_citation": { "url": "https://nodejs.org/en/blog", "title": "Node.js Blog", "start_index": 25, "end_index": 60, "content": "..." }
}
]
}
}
],
"usage": { "prompt_tokens": 2410, "completion_tokens": 85, "total_tokens": 2495, "cost": 0.02061 }
}
가격
토큰 외에 검색에도 별도 가격이 있습니다. Exa는 결과당, 기본 검색은 모델의 web_search 가격에 따라 요청당 과금됩니다. 검색 결과도 입력 토큰으로 계산됩니다. 모두 usage.cost에 포함되어 USD로 차감됩니다. 요금 및 결제를 참고하세요.
오류
Chat completions와 같습니다. 오류를 참고하세요.