Practical code examples and integration guides for Inferno AI across popular languages and frameworks.
Complete Python examples using the OpenAI SDK and native HTTP requests.
Includes:
Direct REST API examples with curl, httpie, and Postman.
Includes:
Implement real-time streaming in multiple languages.
Includes:
Complete Docker examples for development and production.
Includes:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8080/v1", api_key="not-needed")
response = client.chat.completions.create(
model="llama-2-7b-chat",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'http://localhost:8080/v1',
apiKey: 'not-needed'
});
const stream = await client.chat.completions.create({
model: 'llama-2-7b-chat',
messages: [{ role: 'user', content: 'Tell me a story' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama-2-7b-chat",
"messages": [{"role": "user", "content": "Hello!"}]
}'