gpt-4o-mini-search-preview
Model Overview
A specialized model trained to understand and execute web search queries with the Chat completions API.
How to Make a Call
API Schema
post
Body
modelstring · enumRequiredPossible values:
max_tokensnumber · min: 1Optional
The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
streambooleanOptionalDefault:
If set to True, the model response data will be streamed to the client as it is generated using server-sent events.
falseResponses
200Success
post
/v1/chat/completionsasync function main() {
const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'gpt-4o-mini-search-preview',
messages:[
{
role:'user',
content: 'Hello'
}
],
}),
});
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
}
main();200Success
{
"id": "text",
"object": "text",
"created": 1,
"choices": [
{
"index": 1,
"message": {
"role": "text",
"content": "text",
"refusal": null,
"annotations": [
{
"type": "text",
"url_citation": {
"end_index": 1,
"start_index": 1,
"title": "text",
"url": "text"
}
}
],
"audio": {
"id": "text",
"data": "text",
"transcript": "text",
"expires_at": 1
},
"tool_calls": [
{
"id": "text",
"type": "text",
"function": {
"arguments": "text",
"name": "text"
}
}
]
},
"finish_reason": "stop",
"logprobs": {
"content": [
{
"bytes": [
1
],
"logprob": 1,
"token": "text",
"top_logprobs": [
{
"bytes": [
1
],
"logprob": 1,
"token": "text"
}
]
}
],
"refusal": []
}
}
],
"model": "text",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1,
"completion_tokens_details": {
"accepted_prediction_tokens": 1,
"audio_tokens": 1,
"reasoning_tokens": 1,
"rejected_prediction_tokens": 1
},
"prompt_tokens_details": {
"audio_tokens": 1,
"cached_tokens": 1
}
}
}Code Example
import requests
import json # for getting a structured output with indentation
response = requests.post(
"https://api.aimlapi.com/v1/chat/completions",
headers={
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
"Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
"Content-Type":"application/json"
},
json={
"model":"gpt-4o-mini-search-preview",
"messages":[
{
"role":"user",
"content":"Hello" # insert your prompt here, instead of Hello
}
]
}
)
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))async function main() {
const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {
method: 'POST',
headers: {
// insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'gpt-4o-mini-search-preview',
messages:[
{
role:'user',
content: 'Hello' // insert your prompt here, instead of Hello
}
],
}),
});
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
}
main();Last updated
Was this helpful?