Unsupported. The entire object is ignored and removed before forwarding; it cannot select an upstream or price tier.
基本请求
1
2
3
4
5
6
7
8
9
10
11
12
13
from openai import OpenAI
client = OpenAI(
base_url="https://api.bazaarlink.ai/v1",
api_key="sk-bl-YOUR_API_KEY",
)
response = client.embeddings.create(
model="openai/text-embedding-3-small",
input="The quick brown fox jumps over the lazy dog",
)
print(response.data[0].embedding) # 1536-dimensional vector
批量处理
发送字符串数组,可在单次请求中嵌入多段文本 —— 比逐条调用更便宜也更快。
1
2
3
4
5
6
7
8
9
10
11
response = client.embeddings.create(
model="openai/text-embedding-3-small",
input=[
"Machine learning is a subset of artificial intelligence",
"Deep learning uses neural networks with multiple layers",
"Natural language processing enables computers to understand text",
],
)
for i, item inenumerate(response.data):
print(f"Embedding {i}: {len(item.embedding)} dimensions")