AI/ML API Documentation
API KeyModelsPlaygroundGitHubGet Support
  • 📞Contact Sales
  • 🗯️Send Feedback
  • Quickstart
    • 🧭Documentation Map
    • Setting Up
    • Supported SDKs
  • API REFERENCES
    • 📒All Model IDs
    • Text Models (LLM)
      • AI21 Labs
        • jamba-1-5-mini
      • Alibaba Cloud
        • qwen-max
        • qwen-plus
        • qwen-turbo
        • Qwen2-72B-Instruct
        • Qwen2.5-7B-Instruct-Turbo
        • Qwen2.5-72B-Instruct-Turbo
        • Qwen2.5-Coder-32B-Instruct
        • Qwen-QwQ-32B
        • Qwen3-235B-A22B
      • Anthracite
        • magnum-v4
      • Anthropic
        • Claude 3 Haiku
        • Claude 3.5 Haiku
        • Claude 3 Opus
        • Claude 3 Sonnet
        • Claude 3.5 Sonnet
        • Claude 3.7 Sonnet
      • Cohere
        • command-r-plus
      • DeepSeek
        • DeepSeek V3
        • DeepSeek R1
      • Google
        • gemini-1.5-flash
        • gemini-1.5-pro
        • gemini-2.0-flash-exp
        • gemini-2.0-flash-thinking-exp-01-21
        • gemini-2.0-flash
        • gemini-2.5-flash-preview
        • gemini-2.5-pro-exp
        • gemini-2.5-pro-preview
        • gemma-2
        • gemma-3
      • Gryphe
        • MythoMax-L2-13b-Lite
      • Meta
        • Llama-3-chat-hf
        • Llama-3-8B-Instruct-Lite
        • Llama-3.1-8B-Instruct-Turbo
        • Llama-3.1-70B-Instruct-Turbo
        • Llama-3.1-405B-Instruct-Turbo
        • Llama-3.2-11B-Vision-Instruct-Turbo
        • Llama-3.2-90B-Vision-Instruct-Turbo
        • Llama-Vision-Free
        • Llama-3.2-3B-Instruct-Turbo
        • Llama-3.3-70B-Instruct-Turbo
        • Llama-4-scout
        • Llama-4-maverick
      • MiniMax
        • text-01
        • abab6.5s-chat
      • Mistral AI
        • codestral-2501
        • mistral-nemo
        • mistral-tiny
        • Mistral-7B-Instruct
        • Mixtral-8x22B-Instruct
        • Mixtral-8x7B-Instruct
      • NVIDIA
        • Llama-3.1-Nemotron-70B-Instruct-HF
        • llama-3.1-nemotron-70b
      • NeverSleep
        • llama-3.1-lumimaid
      • NousResearch
        • Nous-Hermes-2-Mixtral-8x7B-DPO
      • OpenAI
        • gpt-3.5-turbo
        • gpt-4
        • gpt-4-preview
        • gpt-4-turbo
        • gpt-4o
        • gpt-4o-mini
        • gpt-4o-audio-preview
        • gpt-4o-mini-audio-preview
        • gpt-4o-search-preview
        • gpt-4o-mini-search-preview
        • o1
        • o1-mini
        • o1-preview
        • o3-mini
        • gpt-4.5-preview
        • gpt-4.1
        • gpt-4.1-mini
        • gpt-4.1-nano
        • o4-mini
      • xAI
        • grok-beta
        • grok-3-beta
        • grok-3-mini-beta
    • Image Models
      • Flux
        • flux-pro
        • flux-pro/v1.1
        • flux-pro/v1.1-ultra
        • flux-realism
        • flux/dev
        • flux/dev/image-to-image
        • flux/schnell
      • Google
        • Imagen 3.0
      • OpenAI
        • DALL·E 2
        • DALL·E 3
      • RecraftAI
        • Recraft v3
      • Stability AI
        • Stable Diffusion v3 Medium
        • Stable Diffusion v3.5 Large
    • Video Models
      • Alibaba Cloud
        • Wan 2.1 (Text-to-Video)
      • Google
        • Veo2 (Image-to-Video)
        • Veo2 (Text-to-Video)
      • Kling AI
        • v1-standard/image-to-video
        • v1-standard/text-to-video
        • v1-pro/image-to-video
        • v1-pro/text-to-video
        • v1.6-standard/text-to-video
        • v1.6-standard/image-to-video
        • v1.6-pro/image-to-video
        • v1.6-pro/text-to-video
        • v1.6-standard/effects
        • v1.6-pro/effects
        • v2-master/image-to-video
        • v2-master/text-to-video
      • Luma AI
        • Text-to-Video v2
        • Text-to-Video v1 (legacy)
      • MiniMax
        • video-01
        • video-01-live2d
      • Runway
        • gen3a_turbo
        • gen4_turbo
    • Music Models
      • MiniMax
        • minimax-music [legacy]
        • music-01
      • Stability AI
        • stable-audio
    • Voice/Speech Models
      • Speech-to-Text
        • stt [legacy]
        • Deepgram
          • nova-2
        • OpenAI
          • whisper-base
          • whisper-large
          • whisper-medium
          • whisper-small
          • whisper-tiny
      • Text-to-Speech
        • Deepgram
          • aura
    • Content Moderation Models
      • Meta
        • Llama-Guard-3-11B-Vision-Turbo
        • LlamaGuard-2-8b
        • Meta-Llama-Guard-3-8B
    • 3D-Generating Models
      • Stability AI
        • triposr
    • Vision Models
      • Image Analysis
      • OCR: Optical Character Recognition
        • Google
          • Google OCR
        • Mistral AI
          • mistral-ocr-latest
      • OFR: Optical Feature Recognition
    • Embedding Models
      • Anthropic
        • voyage-2
        • voyage-code-2
        • voyage-finance-2
        • voyage-large-2
        • voyage-large-2-instruct
        • voyage-law-2
        • voyage-multilingual-2
      • BAAI
        • bge-base-en
        • bge-large-en
      • Google
        • textembedding-gecko
        • text-multilingual-embedding-002
      • OpenAI
        • text-embedding-3-large
        • text-embedding-3-small
        • text-embedding-ada-002
      • Together AI
        • m2-bert-80M-retrieval
  • Solutions
    • Bagoodex
      • AI Search Engine
        • Find Links
        • Find Images
        • Find Videos
        • Find the Weather
        • Find a Local Map
        • Get a Knowledge Structure
    • OpenAI
      • Assistants
        • Assistant API
        • Thread API
        • Message API
        • Run and Run Step API
        • Events
  • Use Cases
    • Create Images: Illustrate an Article
    • Animate Images: A Children’s Encyclopedia
    • Create an Assistant to Discuss a Specific Document
    • Create a 3D Model from an Image
    • Create a Looped GIF for a Web Banner
    • Read Text Aloud and Describe Images: Support People with Visual Impairments
    • Summarize Websites with AI-Powered Chrome Extension
  • Capabilities
    • Completion and Chat Completion
    • Streaming Mode
    • Code Generation
    • Thinking / Reasoning
    • Function Calling
    • Vision in Text Models (Image-To-Text)
    • Web Search
    • Features of Anthropic Models
    • Model comparison
  • FAQ
    • Can I use API in Python?
    • Can I use API in NodeJS?
    • What are the Pro Models?
    • How to use the Free Tier?
    • Are my requests cropped?
    • Can I call API in the asynchronous mode?
    • OpenAI SDK doesn't work?
  • Errors and Messages
    • General Info
    • Errors with status code 4xx
    • Errors with status code 5xx
  • Glossary
    • Concepts
  • Integrations
    • 🧩Our Integration List
    • Langflow
    • LiteLLM
