Skip to content

Building Your First App

This tutorial will guide you through building your first application using our AI-powered API.

Prerequisites

  • An API key (get one from your dashboard)
  • Basic programming knowledge (JavaScript, Python, or cURL)

Step 1: Set Up Your Project

Choose your preferred language and set up a new project directory. Install the required SDK or dependencies.

JavaScript/Node.js

npm install @example/api-client

Python

pip install example-api-client

Step 2: Initialize the API Client

JavaScript

const { APIClient } = require('@example/api-client');
const client = new APIClient('your-api-key');

Python

import api_client
client = api_client.Client('your-api-key')

Step 3: Make Your First API Call

Let's generate some text using the API.

JavaScript

const response = await client.generate({
  prompt: 'Write a welcome message for my app',
  model: 'gpt-4',
  max_tokens: 100
});
console.log(response.content);

Python

response = client.generate(prompt='Write a welcome message for my app', model='gpt-4', max_tokens=100)
print(response.content)

Step 4: Handle Errors

Always handle errors gracefully in your code.

JavaScript

try {
  // ... API call ...
} catch (error) {
  console.error('API Error:', error.message);
}

Python

try:
    # ... API call ...
except Exception as e:
    print('API Error:', str(e))

Step 5: Next Steps


Last update: July 14, 2025
Created: July 14, 2025