Supported SDKs
OpenAI​
In the setting up article, we showed an example of how to use the OpenAI SDK with the UmamiAI API. We configured the environment from the very beginning and executed our request to the UmamiAI API.
We fully support the OpenAI API structure, and you can seamlessly use the features that the OpenAI SDK provides out-of-the-box, including:
- Streaming
- Completions
- Chat Completions
- Audio
- Beta Assistants
- Beta Threads
- Embeddings
- Image Generation
- Uploads
This support provides easy integration into systems already using OpenAI's standards. For example, you can integrate our API into any product that supports LLM models by updating only two things in the configuration: the base URL and the API key.
How do I configure the base URL and API key?
REST API​
Because we support the OpenAI API structure, our API can be used with the same endpoints as OpenAI. You can call them from any environment.
Authorization​
UmamiAI API authorization is based on a Bearer token. You need to include it in the Authorization
HTTP header within the request, on example:
Authorization: Bearer YOUR_UMAMIAI_API_KEY
Request Example​
When your token is ready you can call our API through HTTP.
JavaScript
fetch("https://api.umamiai.xyz/v1/chat/completions", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_UMAMIAI_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gpt-4o",
messages: [
{
role: "user",
content: "What kind of model are you?",
},
],
max_tokens: 512,
stream: false,
}),
})
.then((res) => res.json())
.then(console.log);
Python
import requests
import json
response = requests.post(
url="https://api.umamiai.xyz/v1/chat/completions",
headers={
"Authorization": "Bearer abc_api_key_xyz",
"Content-Type": "application/json",
},
data=json.dumps(
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "What kind of model are you?",
},
],
"max_tokens": 512,
"stream": False,
}
),
)
response.raise_for_status()
print(response.json())
Shell
curl --request POST \
--url https://api.umamiai.xyz/v1/chat/completions \
--header 'Authorization: Bearer abc_api_key_xyz' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "What kind of model are you?"
}
],
"max_tokens": 512,
"stream": false
}'