Skip to main content

Quickstart

Get started with Bulutistan LLMaaS in 5 minutes.

Prerequisites

  • An API key from your platform administrator
  • Python 3.8+ or Node.js 16+

Installation

Python

pip install openai

Node.js

npm install openai

Your First Request

Python

from openai import OpenAI

# Initialize the client
client = OpenAI(
api_key="sk-proj-your-api-key",
base_url="https://api.bulutistan.ai/v1"
)

# Make a chat completion request
response = client.chat.completions.create(
model="meta-llama/Llama-3.1-8B-Instruct",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
],
max_tokens=100
)

print(response.choices[0].message.content)

Node.js

import OpenAI from 'openai';

const client = new OpenAI({
apiKey: 'sk-proj-your-api-key',
baseURL: 'https://api.bulutistan.ai/v1'
});

async function main() {
const response = await client.chat.completions.create({
model: 'meta-llama/Llama-3.1-8B-Instruct',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'What is the capital of France?' }
],
max_tokens: 100
});

console.log(response.choices[0].message.content);
}

main();

cURL

curl https://api.bulutistan.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-proj-your-api-key" \
-d '{
"model": "meta-llama/Llama-3.1-8B-Instruct",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
],
"max_tokens": 100
}'

Response Format

{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1704067200,
"model": "meta-llama/Llama-3.1-8B-Instruct",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 8,
"total_tokens": 33
}
}

Next Steps