Powered by GitBook
On this page

Was this helpful?

  1. Solutions
  2. Bagoodex

AI Search Engine

PreviousBagoodexNextFind Links

Last updated 1 month ago

Was this helpful?

Overview

AI Web Search Engine is designed to retrieve real-time information from the internet. This solution processes user queries and return relevant data from various online sources, making them useful for tasks that require up-to-date knowledge beyond static datasets. It supports two usage options:

1

Using six specialized API endpoints, each designed to search for only one specific type of information. These endpoints return structured responses, making them more suitable for integration into specialized services (e.g., a weather widget). Here are the types of information you can retrieve this way:

See API references and examples on the subpages.

2

As a general solution (but searching on the internet): enter a query in the prompt and receive an internet-sourced answer, similar to asking a question on a search engine through a browser. See the API Schema below or check how this call is made in the Python example on the bottom of this page.

How to make a call

Check how this call is made in the below.

Note that queries can include advanced search syntax:

  • Search for an exact match: Enter a word or phrase using \" before and after it. For example, \"tallest building\".

  • Search for a specific site: Enter site: in front of a site or domain. For example, site:youtube.com cat videos.

  • Exclude words from your search: Enter - in front of a word that you want to leave out. For example, jaguar speed -car.

You can also personalize the AI Search Engine output by passing the ip parameter. See below.

