# Embeddings API — Text Embeddings Source: https://ofox.io/docs/api/openai/embeddings Convert text into vector representations for semantic search, clustering, classification, and other use cases. ## Endpoint ```http POST https://api.ofox.io/v1/embeddings ``` ## Request Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `model` | string | ✅ | Embedding model, e.g. `openai/text-embedding-3-small` | | `input` | string \| string[] | ✅ | Text to embed (single or batch) | | `encoding_format` | string | — | Output format: `float` (default) or `base64` | | `dimensions` | number | — | Output vector dimensions (supported by some models) | ## Request Examples **cURL** ```bash filename="Terminal" curl https://api.ofox.io/v1/embeddings \ -H "Authorization: Bearer $OFOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/text-embedding-3-small", "input": "OfoxAI is an LLM Gateway" }' ``` **Python** ```python filename="embedding.py" showLineNumbers from openai import OpenAI client = OpenAI( base_url="https://api.ofox.io/v1", api_key="" ) response = client.embeddings.create( model="openai/text-embedding-3-small", input="OfoxAI is an LLM Gateway" ) embedding = response.data[0].embedding print(f"Vector dimensions: {len(embedding)}") ``` **TypeScript** ```typescript filename="embedding.ts" showLineNumbers import OpenAI from 'openai' const client = new OpenAI({ baseURL: 'https://api.ofox.io/v1', apiKey: '' }) const response = await client.embeddings.create({ model: 'openai/text-embedding-3-small', input: 'OfoxAI is an LLM Gateway' }) console.log(`Vector dimensions: ${response.data[0].embedding.length}`) ``` ## Response Format ```json { "object": "list", "data": [ { "object": "embedding", "index": 0, "embedding": [0.0023, -0.0091, 0.0156, ...] } ], "model": "openai/text-embedding-3-small", "usage": { "prompt_tokens": 8, "total_tokens": 8 } } ``` ## Available Models | Model | Dimensions | Description | |-------|------------|-------------| | `openai/text-embedding-3-small` | 1536 | Cost-effective | | `openai/text-embedding-3-large` | 3072 | Highest accuracy | | `qwen/text-embedding-v4` | 1024 | Optimized for Chinese, Qwen embedding model |