Skip to navigation

Quickstart

Make your first Electron chat completion in under 60 seconds - point the OpenAI SDK at Smallest AI and go.
View as Markdown

Electron is OpenAI-compatible. If you can call the OpenAI Chat Completions API, you can call Electron - change the base URL and the API key, and your existing code works.

Step 1: Get Your API Key

In the Smallest AI Console, go to Settings → API Keys and click Create API Key. Copy it and export:

export SMALLEST_API_KEY="your-api-key-here"
New to Smallest AI? Sign up here first.

Step 2: Make Your First Call

Paste this cURL - no install required:

curl -X POST "https://api.smallest.ai/waves/v1/chat/completions" \
-H "Authorization: Bearer $SMALLEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "electron",
"messages": [
{"role": "user", "content": "Write one sentence about why the sky is blue."}
]
}'

You’ll get back the standard OpenAI chat-completion shape:

{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "electron",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The sky appears blue because shorter blue wavelengths of sunlight scatter more than longer wavelengths when they pass through Earth's atmosphere."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 17,
"completion_tokens": 24,
"total_tokens": 41
}
}

Step 3: Use the OpenAI SDK

Because Electron speaks the OpenAI wire format, you can use the official OpenAI SDKs verbatim - just override base_url (or baseURL) and api_key.

Install the SDK if you don’t already have it:

pip install openai # Python
# or
npm install openai # Node.js
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.smallest.ai/waves/v1",
api_key=os.environ["SMALLEST_API_KEY"],
)
response = client.chat.completions.create(
model="electron",
messages=[
{"role": "user", "content": "Write one sentence about why the sky is blue."}
],
)
print(response.choices[0].message.content)

What’s next