Quickstart
Get started with Onysoft AI Gateway
Onysoft AI Gateway is a unified platform that gives you access to hundreds of AI models through a single API. Because our API is fully compatible with the OpenAI SDKs, you can migrate your existing applications to the Onysoft infrastructure with just a few lines of code changes.
Pay in Turkish Lira: All transactions are billed in Turkish Lira. Work with fixed TRY pricing, unaffected by exchange-rate fluctuations.
1. Create an API Key
First, create a free account and generate an API key from the Dashboard.
Security: Never use your API key in client-side (frontend) code. Store your key on the server side and manage it as an environment variable.
2. Make Your First API Call
The examples below show how to get started in your preferred programming language. The Onysoft API is fully compatible with the OpenAI SDKs — you only need to change the base_url value.
from openai import OpenAI
client = OpenAI(
api_key="sk-ony-your-api-key",
base_url="https://api.onysoft.com/v1"
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{"role": "user", "content": "Merhaba, nasılsın?"}
]
)
print(response.choices[0].message.content)
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-ony-your-api-key',
baseURL: 'https://api.onysoft.com/v1'
});
const response = await client.chat.completions.create({
model: 'openai/gpt-4o-mini',
messages: [
{ role: 'user', content: 'Merhaba, nasılsın?' }
]
});
console.log(response.choices[0].message.content);
$ch = curl_init('https://api.onysoft.com/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer sk-ony-your-api-key',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'openai/gpt-4o-mini',
'messages' => [
['role' => 'user', 'content' => 'Merhaba, nasılsın?']
]
])
]);
$response = json_decode(curl_exec($ch), true);
echo $response['choices'][0]['message']['content'];
curl https://api.onysoft.com/v1/chat/completions \
-H "Authorization: Bearer sk-ony-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{"role": "user", "content": "Merhaba, nasılsın?"}
]
}'
3. Response Format
A successful request returns a response in the following format:
{
"id": "req_a1b2c3d4e5f6a1b2c3d4e5f6",
"object": "chat.completion",
"created": 1706000000,
"model": "openai/gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Merhaba! Ben bir AI asistanıyım, size nasıl yardımcı olabilirim?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 24,
"total_tokens": 36
},
"cost": {
"amount": 0.000024,
"currency": "USD"
}
}
Next Steps
You are now ready to use the API. Here are some resources to keep learning: