Tools & Embeddings
Text Embeddings
Convert text into vector representations
POST
/
v1
/
embeddings
curl https://www.qingbo.dev/v1/embeddings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关"
}'
from openai import OpenAI
client = OpenAI(
base_url="https://www.qingbo.dev/v1",
api_key="YOUR_API_KEY"
)
response = client.embeddings.create(
model="text-embedding-3-small",
input="清波 API 是统一的 AI 模型网关"
)
vector = response.data[0].embedding
print(f"向量维度: {len(vector)}")
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://www.qingbo.dev/v1',
apiKey: 'YOUR_API_KEY'
});
const response = await client.embeddings.create({
model: 'text-embedding-3-small',
input: '清波 API 是统一的 AI 模型网关'
});
console.log(`向量维度: ${response.data[0].embedding.length}`);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]string{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://www.qingbo.dev/v1/embeddings", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
import java.net.http.*;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.qingbo.dev/v1/embeddings"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
{
"object": "list",
"model": "text-embedding-3-small",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0091, 0.0152, ...]
}
],
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}
Synchronous endpoint — returns the embedding vectors directly when the request completes.
curl https://www.qingbo.dev/v1/embeddings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关"
}'
from openai import OpenAI
client = OpenAI(
base_url="https://www.qingbo.dev/v1",
api_key="YOUR_API_KEY"
)
response = client.embeddings.create(
model="text-embedding-3-small",
input="清波 API 是统一的 AI 模型网关"
)
vector = response.data[0].embedding
print(f"向量维度: {len(vector)}")
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://www.qingbo.dev/v1',
apiKey: 'YOUR_API_KEY'
});
const response = await client.embeddings.create({
model: 'text-embedding-3-small',
input: '清波 API 是统一的 AI 模型网关'
});
console.log(`向量维度: ${response.data[0].embedding.length}`);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]string{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://www.qingbo.dev/v1/embeddings", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
import java.net.http.*;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.qingbo.dev/v1/embeddings"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
{
"object": "list",
"model": "text-embedding-3-small",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0091, 0.0152, ...]
}
],
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}
Request Parameters
Embedding model ID, e.g.,
text-embedding-3-small, text-embedding-3-large.Text to embed. Accepts a string or an array of strings (batch embedding).
Response
Always
"list".Model used.
⌘I
curl https://www.qingbo.dev/v1/embeddings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关"
}'
from openai import OpenAI
client = OpenAI(
base_url="https://www.qingbo.dev/v1",
api_key="YOUR_API_KEY"
)
response = client.embeddings.create(
model="text-embedding-3-small",
input="清波 API 是统一的 AI 模型网关"
)
vector = response.data[0].embedding
print(f"向量维度: {len(vector)}")
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://www.qingbo.dev/v1',
apiKey: 'YOUR_API_KEY'
});
const response = await client.embeddings.create({
model: 'text-embedding-3-small',
input: '清波 API 是统一的 AI 模型网关'
});
console.log(`向量维度: ${response.data[0].embedding.length}`);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]string{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://www.qingbo.dev/v1/embeddings", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
import java.net.http.*;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "text-embedding-3-small",
"input": "清波 API 是统一的 AI 模型网关"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.qingbo.dev/v1/embeddings"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
{
"object": "list",
"model": "text-embedding-3-small",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0091, 0.0152, ...]
}
],
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}