API Schema

Example #1

import requests
from openai import OpenAI

# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
API_KEY = '<YOUR_AIMLAPI_KEY>'
API_URL = 'https://api.aimlapi.com'

def complete_chat():
    client = OpenAI(
        base_url=API_URL,
        api_key=API_KEY,
    )    

    response = client.chat.completions.create(
        model="bagoodex/bagoodex-search-v1",
        messages=[
            {
                "role": "user",
                
                # Enter your query here
                "content": 'how to make a slingshot',
            },
        ],
    )
    
    
    print(response.choices[0].message.content)


# Run the function
complete_chat()
// Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
const API_KEY = '<YOUR_AIMLAPI_KEY>';
const API_URL = 'https://api.aimlapi.com/v1/chat/completions';

async function completeChat() {
    const requestBody = {
        model: "bagoodex/bagoodex-search-v1",
        messages: [
            {
                role: "user",
                content: "how to make a slingshot"
            }
        ]
    };

    try {
        const response = await fetch(API_URL, {
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Authorization": `Bearer ${API_KEY}`
            },
            body: JSON.stringify(requestBody)
        });

        const data = await response.json();
        console.log(data.choices[0].message.content);
    } catch (error) {
        console.error("Error fetching completion:", error);
    }
}

// Run the function
completeChat();
Response
To make a slingshot, you can follow the instructions provided in the two sources:

**Option 1: Make a Giant Slingshot**

* Start by cutting two 2x4's to a length of 40 inches each, which will be the main arms of the slingshot.
* Attach the arms to a base made of plywood using screws, and then add side braces to support the arms.
* Install an exercise band as the launching mechanism, making sure to tighten it to achieve the desired distance.
* Add a cross brace to keep the arms rigid and prevent them from spreading or caving in.

**Option 2: Make a Stick Slingshot**

* Find a sturdy, Y-shaped stick and break it down to the desired shape.
* Cut notches on the ends of the stick to hold the rubber bands in place.
* Create a pouch by folding a piece of fabric in half and then half again, and then cutting small holes for the rubber bands.        
* Thread the rubber bands through the holes and tie them securely to the stick using thread.
* Decorate the slingshot with coloured yarn or twine if desired.

You can choose to make either a giant slingshot or a stick slingshot, depending on your preference and the materials available.  

Example #2: Using the IP Parameter for Personalized Model Output

When using regular search engines in browsers, we can simply ask, 'Weather today' without specifying our location. In this case, the search engine automatically uses your IP address to determine your location and provide a more relevant response. The AI Search Engine also supports IP-based personalization.

In the example below, the query does not specify a city, but since the request includes an IP address registered in Stockholm, the system automatically adjusts, and the response will contain today's weather forecast for that city.

