This guide will help you get up and running with Lunos AI Platform in just a few minutes. Follow these simple steps to start integrating AI capabilities into your applications.
Note: This guide assumes you have already created a Lunos account. Checking authentication status...
To use the Lunos API, you'll need an API key. You can create one from your dashboard:
Important: Your API key is sensitive information. Never share it publicly or commit it to version control.
Lunos provides client libraries for various programming languages. Choose the one that fits your stack:
npm install openai
pip install openai
Note: We recommend using the OpenAI library as our official package is still under development. The OpenAI library provides excellent compatibility with the Lunos API.
Initialize the Lunos client with your API key:
1import OpenAI from 'openai';
2
3const client = new OpenAI({
4 apiKey: 'your_api_key_here',
5 baseURL: 'https://api.lunos.tech/v1',
6});
1from openai import OpenAI
2
3client = OpenAI(
4 api_key="your_api_key_here",
5 base_url="https://api.lunos.tech/v1"
6)
Let's make a simple API call to generate a text completion:
1async function generateCompletion() {
2 try {
3 const response = await client.completions.create({
4 model: "openai/gpt-4o",
5 prompt: "Write a short poem about artificial intelligence.",
6 max_tokens: 150,
7 temperature: 0.7,
8 });
9
10 console.log(response.choices[0].message.content);
11 } catch (error) {
12 console.error("Error:", error);
13 }
14}
15
16generateCompletion();
1def generate_completion():
2 try:
3 response = client.completions.create(
4 model="openai/gpt-4o",
5 prompt="Write a short poem about artificial intelligence.",
6 max_tokens=150,
7 temperature=0.7
8 )
9
10 print(response.choices[0].message.content)
11 except Exception as e:
12 print(f"Error: {e}")
13
14generate_completion()
Congratulations! You've made your first API call to Lunos. Now you can explore more features and capabilities:
If you encounter any issues or have questions, our support team is here to help.
No headings found on this page.