Skip to main content

Swagger and OpenAPI

We provide Swagger UI and an OpenAPI-compatible API specification for quick integration, testing requests, and connecting third-party development tools.

Swagger allows you to study the API structure, execute requests directly from the browser, and immediately see server responses. Thanks to OpenAPI support, the specification can be automatically imported into various API clients and SDK generation tools.


Authentication

All API requests are made using a Bearer token:

Authorization: Bearer <your access token>

You can obtain an API key from the BotHub control panel.

For the OpenAI-compatible API, the following base URL is used:

https://openai.bothub.chat/v1

Example request address:

https://openai.bothub.chat/v1/chat/completions

Quick Links

ResourceURL
Swagger UIhttps://bothub.chat/api/v2/swagger
OpenAPI JSONhttps://bothub.chat/api/v2/swagger.json

OpenAPI Compatibility

The API conforms to the OpenAPI specification, making it usable in virtually any modern REST API tool.

The specification is automatically imported into Postman, Insomnia, Bruno, Hoppscotch, and other OpenAPI-compatible clients. After import, the application automatically creates request collections, method groups, and authorization parameters, greatly simplifying integration and testing.

The OpenAPI specification can also be used to generate SDKs, client libraries, and server templates via Swagger Codegen or OpenAPI Generator.


Using Swagger UI

Swagger UI allows you to test the API without writing code. After opening the documentation, select the desired method, click Try it out, fill in the request parameters, and execute the request via Execute.

Before sending requests, you must authorize using the Authorize button, specifying the token in the format:

Bearer <your token>

After executing the request, Swagger will automatically show the HTTP request, curl command, response status, and server JSON response.


Integration with Postman

The Swagger specification can be imported directly into Postman. To do this, open Import, go to the Link tab, and specify:

https://bothub.chat/api/v2/swagger.json

After import, Postman will automatically create a ready-made request collection with all available API methods. To execute requests, you will only need to specify the Bearer token in the Authorization header.


Integration with Insomnia

Insomnia supports direct import of OpenAPI specifications. To connect, create a new project, select Import From URL, and specify the link to swagger.json.

https://bothub.chat/api/v2/swagger.json

After import, all API methods and request parameters will be available automatically.


Integration with Bruno

Bruno also supports OpenAPI import. To connect, create a new collection, select Import OpenAPI, and use the API specification link.

https://bothub.chat/api/v2/swagger.json

After import, Bruno will automatically create the request and method structure.


Usage Example

Below is an example of a simple request to the OpenAI-compatible API via curl. The example sends a message to the model and receives a text response from the AI.

This format is convenient for quickly testing the API, testing authorization, or integrating with your own application.

curl 'https://openai.bothub.chat/v1/chat/completions' \
-H 'Authorization: Bearer <your access token>' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-5-mini",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}'

In response, the API will return a JSON with the generation result, including the model's response text, token usage information, and technical request metadata.