Context length
—
Avg latency
~1901ms
Requests served
104,820
Success rate
98.8%
Price per 1M tokens
0.19 SAR
Input / output, pay-as-you-go
Quick start
from openai import OpenAI
client = OpenAI(
base_url="https://alapi.deep.sa/v1",
api_key="sk-alapi-...",
)
resp = client.embeddings.create(
model="deep-sa/alEmbedding",
input="مرحبا",
)
Example: Match a question to the right help article
Embed your help articles and a customer's question, then show the article closest in meaning, even when the words differ.
import math
from openai import OpenAI
client = OpenAI(base_url="https://alapi.deep.sa/v1", api_key="YOUR_API_KEY")
articles = ["كيف أستعيد كلمة المرور؟", "طرق الدفع المتاحة", "مدة توصيل الطلبات"]
question = "نسيت كلمة السر"
# 1. Embed the help articles and the question in one call
data = client.embeddings.create(model="deep-sa/alEmbedding", input=articles + [question]).data
*article_vectors, question_vector = [d.embedding for d in data]
# 2. Pick the article closest in meaning to the question
def cosine(a, b):
dot = sum(x * y for x, y in zip(a, b))
return dot / (math.sqrt(sum(x * x for x in a)) * math.sqrt(sum(y * y for y in b)))
best = max(range(len(articles)), key=lambda i: cosine(article_vectors[i], question_vector))
print("Best match:", articles[best])
Each model and tool has its own price per 1M tokens View full pricing details