Developer plan
Confirming payment...
Loading your account and API key.
Current balance
Loading...
Confirming your available prepaid credit.
Account status
Ready to embed
Requests remain active while your balance is above the service floor.
Your secret key
Save it somewhere safe.
Shown once. Store this key in a password vault or secrets manager. Similar.dev will not email it to you.
sme_...
First request
Copy, run, embed.
These examples already contain your API key. Run the embedding example first, then use the balance example whenever you want to check available credit.
Create an embedding
embed.py
from openai import OpenAI
client = OpenAI(
api_key="__SIMILAR_API_KEY__",
base_url="https://api.similar.dev/v1",
)
response = client.embeddings.create(
model="similar.dev-lang3-lite-512",
input=["A first document to embed."],
)
print(len(response.data[0].embedding)) # 512
Check your balance
balance.py
import requests
response = requests.get(
"https://api.similar.dev/v1/account",
headers={"Authorization": "Bearer __SIMILAR_API_KEY__"},
)
response.raise_for_status()
print(response.json()["balance_usd"])
Create an embedding
embed.ts
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "__SIMILAR_API_KEY__",
baseURL: "https://api.similar.dev/v1",
});
const response = await client.embeddings.create({
model: "similar.dev-lang3-lite-512",
input: ["A first document to embed."],
});
console.log(response.data[0].embedding.length); // 512
Check your balance
balance.ts
const response = await fetch(
"https://api.similar.dev/v1/account",
{
headers: {
Authorization: "Bearer __SIMILAR_API_KEY__",
},
},
);
const account = await response.json();
console.log(account.balance_usd);
Create an embedding
terminal
curl https://api.similar.dev/v1/embeddings \
-H "Authorization: Bearer __SIMILAR_API_KEY__" \
-H "Content-Type: application/json" \
-d '{
"model": "similar.dev-lang3-lite-512",
"input": ["A first document to embed."]
}'
Check your balance
terminal
curl https://api.similar.dev/v1/account \ -H "Authorization: Bearer __SIMILAR_API_KEY__"