Note that when making a request via Python, the ip parameter should be included inside the extra_body parameter (see example below). When using other languages, this is not required, and the ip parameter can be passed like any other parameter.

import requests
from openai import OpenAI

# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
API_KEY = '<YOUR_AIMLAPI_KEY>'
API_URL = 'https://api.aimlapi.com'

# Call the standart chat completion endpoint to get an ID
def complete_chat():
    client = OpenAI(
        base_url=API_URL,
        api_key=API_KEY,
    )    

    response = client.chat.completions.create(
        model="bagoodex/bagoodex-search-v1",
        messages=[
            {
                "role": "user",
                "content": "Weather today",
            },
        ],
        
        # insert your IP into this section
        extra_body={
            'ip': '192.44.242.19' # we used a random IP address from Stockholm
        }
    )
    print(response.choices[0].message.content)
    return response


# Run the function
complete_chat()
import fetch from 'node-fetch';

// Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
const API_KEY = '<YOUR_AIMLAPI_KEY>';
const API_URL = 'https://api.aimlapi.com/v1/chat/completions';

async function completeChat() {
    const requestBody = {
        model: "bagoodex/bagoodex-search-v1",
        messages: [
            {
                role: "user",
                content: "Weather today"
            }
        ],
        extra_body: {
            ip: "192.44.242.19" // We used a random IP address from Stockholm
        }
    };

    try {
        const response = await fetch(API_URL, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${API_KEY}`
            },
            body: JSON.stringify(requestBody)
        });
        
        const data = await response.json();
        console.log(data.choices[0].message.content);
        return data;
    } catch (error) {
        console.error('Error:', error);
    }
}

// Run the function
completeChat();
Response When Using IP Parameter
"According to the forecast, today's weather in Stockholm is partly cloudy with light winds. The temperature is expected to be around 6°C (43°F) with a gentle breeze. \n\nThe forecast also mentions that the weather will be sunny intervals and light winds throughout the day."

Keep in mind that the system caches the IP address for a period of two weeks. This means that after specifying an IP address once, any queries without an explicit location will continue to return responses linked to Stockholm for the next two weeks, even if you don't include the IP address in subsequent requests. If you need to change the location, simply provide a new IP address in your next request.

If an IP address registered in one location is used while explicitly specifying a different location in the query, AI Search Engine will prioritize the location from the query:

Response when the IP parameter is used (from Stockholm), but the request also includes a different location (San Francisco)
"According to the weather forecast, today in San Francisco, there will be a strong cold front moving through the Bay Area from late morning into the afternoon, boosting wind speeds with gusts at around 45 mph midday and featuring high rain rates at times. This may lead to localized runoff issues. The high temperature is expected to be around 56F, with a chance of rain 100% and rainfall near a half an inch. \n\nYou can check the latest forecast and weather conditions on websites such as [https://weather.com/weather/today/l/USCA0987:1:US] or [https://www.accuweather.com/en/us/san-francisco/94103/weather-forecast/347629]."
Links
Images
Videos
Weather details for a specified location
Locations
Knowledge about a topic, structured as a small knowledge base
chat completion
examples
Example #2
  • Overview
  • How to make a call
  • API Schema
  • POSTGenerate a conversational response using a language model.
  • Example #1
  • Example #2: Using the IP Parameter for Personalized Model Output

Generate a conversational response using a language model.

post

Creates a chat completion using a language model, allowing interactive conversation by predicting the next response based on the given chat history. This is useful for AI-driven dialogue systems and virtual assistants.

Authorizations
Body
modelundefined · enumRequiredPossible values:
frequency_penaltynumber | nullableOptional
logprobsboolean | nullableOptional
top_logprobsnumber | nullableOptional
max_tokensnumber · min: 1OptionalDefault: 512
ninteger | nullableOptional
presence_penaltynumber | nullableOptional
response_formatone ofOptional
or
seedinteger · min: 1Optional
stopany ofOptional
stringOptional
or
string[]Optional
or
any | nullableOptional
streambooleanOptionalDefault: false
temperaturenumber · max: 2Optional
top_pnumber · min: 0.1 · max: 1Optional
tool_choiceany ofOptionalDeprecated
string · enumOptionalPossible values:
or
userstringOptional
best_ofinteger | nullableOptional
use_beam_searchboolean | nullableOptional
top_kinteger | nullableOptional
min_pnumber | nullableOptional
repetition_penaltynumber | nullableOptional
length_penaltynumber | nullableOptional
early_stoppingboolean | nullableOptional
ignore_eosboolean | nullableOptional
min_tokensinteger | nullableOptional
stop_token_idsinteger[] | nullableOptional
skip_special_tokensboolean | nullableOptional
spaces_between_special_tokensany | nullableOptional
echoboolean | nullableOptional

If true, the new message will be prepended with the last message if they belong to the same role.

add_generation_promptboolean | nullableOptional

If true, the generation prompt will be added to the chat template. This is a parameter used by chat template in tokenizer config of the model.

add_special_tokensboolean | nullableOptional

If true, special tokens (e.g. BOS) will be added to the prompt on top of what is added by the chat template. For most models, the chat template takes care of adding the special tokens so this should be set to False (as is the default).

chat_templatestring | nullableOptional

A Jinja template to use for this conversion. If this is not passed, the model's default chat template will be used instead.

include_stop_str_in_outputboolean | nullableOptional

Whether to include the stop string in the output. This is only applied when the stop or stop_token_ids is set

guided_jsonany ofOptional

If specified, the output will follow the JSON schema.

stringOptional
or
or
any | nullableOptional
guided_regexstring | nullableOptional

If specified, the output will follow the regex pattern.

guided_choicestring[] | nullableOptional

If specified, the output will be exactly one of the choices.

guided_grammarstring | nullableOptional

If specified, the output will follow the context free grammar.

guided_decoding_backendstring · enum | nullableOptional

If specified, will override the default guided decoding backend of the server for this specific request. If set, must be either 'outlines' / 'lm-format-enforcer'

Possible values:
guided_whitespace_patternstring | nullableOptional

If specified, will override the default whitespace pattern for guided json decoding.

ipstring · ipOptional

IP from which a request is executed

Responses
201Success
post
POST /v1/chat/completions HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 978

{
  "model": "bagoodex/bagoodex-search-v1",
  "messages": [
    {
      "role": "user",
      "content": "text"
    }
  ],
  "frequency_penalty": 1,
  "logit_bias": {
    "ANY_ADDITIONAL_PROPERTY": 1
  },
  "logprobs": true,
  "top_logprobs": 1,
  "max_tokens": 1,
  "n": 1,
  "presence_penalty": 1,
  "response_format": {
    "type": "text"
  },
  "seed": 1,
  "stop": "text",
  "stream": true,
  "temperature": 1,
  "top_p": 1,
  "user": "text",
  "best_of": 1,
  "use_beam_search": true,
  "top_k": 1,
  "min_p": 1,
  "repetition_penalty": 1,
  "length_penalty": 1,
  "early_stopping": true,
  "ignore_eos": true,
  "min_tokens": 1,
  "stop_token_ids": [
    1
  ],
  "skip_special_tokens": true,
  "spaces_between_special_tokens": null,
  "echo": true,
  "add_generation_prompt": true,
  "add_special_tokens": true,
  "documents": [
    {
      "ANY_ADDITIONAL_PROPERTY": "text"
    }
  ],
  "chat_template": "text",
  "chat_template_kwargs": {
    "ANY_ADDITIONAL_PROPERTY": null
  },
  "include_stop_str_in_output": true,
  "guided_json": "text",
  "guided_regex": "text",
  "guided_choice": [
    "text"
  ],
  "guided_grammar": "text",
  "guided_decoding_backend": "outlines",
  "guided_whitespace_pattern": "text",
  "ip": "text"
}
201Success

No content