Skip to main content

Overview

NanoGPT provides a fully OpenAI-compatible embeddings API that offers access to both OpenAI’s industry-leading embedding models and a curated selection of alternative embedding models at competitive prices. Our API supports 20+ embedding models (and this list changes over time); use GET /api/v1/embedding-models for the source-of-truth list.

Quick Start

Available Models

OpenAI Models

Alternative Models

Multilingual Models

Language-Specific Models

Specialized Models

API Endpoints

Create Embeddings

Endpoint: POST https://nano-gpt.com/api/v1/embeddings Create embeddings for one or more text inputs.

Discover Embedding Models

Endpoint: GET https://nano-gpt.com/api/v1/embedding-models List all available embedding models with detailed information.

Advanced Features

Batch Processing

Process multiple texts efficiently in a single request:

Dimension Reduction

Reduce embedding dimensions for faster similarity comparisons (supported models only):
Supported models for dimension reduction:
  • text-embedding-3-small
  • text-embedding-3-large
  • Qwen/Qwen3-Embedding-0.6B

Base64 Encoding

For more efficient data transfer, request base64-encoded embeddings:

Use Cases

Build powerful search systems that understand meaning:

RAG (Retrieval Augmented Generation)

Enhance LLM responses with relevant context:

Clustering & Classification

Group similar texts or classify content:

Duplicate Detection

Find similar or duplicate content:

Model Selection Guide

By Use Case

By Requirements

Need fastest search?
  • Use models supporting dimension reduction
  • Reduce to 256-512 dimensions
  • Trade small accuracy loss for 2-4x speed improvement
Need highest accuracy?
  • Use text-embedding-3-large
  • Keep full 3072 dimensions
  • Best for critical applications
Processing many languages?
  • Use BAAI/bge-m3 for general multilingual
  • Use language-specific Jina models for best per-language performance
Working with code?
  • Use jina-embeddings-v2-base-code
  • Optimized for programming language semantics

Best Practices

Performance Optimization

  1. Batch Requests: Send up to 2048 texts in a single request
  2. Use Dimension Reduction: Reduce dimensions when exact precision isn’t critical
  3. Cache Embeddings: Store computed embeddings to avoid re-processing
  4. Choose Appropriate Models: Don’t use 3072-dimension models if 768 suffices

Cost Optimization

  1. Monitor Usage: Track the usage field in responses
  2. Start Small: Begin with text-embedding-3-small before upgrading
  3. Implement Caching: Avoid re-embedding identical content
  4. Batch Processing: Reduce API call overhead

Quality Optimization

  1. Preprocess Text: Clean and normalize text before embedding
  2. Consider Context: Include relevant context in the text to embed
  3. Test Different Models: Compare performance for your specific use case
  4. Use Appropriate Similarity Metrics: Cosine similarity for most cases

Integration Examples

JavaScript/TypeScript

cURL

Direct API Usage

Rate Limits & Error Handling

Rate Limits

Rate limits vary by endpoint and account. See Rate Limits.

Error Codes

Error Response Format

For a general guide across NanoGPT APIs, see Error Handling.

Migration from OpenAI

Switching from OpenAI to NanoGPT is seamless:

Pricing Summary

Additional Resources