There are six main endpoints:
/v1/chat/completions
.openai.base_url = 'https://api.airforce'
['openchat-3.5-0106', 'deepseek-coder-6.7b-base', 'deepseek-coder-6.7b-instruct', 'deepseek-math-7b-instruct', 'Nous-Hermes-2-Mixtral-8x7B-DPO', 'hermes-2-pro-mistral-7b', 'openhermes-2.5-mistral-7b', 'lfm-40b-moe', 'discolm-german-7b-v1', 'falcon-7b-instruct', 'llama-2-7b-chat-int8', 'llama-2-7b-chat-fp16', 'neural-chat-7b-v3-1', 'phi-2', 'sqlcoder-7b-2', 'tinyllama-1.1b-chat', 'zephyr-7b-beta', 'any-uncensored', 'llama-3.1-70b-chat', 'llama-3.1-8b-chat', 'llama-3.1-70b-turbo', 'llama-3.1-8b-turbo']
You can get a premium api key. Include the API key in the Authorization header as follows:
Authorization: Bearer YOUR_API_KEY
You can check the usage of your key via the following:
/check?key=<KEY>
Get api key at https://discord.gg/pMeMK4FwXB
The /v1/chat/completions
and /chat/completions
endpoints are used to send a prompt to the specified LLM model and receive a response.
Send a POST request to /v1/chat/completions
or /chat/completions
with the following JSON payload:
{
'model': 'claude-3-opus',
'messages': [
{'role': 'system', 'content': 'System prompt (only the first message, once)'},
{'role': 'user', 'content': 'Message content'},
{'role': 'assistant', 'content': 'Assistant response'}
],
'max_tokens': 2048,
'stream': false,
'temperature': 0.7,
'top_p': 0.5,
'top_k': 0
}
The response will be in the following format:
{
'id': 'chatcmpl-123',
'object': 'chat.completion',
'created': 1677652288,
'model': 'claude-3-opus',
'system_fingerprint': 'fp_44709d6fcb',
'choices': [{
'index': 0,
'message': {
'role': 'assistant',
'content': 'Response content'
},
'logprobs': null,
'finish_reason': 'stop'
}],
'usage': {
'prompt_tokens': 9,
'completion_tokens': 12,
'total_tokens': 21
}
}
The /v1/models
and /models
endpoints are used to list all available models.
Send a GET request to /v1/models
or /models
to retrieve a list of available models.
The response will be in the following format:
{
'object': 'list',
'data': [
{
'id': 'model-id',
'object': 'model',
'created': 1686935002,
'owned_by': 'provider'
},
...
]
}
The /v1/imagine
and /imagine
endpoints are used to generate images.
Send a GET request to /v1/imagine
or /imagine
with the following query parameters:
{
'prompt': 'A beautiful landscape',
'size': '1:1' [one of 1:1, 16:9, 9:16, 21:9, 9:21, 1:2 or 2:1]
'seed': 123456,
'model': 'flux' [one of flux, flux-realism, flux-4o, flux-pixel, flux-3d, flux-anime, flux-disney, any-dark, stable-diffusion-xl-lightning, stable-diffusion-xl-base],
}
The response will be an image in PNG format.
The response will be in the following format:
Content-Type: image/png
(binary image data)
Example GET request:
GET /v1/imagine?prompt=A+beautiful+landscape&size=1:1&seed=123456&model=flux-realism
The /v1/imagine2
and /imagine2
endpoints are used to generate images fast and stable.
The /get-audio
endpoint is used to convert text to speech and return the audio as an MP3 file. The text is provided via a URL query parameter.
Send a GET request to /get-audio
with the following query parameter:
GET /get-audio?text=Your+text+here&voice=alex
For example, to convert "Hello world" to speech:
GET /get-audio?text=Hello+world&voice=sophia
Available voices are alex and sophia - more soon.
The response will be an MP3 audio file with the following format:
Content-Type: audio/mpeg
(binary audio data)
Example GET request:
GET /get-audio?text=Hello+world&voice=alex
Successful request will return an MP3 file containing the spoken text.