Quickstart

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:

1{
2 "id": "chatcmpl-...",
3 "object": "chat.completion",
4 "model": "electron",
5 "choices": [
6 {
7 "index": 0,
8 "message": {
9 "role": "assistant",
10 "content": "The sky appears blue because shorter blue wavelengths of sunlight scatter more than longer wavelengths when they pass through Earth's atmosphere."
11 },
12 "finish_reason": "stop"
13 }
14 ],
15 "usage": {
16 "prompt_tokens": 17,
17 "completion_tokens": 24,
18 "total_tokens": 41
19 }
20}

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
1import os
2from openai import OpenAI
3
4client = OpenAI(
5 base_url="https://api.smallest.ai/waves/v1",
6 api_key=os.environ["SMALLEST_API_KEY"],
7)
8
9response = client.chat.completions.create(
10 model="electron",
11 messages=[
12 {"role": "user", "content": "Write one sentence about why the sky is blue."}
13 ],
14)
15
16print(response.choices[0].message.content)

What’s next