Skip to main content
This guide explains how to call Air API from your application after generating a secret key. Air API provides an OpenAI-compatible interface, allowing you to integrate with minimal code changes. If you are already using the OpenAI SDK, simply replace the base_url and API key.

Migrate from OpenAI to AirCloud

If your application already uses the OpenAI SDK, you only need to replace two settings. See the OpenAI Compatible API page for the full quick start and code samples.

Migration Checklist

  • Replace base_url / baseURL with your AirCloud endpoint from the Console.
  • Replace your OpenAI API key with an AirCloud secret key.
  • Update the model parameter to an AirCloud model ID.

Find Your Endpoint and Secret Key

Select your API workload in the Console, then click View Code to view the endpoint URL and code samples for the selected model. Code Sample Eng Replace YOUR_ENDPOINT and YOUR_API_KEY in the sample code with the values from your Console.

Authentication

Include your secret key in the Authorization header for every API request.
A secret key is displayed only once when it is created. We recommend storing it as an environment variable instead of hardcoding it in your source code. If you lose the key, generate a new one from the Console.

Code Examples

For chat completion and embedding examples, see the OpenAI Compatible API page. Air API also supports text-to-speech through the OpenAI SDK’s audio endpoint, shown below.

TTS Models

Best Practices

  • Protect your API key — Store your secret key as an environment variable and never commit it to a source repository.
  • Monitor usage — Regularly review API usage and costs in the Usage tab of the Console.
  • Maintain available credits — API requests stop when your credits are exhausted. We recommend enabling automatic top-up to avoid service interruptions.

Models and Playground

Learn how to select models and test them using the Playground.

OpenAI Compatible API

Connect your existing OpenAI SDK code to Air API in two lines.

Troubleshooting

Find solutions to common issues and errors.

API Reference

Explore detailed API specifications, including endpoints and parameters.