Skip to content

Quick Start

This section will guide you to complete a minimal viable integration of UURoute in a few minutes.

You can use the interactive [Request Builder](/request-builder) to generate uuroute.ai API requests in the language of your choice.
Python
import requests
import json
response = requests.post(
url="https://portal-api.stag.uuroute.net/v1/chat/completions",
headers={
"Authorization": "Bearer <UUROUTE_API_KEY>",
"HTTP-Referer": "<YOUR_SITE_URL>", # Optional. Site URL for rankings on uuroute.ai.
"X-Title": "<YOUR_SITE_NAME>", # Optional. Site title for rankings on uuroute.ai.
},
data=json.dumps({
"model": "gpt-4o-mini", # Optional
"messages": [
{
"role": "user",
"content": "What is the meaning of life?"
}
]
})
)
TypeScript (fetch)
fetch('https://portal-api.stag.uuroute.net/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer <UUROUTE_API_KEY>',
'HTTP-Referer': '<YOUR_SITE_URL>', // Optional. Site URL for rankings on uuroute.ai.
'X-Title': '<YOUR_SITE_NAME>', // Optional. Site title for rankings on uuroute.ai.
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'gpt-4o-mini',
messages: [
{
role: 'user',
content: 'What is the meaning of life?',
},
],
}),
});
Shell
curl https://portal-api.stag.uuroute.net/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $UUROUTE_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "What is the meaning of life?"
}
]
}'

You can also use any OpenAI-compatible client by setting the UURoute API base URL.

Typescript
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://portal-api.stag.uuroute.net/v1',
apiKey: '<UUROUTE_API_KEY>',
defaultHeaders: {
'HTTP-Referer': '<YOUR_SITE_URL>', // Optional. Site URL for rankings on uuroute.ai.
'X-Title': '<YOUR_SITE_NAME>', // Optional. Site title for rankings on uuroute.ai.
},
});
async function main() {
const completion = await openai.chat.completions.create({
model: 'gpt-4o-mini',
messages: [
{
role: 'user',
content: 'What is the meaning of life?',
},
],
});
console.log(completion.choices[0].message);
}
main();
Python
from openai import OpenAI
client = OpenAI(
base_url="https://portal-api.stag.uuroute.net/v1",
api_key="<UUROUTE_API_KEY>",
)
completion = client.chat.completions.create(
extra_headers={
"HTTP-Referer": "<YOUR_SITE_URL>", # Optional. Site URL for rankings on uuroute.ai.
"X-Title": "<YOUR_SITE_NAME>", # Optional. Site title for rankings on uuroute.ai.
},
model="gpt-4o-mini",
messages=[
{
"role": "user",
"content": "What is the meaning of life?"
}
]
)
print(completion.choices[0].message.content)

The API also supports streaming.