LLM Usage Example
Learn how to make LLM requests using BlueNexus confidential AI models
Assumptions:
You have already obtained an access token from your user
Your access token has access to the necessary scopes to perform LLM operations
Introduction
BlueNexus provides OpenAI-compatible LLM endpoints that support confidential computing environments. The service offers both regular and confidential AI models with automatic scope-based access control.
Select Your Model
Before making LLM requests, you need to choose a model. BlueNexus supports multiple providers and models based on your authorization scope.
Listing Available Models
// Import dependencies
import OpenAI from "openai";
// Initialize the client with your access token
const client = new OpenAI({
apiKey: YourAccessToken, // Your BlueNexus access token
baseURL: "https://api.bluenexus.ai/api/v1",
timeout: 30000, // 30 second timeout
});
// List all available models
async function listModels() {
const response = await client.models.list();
console.log("Available models:");
for (const model of response.data) {
console.log(`- ${model.id}: ${model.owned_by}`);
}
return response.data;
}
// Example models you might see:
// - redpill:phala/gpt-oss-120b (Confidential)
// - redpill:phala/qwen-2.5-7b-instruct (Confidential)
// - redpill:phala/gemma-3-27b-it (Confidential)Understanding Model Scopes
Models are categorized by scope:
Confidential models: Run in Trusted Execution Environments (TEEs) for enhanced privacy
Other models: Standard cloud-based models
Your access token determines which models you can use:
llm:all- Access to all modelsllm:confidential- Access only to confidential modelsllm:other- Access only to non-confidential models
Make LLM Requests
Basic Chat Completion
For simple request-response interactions:
Streaming Chat Completion
For real-time responses where you want to display content as it's generated:
Multi-Turn Conversations
Maintain conversation context by appending messages to the conversation history:
Last updated

