# Table of Contents - [Introduction - NanoGPT API Documentation](#introduction-nanogpt-api-documentation) - [Embeddings - NanoGPT API Documentation](#embeddings-nanogpt-api-documentation) - [Unknown](#unknown) - [v1/audio/transcriptions (STT) - NanoGPT API Documentation](#v1-audio-transcriptions-stt-nanogpt-api-documentation) - [Audio Models - NanoGPT API Documentation](#audio-models-nanogpt-api-documentation) - [AI Detection - NanoGPT API Documentation](#ai-detection-nanogpt-api-documentation) - [Character Models - NanoGPT API Documentation](#character-models-nanogpt-api-documentation) - [Brave - NanoGPT API Documentation](#brave-nanogpt-api-documentation) - [Characters - NanoGPT API Documentation](#characters-nanogpt-api-documentation) - [API Hosts - NanoGPT API Documentation](#api-hosts-nanogpt-api-documentation) - [Chrome Extension - NanoGPT API Documentation](#chrome-extension-nanogpt-api-documentation) - [Pricing and Fees - NanoGPT API Documentation](#pricing-and-fees-nanogpt-api-documentation) - [For Providers - NanoGPT API Documentation](#for-providers-nanogpt-api-documentation) - [Cursor - NanoGPT API Documentation](#cursor-nanogpt-api-documentation) - [Otaku - NanoGPT API Documentation](#otaku-nanogpt-api-documentation) - [Check Balance - NanoGPT API Documentation](#check-balance-nanogpt-api-documentation) - [TypingMind - NanoGPT API Documentation](#typingmind-nanogpt-api-documentation) - [Kilo Code - NanoGPT API Documentation](#kilo-code-nanogpt-api-documentation) - [TEE Attestation - NanoGPT API Documentation](#tee-attestation-nanogpt-api-documentation) - [Retrieve Midjourney Generation Status - NanoGPT API Documentation](#retrieve-midjourney-generation-status-nanogpt-api-documentation) - [List All Batches - NanoGPT API Documentation](#list-all-batches-nanogpt-api-documentation) - [Pay-As-You-Go Billing Override - NanoGPT API Documentation](#pay-as-you-go-billing-override-nanogpt-api-documentation) - [Roo Code - NanoGPT API Documentation](#roo-code-nanogpt-api-documentation) - [Rate Limits - NanoGPT API Documentation](#rate-limits-nanogpt-api-documentation) - [OpenHands - NanoGPT API Documentation](#openhands-nanogpt-api-documentation) - [Droid - NanoGPT API Documentation](#droid-nanogpt-api-documentation) - [List Image Models - NanoGPT API Documentation](#list-image-models-nanogpt-api-documentation) - [Management API - NanoGPT API Documentation](#management-api-nanogpt-api-documentation) - [OpenClaw (ClawdBot) - NanoGPT API Documentation](#openclaw-clawdbot-nanogpt-api-documentation) - [Change Reasoning Effort Within a Conversation - NanoGPT API Documentation](#change-reasoning-effort-within-a-conversation-nanogpt-api-documentation) - [Authentication - NanoGPT API Documentation](#authentication-nanogpt-api-documentation) - [Cline - NanoGPT API Documentation](#cline-nanogpt-api-documentation) - [Fluent - NanoGPT API Documentation](#fluent-nanogpt-api-documentation) - [JanitorAI - NanoGPT API Documentation](#janitorai-nanogpt-api-documentation) - [OpenWebUI - NanoGPT API Documentation](#openwebui-nanogpt-api-documentation) - [Generate Images - NanoGPT API Documentation](#generate-images-nanogpt-api-documentation) - [Personalized Models - NanoGPT API Documentation](#personalized-models-nanogpt-api-documentation) - [Receive Nano - NanoGPT API Documentation](#receive-nano-nanogpt-api-documentation) - [Advisor - NanoGPT API Documentation](#advisor-nanogpt-api-documentation) - [Hosted tool search - NanoGPT API Documentation](#hosted-tool-search-nanogpt-api-documentation) - [RisuAI - NanoGPT API Documentation](#risuai-nanogpt-api-documentation) - [Model Context Protocol (MCP) - NanoGPT API Documentation](#model-context-protocol-mcp-nanogpt-api-documentation) - [Video Input - NanoGPT API Documentation](#video-input-nanogpt-api-documentation) - [Music Generation - NanoGPT API Documentation](#music-generation-nanogpt-api-documentation) - [Partner Program - NanoGPT API Documentation](#partner-program-nanogpt-api-documentation) - [Bring Your Own Key (BYOK) - NanoGPT API Documentation](#bring-your-own-key-byok-nanogpt-api-documentation) - [SillyTavern - NanoGPT API Documentation](#sillytavern-nanogpt-api-documentation) - [Distillation Policy - NanoGPT API Documentation](#distillation-policy-nanogpt-api-documentation) - [Tool Calling Diagnostics - NanoGPT API Documentation](#tool-calling-diagnostics-nanogpt-api-documentation) - [Messages Count Tokens - NanoGPT API Documentation](#messages-count-tokens-nanogpt-api-documentation) - [TEE Signature - NanoGPT API Documentation](#tee-signature-nanogpt-api-documentation) - [JavaScript Library - NanoGPT API Documentation](#javascript-library-nanogpt-api-documentation) - [Video Models - NanoGPT API Documentation](#video-models-nanogpt-api-documentation) - [Extended Thinking (Reasoning) - NanoGPT API Documentation](#extended-thinking-reasoning-nanogpt-api-documentation) - [Gemini CLI - NanoGPT API Documentation](#gemini-cli-nanogpt-api-documentation) - [LibreChat - NanoGPT API Documentation](#librechat-nanogpt-api-documentation) - [Get Image Model Endpoints - NanoGPT API Documentation](#get-image-model-endpoints-nanogpt-api-documentation) - [Data Extraction APIs - NanoGPT API Documentation](#data-extraction-apis-nanogpt-api-documentation) - [TTS Status - NanoGPT API Documentation](#tts-status-nanogpt-api-documentation) - [PII Redaction - NanoGPT API Documentation](#pii-redaction-nanogpt-api-documentation) - [List Inline Batches - NanoGPT API Documentation](#list-inline-batches-nanogpt-api-documentation) - [TypeScript Library - NanoGPT API Documentation](#typescript-library-nanogpt-api-documentation) - [Video Content - NanoGPT API Documentation](#video-content-nanogpt-api-documentation) - [Image Edits - NanoGPT API Documentation](#image-edits-nanogpt-api-documentation) - [Embedding Models - NanoGPT API Documentation](#embedding-models-nanogpt-api-documentation) - [Moderation Models - NanoGPT API Documentation](#moderation-models-nanogpt-api-documentation) - [n8n - NanoGPT API Documentation](#n8n-nanogpt-api-documentation) - [Compressed Request Bodies - NanoGPT API Documentation](#compressed-request-bodies-nanogpt-api-documentation) - [URL Parameters (Web App) - NanoGPT API Documentation](#url-parameters-web-app-nanogpt-api-documentation) - [Batch API - NanoGPT API Documentation](#batch-api-nanogpt-api-documentation) - [Feedback API - NanoGPT API Documentation](#feedback-api-nanogpt-api-documentation) - [Error Handling - NanoGPT API Documentation](#error-handling-nanogpt-api-documentation) - [Video Recover - NanoGPT API Documentation](#video-recover-nanogpt-api-documentation) - [Video Extend - NanoGPT API Documentation](#video-extend-nanogpt-api-documentation) - [Partner Auth - NanoGPT API Documentation](#partner-auth-nanogpt-api-documentation) - [Inline Moderation - NanoGPT API Documentation](#inline-moderation-nanogpt-api-documentation) - [Codex CLI - NanoGPT API Documentation](#codex-cli-nanogpt-api-documentation) - [Claude Code - NanoGPT API Documentation](#claude-code-nanogpt-api-documentation) - [Context Memory - NanoGPT API Documentation](#context-memory-nanogpt-api-documentation) - [Image Models - NanoGPT API Documentation](#image-models-nanogpt-api-documentation) - [CLI Device Login - NanoGPT API Documentation](#cli-device-login-nanogpt-api-documentation) - [Model Suffixes - NanoGPT API Documentation](#model-suffixes-nanogpt-api-documentation) - [Completions - NanoGPT API Documentation](#completions-nanogpt-api-documentation) - [Quickstart - NanoGPT API Documentation](#quickstart-nanogpt-api-documentation) - [Create Invitation - NanoGPT API Documentation](#create-invitation-nanogpt-api-documentation) - [Streaming Protocol (SSE) - NanoGPT API Documentation](#streaming-protocol-sse-nanogpt-api-documentation) - [Grok CLI - NanoGPT API Documentation](#grok-cli-nanogpt-api-documentation) - [Auto Recharge - NanoGPT API Documentation](#auto-recharge-nanogpt-api-documentation) - [Embeddings - NanoGPT API Documentation](#embeddings-nanogpt-api-documentation) - [Context Memory (Standalone) - NanoGPT API Documentation](#context-memory-standalone-nanogpt-api-documentation) - [v1/audio/speech (TTS + Music) - NanoGPT API Documentation](#v1-audio-speech-tts-music-nanogpt-api-documentation) - [OpenCode - NanoGPT API Documentation](#opencode-nanogpt-api-documentation) - [Image Generation (OpenAI-Compatible) - NanoGPT API Documentation](#image-generation-openai-compatible-nanogpt-api-documentation) - [Moderations - NanoGPT API Documentation](#moderations-nanogpt-api-documentation) - [Data API - NanoGPT API Documentation](#data-api-nanogpt-api-documentation) - [Subscription Usage - NanoGPT API Documentation](#subscription-usage-nanogpt-api-documentation) - [Integrations - NanoGPT API Documentation](#integrations-nanogpt-api-documentation) - [Image API - NanoGPT API Documentation](#image-api-nanogpt-api-documentation) - [Prompt Caching - NanoGPT API Documentation](#prompt-caching-nanogpt-api-documentation) - [Voice Cloning - NanoGPT API Documentation](#voice-cloning-nanogpt-api-documentation) - [NSFW Image Classification - NanoGPT API Documentation](#nsfw-image-classification-nanogpt-api-documentation) - [Direct Web Search API - NanoGPT API Documentation](#direct-web-search-api-nanogpt-api-documentation) - [Speech-to-Text Status - NanoGPT API Documentation](#speech-to-text-status-nanogpt-api-documentation) --- # Introduction - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/introduction#content-area) [​](https://docs.nano-gpt.com/introduction#overview) Overview ---------------------------------------------------------------- The NanoGPT API allows you to generate text, images and video using any AI model available. Our implementation for text generation generally matches the OpenAI standards. For API-key integrations, use `https://api.nano-gpt.com` as your API host. It accepts larger requests and allows longer-running requests than the website host, which matters for attachments and long model calls. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for SDK base URLs and the website flows that should stay on `nano-gpt.com`. Partner domains such as [ai.bitcoin.com](https://ai.bitcoin.com/) , [bcashgpt.com](https://bcashgpt.com/) , and [cake.nano-gpt.com](https://cake.nano-gpt.com/) may use the same API paths and request formats. Their request size and runtime limits can differ from `api.nano-gpt.com`. [​](https://docs.nano-gpt.com/introduction#main-api-endpoints) Main API Endpoints ------------------------------------------------------------------------------------ | Endpoint | Purpose | | --- | --- | | `POST /api/v1/chat/completions` | OpenAI-compatible chat generation | | `POST https://api.nano-gpt.com/api/v1/batches` | Asynchronous Batch API jobs for Chat Completions and Responses requests | | `POST /api/v1/responses` | OpenAI-compatible Responses API | | `POST /v1/images/generations` | OpenAI-compatible image generation | | `POST /api/generate-video` | Video generation, editing, extension, and upscaling | | `POST /api/v1/messages` | Anthropic-compatible Messages API | For selected endpoints, you can also use [Accountless x402 API Payments](https://docs.nano-gpt.com/api-reference/miscellaneous/x402) to receive a payment quote without an account or API key by including `x-x402: true` on the initial unauthenticated quote request. Check `GET /api/v1/x402/endpoints` for the current supported matrix. [​](https://docs.nano-gpt.com/introduction#chat-completion-example) Chat Completion example ---------------------------------------------------------------------------------------------- Here’s a simple python example using our OpenAI-compatible chat completions endpoint: import requests import json BASE_URL = "https://api.nano-gpt.com/api/v1" API_KEY = "YOUR_API_KEY" # Replace with your API key headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json", "Accept": "text/event-stream" # Required for SSE streaming } def stream_chat_completion(messages, model="minimax/minimax-m2.7"): """ Send a streaming chat completion request using the OpenAI-compatible endpoint. """ data = { "model": model, "messages": messages, "stream": True # Enable streaming } response = requests.post( f"{BASE_URL}/chat/completions", headers=headers, json=data, stream=True ) if response.status_code != 200: raise Exception(f"Error: {response.status_code}") for line in response.iter_lines(): if line: line = line.decode('utf-8') if line.startswith('data: '): line = line[6:] if line == '[DONE]': break try: chunk = json.loads(line) if chunk['choices'][0]['delta'].get('content'): yield chunk['choices'][0]['delta']['content'] except json.JSONDecodeError: continue # Example usage messages = [\ {"role": "system", "content": "You are a helpful assistant."},\ {"role": "user", "content": "Please explain the concept of artificial intelligence."}\ ] try: print("Assistant's Response:") for content_chunk in stream_chat_completion(messages): print(content_chunk, end='', flush=True) print("") except Exception as e: print(f"Error: {str(e)}") [​](https://docs.nano-gpt.com/introduction#quick-start) Quick Start ---------------------------------------------------------------------- The quickest way to get started with our API is to explore our [Endpoint Examples](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) . Each endpoint page provides comprehensive documentation with request/response formats and example code. The [Chat Completion](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) endpoint is a great starting point for text generation. [​](https://docs.nano-gpt.com/introduction#documentation-sections) Documentation Sections -------------------------------------------------------------------------------------------- For detailed documentation on each feature, please refer to the following sections: * [Text Generation](https://docs.nano-gpt.com/api-reference/text-generation) - Complete guide to text generation APIs including OpenAI-compatible endpoints and legacy options * [Image Generation](https://docs.nano-gpt.com/api-reference/image-generation) - Learn how to generate images using various models like Recraft, Flux, and Stable Diffusion. * [Video Generation](https://docs.nano-gpt.com/api-reference/video-generation) - Create high-quality videos with our video generation API Copy as Markdown --- # Embeddings - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/embeddings#content-area) [​](https://docs.nano-gpt.com/api-reference/embeddings#overview) 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. [​](https://docs.nano-gpt.com/api-reference/embeddings#quick-start) Quick Start ---------------------------------------------------------------------------------- from openai import OpenAI # Initialize client pointing to NanoGPT client = OpenAI( api_key="YOUR_NANOGPT_API_KEY", base_url="https://api.nano-gpt.com/api/v1" ) # Create embedding response = client.embeddings.create( input="Your text to embed", model="text-embedding-3-small" ) embedding = response.data[0].embedding print(f"Embedding has {len(embedding)} dimensions") [​](https://docs.nano-gpt.com/api-reference/embeddings#available-models) Available Models -------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/embeddings#openai-models) OpenAI Models | Model | Dimensions | Max Tokens | Price/1M tokens | Features | | --- | --- | --- | --- | --- | | `text-embedding-3-small` | 1536 | 8191 | $0.02 | Dimension reduction support, most cost-effective | | `text-embedding-3-large` | 3072 | 8191 | $0.13 | Dimension reduction support, highest performance | | `text-embedding-ada-002` | 1536 | 8191 | $0.10 | Legacy model, no dimension reduction | ### [​](https://docs.nano-gpt.com/api-reference/embeddings#alternative-models) Alternative Models #### [​](https://docs.nano-gpt.com/api-reference/embeddings#multilingual-models) Multilingual Models | Model | Dimensions | Price/1M tokens | Description | | --- | --- | --- | --- | | `BAAI/bge-m3` | 1024 | $0.01 | Excellent multilingual support | #### [​](https://docs.nano-gpt.com/api-reference/embeddings#language-specific-models) Language-Specific Models | Model | Language | Dimensions | Price/1M tokens | | --- | --- | --- | --- | | `BAAI/bge-base-en-v1.5` | English | 768 | $0.005 | | `BAAI/bge-large-en-v1.5` | English | 1024 | $0.01 | #### [​](https://docs.nano-gpt.com/api-reference/embeddings#specialized-models) Specialized Models | Model | Use Case | Dimensions | Price/1M tokens | | --- | --- | --- | --- | | `Qwen/Qwen3-Embedding-0.6B` | General | 1024 | $0.01 | | `Qwen/Qwen3-Embedding-4B` | General | 2560 | $0.02 | | `Qwen/Qwen3-Embedding-8B` | General | 4096 | $0.01 | | `gemini-embedding-001` | General | 3072 | $0.15 | ### [​](https://docs.nano-gpt.com/api-reference/embeddings#zero-data-retention-zdr) Zero Data Retention (ZDR) When ZDR-only routing is on for your account, API key, or team, embedding requests are accepted only for models with a Zero Data Retention route: * `Qwen/Qwen3-Embedding-0.6B` * `Qwen/Qwen3-Embedding-4B` * `qwen/qwen3-embedding-8b` * `BAAI/bge-m3` * `BAAI/bge-large-en-v1.5` * `BAAI/bge-base-en-v1.5` These requests use only providers that declare zero data retention. Other embedding models, including the OpenAI and Gemini models, return HTTP 400 with code `zero_data_retention` while ZDR-only routing is on. Without ZDR-only routing, ZDR-capable models may also be served by providers that retain data. [`GET /api/v1/embedding-models`](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models) reports this as `zero_data_retention` on each model. [​](https://docs.nano-gpt.com/api-reference/embeddings#api-endpoints) API Endpoints -------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/embeddings#create-embeddings) Create Embeddings **Endpoint:** `POST https://api.nano-gpt.com/api/v1/embeddings` Create embeddings for one or more text inputs. ### [​](https://docs.nano-gpt.com/api-reference/embeddings#discover-embedding-models) Discover Embedding Models **Endpoint:** `GET https://api.nano-gpt.com/api/v1/embedding-models` List all available embedding models with detailed information. [​](https://docs.nano-gpt.com/api-reference/embeddings#advanced-features) Advanced Features ---------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/embeddings#batch-processing) Batch Processing Process multiple texts efficiently in a single request: texts = [\ "First text to embed",\ "Second text to embed",\ "Third text to embed"\ ] response = client.embeddings.create( input=texts, # Pass array of strings model="text-embedding-3-small" ) # Access embeddings by index for i, data in enumerate(response.data): print(f"Text {i}: {len(data.embedding)} dimensions") ### [​](https://docs.nano-gpt.com/api-reference/embeddings#dimension-reduction) Dimension Reduction Reduce embedding dimensions for faster similarity comparisons (supported models only): # Reduce dimensions to 256 for faster processing response = client.embeddings.create( input="Your text here", model="text-embedding-3-small", dimensions=256 # Reduce from 1536 to 256 ) Supported models for dimension reduction: * `text-embedding-3-small` * `text-embedding-3-large` * `Qwen/Qwen3-Embedding-0.6B` ### [​](https://docs.nano-gpt.com/api-reference/embeddings#base64-encoding) Base64 Encoding For more efficient data transfer, request base64-encoded embeddings: response = client.embeddings.create( input="Your text here", model="text-embedding-3-small", encoding_format="base64" # Returns base64-encoded bytes ) [​](https://docs.nano-gpt.com/api-reference/embeddings#use-cases) Use Cases ------------------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/api-reference/embeddings#semantic-search) Semantic Search Build powerful search systems that understand meaning: import numpy as np from sklearn.metrics.pairwise import cosine_similarity # Create embeddings for your documents documents = ["Document 1 text", "Document 2 text", "Document 3 text"] doc_embeddings = [] for doc in documents: response = client.embeddings.create(input=doc, model="text-embedding-3-small") doc_embeddings.append(response.data[0].embedding) # Create embedding for search query query = "Search query text" query_response = client.embeddings.create(input=query, model="text-embedding-3-small") query_embedding = query_response.data[0].embedding # Calculate similarities similarities = cosine_similarity([query_embedding], doc_embeddings)[0] # Find most similar documents top_matches = np.argsort(similarities)[::-1][:3] for idx in top_matches: print(f"Document {idx}: {similarities[idx]:.3f} similarity") ### [​](https://docs.nano-gpt.com/api-reference/embeddings#rag-retrieval-augmented-generation) RAG (Retrieval Augmented Generation) Enhance LLM responses with relevant context: # 1. Embed and store your knowledge base knowledge_base = [\ {"text": "Company founded in 2020...", "embedding": None},\ {"text": "Product features include...", "embedding": None},\ ] for item in knowledge_base: response = client.embeddings.create( input=item["text"], model="text-embedding-3-small" ) item["embedding"] = response.data[0].embedding # 2. For a user query, find relevant context user_query = "When was the company founded?" query_response = client.embeddings.create( input=user_query, model="text-embedding-3-small" ) query_embedding = query_response.data[0].embedding # 3. Find most relevant facts (implement similarity search) # relevant_facts = find_similar_texts(query_embedding, knowledge_base, top_k=3) # 4. Use retrieved context with chat completion chat_response = client.chat.completions.create( model="gpt-4", messages=[\ {"role": "system", "content": f"Use this context to answer: {relevant_facts}"},\ {"role": "user", "content": user_query}\ ] ) ### [​](https://docs.nano-gpt.com/api-reference/embeddings#clustering-&-classification) Clustering & Classification Group similar texts or classify content: from sklearn.cluster import KMeans # Create embeddings for texts texts = ["Text 1", "Text 2", "Text 3", ...] embeddings = [] for text in texts: response = client.embeddings.create(input=text, model="text-embedding-3-small") embeddings.append(response.data[0].embedding) # Cluster embeddings kmeans = KMeans(n_clusters=5) clusters = kmeans.fit_predict(embeddings) # Each text now has a cluster assignment for text, cluster_id in zip(texts, clusters): print(f"'{text}' belongs to cluster {cluster_id}") ### [​](https://docs.nano-gpt.com/api-reference/embeddings#duplicate-detection) Duplicate Detection Find similar or duplicate content: def find_duplicates(texts, threshold=0.95): embeddings = [] # Generate embeddings for text in texts: response = client.embeddings.create( input=text, model="text-embedding-3-small" ) embeddings.append(response.data[0].embedding) # Calculate pairwise similarities similarities = cosine_similarity(embeddings) # Find duplicates duplicates = [] for i in range(len(texts)): for j in range(i+1, len(texts)): if similarities[i][j] > threshold: duplicates.append((i, j, similarities[i][j])) return duplicates [​](https://docs.nano-gpt.com/api-reference/embeddings#model-selection-guide) Model Selection Guide ------------------------------------------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/api-reference/embeddings#by-use-case) By Use Case | Use Case | Recommended Model | Rationale | | --- | --- | --- | | General English text | `text-embedding-3-small` | Best price/performance ratio | | Maximum accuracy | `text-embedding-3-large` | Highest quality embeddings | | Multilingual content | `BAAI/bge-m3` | Excellent cross-language performance | | Code embeddings | `qwen/qwen3-embedding-8b` | Strong code retrieval with a 32K-token context | | Budget-conscious | `BAAI/bge-large-en-v1.5` | Just $0.01/1M tokens | | Chinese content | `BAAI/bge-m3` | Strong Chinese and multilingual retrieval | | Fast similarity search | Models with dimension reduction | Can reduce dimensions for speed | ### [​](https://docs.nano-gpt.com/api-reference/embeddings#by-requirements) 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 `qwen/qwen3-embedding-8b` for higher-quality multilingual retrieval **Working with code?** * Use `qwen/qwen3-embedding-8b` * Strong code retrieval with a 32K-token context [​](https://docs.nano-gpt.com/api-reference/embeddings#best-practices) Best Practices ---------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/embeddings#performance-optimization) 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 ### [​](https://docs.nano-gpt.com/api-reference/embeddings#cost-optimization) 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 ### [​](https://docs.nano-gpt.com/api-reference/embeddings#quality-optimization) 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 [​](https://docs.nano-gpt.com/api-reference/embeddings#integration-examples) Integration Examples ---------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/embeddings#javascript/typescript) JavaScript/TypeScript import OpenAI from 'openai'; // Initialize client const openai = new OpenAI({ apiKey: 'YOUR_NANOGPT_API_KEY', baseURL: 'https://api.nano-gpt.com/api/v1' }); // Create embedding const response = await openai.embeddings.create({ input: "Your text to embed", model: "text-embedding-3-small" }); const embedding = response.data[0].embedding; console.log(`Embedding has ${embedding.length} dimensions`); ### [​](https://docs.nano-gpt.com/api-reference/embeddings#curl) cURL curl https://api.nano-gpt.com/api/v1/embeddings \ -H "Authorization: Bearer YOUR_NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "Your text to embed", "model": "text-embedding-3-small" }' ### [​](https://docs.nano-gpt.com/api-reference/embeddings#direct-api-usage) Direct API Usage import requests import json headers = { "Authorization": "Bearer YOUR_NANOGPT_API_KEY", "Content-Type": "application/json" } data = { "input": "Your text to embed", "model": "text-embedding-3-small" } response = requests.post( "https://api.nano-gpt.com/api/v1/embeddings", headers=headers, json=data ) result = response.json() embedding = result["data"][0]["embedding"] [​](https://docs.nano-gpt.com/api-reference/embeddings#rate-limits-&-error-handling) Rate Limits & Error Handling -------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/embeddings#rate-limits) Rate Limits Rate limits vary by endpoint and account. See [Rate Limits](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits) . ### [​](https://docs.nano-gpt.com/api-reference/embeddings#error-codes) Error Codes | Code | Description | Solution | | --- | --- | --- | | 401 | Invalid or missing API key | Check your API key | | 400 | Invalid request parameters | Verify model name and input format | | 400 (`zero_data_retention`) | ZDR-only routing is on and the model has no Zero Data Retention route | Use a model with `zero_data_retention: true` | | 429 | Rate limit exceeded | Implement exponential backoff | | 500 | Server error | Retry with exponential backoff | ### [​](https://docs.nano-gpt.com/api-reference/embeddings#error-response-format) Error Response Format { "error": { "message": "Invalid model specified", "type": "invalid_request_error", "param": "model", "code": null } } For a general guide across NanoGPT APIs, see [Error Handling](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling) . [​](https://docs.nano-gpt.com/api-reference/embeddings#migration-from-openai) Migration from OpenAI ------------------------------------------------------------------------------------------------------ Switching from OpenAI to NanoGPT is seamless: # OpenAI client = OpenAI(api_key="sk-...") # NanoGPT (just change base_url and api_key) client = OpenAI( api_key="YOUR_NANOGPT_API_KEY", base_url="https://api.nano-gpt.com/api/v1" ) # All other code remains exactly the same! [​](https://docs.nano-gpt.com/api-reference/embeddings#pricing-summary) Pricing Summary ------------------------------------------------------------------------------------------ | Price Range | Models | Best For | | --- | --- | --- | | $0.005-0.02/1M | BAAI models, Qwen3 | Budget applications | | $0.02/1M | text-embedding-3-small | Balanced performance | | $0.10/1M | ada-002 | Legacy compatibility | | $0.13/1M | text-embedding-3-large | Maximum performance | | $0.15-0.20/1M | Gemini embeddings | Image input with Gemini Embedding 2 | [​](https://docs.nano-gpt.com/api-reference/embeddings#additional-resources) Additional Resources ---------------------------------------------------------------------------------------------------- * [Embeddings Endpoint Reference](https://docs.nano-gpt.com/api-reference/endpoint/embeddings) * [Embedding Models List](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models) * [Text Generation Guide](https://docs.nano-gpt.com/api-reference/text-generation) * [Quickstart Guide](https://docs.nano-gpt.com/quickstart) Copy as Markdown --- # Unknown \# NanoGPT API Documentation - \[Introduction\](https://docs.nano-gpt.com/introduction.md): Welcome to the Nano-GPT.com API - \[Authentication\](https://docs.nano-gpt.com/authentication.md): How to authenticate with the NanoGPT API and web app. - \[Quickstart\](https://docs.nano-gpt.com/quickstart.md): Start querying any model within 2 minutes. - \[Models\](https://docs.nano-gpt.com/api-reference/endpoint/models.md): List available models. The default response is intentionally minimal for OpenAI compatibility; use \`detailed=true\` for capabilities, supported service tiers, and pricing. - \[List Image Models\](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models.md): List image models for NanoGPT's dedicated Image API - \[Get Image Model Endpoints\](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints.md): Inspect endpoint metadata, pricing, and image-input constraints for an image model - \[Image Models\](https://docs.nano-gpt.com/api-reference/endpoint/image-models.md): List available image generation and image editing models with capabilities and supported parameters - \[Video Models\](https://docs.nano-gpt.com/api-reference/endpoint/video-models.md): List available video models with generation capabilities and supported parameters - \[Audio Models\](https://docs.nano-gpt.com/api-reference/endpoint/audio-models.md): List available text-to-speech and speech-to-text models - \[Personalized Models\](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models.md) - \[Characters\](https://docs.nano-gpt.com/api-reference/endpoint/characters.md) - \[Character Models\](https://docs.nano-gpt.com/api-reference/endpoint/character-models.md) - \[Chat Completion\](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion.md): Creates a chat completion for the provided messages. The NanoGPT Advisor extension is available for non-streaming, platform-billed pay-as-you-go API-key requests that do not use client tools, structured output, inline moderation, BYOK, accountless payment, memory, or server-side content enhancements… - \[Batch API\](https://docs.nano-gpt.com/api-reference/endpoint/batches.md): Run Chat Completions, Responses, and native Anthropic Message Batches asynchronously - \[List Inline Batches\](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list.md): List authenticated inline batches with filters and bidirectional cursor pagination - \[List All Batches\](https://docs.nano-gpt.com/api-reference/endpoint/batches-list.md): List all authenticated batches with filters and bidirectional cursor pagination - \[Direct Web Search API\](https://docs.nano-gpt.com/api-reference/endpoint/web-search.md): Run direct web search requests with explicit query control, provider-specific options, and Sofya search, fetch, extract, and research operations - \[Data API\](https://docs.nano-gpt.com/api-reference/endpoint/data-api.md): Discover and call NanoGPT data tools through one stable endpoint family - \[Decisions\](https://docs.nano-gpt.com/api-reference/endpoint/decisions.md): Typed choices, scores, and yes/no probabilities from decision models. - \[Responses\](https://docs.nano-gpt.com/api-reference/endpoint/responses.md): Create a response with the OpenAI-compatible Responses API. Compatible models can use the Responses-only hosted tool-search pilot by adding a nanogpt:tool\_search or tool\_search entry and marking function tools with defer\_loading: true. The NanoGPT Advisor extension is available for non-streaming, fo… - \[Messages\](https://docs.nano-gpt.com/api-reference/endpoint/messages.md): Accepts Anthropic Messages requests, including video blocks for models that advertise video input. Authenticate with an API key using the Authorization: Bearer header or the x-api-key header. - \[Messages Count Tokens\](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens.md): Anthropic-compatible token estimate endpoint for planning and cost control - \[Completions\](https://docs.nano-gpt.com/api-reference/endpoint/completion.md): Creates a completion for the provided prompt. This endpoint is available on a best-effort basis for legacy compatibility, and performance may be less consistent than /v1/chat/completions because not all upstream providers support the legacy completions API. - \[v1/audio/transcriptions (STT)\](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions.md): OpenAI-compatible speech-to-text transcription endpoint - \[Embeddings\](https://docs.nano-gpt.com/api-reference/endpoint/embeddings.md): Create embeddings for text using OpenAI-compatible and alternative embedding models - \[Embedding Models\](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models.md): List all available embedding models with detailed information - \[Generate Images\](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate.md): Generate text-to-image and image-to-image outputs through NanoGPT's normalized Image API endpoint - \[Image Generation (OpenAI-Compatible)\](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai.md): Creates an image generation for the provided prompt (OpenAI-compatible). For unauthenticated accountless x402 quote requests, include x-x402: true. - \[Image Edits\](https://docs.nano-gpt.com/api-reference/endpoint/image-edits.md): OpenAI-compatible image editing endpoint with multipart and JSON inputs - \[NSFW Image Classification\](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image.md): Binary NSFW classification for up to 10 image URLs or data URLs per request - \[Moderation Models\](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models.md): List available content moderation models - \[Moderations\](https://docs.nano-gpt.com/api-reference/endpoint/moderations.md): Classify text and image content for safety - \[AI Detection\](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection.md): AI-text and plagiarism detection endpoint - \[Speech-to-Text Transcription\](https://docs.nano-gpt.com/api-reference/endpoint/transcribe.md): Transcribe audio (and supported video formats) into text using speech recognition models. Supports multiple languages, diarization (model-dependent), and various formats. Most models return synchronous results; some models (for example Elevenlabs-STT and voice cloning workflows) return asynchronous… - \[Speech-to-Text Status\](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status.md): Check the status of an asynchronous transcription job (Elevenlabs-STT). Poll this endpoint to get the transcription results when the job is completed. - \[YouTube Transcription\](https://docs.nano-gpt.com/api-reference/endpoint/youtube-transcribe.md): Extract transcripts from YouTube videos programmatically. Supports multiple URLs per request and provides detailed response information including success/failure status for each video. - \[Context Memory (Standalone)\](https://docs.nano-gpt.com/api-reference/endpoint/memory.md): Compress a conversation with Context Memory and return compressed messages and usage (no model inference) - \[Web Scraping\](https://docs.nano-gpt.com/api-reference/endpoint/scrape-urls.md): Extract clean, formatted content from web pages. Returns both raw HTML content and formatted markdown. - \[Data Extraction APIs\](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction.md): Public data extraction endpoints for web, maps, social, and email/domain intelligence workflows - \[v1/audio/speech (TTS + Music)\](https://docs.nano-gpt.com/api-reference/endpoint/speech.md) - \[Text-to-Speech\](https://docs.nano-gpt.com/api-reference/endpoint/tts.md): Convert text into natural-sounding speech using various TTS models from different providers. Supports multiple languages, voices, and customization options including speed control, voice instructions, and audio format selection. - \[TTS Status\](https://docs.nano-gpt.com/api-reference/endpoint/tts-status.md) - \[Voice Cloning\](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning.md): Clone voices from reference audio and reuse them with compatible TTS models - \[TEE Attestation\](https://docs.nano-gpt.com/api-reference/endpoint/tee-attestation.md): Fetch TEE attestation report for a model - \[TEE Signature\](https://docs.nano-gpt.com/api-reference/endpoint/tee-signature.md): Fetch ECDSA signature for a chat request - \[Retrieve Midjourney Generation Status\](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status.md): Check the status of an asynchronous Midjourney image generation task - \[Video Generation\](https://docs.nano-gpt.com/api-reference/endpoint/video-generation.md): Generate videos using supported text-to-video, image-to-video, and video-to-video models. The response includes a runId and pending status; poll the status endpoint for completion. See the docs for the current model list and required inputs. - \[Video Status (Unified)\](https://docs.nano-gpt.com/api-reference/endpoint/video-status-unified.md): Unified video status endpoint that works across all video backends. Check the status of a video generation request using only the request ID and receive normalized status information. - \[Video Recover\](https://docs.nano-gpt.com/api-reference/endpoint/video-recover.md): Recover recent video generation runs for a user. - \[Video Extend\](https://docs.nano-gpt.com/api-reference/endpoint/video-extend.md): Extend a Midjourney video using a task-based flow (taskId + index). - \[Video Content\](https://docs.nano-gpt.com/api-reference/endpoint/video-content.md): Proxy content retrieval for Sora 2 videos. - \[Check Balance\](https://docs.nano-gpt.com/api-reference/endpoint/check-balance.md): Check the account balance - \[Usage\](https://docs.nano-gpt.com/api-reference/endpoint/usage.md): Retrieve aggregate spend, request, and token usage for the authenticated API key - \[Request Billing\](https://docs.nano-gpt.com/api-reference/endpoint/request-billing.md): Look up a recorded primary charge and token usage by request ID for 24 hours. - \[Feedback API\](https://docs.nano-gpt.com/api-reference/endpoint/feedback.md): Submit private API feedback and retrieve its status, with exact error codes and retry guidance. - \[Create Invitation\](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create.md): Create an invitation or referral link with an optional credit amount. - \[Subscription Usage\](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage.md): Read subscription token quotas and billing-routing advice for your inference API key. - \[Receive Nano\](https://docs.nano-gpt.com/api-reference/endpoint/receive-nano.md): Process pending Nano transactions for the account - \[Deposits (Crypto + Fiat)\](https://docs.nano-gpt.com/api-reference/endpoint/crypto-deposits.md): Create deposit payment intents and track status programmatically - \[Text Generation\](https://docs.nano-gpt.com/api-reference/text-generation.md): Complete guide to text generation APIs - \[Embeddings\](https://docs.nano-gpt.com/api-reference/embeddings.md): Complete guide to text embeddings API - \[Image API\](https://docs.nano-gpt.com/api-reference/image-generation.md): Discover image models, inspect endpoint metadata and pricing, and generate images through NanoGPT's normalized Image API. - \[Video Generation\](https://docs.nano-gpt.com/api-reference/video-generation.md): Complete guide to video generation APIs - \[Speech-to-Text (STT)\](https://docs.nano-gpt.com/api-reference/speech-to-text.md): Complete guide to speech-to-text transcription APIs - \[Text-to-Speech (TTS)\](https://docs.nano-gpt.com/api-reference/text-to-speech.md): Complete guide to text-to-speech synthesis APIs - \[Music Generation\](https://docs.nano-gpt.com/api-reference/music-generation.md): Generate music from text prompts using NanoGPT's OpenAI-compatible audio/speech endpoint. - \[TEE Verification\](https://docs.nano-gpt.com/api-reference/tee-verification.md): Guide to verifying TEE attestation reports and signatures for TEE-backed models. - \[Evals and Observability\](https://docs.nano-gpt.com/api-reference/evals.md): Run prompt and model experiments, freeze datasets, version scorers, inspect traces, and aggregate eval metrics. - \[Teams\](https://docs.nano-gpt.com/api-reference/teams.md): Complete API reference for the NanoGPT Teams feature - \[Management API\](https://docs.nano-gpt.com/api-reference/management-api.md): Monitor subscription quotas or manage API keys with separate, scoped credentials. - \[API Hosts\](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts.md): Choose the direct API host for inference, uploads, and long-running requests. - \[Rate Limits\](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits.md): Information about API rate limits - \[Error Handling\](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling.md): Error formats, status codes, and retry guidance for the NanoGPT API. - \[Inline Moderation\](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation.md): Run a paid input safety preflight before selected generation requests - \[Accountless x402 API Payments\](https://docs.nano-gpt.com/api-reference/miscellaneous/x402.md): Opt in to accountless payment quotes for supported NanoGPT API endpoints, pay with a supported crypto rail, and complete or replay the original request. - \[Extended Thinking (Reasoning)\](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking.md): How NanoGPT surfaces and controls reasoning output across OpenAI-compatible endpoints - \[Change Reasoning Effort Within a Conversation\](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort.md): Use ordered effort updates with Astra and Fable 5.1, including trailing updates and developer messages. - \[Streaming Protocol (SSE)\](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol.md): How NanoGPT streams responses over Server-Sent Events across chat completions, messages, and responses. - \[Compressed Request Bodies\](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression.md): Send gzip, deflate, or Brotli compressed JSON to the text APIs for faster uploads - \[Tool Calling Diagnostics\](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics.md): Opt in to share a failed tool-calling turn with NanoGPT support - \[Hosted tool search\](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search.md): Let compatible models discover relevant functions from large deferred tool catalogs on demand. - \[Advisor\](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor.md): Let one model consult a different second model before producing its final answer. - \[Video Input\](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input.md): Send videos to compatible text and multimodal models through Chat Completions, Responses, or Messages. - \[Prompt Caching\](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching.md): Understand NanoGPT caching behavior: implicit caching by default on supported providers (including many open-source routes), plus explicit prompt-caching controls for Claude. - \[Pricing and Fees\](https://docs.nano-gpt.com/api-reference/miscellaneous/pricing.md): Information about API pricing - \[Pay-As-You-Go Billing Override\](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override.md): Force pay-as-you-go billing for subscription-included models - \[Provider Selection\](https://docs.nano-gpt.com/api-reference/miscellaneous/provider-selection.md): Choose the upstream provider for supported open-source models - \[Distillation Policy\](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy.md): Identify text models and provider routes whose outputs may be used for model distillation or training - \[Model Suffixes\](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes.md): Supported suffixes for web search, memory, PII redaction, caching, reasoning effort and visibility, thinking variants, and provider routing preferences. - \[PII Redaction\](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction.md): Optional PII redaction for API and web chat requests. - \[OAuth PKCE\](https://docs.nano-gpt.com/api-reference/miscellaneous/oauth-pkce.md): Let users sign in with NanoGPT and receive an app-specific API key through authorization-code PKCE. - \[Brave\](https://docs.nano-gpt.com/api-reference/miscellaneous/brave.md): Brave provider notes - \[Bring Your Own Key (BYOK)\](https://docs.nano-gpt.com/api-reference/miscellaneous/byok.md): Route chat completions through your own provider API keys. - \[For Providers\](https://docs.nano-gpt.com/api-reference/miscellaneous/for-providers.md): Information for model providers - \[Auto Recharge\](https://docs.nano-gpt.com/api-reference/miscellaneous/auto-recharge.md): Information about automatically recharging your account - \[Chrome Extension\](https://docs.nano-gpt.com/api-reference/miscellaneous/chrome-extension.md): Information about the NanoGPT Chrome Extension - \[URL Parameters (Web App)\](https://docs.nano-gpt.com/web-app/url-parameters.md): Currently supported URL parameters for the NanoGPT web app UI. - \[JavaScript Library\](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript.md): Node.js library for interacting with NanoGPT API - \[Context Memory\](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory.md): Lossless, hierarchical episodic memory for unlimited AI conversations - \[TypeScript Library\](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript.md): TypeScript client for NanoGPT API - \[Model Context Protocol (MCP)\](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server.md): Integrate NanoGPT into your AI workflows via MCP - \[Partner Program\](https://docs.nano-gpt.com/partner/overview.md): Add NanoGPT-powered AI to your product while keeping your own users, brand, and UI — then apply to join. - \[Partner Auth\](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth.md): Add NanoGPT-powered AI to your product while keeping your own user accounts, brand, and UI. - \[Integrations\](https://docs.nano-gpt.com/integrations.md): Set up NanoGPT in coding agents, chat frontends, automation tools, and OpenAI-compatible clients. - \[CLI Device Login\](https://docs.nano-gpt.com/integrations/cli-login.md): Integrate NanoGPT device login into your CLI app - \[Cline\](https://docs.nano-gpt.com/integrations/cline.md): Using NanoGPT with Cline CLI interface - \[Codex CLI\](https://docs.nano-gpt.com/integrations/codex-cli.md): Using OpenAI Codex CLI with NanoGPT - \[Grok CLI\](https://docs.nano-gpt.com/integrations/grok-cli.md): Use Grok CLI with NanoGPT and Grok + 50 other models - \[Gemini CLI\](https://docs.nano-gpt.com/integrations/gemini-cli.md): Use Gemini CLI with NanoGPT via the OpenRouter compatible fork - \[Claude Code\](https://docs.nano-gpt.com/integrations/claude-code.md): Use Claude Code with NanoGPT and Claude + 400 models - \[Roo Code\](https://docs.nano-gpt.com/integrations/roocode.md): Using NanoGPT with Roo Code interface - \[Kilo Code\](https://docs.nano-gpt.com/integrations/kilocode.md): Using NanoGPT with Kilo Code interface - \[Cursor\](https://docs.nano-gpt.com/integrations/cursor.md): Using NanoGPT with Cursor AI-powered code editor - \[Fluent\](https://docs.nano-gpt.com/integrations/fluent.md): Use NanoGPT models and MCP tools in Fluent for macOS - \[MCP\](https://docs.nano-gpt.com/integrations/mcp.md): Use NanoGPT via MCP-compatible clients - \[n8n\](https://docs.nano-gpt.com/integrations/n8n.md): Use n8n OpenAI nodes with NanoGPT to access 50+ models in your workflows - \[SillyTavern\](https://docs.nano-gpt.com/integrations/sillytavern.md): Using NanoGPT with SillyTavern for character-based chat - \[RisuAI\](https://docs.nano-gpt.com/integrations/risuai.md): Using NanoGPT with RisuAI for chat and character-based conversations - \[OpenWebUI\](https://docs.nano-gpt.com/integrations/openwebui.md): Using NanoGPT with OpenWebUI for an open-source ChatGPT-like interface - \[Otaku\](https://docs.nano-gpt.com/integrations/otaku.md): Using NanoGPT with Otaku, a roleplay terminal client - \[TypingMind\](https://docs.nano-gpt.com/integrations/typingmind.md): Using NanoGPT with TypingMind for an enhanced ChatGPT experience - \[LibreChat\](https://docs.nano-gpt.com/integrations/librechat.md): Using NanoGPT with LibreChat for a ChatGPT-like interface - \[OpenHands\](https://docs.nano-gpt.com/integrations/openhands.md): Using NanoGPT with OpenHands autonomous agent - \[OpenClaw (ClawdBot)\](https://docs.nano-gpt.com/integrations/openclaw.md): Use OpenClaw with NanoGPT to access Claude, GPT, Gemini, and more - \[OpenCode\](https://docs.nano-gpt.com/integrations/opencode.md): OpenCode integration for NanoGPT - \[JanitorAI\](https://docs.nano-gpt.com/integrations/janitorai.md): Using NanoGPT with JanitorAI's custom API integration - \[Droid\](https://docs.nano-gpt.com/integrations/droid.md): Use NanoGPT with the Droid CLI agent ## OpenAPI Specs - \[openapi\](/api-reference/openapi.json) ## Optional - \[Back to NanoGPT\](https://nano-gpt.com) - \[Discord\](https://discord.gg/KaQt8gPG6V) - \[Blog\](https://nano-gpt.com/blog) This documentation is built and hosted on \[Mintlify\](https://mintlify.com), a developer documentation platform. --- # v1/audio/transcriptions (STT) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#content-area) v1/audio/transcriptions (STT) cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/audio/transcriptions import requests url = "https://api.nano-gpt.com/api/v1/audio/transcriptions" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/audio/transcriptions', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/audio/transcriptions",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/audio/transcriptions" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/audio/transcriptions") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/audio/transcriptions") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / v1 / audio / transcriptions Try it v1/audio/transcriptions (STT) cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/audio/transcriptions import requests url = "https://api.nano-gpt.com/api/v1/audio/transcriptions" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/audio/transcriptions', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/audio/transcriptions",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/audio/transcriptions" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/audio/transcriptions") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/audio/transcriptions") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#overview) Overview ----------------------------------------------------------------------------------------------- NanoGPT provides a drop-in OpenAI-compatible endpoint for speech-to-text (STT) transcription. [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#endpoint) Endpoint ----------------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/audio/transcriptions [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#authentication) Authentication ----------------------------------------------------------------------------------------------------------- Use either header: * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#request-formats) Request Formats ------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#1-multipart-upload-openai-compatible) 1) Multipart upload (OpenAI-compatible) Send `multipart/form-data` with: * `file` (required): audio (or video for supported models) * `model` (required): STT model ID * `language` (optional): language code (default: auto-detect) curl -X POST https://api.nano-gpt.com/api/v1/audio/transcriptions \ -H "Authorization: Bearer YOUR_API_KEY" \ -F file=@audio.mp3 \ -F model=Whisper-Large-V3 \ -F language=en ### [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#2-json-with-url) 2) JSON with URL { "model": "Whisper-Large-V3", "file_url": "https://example.com/audio.mp3", "language": "en" } NanoGPT accepts `file_url` or `audio_url` for URL-based transcription. [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#supported-models-examples) Supported Models (Examples) ----------------------------------------------------------------------------------------------------------------------------------- Model availability changes; use `GET /api/v1/models?detailed=true` for discovery. | Model | Notes | | --- | --- | | `Whisper-Large-V3` | High-accuracy transcription | | `Wizper` | Fast processing | | `Elevenlabs-STT` | Speaker diarization + audio event tagging | | `gpt-4o-mini-transcribe` | Improved accuracy vs Whisper (OpenAI-family) | | `openai-whisper-with-video` | Accepts video files (MP4, MOV, etc.) | ### [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#voice-cloning-via-the-same-endpoint) Voice Cloning (via the same endpoint) Some special model IDs run voice-cloning workflows instead of returning plain transcription text: * `qwen-voice-clone` — returns a reusable speaker embedding URL * `minimax-voice-clone` — returns a reusable custom voice ID (and/or preview output) [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#response) Response ----------------------------------------------------------------------------------------------- { "text": "The transcribed text goes here.", "language": "en", "duration": 45.2 } [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#supported-formats) Supported Formats ----------------------------------------------------------------------------------------------------------------- * Audio: MP3, OGG, WAV, M4A, AAC * Video (model-dependent): MP4, MOV, AVI, MKV, WEBM [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#example-python-openai-sdk) Example (Python, OpenAI SDK) ------------------------------------------------------------------------------------------------------------------------------------ from openai import OpenAI client = OpenAI( base_url="https://api.nano-gpt.com/api/v1", api_key="YOUR_API_KEY" ) with open("audio.mp3", "rb") as audio_file: transcript = client.audio.transcriptions.create( model="Whisper-Large-V3", file=audio_file ) print(transcript.text) [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-transcriptions#see-also) See Also ----------------------------------------------------------------------------------------------- * NanoGPT transcription workflows: `api-reference/endpoint/transcribe.mdx` * Full STT guide and model list: `api-reference/speech-to-text.mdx` --- # Audio Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#content-area) Audio Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/audio-models import requests url = "https://api.nano-gpt.com/api/v1/audio-models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/audio-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/audio-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/audio-models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/audio-models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/audio-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body GET / api / v1 / audio-models Try it Audio Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/audio-models import requests url = "https://api.nano-gpt.com/api/v1/audio-models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/audio-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/audio-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/audio-models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/audio-models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/audio-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#overview) Overview --------------------------------------------------------------------------------------- Use `GET /api/v1/audio-models` to discover the currently available audio models. The response includes both text-to-speech (TTS) and speech-to-text (STT) models. This endpoint is cacheable. Refresh it periodically and do not hardcode audio model capabilities in your client. [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#endpoint) Endpoint --------------------------------------------------------------------------------------- GET https://api.nano-gpt.com/api/v1/audio-models [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#authentication) Authentication --------------------------------------------------------------------------------------------------- Authentication is optional. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#query-parameters) Query Parameters ------------------------------------------------------------------------------------------------------- | Parameter | Type | Default | Description | | --- | --- | --- | --- | | `detailed` | boolean | `true` | Include names, descriptions, pricing, capabilities, and supported parameters. | | `type` | string | `all` | Filter by audio model type. Allowed values: `all`, `tts`, `stt`. | [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#response) Response --------------------------------------------------------------------------------------- { "object": "list", "data": [\ {\ "id": "tts-model-id",\ "object": "model",\ "name": "Display name",\ "description": "Model description",\ "architecture": {\ "modality": "audio",\ "input_modalities": ["text"],\ "output_modalities": ["audio"]\ },\ "pricing": {\ "currency": "USD"\ },\ "capabilities": {\ "text_to_speech": true,\ "speech_to_text": false\ },\ "supported_parameters": {}\ }\ ], "meta": { "count": 1, "generated_at": "2026-05-07T12:00:00.000Z" } } When `type` is not `all`, `meta` may include the active filter. [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#model-types) Model Types --------------------------------------------------------------------------------------------- | Type | Description | | --- | --- | | `tts` | Text-to-speech models for `POST /api/v1/audio/speech` and related TTS endpoints. | | `stt` | Speech-to-text models for transcription endpoints. | | `all` | Both TTS and STT models. | [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#example) Example ------------------------------------------------------------------------------------- curl "https://api.nano-gpt.com/api/v1/audio-models?type=stt&detailed=true" \ -H "x-api-key: $NANOGPT_API_KEY" [​](https://docs.nano-gpt.com/api-reference/endpoint/audio-models#notes) Notes --------------------------------------------------------------------------------- * Supported parameters vary by model, including voices, formats, streaming support, file formats, language support, diarization, timestamps, and max input size. * Use this endpoint instead of hardcoding audio model capabilities. * The response is cacheable, but model availability can change. --- # AI Detection - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#content-area) AI Detection cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/ai-detection import requests url = "https://api.nano-gpt.com/api/v1/ai-detection" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/ai-detection', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/ai-detection",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/ai-detection" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/ai-detection") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/ai-detection") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / v1 / ai-detection Try it AI Detection cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/ai-detection import requests url = "https://api.nano-gpt.com/api/v1/ai-detection" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/ai-detection', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/ai-detection",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/ai-detection" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/ai-detection") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/ai-detection") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#overview) Overview --------------------------------------------------------------------------------------- Use `POST /api/v1/ai-detection` to run AI-text detection or plagiarism detection on a text input. [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#endpoint) Endpoint --------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/ai-detection [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#authentication) Authentication --------------------------------------------------------------------------------------------------- An API key is required. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#request-body) Request Body ----------------------------------------------------------------------------------------------- { "text": "Text to analyze...", "mode": "ai" } [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#parameters) Parameters ------------------------------------------------------------------------------------------- | Field | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `text` | string | Yes | \- | Text to analyze. | | `mode` | string | No | `ai` | Detection mode. Allowed values: `ai`, `plagiarism`. | [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#modes) Modes --------------------------------------------------------------------------------- | Mode | Description | | --- | --- | | `ai` | AI-text detection. | | `plagiarism` | Plagiarism detection. | [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#response) Response --------------------------------------------------------------------------------------- { "object": "ai_detection.result", "mode": "ai", "model": "pangram-ai-detection", "content": "Human-readable summary", "result": { "score": 0.12 }, "word_count": 250, "usage": { "prompt_tokens": 300, "completion_tokens": 50, "total_tokens": 350 }, "pricing": { "amount": 0.01, "currency": "USD" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#example) Example ------------------------------------------------------------------------------------- curl -X POST https://api.nano-gpt.com/api/v1/ai-detection \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Text to analyze...", "mode": "ai" }' [​](https://docs.nano-gpt.com/api-reference/endpoint/ai-detection#common-errors) Common Errors ------------------------------------------------------------------------------------------------- | Code | Description | | --- | --- | | `missing_api_key` | API key is required. | | `invalid_json` | Request body is not valid JSON. | | `invalid_mode` | `mode` is not `ai` or `plagiarism`. | | `missing_text` | `text` is required. | | `model_not_allowed` | Detection model is not available for the account or route. | | `paid_features_disabled` | Paid API features are disabled for the account. | | `insufficient_balance` | Account balance is too low for the request. | --- # Character Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/character-models#content-area) [​](https://docs.nano-gpt.com/api-reference/endpoint/character-models#overview) Overview ------------------------------------------------------------------------------------------- `/api/v1/character-models` returns approved public characters that are enabled for API use in a model-list-compatible shape. Use this endpoint when you want to sync available public characters into tools that already understand model list responses. [​](https://docs.nano-gpt.com/api-reference/endpoint/character-models#endpoint) Endpoint ------------------------------------------------------------------------------------------- GET https://api.nano-gpt.com/api/v1/character-models Query parameters: | Field | Type | Description | | --- | --- | --- | | `detailed` | boolean | Include slug and extended character metadata | | `cursor` | string | Pagination cursor | | `limit` | number | Page size | [​](https://docs.nano-gpt.com/api-reference/endpoint/character-models#example) Example ----------------------------------------------------------------------------------------- curl "https://api.nano-gpt.com/api/v1/character-models?detailed=true" Response: { "object": "list", "data": [\ {\ "id": "11111111-1111-1111-1111-111111111111",\ "object": "model",\ "created": 1760000000,\ "owned_by": "nanogpt",\ "character": {\ "character_id": "11111111-1111-1111-1111-111111111111",\ "slug": "helpful-guide",\ "base_model_id": "deepseek-ai/DeepSeek-V3-0324",\ "content_rating": "sfw",\ "tags": ["writing"],\ "rating_avg": 4.8,\ "rating_count": 12\ }\ }\ ], "next_cursor": null } Pass the returned `character.character_id` as `character_id` to the Responses API. --- # Brave - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/brave#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/brave#brave) Brave =============================================================================== Brave is supported as a standard web search provider in NanoGPT. For primary usage, use the main web search docs: * [Chat Completion web search](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) * [Direct Web Search API (`POST /api/web`)](https://docs.nano-gpt.com/api-reference/endpoint/web-search) * [Web Search in Text Generation Guide](https://docs.nano-gpt.com/api-reference/text-generation) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/brave#common-usage) Common usage --------------------------------------------------------------------------------------------- * `webSearch.provider: "brave"` * Model suffixes: `:online/brave` and `:online/brave-deep` [​](https://docs.nano-gpt.com/api-reference/miscellaneous/brave#notes) Notes ------------------------------------------------------------------------------- * Provider pricing is documented in the web search pricing tables. * BYOK support is provider-dependent; see [BYOK](https://docs.nano-gpt.com/api-reference/miscellaneous/byok) . * If Brave model IDs appear in `GET /api/v1/models`, you can use them like any other model ID. --- # Characters - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/characters#content-area) [​](https://docs.nano-gpt.com/api-reference/endpoint/characters#overview) Overview ------------------------------------------------------------------------------------- Characters are reusable AI personas with a base model, system prompt, optional first message, tags, content rating, and visibility controls. The website uses these same endpoints for importing, publishing, browsing, rating, and adapting character cards. [​](https://docs.nano-gpt.com/api-reference/endpoint/characters#authentication) Authentication ------------------------------------------------------------------------------------------------- Use either header for private writes: * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` Public catalog reads do not require authentication. Private reads and writes require the owning session or API key. [​](https://docs.nano-gpt.com/api-reference/endpoint/characters#list-public-characters) List Public Characters ----------------------------------------------------------------------------------------------------------------- GET https://api.nano-gpt.com/api/v1/characters Query parameters: | Field | Type | Description | | --- | --- | --- | | `q` | string | Search name, summary, and description | | `tags` | string or repeated string | Filter by one or more tag slugs | | `content_rating_max` | string | `sfw`, `suggestive`, `nsfw`, or `explicit` | | `sort` | string | `new`, `top_rated`, or `trending_simple` | | `cursor` | string | Pagination cursor from the previous response | | `limit` | number | Page size | Only approved public characters are returned. [​](https://docs.nano-gpt.com/api-reference/endpoint/characters#create-character) Create Character ----------------------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/characters { "name": "Helpful Guide", "summary": "A concise assistant for technical writing", "description": "Helps plan, edit, and tighten technical docs.", "base_model_id": "deepseek-ai/DeepSeek-V3-0324", "system_prompt": "You are a concise technical writing assistant.", "first_message": "What are we editing today?", "visibility": "private", "allow_api": false, "creator_content_rating": "sfw", "tags": ["writing", "productivity"] } Visibility values: | Value | Behavior | | --- | --- | | `private` | Only the owner can see and use it | | `unlisted` | Usable by direct ID or slug when permitted, not listed publicly | | `public` | Submitted to moderation before public discovery | Public submissions are created with `moderation_status: pending` and become discoverable only after approval. [​](https://docs.nano-gpt.com/api-reference/endpoint/characters#manage-your-characters) Manage Your Characters ----------------------------------------------------------------------------------------------------------------- GET /api/v1/characters/mine GET /api/v1/characters/{idOrSlug} PATCH /api/v1/characters/{idOrSlug} DELETE /api/v1/characters/{idOrSlug} `DELETE` archives the character instead of hard-deleting it. `PATCH` accepts the same core fields as create. Editing an approved public character sends it back to pending moderation. [​](https://docs.nano-gpt.com/api-reference/endpoint/characters#reviews-and-reports) Reviews And Reports ----------------------------------------------------------------------------------------------------------- PUT /api/v1/characters/{idOrSlug}/review POST /api/v1/characters/{idOrSlug}/report Review body: { "rating": 5, "review_text": "Optional review text with at least 10 characters." } Reviews require an authenticated account with either an active subscription or more than $1 in account balance. USD balance and Nano balance converted to USD both count toward this threshold. Report body: { "reason": "Policy concern", "details": "Optional extra context." } [​](https://docs.nano-gpt.com/api-reference/endpoint/characters#runtime-usage) Runtime Usage ----------------------------------------------------------------------------------------------- The Responses API accepts `character_id`: { "character_id": "character-uuid-or-slug", "input": "Introduce yourself" } When `character_id` is supplied, NanoGPT applies the character’s base model, instructions, and sampler defaults unless explicitly overridden by the request. For non-owner API usage, the character must be public, approved, and have API access enabled. --- # API Hosts - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts#recommended-host) Recommended host --------------------------------------------------------------------------------------------------------- Use `https://api.nano-gpt.com` for API-key requests. The direct API host has a higher request size limit and a longer request runtime than `https://nano-gpt.com`, so it is the better choice for large attachments, long conversations, and model calls that take time to finish. Batch file uploads also use the direct API host. | Client or request | Base URL or endpoint | | --- | --- | | OpenAI-compatible SDKs | `https://api.nano-gpt.com/api/v1` | | Anthropic SDK | `https://api.nano-gpt.com/api` (the SDK appends `/v1/messages`) | | Raw Chat Completions | `https://api.nano-gpt.com/api/v1/chat/completions` | | Raw Responses | `https://api.nano-gpt.com/api/v1/responses` | | Raw Messages | `https://api.nano-gpt.com/api/v1/messages` | | Batch files and jobs | `https://api.nano-gpt.com/api/v1` | The endpoint path and request format stay the same when switching from the website host to the direct API host. For example, replace `https://nano-gpt.com/api/v1/chat/completions` with `https://api.nano-gpt.com/api/v1/chat/completions`. The direct host’s higher ingress limit does not override the application, model, file-type, or provider limits for a particular endpoint. For authenticated Chat Completions, Responses, and Messages JSON requests, the application body limit is 32 MiB; check endpoint documentation for multipart and file limits. A long-running call also needs a sufficiently long timeout in your HTTP client. Check `GET https://api.nano-gpt.com/api/v1/models?detailed=true` for model availability on the direct host. The website and direct API host can have different model catalogs during deployment rollouts; a model listed on one host is not automatically available on the other. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts#website-flows) Website flows --------------------------------------------------------------------------------------------------- Use `https://nano-gpt.com` for the dashboard, creating or managing API keys, browser sign-in, OAuth and device login, and the [Management API](https://docs.nano-gpt.com/api-reference/management-api) . Follow the [Accountless x402 API Payments](https://docs.nano-gpt.com/api-reference/miscellaneous/x402) guide for its quote, payment, and callback URLs. --- # Chrome Extension - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/chrome-extension#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/chrome-extension#chrome-extension) Chrome Extension ================================================================================================================ The [NanoGPT Chrome Extension](https://chromewebstore.google.com/detail/nanogpt-search-extension/ajikfdfilhfkakicgdnjhklpfcohibfg?pli=1) is now available! Query NanoGPT from any website by hitting ALT + S (Windows) or CMD + S (Mac)! See also [this short Youtube video](https://www.youtube.com/watch?v=gndGYqvnQTY) . --- # Pricing and Fees - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/pricing#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pricing#pricing) Pricing ===================================================================================== For full pricing per model see our [dedicated pricing page](https://nano-gpt.com/pricing) with all models listed. We do not charge any minimum fee per query, nor do we charge any fee on deposits. Pricing examples and model IDs follow the same canonical-ID policy as this documentation: use exact IDs returned by `GET /api/v1/models`, and do not rely on hidden/internal aliases. If you are (potentially) going to be a large user of our API reach out to us at [support@nano-gpt.com](mailto:support@nano-gpt.com) or our [Discord](https://discord.gg/KaQt8gPG6V) for a discount. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pricing#look-up-a-recent-request-charge) Look up a recent request charge ------------------------------------------------------------------------------------------------------------------------------------- [Request Billing](https://docs.nano-gpt.com/api-reference/endpoint/request-billing) returns the original recorded primary charge and token usage using the response’s `X-Request-ID` and the same inference API key. It is available for 24 hours from the charge’s accounting timestamp. The exact cost is a decimal string in USD or XNO; refunds and separately billed extras are excluded. For aggregate spend and refund totals, use [Usage](https://docs.nano-gpt.com/api-reference/endpoint/usage) . --- # For Providers - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/for-providers#content-area) We work with inference providers and model developers that can offer something valuable to NanoGPT users. If you think you would be a good fit, contact us at [support@nano-gpt.com](mailto:support@nano-gpt.com) or through our [Discord](https://discord.gg/KaQt8gPG6V) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/for-providers#what-we-look-for) What we look for ------------------------------------------------------------------------------------------------------------- We receive many integration requests, so we prioritize providers that give users a clear reason to choose them. That could include: * Models that are not widely available through other providers * A meaningful advantage in price, latency, throughput, reliability, privacy, geographic coverage, or infrastructure * A distinctive technical approach, such as specialized hardware or a decentralized backend * Sufficient production capacity and operational support to handle sustained traffic reliably Size alone is not a requirement. A smaller provider can still be a strong fit if it offers a distinctive model or capability. However, if the offering is otherwise similar to providers we already support, we generally expect meaningful operational scale. A single-GPU or single-operator service is unlikely to be a fit unless it offers something genuinely unique. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/for-providers#stealth-model-launches) Stealth model launches ------------------------------------------------------------------------------------------------------------------------- We are also open to launching models in stealth, including under a temporary or non-public name. A stealth launch can help providers and model developers learn how people use a model in practice before a broader release—for example, for programming, creative writing, role play, or general conversation. If you would like to test a model this way, please reach out. We can discuss the scope, duration, presentation, and technical requirements of the launch. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/for-providers#what-to-include-when-contacting-us) What to include when contacting us ------------------------------------------------------------------------------------------------------------------------------------------------- To help us evaluate your offering, please include: * Your company name * The best way to contact you—we generally prefer email * Why you think we should integrate your service * Do you offer models that are difficult to access elsewhere? * Do you have especially competitive pricing or volume discounts? * Do you offer a meaningful technical, privacy, performance, or infrastructure advantage? * Your available infrastructure, approximate capacity, regions, and operational support * Your rate limits * Your privacy policy, including whether prompts are logged and how long they are retained * Whether you support credit card payments or automatic invoicing * Whether you provide an OpenAI-compatible endpoint * Whether you are proposing a public integration or a stealth model launch * Any other information that may be relevant --- # Cursor - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/cursor#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/cursor#using-cursor-with-nanogpt) Using Cursor with NanoGPT ========================================================================================================= A quick guide to setting up Cursor with NanoGPT’s API. [​](https://docs.nano-gpt.com/integrations/cursor#setup-instructions) Setup Instructions ------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. In Cursor settings: * Override OpenAI Base URL with: [https://nano-gpt.com/api/v1/](https://nano-gpt.com/api/v1/) * Set the API Key to your NanoGPT API key * Click ”+ Add Model” to add any of our models you want to use That’s it! You can now use any of our models in Cursor. Available models include openai/gpt-6.1-sol, anthropic/claude-opus-5.5, google/gemini-flash-latest, and many more. Want to explore available models? Visit our [pricing page](https://nano-gpt.com/pricing) . --- # Otaku - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/otaku#content-area) [​](https://docs.nano-gpt.com/integrations/otaku#otaku-integration) Otaku Integration ======================================================================================== [Otaku](https://otaku.sh/) is a roleplay client for the terminal, available on macOS, Linux, and Windows through WSL. NanoGPT is built in, so your NanoGPT model catalog appears directly in the model picker. [​](https://docs.nano-gpt.com/integrations/otaku#setup) Setup ---------------------------------------------------------------- 1. Install Otaku: curl -LsSf https://otaku.sh/install.sh | sh Alternatively, install it with `uv tool install otaku`. 2. Run `otaku`. When the model picker opens, press **Tab** to move to the provider panel, select **NanoGPT**, and paste your NanoGPT API key into the `API key:` field. Otaku verifies the key and lists your NanoGPT model catalog on the left. Your API key is stored encrypted in the configuration file. 3. Choose a model and start chatting. The prompt shows `$` while a cloud model is selected. [​](https://docs.nano-gpt.com/integrations/otaku#useful-commands) Useful commands ------------------------------------------------------------------------------------ * `/model` (Ctrl+O) reopens the picker to switch models or providers. * `/balance` shows your NanoGPT balance. * `/context` shows exactly what is sent to the model. [​](https://docs.nano-gpt.com/integrations/otaku#manual-configuration) Manual configuration ---------------------------------------------------------------------------------------------- To configure Otaku manually, add your API key to the `[nanogpt]` section of `~/.otaku/configs/providers.toml`: [nanogpt] url = "https://api.nano-gpt.com/api/v1" api_key = "your-nanogpt-api-key" For more information, see the [Otaku guide and demo](https://otaku.sh/) or the [Otaku source code](https://github.com/enclavum/otaku) . --- # Check Balance - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/check-balance#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/check-balance \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/check-balance" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.text) const options = {method: 'POST', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/check-balance', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/check-balance",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/check-balance" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/check-balance") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/check-balance") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 { "usd_balance": "129.46956147", "nano_balance": "26.71801147", "nanoDepositAddress": "nano_1gx385nnj7rw67hsksa3pyxwnfr48zu13t35ncjmtnqb9zdebtjhh7ahks34" } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / check-balance Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/check-balance \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/check-balance" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.text) const options = {method: 'POST', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/check-balance', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/check-balance",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/check-balance" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/check-balance") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/check-balance") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 { "usd_balance": "129.46956147", "nano_balance": "26.71801147", "nanoDepositAddress": "nano_1gx385nnj7rw67hsksa3pyxwnfr48zu13t35ncjmtnqb9zdebtjhh7ahks34" } { "error": 123, "message": "" } #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/check-balance#authorization-x-api-key) x-api-key string header required #### Response 200 application/json Account balance information [​](https://docs.nano-gpt.com/api-reference/endpoint/check-balance#response-usd-balance) usd\_balance string Account balance in USD Example: `"129.46956147"` [​](https://docs.nano-gpt.com/api-reference/endpoint/check-balance#response-nano-balance) nano\_balance string Account balance in Nano Example: `"26.71801147"` [​](https://docs.nano-gpt.com/api-reference/endpoint/check-balance#response-nano-deposit-address) nanoDepositAddress string Nano deposit address for the account Example: `"nano_1gx385nnj7rw67hsksa3pyxwnfr48zu13t35ncjmtnqb9zdebtjhh7ahks34"` --- # TypingMind - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/typingmind#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/typingmind#quick-start-guide) Quick Start Guide --------------------------------------------------------------------------------------------- 1. Get your API key from your [API page](https://nano-gpt.com/api) 2. In [TypingMind](https://www.typingmind.com/) , go to add custom model 3. Select “Create Manually” 4. Enter the following details: * Name: NanoGPT * API Type: OpenAI Compatible API * Icon URL (Optional): [https://nano-gpt.com/logo.png](https://nano-gpt.com/logo.png) * Endpoint: `https://nano-gpt.com/api/v1/chat/completions` * Model ID: openai/gpt-6.1-sol (or anthropic/claude-opus-5.5, google/gemini-flash-latest) * Authorization: Bearer YOUR\_API\_KEY 5. Click “Test” to verify the connection, then “Add Model” [​](https://docs.nano-gpt.com/integrations/typingmind#all-the-models) All the models --------------------------------------------------------------------------------------- We have a v1 models route that now supports detailed model information including pricing when you use `?detailed=true`. You can also find an easy overview of all models on our [pricing page](https://nano-gpt.com/pricing) . --- # Kilo Code - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/kilocode#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/kilocode#using-kilo-code-with-nanogpt) Using Kilo Code with NanoGPT ================================================================================================================= A quick guide to setting up Kilo Code with NanoGPT’s API. [​](https://docs.nano-gpt.com/integrations/kilocode#setup-instructions) Setup Instructions --------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. In Kilo Code settings, add a new Custom Model with these details: * API Provider: OpenAI Compatible * Base URL: [https://nano-gpt.com/api/v1/](https://nano-gpt.com/api/v1/) * API Key: Your key from step 1 * Model ID: openai/gpt-6.1-sol That’s it! You can now use Kilo Code with every model you can think of. Model names are on our [pricing page](https://nano-gpt.com/pricing) - important ones are openai/gpt-6.1-sol, anthropic/claude-opus-5.5, google/gemini-flash-latest, or just any other model you fancy. --- # TEE Attestation - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/tee-attestation#content-area) cURL cURL curl --request GET \ --url https://api.nano-gpt.com/v1/tee/attestation \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/v1/tee/attestation" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/v1/tee/attestation', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/v1/tee/attestation",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/v1/tee/attestation" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/v1/tee/attestation") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/v1/tee/attestation") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "attestation": "" } { "error": 123, "message": "" } GET / v1 / tee / attestation Try it cURL cURL curl --request GET \ --url https://api.nano-gpt.com/v1/tee/attestation \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/v1/tee/attestation" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/v1/tee/attestation', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/v1/tee/attestation",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/v1/tee/attestation" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/v1/tee/attestation") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/v1/tee/attestation") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "attestation": "" } { "error": 123, "message": "" } Fetch a TEE attestation report for a given model. #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-attestation#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Query Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-attestation#parameter-model) model string required TEE model to attest #### Response 200 application/json TEE attestation report [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-attestation#response-attestation) attestation string The attestation report --- # Retrieve Midjourney Generation Status - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/check-midjourney-status \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "task_id": "1744449927914205" } ' import requests url = "https://api.nano-gpt.com/api/check-midjourney-status" payload = { "task_id": "1744449927914205" } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({task_id: '1744449927914205'}) }; fetch('https://api.nano-gpt.com/api/check-midjourney-status', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/check-midjourney-status",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'task_id' => '1744449927914205'\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/check-midjourney-status" payload := strings.NewReader("{\n \"task_id\": \"1744449927914205\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/check-midjourney-status") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"task_id\": \"1744449927914205\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/check-midjourney-status") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"task_id\": \"1744449927914205\"\n}" response = http.request(request) puts response.read_body 200 400 { "status": "SUCCESS", "task_id": "1744449927914205", "progress": "50%", "imageUrl": "https://image-url.com/generated_image.png", "failReason": "Content moderation filter triggered." } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / check-midjourney-status Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/check-midjourney-status \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "task_id": "1744449927914205" } ' import requests url = "https://api.nano-gpt.com/api/check-midjourney-status" payload = { "task_id": "1744449927914205" } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({task_id: '1744449927914205'}) }; fetch('https://api.nano-gpt.com/api/check-midjourney-status', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/check-midjourney-status",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'task_id' => '1744449927914205'\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/check-midjourney-status" payload := strings.NewReader("{\n \"task_id\": \"1744449927914205\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/check-midjourney-status") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"task_id\": \"1744449927914205\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/check-midjourney-status") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"task_id\": \"1744449927914205\"\n}" response = http.request(request) puts response.read_body 200 400 { "status": "SUCCESS", "task_id": "1744449927914205", "progress": "50%", "imageUrl": "https://image-url.com/generated_image.png", "failReason": "Content moderation filter triggered." } { "error": 123, "message": "" } #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#authorization-x-api-key) x-api-key string header required #### Body application/json Task ID to check status for [​](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#body-task-id) task\_id string required The unique identifier for the Midjourney generation task. Example: `"1744449927914205"` #### Response 200 application/json Midjourney task status response [​](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#response-status) status enum required The current status of the Midjourney task. Available options: `SUCCESS`, `FAILED`, `PENDING`, `RUNNING`, `IN_PROGRESS`, `submitted`, `NOT_START`, `unknown` Example: `"SUCCESS"` [​](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#response-task-id) task\_id string required The unique identifier for the Midjourney generation task. Example: `"1744449927914205"` [​](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#response-progress-one-of-0) progress string | null Optional progress indicator (e.g., "0%") Example: `"50%"` [​](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#response-image-url-one-of-0) imageUrl string | null The URL of the generated image (present on SUCCESS). Example: `"https://image-url.com/generated_image.png"` [​](https://docs.nano-gpt.com/api-reference/endpoint/check-midjourney-status#response-fail-reason-one-of-0) failReason string | null The reason for failure (present on FAILED). Example: `"Content moderation filter triggered."` --- # List All Batches - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#content-area) List all batches cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/batches \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/batches" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/batches', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/batches",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/batches" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/batches") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/batches") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 401 { "object": "list", "data": [\ {\ "id": "",\ "object": "batch",\ "endpoint": "/v1/chat/completions",\ "input_file_id": "",\ "completion_window": "24h",\ "status": "validating",\ "created_at": 123,\ "request_counts": {\ "total": 1,\ "completed": 1,\ "failed": 1\ },\ "output_file_id": "",\ "error_file_id": "",\ "in_progress_at": 123,\ "finalizing_at": 123,\ "completed_at": 123,\ "failed_at": 123,\ "expired_at": 123,\ "cancelling_at": 123,\ "cancelled_at": 123,\ "metadata": {},\ "usage": {\ "prompt_tokens": 1,\ "completion_tokens": 1,\ "total_tokens": 1\ },\ "errors": {}\ }\ ], "first_id": "", "last_id": "", "has_more": true } { "error": 123, "message": "" } { "error": 123, "message": "" } GET / api / v1 / batches Try it List all batches cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/batches \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/batches" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/batches', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/batches",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/batches" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/batches") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/batches") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 401 { "object": "list", "data": [\ {\ "id": "",\ "object": "batch",\ "endpoint": "/v1/chat/completions",\ "input_file_id": "",\ "completion_window": "24h",\ "status": "validating",\ "created_at": 123,\ "request_counts": {\ "total": 1,\ "completed": 1,\ "failed": 1\ },\ "output_file_id": "",\ "error_file_id": "",\ "in_progress_at": 123,\ "finalizing_at": 123,\ "completed_at": 123,\ "failed_at": 123,\ "expired_at": 123,\ "cancelling_at": 123,\ "cancelled_at": 123,\ "metadata": {},\ "usage": {\ "prompt_tokens": 1,\ "completion_tokens": 1,\ "total_tokens": 1\ },\ "errors": {}\ }\ ], "first_id": "", "last_id": "", "has_more": true } { "error": 123, "message": "" } { "error": 123, "message": "" } This OpenAI-compatible list includes both inline and file-backed jobs. Items retain the standard batch shape, including file IDs, lifecycle timestamps, request counts, metadata, usage, and errors where applicable. See the [Batch API guide](https://docs.nano-gpt.com/api-reference/endpoint/batches#list-batches) for pagination examples, filter rules, and error behavior. #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Query Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#parameter-limit) limit integer default:20 Number of batches to return. Required range: `1 <= x <= 100` [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#parameter-after) after string Return the next page of batches older than this batch ID. Use the current page's last\_id. Cannot be combined with before. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#parameter-before) before string Return the adjacent page of batches newer than this batch ID, still ordered newest first. Use the current page's first\_id. Cannot be combined with after. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#parameter-status) status enum\[\] Filter by one or more statuses. Repeat the parameter or provide comma-separated values. Available options: `validating`, `in_progress`, `finalizing`, `completed`, `failed`, `expired`, `cancelling`, `cancelled` [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#parameter-one-of-0) created\_after integerstringintegerstring Return batches created strictly after this boundary. Accepts Unix seconds or a timezone-qualified ISO 8601/RFC 3339 timestamp with at most millisecond precision. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#parameter-one-of-0) created\_before integerstringintegerstring Return batches created strictly before this boundary. Accepts Unix seconds or a timezone-qualified ISO 8601/RFC 3339 timestamp with at most millisecond precision. #### Response 200 application/json A page of all visible batches ordered newest first. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#response-object) object string required Allowed value: `"list"` [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#response-data) data object\[\] required All visible batches ordered newest first, including inline and file-backed jobs. Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#response-first-id-one-of-0) first\_id string | null required First batch ID in this page, or null for an empty page. Pass as before to return to the adjacent newer page. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#response-last-id-one-of-0) last\_id string | null required Last batch ID in this page, or null for an empty page. Pass as after to fetch the next older page. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches-list#response-has-more) has\_more boolean required Whether more records exist in the direction being paged. --- # Pay-As-You-Go Billing Override - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#pay-as-you-go-billing-override-api) Pay-As-You-Go Billing Override (API) ====================================================================================================================================================== This override forces a request to be treated as paid (pay-as-you-go), even when the user has an active subscription and the model is subscription-included. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#what-it-does) What It Does -------------------------------------------------------------------------------------------------------- * Forces a request to be treated as paid (pay-as-you-go). * Bypasses subscription coverage for that request. * Allows saved provider preferences to apply to subscription-included traffic. * Does not change which models support provider selection. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#when-to-use-it) When to Use It ------------------------------------------------------------------------------------------------------------ Use `billing_mode: "paygo"` when: * A subscriber wants to force pay-as-you-go billing without selecting a provider in the request. * A subscriber wants saved provider preferences to apply to subscription-included traffic. Explicit per-request provider selection already uses pay-as-you-go billing. If a subscriber sends `X-Provider` for a subscription-included model, the request is charged at the selected provider price and does not need `X-Billing-Mode: paygo`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#api-key-billing-settings) API Key Billing Settings -------------------------------------------------------------------------------------------------------------------------------- Open [API keys](https://nano-gpt.com/api) , then the key’s settings → **Billing**. Subscribers can choose subscription first, subscription only, or pay-as-you-go only. Without an active subscription, the default key uses your balance. A key saved as **Subscription only** cannot spend your balance. Forcing pay-as-you-go or choosing an explicit provider does not override that key restriction; change the key’s billing mode if you want paid routing. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#supported-inputs) Supported Inputs ---------------------------------------------------------------------------------------------------------------- **Header** * `X-Billing-Mode: paygo` (header name is case-insensitive) * `x-billing-mode` is also accepted **Body (all endpoints)** * `"billing_mode": "paygo"` * Alias: `"billingMode": "paygo"` **Accepted values (case-insensitive)** * `paygo` * `pay-as-you-go` * `pay_as_you_go` * `paid` * `payg` **Precedence**: Body value wins if both body and header are present. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#api-examples) API Examples -------------------------------------------------------------------------------------------------------- Example with explicit provider selection: POST /api/v1/chat/completions X-Provider: deepinfra Content-Type: application/json { "model": "openai/gpt-oss-20b", "messages": [\ { "role": "user", "content": "Say hello in one sentence." }\ ] } Example forcing paygo without explicit provider selection: POST /api/v1/chat/completions X-Billing-Mode: paygo Content-Type: application/json { "model": "openai/gpt-oss-20b", "messages": [\ { "role": "user", "content": "Say hello in one sentence." }\ ] } Responses: POST /api/v1/responses X-Billing-Mode: paygo { "model": "gpt-4o-mini", "input": "Hello" } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#provider-selection-notes) Provider Selection Notes -------------------------------------------------------------------------------------------------------------------------------- * Provider selection only works for models that support it. * If a model does not support provider selection, `X-Provider` is ignored. * `X-Provider` explicitly selects a provider for the request. * Explicit provider selection is always pay-as-you-go and is charged at the selected provider’s price, including provider-selection markup. * For subscription users, sending `X-Provider` bypasses subscription coverage for that request. You do not need to also send `X-Billing-Mode: paygo`. * You cannot currently force a provider and have that same request count as subscription-included usage. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#subscription-and-limits-behavior) Subscription and Limits Behavior ------------------------------------------------------------------------------------------------------------------------------------------------ When `billing_mode: "paygo"` is set: * The request is not eligible for subscription coverage. * Subscription quota is not consumed. * Pay-as-you-go balance checks apply as normal. If `subscription.enablePaidModelsApi` is `false`, the request is rejected (same as any other paid API request). [​](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override#faq) FAQ -------------------------------------------------------------------------------------- **Does this affect which models are available?** No. It only changes billing eligibility. Model availability is unchanged. **Does it force a provider for non-selectable models?** No. It only affects billing. Use `X-Provider` to explicitly select a provider for models that support provider selection. **Can I combine this with BYOK?** Yes. BYOK still works; paygo override only changes subscription eligibility. --- # Roo Code - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/roocode#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/roocode#using-roo-code-with-nanogpt) Using Roo Code with NanoGPT ============================================================================================================== A quick guide to setting up Roo Code with NanoGPT’s API. [​](https://docs.nano-gpt.com/integrations/roocode#setup-instructions) Setup Instructions -------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. In Roo Code settings, add a new Custom Model with these details: * API Provider: OpenAI Compatible * Base URL: [https://nano-gpt.com/api/v1thinking/](https://nano-gpt.com/api/v1thinking/) * API Key: Your key from step 1 * Model ID: openai/gpt-6.1-sol > **Tip:** Roo Code surfaces the `thinking` and `response` channels side-by-side. Pointing it at `https://nano-gpt.com/api/v1thinking/` keeps that richer reasoning stream intact for models like Minimax M2 or Kimi K2 Thinking. That’s it! You can now use Roo Code with every model you can think of. Model names are on our [pricing page](https://nano-gpt.com/pricing) - important ones are openai/gpt-6.1-sol, anthropic/claude-opus-5.5, google/gemini-flash-latest, or just any other model you fancy. --- # Rate Limits - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits#rate-limits) Rate Limits ================================================================================================= NanoGPT enforces a mix of global throughput limits and (optionally) per-key daily limits. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits#global-throughput-limits-per-second) Global Throughput Limits (Per-Second) --------------------------------------------------------------------------------------------------------------------------------------------------- The NanoGPT API currently imposes a limit of **25 requests per second**. If you need a higher limit, email [support@nano-gpt.com](mailto:support@nano-gpt.com) with: * which model(s) you need * your target RPS / peak traffic patterns * whether requests are streaming If your use case requires more than **1 billion tokens/day** of a specific model, contact support. We can usually support it, and may be able to offer better pricing. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits#per-key-daily-limits-optional) Per-Key Daily Limits (Optional) --------------------------------------------------------------------------------------------------------------------------------------- NanoGPT supports **per-API-key daily limits** to help you cap usage and spend. You can set these when creating or editing an API key in the NanoGPT dashboard. Available limits: | Limit | Description | Reset | | --- | --- | --- | | Requests per Day (RPD) | Maximum number of API requests the key can make per day (across endpoints) | Midnight UTC | | USD per Day | Maximum estimated USD spend the key can incur per day | Midnight UTC | Notes: * Limits are enforced **per API key**, not per user. Multiple keys have independent counters. * If a limit is not set, that dimension is unlimited for the key. * Counters reset at **00:00 UTC** every day. * USD/day uses **cost estimation at request time**. Actual cost can differ slightly, so the effective cap is approximate. * Subscription-covered requests (models included in your subscription plan) can bypass the USD/day limit since no balance is spent, but they still count toward RPD. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits#when-a-daily-limit-is-exceeded) When A Daily Limit Is Exceeded --------------------------------------------------------------------------------------------------------------------------------------- When a per-key daily limit is exceeded, NanoGPT returns an **OpenAI-compatible** `429` error and includes a `Retry-After` header (seconds until the next reset at midnight UTC). Example response: { "error": { "message": "Daily request limit exceeded (1000/1000). Resets at midnight UTC.", "code": "daily_rpd_limit_exceeded", "type": "rate_limit_error" } } Error codes: | Code | Description | | --- | --- | | `daily_rpd_limit_exceeded` | Request count limit reached | | `daily_usd_limit_exceeded` | Spend limit reached | --- # OpenHands - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/openhands#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/openhands#using-openhands-with-nanogpt) Using OpenHands with NanoGPT ================================================================================================================== A quick guide to setting up OpenHands with NanoGPT’s API. [​](https://docs.nano-gpt.com/integrations/openhands#setup-instructions) Setup Instructions ---------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. In OpenHands, add a new LLM Endpoint and toggle “Advanced”. 3. Configure the fields as follows: * Custom Model: `openai/` * Example: `openai/openai/gpt-6.1-sol` (OpenHands’ first `openai/` selects its OpenAI-compatible adapter; the rest is the NanoGPT model ID.) * If a model name contains a slash, include it: e.g. `openai/anthropic/claude-opus-5.5` or `openai/google/gemini-flash-latest` * Base URL: `https://nano-gpt.com/api/v1` (no trailing slash) * API Key: Your key from step 1 * Search API Key (Tavily): Optional * Agent: `CodeActAgent` (recommended) [​](https://docs.nano-gpt.com/integrations/openhands#important-notes) Important Notes ---------------------------------------------------------------------------------------- * The Base URL must NOT end with a `/`. Use `https://nano-gpt.com/api/v1` exactly. * Prefix the model with `openai/` and use the exact model name as shown by the NanoGPT API or on our pricing page. You can now use OpenHands with any NanoGPT model. Popular choices include `openai/gpt-6.1-sol`, `anthropic/claude-opus-5.5`, and `google/gemini-flash-latest`. For a full list, check our [pricing page](https://nano-gpt.com/pricing) . --- # Droid - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/droid#content-area) [​](https://docs.nano-gpt.com/integrations/droid#quick-start) Quick start ---------------------------------------------------------------------------- 1. Install the Droid CLI: `curl -fsSL https://app.factory.ai/cli | sh` 2. Grab your NanoGPT API key from [nano-gpt.com/api](https://nano-gpt.com/api) . [​](https://docs.nano-gpt.com/integrations/droid#configure-nanogpt-as-a-custom-model) Configure NanoGPT as a custom model ---------------------------------------------------------------------------------------------------------------------------- Add (or merge) the following block into `~/.factory/config.json`: { "custom_models": [\ {\ "model_display_name": "GLM Latest",\ "model": "z-ai/glm-latest",\ "base_url": "https://api.nano-gpt.com/api/v1/",\ "api_key": "xxx",\ "provider": "generic-chat-completion-api"\ }\ ] } * Replace `api_key` with your NanoGPT key and keep it secret. * If you already have other `custom_models`, just append this object instead of removing the existing ones. * Keep the trailing slash on `base_url`—Droid expects it when talking to OpenAI-compatible APIs. [​](https://docs.nano-gpt.com/integrations/droid#use-it) Use it ------------------------------------------------------------------ Start a new terminal and run `droid` to load the config. When prompted for a model, pick **GLM Latest** (or whatever name you set in `model_display_name`) to use NanoGPT through Droid. --- # List Image Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models#content-area) List Image Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/images/models import requests url = "https://api.nano-gpt.com/api/v1/images/models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/images/models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images/models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images/models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/images/models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images/models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body GET / api / v1 / images / models Try it List Image Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/images/models import requests url = "https://api.nano-gpt.com/api/v1/images/models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/images/models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images/models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images/models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/images/models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images/models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models#overview) Overview ------------------------------------------------------------------------------------------- Use `GET /api/v1/images/models` to discover image models for the dedicated Image API. The response includes model IDs, capabilities, supported parameters, streaming support, and a model-specific endpoint metadata URL. Model availability and supported parameters can change. Build clients from the returned metadata instead of hardcoding model capability tables. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models#authentication) Authentication ------------------------------------------------------------------------------------------------------- Authentication is optional. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models#response) Response ------------------------------------------------------------------------------------------- { "object": "list", "data": [\ {\ "id": "openai/gpt-image-2.5/flare/text-to-image",\ "name": "GPT Image 2.5 Flare",\ "description": "Model description...",\ "created": 1760000000,\ "owned_by": "openai",\ "architecture": {\ "input_modalities": ["text", "image"],\ "output_modalities": ["image"]\ },\ "supported_parameters": {\ "resolution": {\ "type": "enum",\ "values": ["1k", "2k", "4k"],\ "default": "1k"\ },\ "n": {\ "type": "range",\ "min": 1,\ "max": 4,\ "default": 1\ }\ },\ "supports_streaming": false,\ "endpoints": "/api/v1/images/models/openai/gpt-image-2.5/flare/text-to-image/endpoints",\ "capabilities": {\ "image_generation": true,\ "image_to_image": true,\ "inpainting": false,\ "nsfw": false\ },\ "category": "image"\ }\ ], "meta": { "count": 201, "generated_at": "2026-06-25T00:00:00.000Z" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models#fields) Fields --------------------------------------------------------------------------------------- | Field | Type | Description | | --- | --- | --- | | `id` | string | Model ID to use in `POST /api/v1/images`. | | `name` | string | Human-readable model name. | | `description` | string | Model description. | | `created` | integer | Unix timestamp for when the model was added. | | `owned_by` | string | Public owner or provider label. | | `architecture.input_modalities` | string\[\] | Supported input modalities, such as `text` or `image`. | | `architecture.output_modalities` | string\[\] | Supported output modalities. | | `supported_parameters` | object | Machine-readable model-specific parameter metadata. | | `supports_streaming` | boolean | Currently always `false`. | | `endpoints` | string | URL for endpoint metadata and pricing for this model. | | `capabilities` | object | Feature flags such as `image_generation`, `image_to_image`, `inpainting`, and `nsfw`. | | `category` | string | Usually `image`. | [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models#example) Example ----------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/images/models [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models#notes) Notes ------------------------------------------------------------------------------------- * `supported_parameters` varies by model. * Model IDs may contain slashes. Prefer the returned `endpoints` URL when fetching endpoint metadata. * Use this endpoint with [Get Image Model Endpoints](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints) before sending generation requests. --- # Management API - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/management-api#content-area) Management tokens let you automate account tasks without sharing your inference API key. Choose **Usage only** for a quota widget or monitoring script: that token cannot run models, spend your balance, or create API keys. [​](https://docs.nano-gpt.com/api-reference/management-api#create-a-token) Create a token -------------------------------------------------------------------------------------------- 1. Open [Settings → Security → Management API tokens](https://nano-gpt.com/settings#management-api-tokens) . 2. Select **New token**, enter a name, and choose **Usage only — view subscription quotas**. 3. Choose an expiration and copy the secret when it is shown. It is shown only once. Registration is optional: anonymous browser sessions can create, list, and revoke management tokens too. Tokens belong to the session that creates them. Save your sign-in key before clearing browser data so you can restore access and revoke tokens later. A management token cannot restore your browser session. Tokens expire after 90 days by default (365 days maximum). You can revoke them in Settings. Store the token as a secret: anyone who has it can read the data its scopes allow. Send it in an authorization header, not a URL. [​](https://docs.nano-gpt.com/api-reference/management-api#read-subscription-usage) Read subscription usage -------------------------------------------------------------------------------------------------------------- curl https://nano-gpt.com/api/management/v1/subscription/usage \ -H "Authorization: Bearer $NANOGPT_MANAGEMENT_TOKEN" Example response (limits are illustrative; use the returned values): { "active": true, "state": "active", "limits": { "dailyInputTokens": 1000000, "weeklyInputTokens": 6000000, "dailyImages": 10 }, "dailyInputTokens": { "used": 250000, "remaining": 750000, "percentUsed": 0.25, "resetAt": 1788652800000 }, "weeklyInputTokens": { "used": 1500000, "remaining": 4500000, "percentUsed": 0.25, "resetAt": 1788739200000 }, "dailyImages": { "used": 2, "remaining": 8, "percentUsed": 0.2, "resetAt": 1788652800000 }, "period": { "currentPeriodEnd": "2026-10-05T00:00:00.000Z" } } * `active` and `state` describe subscription status. Active status alone does not mean quota remains. * `dailyInputTokens` and `weeklyInputTokens` count input tokens, not requests or dollars. `dailyImages` counts images. * Each quota includes `used`, `remaining`, `percentUsed` (a fraction; multiply by 100 for display), and `resetAt` (UNIX epoch milliseconds). `percentUsed` can exceed 1. * A null quota/limit means that window is not configured or applicable. If a lookup is unavailable, the quota’s counters are null and `degraded: true`; display **unknown**, not zero usage or a full allowance. * `period.currentPeriodEnd` is an ISO timestamp or null. Use the returned reset times instead of hardcoding billing or quota windows. * Token-based trials also return `usageUnits: "tokens"`, `tokenLimits.total`, and a `tokens` quota object. The endpoint reads the token owner’s personal subscription. It accepts no account selector or force-refresh parameter. It returns no API-key secrets, Stripe identifiers, cancellation metadata, cash balance, or query history. Normal status refresh and quota reconciliation may run during a read. For inference-key-specific billing advice, use the existing [Subscription Usage](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage) endpoint with an inference API key. Management tokens cannot authenticate inference endpoints. [​](https://docs.nano-gpt.com/api-reference/management-api#verify-a-usage-only-token) Verify a Usage only token ------------------------------------------------------------------------------------------------------------------ After creating a token with only `usage:read`, check that it can read quotas: curl --fail-with-body \ https://nano-gpt.com/api/management/v1/subscription/usage \ -H "Authorization: Bearer $NANOGPT_MANAGEMENT_TOKEN" Expect `200` with the usage fields described above. An inactive subscription can still return a successful response; check `active`, `state`, and the quota fields instead of assuming that HTTP success means included usage is available. Then check its permission boundary with a read-only API-key list request: curl -i https://nano-gpt.com/api/management/v1/api-keys \ -H "Authorization: Bearer $NANOGPT_MANAGEMENT_TOKEN" A token with only `usage:read` must return `403` with `insufficient_scope` here. If it returns `200`, the token has API-key read or write permissions too; create a token with only **Usage only** access for your monitoring tool. Missing, invalid, expired, or revoked management tokens return `401` with `invalid_management_token`. To check revocation, revoke a disposable test token in Settings and repeat the usage request; it should return `401`. Keep the token out of screenshots and logs. [​](https://docs.nano-gpt.com/api-reference/management-api#permissions) Permissions -------------------------------------------------------------------------------------- | Scope | Access | | --- | --- | | `usage:read` | Read personal subscription quotas only | | `api_keys:read` | List and inspect API-key metadata; secrets are never returned | | `api_keys:write` | Create, update, and revoke API keys; includes `api_keys:read` | API-key scopes do not include `usage:read`. Existing tokens do not gain new permissions. Create a new token when you need a different scope. For monitoring, select only `usage:read`: a token with `api_keys:write` can create keys that spend money. [​](https://docs.nano-gpt.com/api-reference/management-api#api-key-management) API-key management ---------------------------------------------------------------------------------------------------- Base URL: `https://nano-gpt.com/api/management/v1`. Authenticate with `Authorization: Bearer sk-nano-mgmt-...`. | Method | Path | Required scope | | --- | --- | --- | | GET | `/subscription/usage` | `usage:read` | | GET | `/api-keys` | `api_keys:read` | | GET | `/api-keys/{id}` | `api_keys:read` | | POST | `/api-keys` | `api_keys:write` | | PATCH | `/api-keys/{id}` | `api_keys:write` | | DELETE | `/api-keys/{id}` | `api_keys:write` | Creating an inference key requires an `Idempotency-Key` header. The new key secret is returned only on creation and an exact idempotent replay. List, read, and update responses do not return it. See the [Management OpenAPI contract](https://nano-gpt.com/management-openapi.json) for request and response schemas. Ordinary inference API keys cannot call the Management API. [​](https://docs.nano-gpt.com/api-reference/management-api#errors) Errors ---------------------------------------------------------------------------- * `401`: missing, invalid, expired, or revoked management token. * `403` with `insufficient_scope`: create a token with the required scope. * `429`: rate limited; respect `Retry-After`. * `503`: temporarily unavailable; retry with backoff and respect `Retry-After` when present. Responses are private and uncached. Retain `X-Request-Id` for troubleshooting; never log the authorization header. --- # OpenClaw (ClawdBot) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/openclaw#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/openclaw#quick-setup-guide) Quick Setup Guide ------------------------------------------------------------------------------------------- 1. Install OpenClaw (ClawdBot) and skip any default model setup. 2. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) . 3. Open your config (Config -> Models -> Raw, or edit `~/.clawdbot/clawdbot.json`). 4. Add a NanoGPT provider block like this: Model limits and per-million-token USD cost estimates below were checked against the NanoGPT catalog on October 2, 2026. Check the [models endpoint](https://docs.nano-gpt.com/api-reference/endpoint/models) for current rates. { "models": { "mode": "merge", "providers": { "nanogpt": { "baseUrl": "https://nano-gpt.com/api/v1", "apiKey": "YOUR_NANOGPT_API_KEY_HERE", "auth": "api-key", "api": "openai-completions", "headers": {}, "authHeader": false, "models": [\ {\ "id": "anthropic/claude-opus-5.5",\ "name": "Claude Opus 5.5",\ "reasoning": true,\ "input": [\ "text",\ "image"\ ],\ "cost": {\ "input": 4,\ "output": 20,\ "cacheRead": 0.2,\ "cacheWrite": 5\ },\ "contextWindow": 1000000,\ "maxTokens": 128000\ }\ ] } } } } 5. Replace `YOUR_NANOGPT_API_KEY_HERE` with your actual key. 6. Restart OpenClaw (or restart the gateway if you are using it). [​](https://docs.nano-gpt.com/integrations/openclaw#some-models-to-try) Some Models To Try --------------------------------------------------------------------------------------------- These are examples only. Use the model IDs returned by the models endpoint below. * `anthropic/claude-opus-5.5` * `openai/gpt-6.1-sol` * `google/gemini-flash-latest` * `minimax/minimax-m3` * `moonshotai/kimi-k3` [​](https://docs.nano-gpt.com/integrations/openclaw#get-the-most-recent-models) Get The Most Recent Models ------------------------------------------------------------------------------------------------------------- curl https://nano-gpt.com/api/v1/models If you want filtered lists: * `https://nano-gpt.com/api/subscription/v1/models` (subscription-only) * `https://nano-gpt.com/api/paid/v1/models` (paid-only) [​](https://docs.nano-gpt.com/integrations/openclaw#verify-your-setup) Verify Your Setup ------------------------------------------------------------------------------------------- Once OpenClaw is running, confirm requests are flowing by checking your usage at [nano-gpt.com/usage](https://nano-gpt.com/usage) . [​](https://docs.nano-gpt.com/integrations/openclaw#problems) Problems? -------------------------------------------------------------------------- Email support at [support@nano-gpt.com](mailto:support@nano-gpt.com) or use the in-app chat. --- # Change Reasoning Effort Within a Conversation - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort#content-area) NanoGPT supports ordered effort updates for **GPT-6 Astra** (`openai/gpt-6-astra`) and **Claude Fable 5.1** (`anthropic/claude-fable-5.1`) on compatible endpoints. Keep the request-level effort constant and insert an update immediately before the user turn that needs a different effort, or append it after the final user turn to control the response generated by that request. The new effort persists until another update replaces it. Replay each update in its original position. Do not replace previous updates or move them to the beginning of the conversation. The request-level effort remains the baseline, and Responses `reasoning.effort` reports that baseline. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort#chat-completions) Chat Completions ----------------------------------------------------------------------------------------------------------------------- Send to `POST https://api.nano-gpt.com/api/v1/chat/completions`. `configuration_update` accepts `system` and `developer` roles with empty content. { "model": "openai/gpt-6-astra", "reasoning": { "effort": "low" }, "messages": [\ { "role": "user", "content": "Draft a migration plan." },\ { "role": "assistant", "content": "First, create the new table..." },\ {\ "role": "system",\ "content": "",\ "configuration_update": { "reasoning": { "effort": "high" } }\ },\ { "role": "user", "content": "Analyze failure modes and rollback steps." }\ ] } A trailing developer update is also accepted: { "model": "openai/gpt-6-astra", "reasoning": { "effort": "low" }, "messages": [\ { "role": "user", "content": "Analyze failure modes and rollback steps." },\ { "role": "developer", "content": "", "configuration_update": { "reasoning": { "effort": "high" } } }\ ] } When replaying this request, leave the update before the returned assistant response, including any reasoning or tool calls. Do not move it ahead of a later user message. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort#responses) Responses --------------------------------------------------------------------------------------------------------- Send to `POST https://api.nano-gpt.com/api/v1/responses`. { "model": "openai/gpt-6-astra", "reasoning": { "effort": "low" }, "input": [\ { "role": "user", "content": "Draft a migration plan." },\ { "role": "assistant", "content": "First, create the new table..." },\ { "type": "configuration_update", "reasoning": { "effort": "high" } },\ { "role": "user", "content": "Analyze failure modes and rollback steps." }\ ] } Use manual replay or NanoGPT’s stored `previous_response_id` history. Manual replay should include the provider’s returned reasoning and tool items along with messages. For these requests, NanoGPT asks for `reasoning.encrypted_content` automatically so provider-issued replay data can be returned and stored; preserve opaque encrypted fields without editing them. Inline-update conversations use the native Responses transport, including later requests that inherit an update from stored history. Do not switch such a stored conversation to an unsupported model. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort#anthropic-messages) Anthropic Messages --------------------------------------------------------------------------------------------------------------------------- Send to `POST https://api.nano-gpt.com/api/v1/messages`. { "model": "anthropic/claude-fable-5.1", "max_tokens": 4096, "output_config": { "effort": "high" }, "messages": [\ { "role": "user", "content": "Analyze the migration." },\ { "role": "assistant", "content": "The main risks are..." },\ { "role": "system", "content": [], "output_config": { "effort": "low" } },\ { "role": "user", "content": "Give me a short checklist." }\ ] } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort#supported-combinations) Supported combinations ----------------------------------------------------------------------------------------------------------------------------------- * Astra inline efforts: `low`, `medium`, `high`, `xhigh`. * Claude inline efforts: `low`, `medium`, `high`, `xhigh`, `max`; `minimal` maps to `low`. `none` is rejected. * Updates may precede the first user turn or trail the request on all three APIs. Starting with an update selects a compatible route immediately. Replayed updates may precede assistant, reasoning, or tool-call output. Anthropic Messages `output_config` updates still require the `system` role. * Streaming and non-streaming requests, function tools, complete tool histories, and post-tool continuations are supported. Preserve prior reasoning/signature fields using the API’s normal history representation. * Model-specific tool restrictions still apply. In particular, Fable 5.1 may reject forced tool choice; use automatic tool choice. * Requests without updates retain existing routes and behavior. An unsupported explicitly selected provider fails; automatic fallback filters out incompatible endpoints. Existing provider permissions still apply. This initial implementation rejects non-empty updates, adjacent updates, pro mode, unsupported models/efforts, automatic truncation, context-management/compaction controls, multi-agent controls, Advisor, memory/history-limit controls, background requests, explicit BYOK, hosted/non-function tools, and Batch lines. These are NanoGPT’s initial compatibility boundaries; native Anthropic permits broader update placement. Other transport paths are not enabled for this feature. Updates are generation controls, not prompt text. Reasoning visibility controls remain separate and never become fields inside an update. Existing Chat/Messages response-local visibility handling is preserved. `reasoning.exclude:true` with inline updates is explicitly rejected on Responses, where response-local exclusion is not yet supported. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort#cache-behavior) Cache behavior ------------------------------------------------------------------------------------------------------------------- Keeping earlier input stable makes cache reuse possible; a cache entry does not follow a conversation between providers. Moving an existing conversation to a compatible route may miss the old cache. Keeping provider choice, tools, baseline effort, and earlier input stable gives the best chance of reuse. See [Prompt Caching](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching) for cache controls and [Extended Thinking](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking) for response visibility. --- # Authentication - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/authentication#content-area) [​](https://docs.nano-gpt.com/authentication#usage-monitoring-and-api-key-management) Usage monitoring and API-key management -------------------------------------------------------------------------------------------------------------------------------- For subscription quota monitoring, create a **Usage only** [management token](https://docs.nano-gpt.com/api-reference/management-api) in Settings → Security. It can read usage without permission to run models or spend your balance. Management tokens begin with `sk-nano-mgmt-` and authenticate only `/api/management/v1` endpoints. Their permissions are separate from inference API keys. Use only `usage:read` for a monitoring tool; `api_keys:write` can create spending-capable inference keys. [​](https://docs.nano-gpt.com/authentication#api-authentication-recommended-for-inference) API Authentication (Recommended for inference) -------------------------------------------------------------------------------------------------------------------------------------------- Most integrations should use an **API key**. Send API-key requests to `https://api.nano-gpt.com`. Create and manage keys on the [NanoGPT website](https://nano-gpt.com/api) ; see [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for the correct client base URL. ### [​](https://docs.nano-gpt.com/authentication#api-key-format) API key format New keys use the format: sk-nano- Some older accounts may still have **legacy** keys (a plain UUID). Both formats are accepted. ### [​](https://docs.nano-gpt.com/authentication#send-your-key-headers) Send your key (headers) Use one of these headers on inference API requests: 1. `Authorization: Bearer ` (recommended) 2. `X-API-Key: ` Example: curl "https://api.nano-gpt.com/api/v1/models" \ -H "Authorization: Bearer sk-nano-YOUR_API_KEY" ### [​](https://docs.nano-gpt.com/authentication#common-errors) Common errors * `401 Unauthorized`: Missing/invalid/revoked API key (or your key is inactive/expired, if your account has expiration enabled) * `403 Forbidden`: API key browser-origin restriction failed (`api_key_origin_not_allowed`) * `429 Too Many Requests`: Rate limit exceeded (per-second throughput, or a per-key daily cap if configured) For rate-limit details, see [Rate Limits](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits) . ### [​](https://docs.nano-gpt.com/authentication#getting-an-api-key) Getting an API key Create and manage API keys in the NanoGPT dashboard: [https://nano-gpt.com/api](https://nano-gpt.com/api) [​](https://docs.nano-gpt.com/authentication#cli-authentication-device-login) CLI Authentication (Device Login) ------------------------------------------------------------------------------------------------------------------ If you’re building a CLI, use **device login** so users can approve access in a browser and your CLI receives an API key (`sk-nano-...`). See: [CLI Device Login](https://docs.nano-gpt.com/integrations/cli-login) [​](https://docs.nano-gpt.com/authentication#oauth-pkce-sign-in-with-nanogpt) OAuth PKCE (Sign in with NanoGPT) ------------------------------------------------------------------------------------------------------------------ If you’re building a third-party app, local tool, coding agent, or generic OAuth client, use **OAuth PKCE** so users can approve access in NanoGPT instead of manually creating and pasting an API key. OAuth returns an app-specific NanoGPT API key (`sk-nano-...`) that your app sends as: Authorization: Bearer sk-nano-... You can also attach your referral link, so users who create a NanoGPT account through your sign-in are referred by you. See [Referral Attribution](https://docs.nano-gpt.com/api-reference/miscellaneous/oauth-pkce#referral-attribution) . See: [OAuth PKCE](https://docs.nano-gpt.com/api-reference/miscellaneous/oauth-pkce) [​](https://docs.nano-gpt.com/authentication#web-app-sign-in-browser) Web App Sign-In (Browser) -------------------------------------------------------------------------------------------------- If you are using the NanoGPT web app, sign-in is handled via browser sessions. Supported sign-in methods include: * OAuth (GitHub, Google) * Email one-time code (magic link / verification code) * Email/password (or username/password, where supported) * Passkey (WebAuthn) If you are calling the API from a backend service, prefer API keys instead of relying on browser cookies. [​](https://docs.nano-gpt.com/authentication#api-key-security-best-practices) API Key Security Best Practices ---------------------------------------------------------------------------------------------------------------- * Store keys in environment variables (for example: `NANOGPT_API_KEY`). * Never commit keys to git or ship them in client-side code. * Prefer `Authorization: Bearer ...` over putting keys in URLs. * For browser-based apps, set **Allowed browser origins** when creating the API key so the key is only accepted from your app’s origin. Prefer backend calls or OAuth PKCE when possible; do not embed unrestricted API keys in client-side code. * Use separate keys per app/environment so you can revoke access without breaking everything. * Set spending and request limits (if available for your account) to cap blast radius. --- # Cline - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/cline#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/cline#using-cline-with-nanogpt) Using Cline with NanoGPT ====================================================================================================== A quick guide to setting up Cline with NanoGPT’s API. [​](https://docs.nano-gpt.com/integrations/cline#setup-instructions) Setup Instructions ------------------------------------------------------------------------------------------ 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. In Cline settings, add a new Custom Model with these details: * API Provider: OpenAI Compatible * Base URL: [https://nano-gpt.com/api/v1/](https://nano-gpt.com/api/v1/) * API Key: Your key from step 1 * Model ID: openai/gpt-6.1-sol > **Tip:** If Cline is not showing a model’s `thinking` output, switch the Base URL to `https://nano-gpt.com/api/v1legacy/`. Cline still expects the legacy streaming shape for parallel thinking/output channels, and this endpoint keeps that compatibility without affecting model availability. That’s it! You can now use Cline with every model you can think of. Model names are on our [pricing page](https://nano-gpt.com/pricing) - important ones are openai/gpt-6.1-sol, anthropic/claude-opus-5.5, google/gemini-flash-latest, or just any other model you fancy. --- # Fluent - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/fluent#content-area) [​](https://docs.nano-gpt.com/integrations/fluent#fluent-integration) Fluent Integration =========================================================================================== Use this guide to connect [Fluent](https://fluentmac.app/) to NanoGPT. Fluent can use NanoGPT as a model provider and can also run the NanoGPT MCP server as an integration. [​](https://docs.nano-gpt.com/integrations/fluent#add-nanogpt-as-a-model-provider) Add NanoGPT as a model provider --------------------------------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. Open Fluent Settings and go to **Models**. 3. Under **Partners**, select **NanoGPT**. 4. Enter your NanoGPT API key. 5. Click **Refresh** to load the available NanoGPT models. 6. Choose the model you want to use, then click **Make Default** if you want Fluent to use it by default. ![NanoGPT selected as a partner model provider in Fluent](https://mintcdn.com/nano-gpt/foRifN2ExQUOBcIA/images/integrations/fluent-models.png?w=2500&fit=max&auto=format&n=foRifN2ExQUOBcIA&q=85&s=0f864dc5194cb8dda6f368cd76119517) Fluent shows NanoGPT models in its model list after your key is added. You can switch models from Fluent just like any other provider. Fluent may show a NanoGPT partner discount in the Models screen. Check Fluent for the current discount before choosing a model. [​](https://docs.nano-gpt.com/integrations/fluent#add-nanogpt-mcp) Add NanoGPT MCP ------------------------------------------------------------------------------------- NanoGPT MCP gives Fluent access to NanoGPT tools such as chat, balance checks, image generation, web search, URL scraping, YouTube transcription, and model listing. 1. Open Fluent Settings and go to **Integrations**. 2. Click **Add Integration**, then choose **Configure Manually**. 3. Set the integration name to `NanoGPT`. 4. Set **Type** to **Stdio (Local Process)**. 5. In **Command**, enter: npx 6. In **Args**, enter: -y @nanogpt/mcp 7. Add an environment variable: * Key: `NANOGPT_API_KEY` * Value: your NanoGPT API key 8. Save the integration. ![NanoGPT MCP configured as a Fluent integration](https://mintcdn.com/nano-gpt/foRifN2ExQUOBcIA/images/integrations/fluent-mcp.png?w=2500&fit=max&auto=format&n=foRifN2ExQUOBcIA&q=85&s=a353e3aa68a12ffc96710ad0daf9c98e) Once saved, Fluent should show the NanoGPT integration as connected. [​](https://docs.nano-gpt.com/integrations/fluent#notes) Notes ----------------------------------------------------------------- * You need Node.js 22.x or later for the NanoGPT MCP server. * If Fluent does not connect, verify that `npx` is available in your shell and that `NANOGPT_API_KEY` is set on the integration. * If you rotate your NanoGPT API key, update it in both the NanoGPT model provider settings and the NanoGPT MCP integration environment variables. --- # JanitorAI - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/janitorai#content-area) [​](https://docs.nano-gpt.com/integrations/janitorai#using-janitorai-with-nanogpt) Using JanitorAI with NanoGPT ================================================================================================================== A quick guide to connecting JanitorAI chats to NanoGPT’s API. [​](https://docs.nano-gpt.com/integrations/janitorai#setup-instructions) Setup Instructions ---------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. In JanitorAI, open **API Settings** 3. Select **Proxy** as the provider 4. Click **\+ Add** under **Proxy Configurations** 5. Configure the proxy with the following values: Configuration Name: any label, e.g. NanoGPT Model Name: Model ID, e.g. auto-model-basic Proxy URL: https://api.nano-gpt.com/api/v1/chat/completions API Key: 6. Click **Apply**, then make sure the NanoGPT proxy configuration is marked **Active** JanitorAI now routes your conversations through NanoGPT. [​](https://docs.nano-gpt.com/integrations/janitorai#available-models) Available Models ------------------------------------------------------------------------------------------ `auto-model-basic` automatically selects a model included in your subscription. To use a specific model instead, copy its exact current model ID from the [NanoGPT pricing page](https://nano-gpt.com/pricing) . [​](https://docs.nano-gpt.com/integrations/janitorai#include-reasoning) Include Reasoning -------------------------------------------------------------------------------------------- If you want JanitorAI to include reasoning output for reasoning-capable models, duplicate the configuration above and change the proxy URL to: https://api.nano-gpt.com/api/v1thinking/chat/completions [​](https://docs.nano-gpt.com/integrations/janitorai#troubleshooting) Troubleshooting ---------------------------------------------------------------------------------------- If JanitorAI shows a **PROXY ERROR** like this: ![JanitorAI proxy error saying no response from bot](https://mintcdn.com/nano-gpt/VewASTUpVjOBWKKW/images/integrations/janitorai-proxy-error.svg?w=2500&fit=max&auto=format&n=VewASTUpVjOBWKKW&q=85&s=0865defde312d1c45b5418caaa84561f) The most common causes are: * You used a paid model that is not included in your subscription and your NanoGPT account has no balance. * The model ID is outdated, misspelled, or unavailable. A `404` response usually means you should copy the model’s current ID from the [NanoGPT pricing page](https://nano-gpt.com/pricing) . * The proxy configuration is wrong. Re-check that **Proxy URL** is `https://api.nano-gpt.com/api/v1/chat/completions` or `https://api.nano-gpt.com/api/v1thinking/chat/completions`, and that your API key has no extra spaces. --- # OpenWebUI - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/openwebui#content-area) [​](https://docs.nano-gpt.com/integrations/openwebui#quick-setup-guide) Quick Setup Guide -------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. In OpenWebUI, go to Settings and find the “Add Connection” option 3. Enter the following details: * URL: `https://api.nano-gpt.com/api/v1` * API Key: Your key from step 1 * Prefix ID: (Optional) Leave empty or add a custom prefix * Model IDs: Leave empty to include all available models That’s it! Once you save the connection, you’ll have access to all NanoGPT models through OpenWebUI. [​](https://docs.nano-gpt.com/integrations/openwebui#available-models) Available Models ------------------------------------------------------------------------------------------ You can access all our models through this integration, including: * ChatGPT * Claude 3.7 Sonnet * Gemini 2.0 Pro * Perplexity * And many more! For a complete list of available models and their pricing, visit our [pricing page](https://nano-gpt.com/pricing) . --- # Generate Images - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#content-area) Generate Images cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/images import requests url = "https://api.nano-gpt.com/api/v1/images" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/images', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/images") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / v1 / images Try it Generate Images cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/images import requests url = "https://api.nano-gpt.com/api/v1/images" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/images', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/images") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#overview) Overview --------------------------------------------------------------------------------------------- Use `POST /api/v1/images` to generate images through NanoGPT’s normalized Image API. The endpoint accepts JSON only and supports text-to-image and image-to-image requests for models that expose those capabilities. Discover model-specific parameters first with: * `GET /api/v1/images/models` * `GET /api/v1/images/models/{modelId}/endpoints` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#authentication) Authentication --------------------------------------------------------------------------------------------------------- Use either header: * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#request) Request ------------------------------------------------------------------------------------------- POST /api/v1/images Content-Type: application/json [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#text-to-image-example) Text-To-Image Example ----------------------------------------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/images \ -H "Content-Type: application/json" \ -H "x-api-key: $NANOGPT_API_KEY" \ -d '{ "model": "openai/gpt-image-2.5/flare/text-to-image", "prompt": "A clean product photo of a matte black espresso machine on a white counter", "resolution": "1k", "quality": "high", "n": 1 }' [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#image-to-image-example) Image-To-Image Example ------------------------------------------------------------------------------------------------------------------------- { "model": "openai/gpt-image-2.5/flare/text-to-image", "prompt": "Make this look like a polished studio product photo", "input_references": [\ {\ "type": "image_url",\ "image_url": {\ "url": "https://example.com/reference.png"\ }\ }\ ], "resolution": "1k", "quality": "high", "n": 1 } [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#request-fields) Request Fields --------------------------------------------------------------------------------------------------------- | Field | Type | Required | Description | | --- | --- | --- | --- | | `model` | string | Yes | Image model ID from `GET /api/v1/images/models`. | | `prompt` | string | Usually | Text prompt or edit instruction. Model requirements can vary. | | `n` | integer | No | Number of output images. Internally normalized to `nImages`; if both are supplied, `nImages` takes precedence. | | `resolution` | string | No | Output resolution when supported by the model. | | `aspect_ratio` | string | No | Output aspect ratio when supported by the model. | | `quality` | string | No | Quality tier when supported by the model. | | `output_format` | string | No | Output format when supported by the model. | | `seed` | integer | No | Optional model-specific seed that may improve reproducibility where supported by the model/provider route. Identical results are not guaranteed. Check the selected model’s `supported_parameters` metadata before using this field. | | `input_references` | array | No | Image references for image-to-image models. | NanoGPT exposes many model-specific parameters. Treat parameter support as discoverable through `supported_parameters`, not globally available. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#input-references) Input References ------------------------------------------------------------------------------------------------------------- `input_references` accepts an array of image references. Supported entries: [\ "https://example.com/image.png",\ "data:image/png;base64,...",\ {\ "type": "image_url",\ "image_url": {\ "url": "https://example.com/image.png"\ }\ }\ ] Do not mix `input_references` with legacy image aliases such as `imageDataUrl`, `imageDataUrls`, `image_url`, or `images` in the same request. The route returns `conflicting_image_inputs` if both styles are supplied. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#unsupported-features) Unsupported Features --------------------------------------------------------------------------------------------------------------------- `stream: true` is not supported yet. Provider selection and provider passthrough are not supported yet. Non-empty `provider` objects return `unsupported_provider_options`. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#common-errors) Common Errors ------------------------------------------------------------------------------------------------------- | Code | Description | | --- | --- | | `missing_model` | `model` is required. | | `invalid_content_type` | `POST /api/v1/images` accepts `application/json` requests only. | | `invalid_input_references` | `input_references` must be an array of image URL strings, data URLs, or `image_url` objects. | | `conflicting_image_inputs` | Use `input_references` or legacy image input aliases, not both. | | `unsupported_stream` | `stream: true` is not supported yet. | | `unsupported_provider_options` | Provider selection and passthrough options are not supported yet. | [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate#notes) Notes --------------------------------------------------------------------------------------- * Use `n` for output count. If your request also sends `nImages`, `nImages` takes precedence. * Use [Image API](https://docs.nano-gpt.com/api-reference/image-generation) for the full guide and error response examples. --- # Personalized Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#personalized-models-api) Personalized Models API ============================================================================================================================ Curated, OpenAI‑compatible model listing scoped to each account’s preferences. This endpoint returns only the text models you have marked as “visible” in Settings → Models, regardless of whether they are subscription or paid models. * GET `/api/personalized/v1/models` See also: * Canonical models list: `GET /api/v1/models` * Subscription‑only list: `GET /api/subscription/v1/models` * Paid‑only list: `GET /api/paid/v1/models` [​](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#compatibility-&-response-shape) Compatibility & Response Shape ------------------------------------------------------------------------------------------------------------------------------------------ The response mirrors OpenAI’s Models API: { "object": "list", "data": [ { /* model */ }, ... ] } Each model contains at least: { "id": "openai/gpt-6.1-sol", "object": "model", "created": 1736966400, "owned_by": "openai" } Use `?detailed=true` to include additional fields like `name`, `description`, `context_length`, `capabilities`, `pricing`, `icon_url`, and `cost_estimate`. [​](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#authentication) Authentication ---------------------------------------------------------------------------------------------------------- An API key is required. * `Authorization: Bearer ` * or `x-api-key: ` If the key is missing or invalid, the endpoint returns `401`. [​](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#personalization-rules) Personalization Rules ------------------------------------------------------------------------------------------------------------------------ * The list is filtered by your account’s visible text models (configured in the NanoGPT web app under Settings → Models → “Visible Text Models”). * This endpoint ignores the user preference “Also show paid models.” If you marked paid models as visible, they appear here even if you generally hide paid models elsewhere. * If you have not set any preferences, the endpoint falls back to NanoGPT defaults (`visible === true` in our model registry). [​](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#examples) Examples ---------------------------------------------------------------------------------------------- Basic list: curl -H "Authorization: Bearer $NANOGPT_API_KEY" \ https://nano-gpt.com/api/personalized/v1/models Detailed list with pricing/capabilities: curl -H "x-api-key: $NANOGPT_API_KEY" \ "https://nano-gpt.com/api/personalized/v1/models?detailed=true" Sample detailed item: { "id": "openai/gpt-6.1-sol", "object": "model", "created": 1736966400, "owned_by": "openai", "name": "GPT-5.2", "description": "OpenAI flagship general-purpose model", "context_length": 128000, "capabilities": { "vision": false }, "pricing": { "prompt": 2.50, "completion": 10.00, "currency": "USD", "unit": "per_million_tokens" }, "icon_url": "/icons/OpenAI.svg", "cost_estimate": { "cheap": false } } [​](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#managing-your-visible-models) Managing Your Visible Models -------------------------------------------------------------------------------------------------------------------------------------- The recommended way to customize your personalized list is via the NanoGPT web UI: * Open Settings → Models → “Visible Text Models”. * Toggle visibility and categories as needed; changes are saved to your account. Advanced (web session only): * GET `/api/user/model-visibility` — returns your saved preferences as `{ modelPreferences: { visibleTextModels, modelCategories } }`. * POST `/api/user/model-visibility` — upserts preferences. Cookie‑based session auth is required (not API‑key auth). Payload shape: { "visibleTextModels": { "openai/gpt-6.1-sol": true, "anthropic/claude-opus-4.5": false }, "modelCategories": { "openai/gpt-6.1-sol": "General" } } Keys outside NanoGPT’s known model ids are ignored. [​](https://docs.nano-gpt.com/api-reference/endpoint/personalized-models#notes) Notes ---------------------------------------------------------------------------------------- * This route is explicitly dynamic (no shared caching across keys). * Model ids and metadata evolve as providers update their catalogs; keep consumers resilient to new fields. * Personalized results may include paid models even if `/api/v1/models` hides them for your account (by design). --- # Receive Nano - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/receive-nano#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/receive-nano \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/receive-nano" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.text) const options = {method: 'POST', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/receive-nano', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/receive-nano",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/receive-nano" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/receive-nano") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/receive-nano") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 { "success": true, "received_blocks": [\ ""\ ], "total_received": "" } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / receive-nano Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/receive-nano \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/receive-nano" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.text) const options = {method: 'POST', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/receive-nano', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/receive-nano",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/receive-nano" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/receive-nano") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/receive-nano") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 { "success": true, "received_blocks": [\ ""\ ], "total_received": "" } { "error": 123, "message": "" } #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/receive-nano#authorization-x-api-key) x-api-key string header required #### Response 200 application/json Nano receive operation result [​](https://docs.nano-gpt.com/api-reference/endpoint/receive-nano#response-success) success boolean Whether the operation was successful [​](https://docs.nano-gpt.com/api-reference/endpoint/receive-nano#response-received-blocks) received\_blocks string\[\] Array of received block hashes [​](https://docs.nano-gpt.com/api-reference/endpoint/receive-nano#response-total-received) total\_received string Total amount of Nano received --- # Advisor - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#overview) Overview --------------------------------------------------------------------------------------- Advisor lets the model handling a [Chat Completion](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) or [Responses](https://docs.nano-gpt.com/api-reference/endpoint/responses) request consult one client-selected second model before returning its final answer. * The top-level `model` is the executor. * `advisor.model` is the model it may consult. * In `auto` mode, the executor decides whether advice is useful. * In `required` mode, NanoGPT requires one valid consultation attempt before the executor can return its final answer. * The executor and advisor must resolve to different model IDs. Advisor is a NanoGPT request extension. It is not a model ID and does not use OpenRouter’s `openrouter:advisor` tool shape. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#chat-completions-example) Chat Completions example ----------------------------------------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o-mini", "messages": [\ {\ "role": "user",\ "content": "Review this database migration plan and identify the riskiest assumption."\ }\ ], "stream": false, "advisor": { "model": "anthropic/claude-opus-4.8", "mode": "auto" } }' The returned object remains a normal non-streaming Chat Completions response from the executor, with additional top-level `advisor` metadata. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#responses-api-example) Responses API example ----------------------------------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/responses \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o-mini", "input": "Review this database migration plan and identify the riskiest assumption.", "stream": false, "advisor": { "model": "anthropic/claude-opus-4.8", "mode": "required" } }' The returned object remains a native non-streaming Responses API object. Responses Advisor supports normal response storage and conversation history, including `store`, `previous_response_id`, and `conversation`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#advisor-request-object) Advisor request object ------------------------------------------------------------------------------------------------------------------- | Field | Type | Required | Behavior | | --- | --- | --- | --- | | `model` | string | Yes | The single model the executor may consult. It must resolve differently from the executor model. Model arrays and automatic advisor-model selection are not supported. | | `instructions` | string | No | Additional instructions for the advisor, limited to 16,000 characters. The executor still supplies the focused consultation question. | | `mode` | string | No | `"auto"` is the default and lets the executor decide whether to consult. `"required"` requires one valid consultation attempt before the final answer. | | `max_uses` | integer | No | Only `1` is accepted, and `1` is the default. | | `max_completion_tokens` | integer | No | Optional maximum advisor output tokens. When omitted, NanoGPT does not impose an Advisor-specific output cap and the selected model/provider defaults apply. When supplied, it must be a positive integer. | | `forward_transcript` | boolean | No | Only `false` is accepted, and `false` is the default. The original conversation is not automatically copied into the advisor request. | Unknown Advisor fields are rejected. Top-level `provider` and `X-Provider` routing controls apply to the executor’s initial and continuation calls. The advisor model uses its own normal routing. Use a provider-specific advisor model ID or supported routing suffix if provider control is required for that phase. See [Provider Selection](https://docs.nano-gpt.com/api-reference/miscellaneous/provider-selection) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#mode-semantics) Mode semantics --------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#auto) Auto `mode: "auto"` allows the executor to answer directly or make one consultation. If it answers directly, there is no advisor or continuation call. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#required) Required `mode: "required"` explicitly forces the internal consultation tool choice. If the executor provider ignores that requirement or returns a missing or malformed consultation request, NanoGPT fails closed instead of presenting the result as consulted. Required mode guarantees a valid consultation attempt, not successful advice. After the executor makes a valid consultation request, an advisor-provider failure can still be reported to the executor so it can produce a final continuation marked with failed Advisor metadata. Relevant error codes include: * `advisor_required_consultation_missing` * `advisor_required_consultation_invalid` * `advisor_phase_timeout` * `advisor_failed` See [Error Handling](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling) for the standard error envelope and retry guidance. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#billing) Billing ------------------------------------------------------------------------------------- Advisor is initially available only to platform-billed, pay-as-you-go API-key requests. * If no consultation occurs in `auto` mode, only the executor call is billed normally. * If consultation occurs, the initial executor turn, advisor turn, and final executor continuation are separate model calls. * Every completed model call is billed at its applicable platform model rate. * Completed earlier phases remain billable if a later phase fails. * Advisor therefore usually increases both total cost and latency when consultation occurs. Advisor is not a fixed-price add-on. There is no separate flat Advisor charge; cost comes from the individual model calls. See [Pricing](https://docs.nano-gpt.com/api-reference/miscellaneous/pricing) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#privacy) Privacy ------------------------------------------------------------------------------------- `forward_transcript: false` means NanoGPT does not automatically copy the original conversation into the advisor request. It does not mean the advisor receives no information from the conversation. The executor creates the focused consultation question and can include details it considers necessary. That question is sent to the selected advisor model’s provider. Choose an advisor model and provider whose data-handling policy is acceptable for the request. Saved memory is disabled on every internal call. Requests that include memory or server-side content enhancements are rejected instead of silently changing their behavior. Advisor is not available through Private Mode. Enabling Advisor on the standard API does not make either model call Private/TEE. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#initial-limitations) Initial limitations ------------------------------------------------------------------------------------------------------------- Advisor requests must: * Use `POST /api/v1/chat/completions` or `POST /api/v1/responses`. * Be non-streaming (`stream` omitted or `false`). * Use an executor model with function tool-calling support. * Select one explicit advisor model that resolves differently from the executor. * Use a platform-billed pay-as-you-go API key. Advisor requests cannot currently use: * Client `tools`, `tool_choice`, `parallel_tool_calls`, legacy `functions`/`function_call`, or `max_tool_calls`, even when empty or disabled. * Structured output through Chat Completions `response_format`/`structured_outputs` or a non-text Responses `text.format`. * Fusion. * Context Memory or memory model suffixes. * Server-side web search, URL scraping, or YouTube transcript enhancements. * BYOK headers or body configuration. * Paid inline moderation headers. * Subscriptions. * Accountless x402 or L402 payment. * Private Mode. * Responses `background: true`. Conflicting requests return a `400` error rather than silently dropping the unsupported option. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#response-metadata) Response metadata --------------------------------------------------------------------------------------------------------- Successful responses contain a top-level `advisor` object with fields including: * `id` * `mode` * `executor_model` * `advisor_model` * `requested` * `consulted` * `successful` * `consultation_count` * `max_uses` * `status` * Per-phase `usage` * Per-phase `pricing` when available Status meanings: * `not_used`: an `auto` executor answered without consultation. * `completed`: consultation returned usable advice and the executor produced its continuation. * `failed`: consultation was attempted but did not return usable advice; the executor could still produce a final continuation. `requested` means the executor emitted the internal consultation request. `consulted` means the advisor child call was attempted, while `successful` records whether it returned usable advice. Top-level numeric `usage` and `x_nanogpt_pricing` aggregate billable phases that returned those fields. Per-phase reconciliation data is available under `advisor.usage` and `advisor.pricing`, using `executor`, `advisor`, `continuation`, and `total` breakdowns. If a billable phase does not expose pricing metadata, NanoGPT omits aggregate pricing instead of showing a misleading partial total. Standard NanoGPT responses also include `x-nanogpt-advisor-id` for billing and support correlation. Whitelabel responses intentionally omit this NanoGPT-branded header and should use `X-Request-ID` for support correlation. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#timeouts-and-failure-behavior) Timeouts and failure behavior --------------------------------------------------------------------------------------------------------------------------------- Each internal model phase has a 10-minute deadline. * An advisor-phase timeout fails open after a valid consultation request and gives the executor a tool result explaining that advice was unavailable. * An initial-executor or final-continuation timeout terminates the request with `advisor_phase_timeout`. * A failed consultation is not retried automatically. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/advisor#typescript-sdk) TypeScript SDK --------------------------------------------------------------------------------------------------- The first-party TypeScript SDK exposes Advisor request and response types on both Chat Completions and Responses request helpers. The standard OpenAI SDK can still call Advisor by passing the NanoGPT extension through its extra-body or custom-typing escape hatch, but upstream OpenAI SDK types do not know about the NanoGPT-specific `advisor` field. --- # Hosted tool search - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#content-area) Hosted tool search lets a compatible model search a large function catalog and load only the definitions it needs. This can reduce the input tokens used by tool definitions and helps keep the initial prompt prefix stable when the catalog changes. The pilot is available on the [Responses API](https://docs.nano-gpt.com/api-reference/endpoint/responses) . Add one `nanogpt:tool_search` entry (the shorter `tool_search` alias is also accepted), then mark functions that should be discovered on demand with `defer_loading: true`. Hosted tool search discovers function definitions. It does not execute a client function, grant permission to use it, or bypass an approval flow. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#how-it-works) How it works ---------------------------------------------------------------------------------------------------------- 1. Your request includes the search tool and the complete set of functions the caller is already authorized to use. 2. Eager functions remain visible immediately. Deferred functions are searched and revealed on demand. 3. Search activity appears in the response as a `tool_search_call` output item. 4. When the model selects a revealed function, it returns a normal `function_call` item. 5. Your client executes that function under its normal authorization and approval rules, then sends a normal `function_call_output` item. Search is limited to the function definitions submitted in the request. Callers must submit only functions the user is authorized to use. Tool names, descriptions, and schemas should still be treated as untrusted application input. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#request-example) Request example ---------------------------------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/responses \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-5.5", "input": "What is the weather in Amsterdam?", "tools": [\ {\ "type": "nanogpt:tool_search",\ "max_results": 5\ },\ {\ "type": "function",\ "name": "weather_forecast",\ "description": "Get the weather forecast for a city.",\ "parameters": {\ "type": "object",\ "properties": {\ "city": { "type": "string" }\ },\ "required": ["city"]\ },\ "defer_loading": true\ },\ {\ "type": "function",\ "name": "calendar_events_find",\ "description": "Find calendar events.",\ "parameters": {\ "type": "object",\ "properties": {\ "query": { "type": "string" }\ }\ },\ "defer_loading": true\ }\ ] }' A compatible response can contain both discovery and the selected function call: { "output": [\ {\ "type": "tool_search_call",\ "id": "ts_123",\ "status": "completed"\ },\ {\ "type": "function_call",\ "id": "fc_123",\ "call_id": "call_abc123",\ "name": "weather_forecast",\ "arguments": "{\"city\":\"Amsterdam\"}",\ "status": "completed"\ }\ ] } Execute `weather_forecast` in your application only after applying the same authorization and approval checks you use for eager tools. Return its result with a normal `function_call_output` continuation. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#tool_choice) `tool_choice` ---------------------------------------------------------------------------------------------------------- Hosted tool search supports: * Omitted `tool_choice` * `"auto"` * A Responses `allowed_tools` choice It cannot be combined with `"none"`, `"required"`, or a forced function choice. These combinations return `tool_search_tool_choice_conflict` instead of silently changing the request. If you use `allowed_tools`, the allowlist must remain consistent with the functions the caller is authorized to use. Discovery never expands that authorization boundary. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#limits-and-compatibility) Limits and compatibility ---------------------------------------------------------------------------------------------------------------------------------- | Limit | Current pilot behavior | | --- | --- | | API | Responses API only | | Search entries | Exactly one when deferred functions are present | | Deferred functions | At least one | | Complete `tools` array | Maximum 2,000 entries | | `max_results` | Integer from 1 to 50; default 5 | | Tool names | Unique, case-insensitively | | Background requests | `background: true` is not supported | | Other hosted tools | Cannot be mixed with web search, X search, MCP, namespace, or other hosted built-ins in the pilot | | Model support | Capability-dependent; unsupported models fail explicitly | The search entry itself cannot set `defer_loading: true`. Chat Completions and Anthropic Messages do not support this NanoGPT hosted-search contract and return `tool_search_api_not_supported` when it is requested. Existing MCP integrations remain available outside this pilot. If your client converts already-authorized MCP definitions into ordinary Responses function tools, those function definitions can participate in hosted search; the client remains responsible for execution, credentials, authorization, and approval. Do not include MCP credentials in function names, descriptions, or schemas. Use [`GET /api/v1/agent-capabilities`](https://api.nano-gpt.com/api/v1/agent-capabilities) and inspect `toolSearch` for the current public contract, aliases, API support, and limits. Model support is still evaluated per request. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#prompt-caching) Prompt caching -------------------------------------------------------------------------------------------------------------- Sending every function eagerly makes the full catalog part of the initial prompt prefix. Adding, removing, or editing an eager definition changes that prefix. With hosted search, the small search-tool definition stays in the initial prefix and relevant deferred definitions are revealed later. This improves the opportunity for prompt-cache reuse and usually reduces initial input tokens for large catalogs. It does not guarantee a cache hit: model/provider thresholds, TTLs, routing, and exact-prefix requirements still apply. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#billing) Billing ------------------------------------------------------------------------------------------------ Hosted search has no separate NanoGPT fee. Normal model input and output usage remains billable, including model work involved in discovery. Any applicable hosted-tool charge is also included in normal request accounting. Usage and `x_nanogpt_pricing` continue to follow the normal Responses contract. Use `max_tool_calls` and client-side cancellation or turn limits to bound the overall agent workflow. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search#errors) Errors ---------------------------------------------------------------------------------------------- Errors use the standard NanoGPT error envelope. Hosted-search validation can return: | Code | Meaning | | --- | --- | | `tool_search_required` | A function uses `defer_loading` without a search entry | | `deferred_tools_required` | A search entry has no deferred function to search | | `duplicate_tool_search` | More than one search entry was supplied | | `duplicate_tool_name` | Function names collide case-insensitively | | `invalid_defer_loading` | `defer_loading` is not a boolean | | `tool_search_cannot_be_deferred` | The search entry itself is deferred | | `invalid_tool_search_max_results` | `max_results` is outside the integer range 1–50 | | `tool_search_catalog_too_large` | The complete tools array exceeds 2,000 entries | | `tool_search_tool_choice_conflict` | `tool_choice` would prevent or force a conflicting call | | `tool_search_model_not_supported` | The selected model cannot perform hosted search | | `tool_search_api_not_supported` | The request uses an unsupported API surface | | `tool_search_background_not_supported` | Hosted search was combined with background mode | | `tool_search_mixed_hosted_tools_not_supported` | The pilot was mixed with another hosted or non-function tool type | No match is a valid search outcome. The model may search again, answer without a function, or return an ordinary incomplete/failed response. Clients should enforce their own turn and tool-call limits, and handle cancellation and partial streams using the normal [streaming protocol](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol) . --- # RisuAI - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/risuai#content-area) [​](https://docs.nano-gpt.com/integrations/risuai#risuai-integration) RisuAI Integration =========================================================================================== Use this guide to connect RisuAI to NanoGPT so you can run your chats through NanoGPT models. [​](https://docs.nano-gpt.com/integrations/risuai#before-you-start) Before You Start --------------------------------------------------------------------------------------- 1. Create or log in to your NanoGPT account. 2. Generate your API key at [nano-gpt.com/api](https://nano-gpt.com/api) . 3. Open [risuai.xyz](https://risuai.xyz/) . If RisuAI shows onboarding, skip it. NanoGPT is configured in the main settings. [​](https://docs.nano-gpt.com/integrations/risuai#step-by-step-setup) Step-by-Step Setup ------------------------------------------------------------------------------------------- 1. From the RisuAI home screen, open the left menu (hamburger icon), then go to **Settings**. ![Open the menu and go to Settings in RisuAI](https://mintcdn.com/nano-gpt/JZU2VneOQbGbp1Of/images/risuai-01.png?w=2500&fit=max&auto=format&n=JZU2VneOQbGbp1Of&q=85&s=343ca74ff27986f3d76f5d30be58bcfd) 2. In **Settings**, open the **Chat Bot** panel. ![Open the Chat Bot settings panel in RisuAI](https://mintcdn.com/nano-gpt/JZU2VneOQbGbp1Of/images/risuai-02.png?w=2500&fit=max&auto=format&n=JZU2VneOQbGbp1Of&q=85&s=a77d7db9eeb7e26488d278adea3f9767) 3. Set both of these fields to **NanoGPT**: * **Model** * **Auxiliary Model** ![Set both Model and Auxiliary Model to NanoGPT in RisuAI](https://mintcdn.com/nano-gpt/JZU2VneOQbGbp1Of/images/risuai-03.png?w=2500&fit=max&auto=format&n=JZU2VneOQbGbp1Of&q=85&s=51ff5873831e7809084978eb8eebd34d) 4. Paste your key from [nano-gpt.com/api](https://nano-gpt.com/api) into **NanoGPT API Key**. 5. If you have a NanoGPT subscription, enable **Use subscription endpoint & models**. * If this is not enabled, RisuAI uses pay-as-you-go mode by default. ![Enable subscription endpoint and select NanoGPT model settings in RisuAI](https://mintcdn.com/nano-gpt/JZU2VneOQbGbp1Of/images/risuai-04.png?w=2500&fit=max&auto=format&n=JZU2VneOQbGbp1Of&q=85&s=53895d592824b9faac623bf8237bb667) 6. Choose your model in **NanoGPT Model**: * **Select from List** to browse available models. * **Manual Input** if the model list does not load or you want to enter a model ID directly. 7. Optional: enable **Response Streaming** for streamed output. [​](https://docs.nano-gpt.com/integrations/risuai#pay-as-you-go-provider-selection) Pay-As-You-Go Provider Selection ----------------------------------------------------------------------------------------------------------------------- In pay-as-you-go mode, some models expose multiple providers. RisuAI will show provider options with pricing so you can compare and choose. ![Compare provider options and pricing in RisuAI pay-as-you-go mode](https://mintcdn.com/nano-gpt/JZU2VneOQbGbp1Of/images/risuai-05.png?w=2500&fit=max&auto=format&n=JZU2VneOQbGbp1Of&q=85&s=875a1ad29b47ffe0a665aea4820845f1) [​](https://docs.nano-gpt.com/integrations/risuai#quick-troubleshooting) Quick Troubleshooting ------------------------------------------------------------------------------------------------- * Model list not loading: switch to **Manual Input** and enter the model ID. * Unexpected pricing mode: verify whether **Use subscription endpoint & models** is enabled. * Auth errors: confirm your NanoGPT API key is valid and pasted without extra spaces. --- # Model Context Protocol (MCP) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#nanogpt-mcp-server) NanoGPT MCP Server ============================================================================================================== The NanoGPT MCP Server allows you to integrate NanoGPT’s powerful AI capabilities directly into your favorite AI tools and editors that support the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) . With this server, you can give your AI agents access to NanoGPT’s full library of LLMs, image, video, 3D, speech and music generation, web search, and scraping. The source code is on [GitHub](https://github.com/Nano-GPT-com/nanogpt-mcp) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#installation) Installation -------------------------------------------------------------------------------------------------- You can run the NanoGPT MCP server directly using `npx`. No manual installation is required if you have Node.js installed. npx @nanogpt/mcp ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#claude-code) Claude Code To add NanoGPT MCP to Claude Code via the CLI: **macOS / Linux** claude mcp add nanogpt --scope user \ --env NANOGPT_API_KEY=YOUR_API_KEY \ -- npx -y @nanogpt/mcp **Windows** claude mcp add nanogpt --scope user --env NANOGPT_API_KEY=YOUR_API_KEY -- cmd /c "C:\Program Files\nodejs\npx.cmd" -y @nanogpt/mcp On native Windows, `npx` is usually a `.cmd` shim, so it should be launched through `cmd /c`. If you use WSL, run the macOS/Linux command inside WSL instead of the native Windows one. Replace `YOUR_API_KEY` with your actual NanoGPT API key. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#codex) Codex codex mcp add nanogpt --env NANOGPT_API_KEY=YOUR_API_KEY -- npx -y @nanogpt/mcp ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#ide-integration) IDE Integration To use NanoGPT MCP with tools like **Claude Desktop**, **Cline**, or **Cursor**, add the following to your configuration file: { "mcpServers": { "nanogpt": { "command": "npx", "args": ["-y", "@nanogpt/mcp"], "env": { "NANOGPT_API_KEY": "your_api_key_here" } } } } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#configuration) Configuration ---------------------------------------------------------------------------------------------------- The server is configured via environment variables. | Variable | Description | Default | | --- | --- | --- | | `NANOGPT_API_KEY` | **Required**. Your NanoGPT API key. | \- | | `NANOGPT_BASE_URL` | The base URL for the NanoGPT API. | `https://nano-gpt.com` | | `NANOGPT_AUTH_MODE` | Authentication mode (`bearer`, `x-api-key`, or `both`). | `bearer` | | `NANOGPT_LOG_LEVEL` | Logging verbosity (`debug`, `info`, `warn`, `error`). | `info` | | `NANOGPT_TIMEOUT_MS` | Request timeout in milliseconds. | `120000` | | `NANOGPT_MAX_RETRIES` | Number of times to retry failed requests. | `0` | | `NANOGPT_DEFAULT_MODEL` | Default model to use for chat tools. | \- | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#available-tools) Available Tools -------------------------------------------------------------------------------------------------------- | Area | Tools | | --- | --- | | Account | `nanogpt_get_balance` | | Text | `nanogpt_chat`, `nanogpt_vision`, `nanogpt_embeddings`, `nanogpt_ai_detection` | | Images | `nanogpt_image_generate`, `nanogpt_image_edit`, `nanogpt_ai_qr` | | Video | `nanogpt_video_generate` | | 3D | `nanogpt_3d_generate` | | Audio | `nanogpt_text_to_speech`, `nanogpt_music_generate`, `nanogpt_audio_transcribe` | | Web and research | `nanogpt_web_search`, `nanogpt_scrape_urls`, `nanogpt_firecrawl`, `nanogpt_youtube_transcribe`, `nanogpt_x_research`, `nanogpt_hunter` | | Social and maps data | `nanogpt_reddit`, `nanogpt_google_maps_scrape`, `nanogpt_google_maps_reviews_scrape`, `nanogpt_facebook_ads`, `nanogpt_facebook_posts_scrape`, `nanogpt_instagram_profile`, `nanogpt_instagram_posts_scrape`, `nanogpt_instagram_reels`, `nanogpt_linkedin_profile`, `nanogpt_tiktok_scrape` | | Model catalogs (free) | `nanogpt_list_text_models`, `nanogpt_list_image_models`, `nanogpt_list_video_models`, `nanogpt_list_3d_models`, `nanogpt_list_audio_models` | Each tool describes its parameters to your agent through MCP, so the agent can call it without reading the API documentation. The source code is on [GitHub](https://github.com/Nano-GPT-com/nanogpt-mcp) . See the [MCP integration guide](https://docs.nano-gpt.com/integrations/mcp#tool-reference) for parameters and examples. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#video-and-3d-generation) Video and 3D Generation ------------------------------------------------------------------------------------------------------------------------ Video and 3D jobs run asynchronously and usually take between 30 seconds and several minutes: * `operation: "submit_and_poll"` submits the job and waits up to `timeout_ms` (default 50 seconds) for the result. A finished job returns the video or GLB URL. The wait includes the submit request, but a submission that is still in progress is never cut short (aborting it could lose a job that was already accepted), so an unusually slow submission can take longer than `timeout_ms`. * If the job is still running, the result contains its `runId`. Call the tool again with `operation: "poll"` and that `runId` to keep waiting, or `operation: "status"` for a single check. * `operation: "submit"` only submits the job. Many MCP clients stop a tool call after 60 seconds, so keep `timeout_ms` below your client’s tool timeout and continue long jobs with `poll`. A job is charged when it is submitted, so poll instead of submitting it again. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#resources) Resources -------------------------------------------------------------------------------------------- Resources allow agents to “read” data stored by the server. NanoGPT MCP provides: * **`nanogpt://raw/{id}`**: Access the raw JSON response from a previous API call. * **`nanogpt://image/{id}`**: Access an image generated during the session. * **`nanogpt://media/{id}`**: Access generated audio or other media from the session. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#cost-&-billing) Cost & Billing ------------------------------------------------------------------------------------------------------ * Paid tools deduct from your NanoGPT account balance. * Model listing operations are complimentary. * Video and 3D jobs are charged when submitted; use `poll` to keep waiting instead of submitting again. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#troubleshooting) Troubleshooting -------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#api-key-validation) API key validation * Ensure `NANOGPT_API_KEY` is set in your MCP client configuration. * Verify the key in your NanoGPT API dashboard and remove any extra spaces. * If Claude Code fails immediately with `Invalid API key`, verify the MCP launcher command too, especially on native Windows where `npx` should run via `cmd /c "C:\Program Files\nodejs\npx.cmd"`. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#timeouts-for-long-operations) Timeouts for long operations For video and 3D jobs, keep `timeout_ms` below your MCP client’s tool-call timeout (often 60 seconds) and continue with `operation: "poll"`. For slow web searches or other large requests, increase the HTTP timeout with `NANOGPT_TIMEOUT_MS`: { "mcpServers": { "nanogpt": { "command": "npx", "args": ["-y", "@nanogpt/mcp"], "env": { "NANOGPT_API_KEY": "your_api_key_here", "NANOGPT_TIMEOUT_MS": "900000" } } } } ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#node-js-version-compatibility) Node.js version compatibility The MCP server requires Node.js 22+: node --version ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#mcp-client-connection-checks) MCP client connection checks * Re-add the server configuration if your client can’t connect. * Review your MCP client logs for connection errors. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/mcp-server#getting-started) Getting Started -------------------------------------------------------------------------------------------------------- 1. Get your API key from the [NanoGPT API dashboard](https://nano-gpt.com/api) . 2. Configure your MCP client (like Claude Desktop) with the server settings. 3. Start chatting with your agent and ask it to “Search the web for…”, “Generate an image of…”, “Make a 5 second video of…” or “Create a 3D model of…”. For more details on specific models and pricing, visit the [Pricing Page](https://docs.nano-gpt.com/api-reference/miscellaneous/pricing) . --- # Video Input - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#content-area) Video input lets compatible text and multimodal models understand a video. It is separate from [video generation](https://docs.nano-gpt.com/api-reference/endpoint/video-generation) : this guide covers video sent as input, not video creation, editing, or video-to-video generation. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#choose-a-compatible-model) Choose a compatible model ----------------------------------------------------------------------------------------------------------------------------- Request the detailed model catalog and select a model that advertises video input: GET /api/v1/models?detailed=true Look for additive capability fields such as: { "architecture": { "input_modalities": ["text", "image", "video"] }, "capabilities": { "video_input": true } } An explicitly selected model without video capability is rejected before provider dispatch and billing. Automatic fallback keeps only routes that preserve video input. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#chat-completions) Chat Completions ----------------------------------------------------------------------------------------------------------- Use the canonical OpenAI-compatible `video_url` content part with `POST /api/v1/chat/completions`: { "model": "google/gemini-3.1-flash-lite", "messages": [{\ "role": "user",\ "content": [\ { "type": "text", "text": "Describe this clip." },\ {\ "type": "video_url",\ "video_url": {\ "url": "https://cdn.example.com/clip.mp4",\ "detail": "auto"\ }\ }\ ]\ }] } `video_url.url` may be a public HTTPS URL or a `data:video/*;base64,...` URL. `detail` accepts `auto`, `low`, or `high` where the selected route supports it. The endpoint accepts compatibility aliases (`input_video`, direct `video`, and safely identifiable `input_file`/`file` blocks), but new integrations should emit `video_url`. A file block is classified as video only when NanoGPT can identify it from a `video/*` MIME type, a video data URL, or a recognized video filename/URL extension. Do not use an opaque file reference for video. See [Chat Completions](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion#video-input) for endpoint-specific examples. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#responses) Responses --------------------------------------------------------------------------------------------- Use `input_video` inside a message content array with `POST /api/v1/responses`: { "model": "google/gemini-3.1-flash-lite", "input": [{\ "type": "message",\ "role": "user",\ "content": [\ { "type": "input_text", "text": "Summarize the action." },\ {\ "type": "input_video",\ "video_url": "data:video/mp4;base64,AAAA..."\ }\ ]\ }] } Chat-style `video_url` is accepted as a compatibility alias. `input_file` is accepted as video only when its MIME type, data URL, or recognized filename/URL extension safely identifies video. PDFs, audio files, and unknown or opaque files are not silently treated as video. An opaque `file_id` is not resolved for Responses video input and returns `video_file_id_not_supported`. Responses Batch is separate and currently rejects video inputs. This change does not add video support to Batch. See [Responses](https://docs.nano-gpt.com/api-reference/endpoint/responses#video-input) for the full endpoint contract. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#anthropic-messages) Anthropic Messages --------------------------------------------------------------------------------------------------------------- Use an Anthropic `video` content block with `POST /api/v1/messages`. For inline bytes, use the base64 source form: { "model": "google/gemini-3.1-flash-lite", "max_tokens": 512, "messages": [{\ "role": "user",\ "content": [\ { "type": "text", "text": "What happens in this clip?" },\ {\ "type": "video",\ "source": {\ "type": "base64",\ "media_type": "video/mp4",\ "data": "AAAA..."\ }\ }\ ]\ }] } For URL transport, use: { "type": "video", "source": { "type": "url", "url": "https://cdn.example.com/clip.mp4", "media_type": "video/mp4" } } A `document` compatibility block with a `video/*` source is normalized as video. A document with `application/pdf` remains a document. Use `type: "video"` for new integrations. See [Messages](https://docs.nano-gpt.com/api-reference/endpoint/messages#video-block) for endpoint-specific examples. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#sources-limits-and-security) Sources, limits, and security ----------------------------------------------------------------------------------------------------------------------------------- * Public remote sources must use HTTPS. Plain HTTP and other schemes are rejected. * Inline sources must be valid `data:video/*;base64,...` URLs, or raw base64 in an established direct field such as Anthropic `source.data` or a video-typed `input_file.file_data`. * Routes that fetch or materialize video apply SSRF protections, validate the fetched content type, allow at most 2 video attachments, and limit each attachment to 20 MB by default. Provider pass-through routes may impose stricter codec, duration, or size limits. * NanoGPT does not publish one universal duration or token conversion limit. Video remains a distinct modality for routing and billing; when duration metadata is unavailable, a conservative estimate may be reconciled against provider-reported usage. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#segment-selection) Segment selection ------------------------------------------------------------------------------------------------------------- `start_offset` and `end_offset` are measured in seconds and validated as finite, non-negative numbers (`end_offset` must be greater than `start_offset`). No current public text-model route can reliably honor these fields, so valid offsets return `video_segment_not_supported`; invalid ranges return `invalid_video_segment`. Do not present segment selection as supported. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#youtube-urls) YouTube URLs --------------------------------------------------------------------------------------------------- YouTube pass-through is model- and route-dependent. An applicable direct Gemini route may accept a public YouTube URL. A route that would need NanoGPT to fetch or materialize it returns `youtube_video_route_not_supported`. NanoGPT does not download or scrape YouTube for video input. The separate opt-in YouTube transcript feature is not video understanding. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/video-input#validation-errors) Validation errors ------------------------------------------------------------------------------------------------------------- Video errors use the endpoint’s normal OpenAI- or Anthropic-compatible error envelope. Common `400` codes include: | Code | Meaning | | --- | --- | | `video_input_not_supported` | The selected model does not support video input. | | `invalid_video_url_scheme` | A non-HTTPS remote source was used. Chat Completions may expose `video_attachment_url_invalid` as an established alias. | | `invalid_video_data_url` | The data URL is malformed or is not a video data URL. | | `invalid_video_base64` | Inline base64 is malformed. | | `invalid_video_mime_type` | An explicit non-video MIME type was used for video content. | | `missing_video_source` | The content block has no usable URL or data. | | `video_file_id_not_supported` | An unresolved uploaded-file reference was used. | | `video_attachment_too_large` | A materialized attachment exceeded the route limit. | | `video_attachment_limit_exceeded` | Too many materialized video attachments were supplied. | | `invalid_video_segment` | Segment offsets are invalid. | | `video_segment_not_supported` | The selected route cannot honor segment selection. | | `youtube_video_route_not_supported` | The selected route cannot accept the YouTube URL directly. | --- # Music Generation - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/music-generation#content-area) [​](https://docs.nano-gpt.com/api-reference/music-generation#overview) Overview ---------------------------------------------------------------------------------- NanoGPT supports AI music generation through the same OpenAI-compatible Text-to-Speech endpoint. When you specify a music model, the `input` field is treated as a music prompt (not text to speak) and the API returns an audio file. [​](https://docs.nano-gpt.com/api-reference/music-generation#endpoint) Endpoint ---------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/audio/speech [​](https://docs.nano-gpt.com/api-reference/music-generation#choosing-a-music-model) Choosing A Music Model -------------------------------------------------------------------------------------------------------------- Music model availability changes over time. Discover available audio models via `GET https://api.nano-gpt.com/api/v1/audio-models` (see [Audio Models](https://docs.nano-gpt.com/api-reference/endpoint/audio-models) ) and select a model intended for music generation. [​](https://docs.nano-gpt.com/api-reference/music-generation#request-format) Request Format ---------------------------------------------------------------------------------------------- { "model": "YOUR_MUSIC_MODEL_ID", "input": "A chill lo-fi hip hop beat with soft piano chords and vinyl crackle, 120 BPM" } If you are using an OpenAI client that enforces the OpenAI TTS schema (for example the official OpenAI SDK), you may need to include a `voice` field. For music models, `voice` is ignored, so it can be any string (many examples use `"alloy"`). ### [​](https://docs.nano-gpt.com/api-reference/music-generation#parameters) Parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `model` | string | Yes | A music-capable audio model ID (discover via `GET https://api.nano-gpt.com/api/v1/audio-models`) | | `input` | string | Yes | A text prompt describing the music you want generated | | `voice` | string | No | Ignored for music models. Some OpenAI-compatible clients require this field; if so, pass any string (for example `"alloy"`). | [​](https://docs.nano-gpt.com/api-reference/music-generation#response) Response ---------------------------------------------------------------------------------- The response is an audio file (typically MP3). The `Content-Type` header indicates the format. HTTP/1.1 200 OK Content-Type: audio/mpeg The response body is raw audio bytes. [​](https://docs.nano-gpt.com/api-reference/music-generation#examples) Examples ---------------------------------------------------------------------------------- cURL Python (OpenAI SDK) curl -X POST https://api.nano-gpt.com/api/v1/audio/speech \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_MUSIC_MODEL_ID", "input": "An energetic electronic dance track with heavy bass drops and synth leads" }' \ --output music.mp3 from openai import OpenAI client = OpenAI( base_url="https://api.nano-gpt.com/api/v1", api_key="YOUR_API_KEY", ) response = client.audio.speech.create( model="YOUR_MUSIC_MODEL_ID", input="A peaceful acoustic guitar melody with soft drums", voice="alloy", # Ignored for music models; included for OpenAI SDK compatibility ) response.stream_to_file("output.mp3") [​](https://docs.nano-gpt.com/api-reference/music-generation#tips) Tips -------------------------------------------------------------------------- * Be descriptive: include genre, instruments, tempo (BPM), mood, and style. * Duration: generation duration varies by model. Most models produce ~10-30 seconds by default; duration may be influenced by the prompt. * Cost/quality vary by model. If cost predictability matters, prefer models with flat per-generation pricing (when available). --- # Partner Program - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/partner/overview#content-area) [​](https://docs.nano-gpt.com/partner/overview#overview) Overview -------------------------------------------------------------------- The NanoGPT Partner Program lets you add AI — chat, image, video, and audio — inside your own product while NanoGPT runs the models, balances, and billing behind the scenes. Your app stays the customer-facing experience; your users never need a NanoGPT account or API key. Authentication is a short-lived JWT your backend signs and NanoGPT verifies against your public key. There is no OAuth dance, no SDK to install, and no NanoGPT credentials to manage. Most partners make their first successful call the same day they apply. Already approved and ready to integrate? See the [Partner Auth](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth) reference for the full JWT spec, scopes, and endpoints. [​](https://docs.nano-gpt.com/partner/overview#what-you-get) What You Get ---------------------------------------------------------------------------- * **Keep your users in your product.** Your app remains the brand and UI. NanoGPT sits behind it as the AI, model, balance, and billing layer. * **User-funded balances.** Each linked user has their own NanoGPT balance and can top up with Nano, stablecoins (USDC/USDT), major chains (SOL, ETH, and more), or other supported crypto. * **No model or billing infrastructure to build.** Access the full NanoGPT model catalog through one integration; we handle routing, billing, and usage records. * **Optional referral revenue.** Earn a configurable share of your users’ top-ups. * **Optional partner tiers.** Offer tiered usage discounts to your users once tiers are enabled for your integration. * **Demo mode to test free.** We activate you in demo mode first, so you can build and test the entire flow against a free model before anything involves money. [​](https://docs.nano-gpt.com/partner/overview#apply-to-become-a-partner) Apply to Become a Partner ------------------------------------------------------------------------------------------------------ Applying takes about 15 minutes on your side. You will need three things: 1 Pick a partner ID A short, lowercase identifier, for example `acme`. This becomes your JWT issuer and the slug we configure for you. 2 Generate a signing keypair Create an ECDSA P-256 keypair and keep the private key in your own secret manager: openssl ecparam -name prime256v1 -genkey -noout -out nanogpt-partner.pem openssl pkey -in nanogpt-partner.pem -pubout Send us the output of the second command (the **public** key) plus a key ID such as `acme-2026-06`. Your public key is safe to share — it can only _verify_ tokens, never sign them. The private key never leaves your infrastructure. We confirm the key’s fingerprint with you before activation, so it cannot be tampered with in transit. Never send a private key to anyone. 3 Tell us what you need at launch Any combination of: AI requests, user balances, top-ups, and signed-in web access (SSO). This determines your scopes and browser redirect allowlist. Email these three items to **[partner@nano-gpt.com](mailto:partner@nano-gpt.com?subject=NanoGPT%20Partner%20Program%20application) ** and we’ll take it from there. [​](https://docs.nano-gpt.com/partner/overview#what-happens-next) What Happens Next -------------------------------------------------------------------------------------- 1. We register your public key and activate you in **demo mode** — usually the same day. 2. Your backend signs a JWT and calls NanoGPT with it as a Bearer token. Your first request works against a free model with zero balance, so you can validate the full integration before money is involved. 3. When you’re ready to launch, we switch off demo mode and confirm your commercial settings — referral revenue share, any partner tiers, and your redirect allowlist. 4. Your users fund their own usage, and you can surface balance and top-up options directly in your product. [​](https://docs.nano-gpt.com/partner/overview#build-the-integration) Build the Integration ---------------------------------------------------------------------------------------------- Once you’re approved, the [Partner Auth](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth) reference covers everything you need: the JWT header and claims, the available scopes, sending AI requests, checking balances, creating top-ups, browser SSO login links, reading usage, and error handling. --- # Bring Your Own Key (BYOK) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#overview) Overview ------------------------------------------------------------------------------------ BYOK (Bring Your Own Key) lets you store API credentials for supported upstream providers and then opt-in per request to route through your own keys. Typical reasons to use BYOK: * Your provider bills you directly (enterprise agreements, committed-use discounts, free tiers). * You want NanoGPT routing + enhancements, without using NanoGPT platform keys. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#availability) Availability -------------------------------------------------------------------------------------------- BYOK is currently supported on: * `POST /api/v1/chat/completions` [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#pricing) Pricing ---------------------------------------------------------------------------------- When you use BYOK: * Your provider bills you directly for usage on their side. * NanoGPT charges a **5% platform fee** on top for routing and platform features. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#configure-keys) Configure Keys ------------------------------------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#web-ui-recommended) Web UI (Recommended) Manage BYOK keys in the NanoGPT web app: * [https://nano-gpt.com/byok](https://nano-gpt.com/byok) Keys are never shown again after saving (only a short suffix is displayed), so treat them like passwords. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#api-nanogpt-key-required) API (NanoGPT key required) If you prefer managing keys programmatically, use these endpoints (not OpenAI-compatible): POST /api/user/provider-keys GET /api/user/provider-keys DELETE /api/user/provider-keys?provider= Example: add/update a provider key curl -X POST "https://nano-gpt.com/api/user/provider-keys" \ -H "Authorization: Bearer YOUR_NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "openai", "key": "YOUR_PROVIDER_API_KEY" }' [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#use-byok-on-a-request) Use BYOK On A Request -------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#enable-byok) Enable BYOK Option A: request header x-use-byok: true Option B: request body { "byok": { "enabled": true } } ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#select-a-provider-optional) Select a provider (optional) If the model can route through multiple providers, you can force a specific provider. Header: x-byok-provider: openai Body: { "byok": { "enabled": true, "provider": "openai" } } ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#fallbacks-optional) Fallbacks (optional) BYOK defaults to **fail-fast** behavior. If your provider key fails, NanoGPT will not silently route the request through a different provider key. You can control this via the request body: { "byok": { "enabled": true, "disableFallbacks": true } } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#provider-slugs) Provider Slugs ------------------------------------------------------------------------------------------------ The exact set of supported providers can evolve; the BYOK UI lists what your account can configure. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#chat-/-completion-providers) Chat / completion providers These providers can be used for BYOK on `POST /api/v1/chat/completions`: | Provider | Slug | Key format | | --- | --- | --- | | OpenAI | `openai` | API key string (`sk-...`) | | OpenAI Responses | `openai-responses` | API key string (`sk-...`) | | Anthropic | `anthropic` | API key string (`sk-ant-...`) | | OpenRouter | `openrouter` | API key string (`or-...`) | | Chutes | `chutes` | API key string (`cpk_...`) | | AWS Bedrock | `aws` | JSON: `{"accessKeyId":"...","secretAccessKey":"...","region":"us-east-1"}` | | Azure OpenAI | `azure` | JSON: `{"endpoint":"...","apiKey":"...","deploymentName":"...","apiVersion":"..."}` | | Azure Responses | `azure-responses` | JSON: `{"endpoint":"...","apiKey":"...","apiVersion":"..."}` | | Azure Anthropic Foundry | `azure-anthropic-foundry` | JSON: `{"endpoint":"...","apiKey":"..."}` | | Google AI Studio | `google` | API key string (`AIza...`) | | Groq | `groq` | API key string (`gsk_...`) | | NVIDIA | `nvidia` | API key string (`nvapi-...`) | | SambaNova | `sambanova` | API key string | | Vercel | `vercel` | API key string | | Novita | `novita` | API key string (`nvta_...`) | | Akash | `akash` | API key string (`sk-...`) | | Z.AI (GLM) | `zai` | API key string | | GMICloud | `gmicloud` | API key string | | Cerebras | `cerebras` | API key string (`csk-...`) | | MegaNova | `meganova` | API key string | Notes: * AWS JSON can also include `sessionToken`. * Azure-style providers require provider-specific endpoints and identifiers (for example, a deployment name). * If you want to force Google AI Studio routing for Gemini models, set `x-byok-provider: google` (or `byok.provider: "google"`). * Additional provider options may appear over time in the BYOK UI and provider-discovery endpoints. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#web-search-only-providers) Web-search-only providers These providers are BYOK for web search enhancements, not chat model execution: | Provider | Slug | | --- | --- | | Tavily | `tavily` | | Exa | `exa` | | Kagi | `kagi` | | Perplexity | `perplexity` | | Valyu | `valyu` | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#teams-byok) Teams (BYOK) ------------------------------------------------------------------------------------------ Teams can also store provider keys and configure whether team-billed traffic should use team keys. Team settings endpoints (session-authenticated, not OpenAI-compatible): GET /api/teams/{teamUuid}/byok-settings PATCH /api/teams/{teamUuid}/byok-settings GET /api/teams/{teamUuid}/provider-keys POST /api/teams/{teamUuid}/provider-keys DELETE /api/teams/{teamUuid}/provider-keys?provider= BYOK modes: * `disabled`: BYOK off for the team. * `prefer_team`: use a team key when available; otherwise fall back to normal routing. * `require_team`: fail requests when no team key exists for the required provider. Important behavior: * In `prefer_team` mode, team-billed traffic will not use a member’s personal BYOK keys unless the client explicitly opts in to BYOK on the request. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/byok#security-notes) Security Notes ------------------------------------------------------------------------------------------------ * Never put provider keys in client-side code or public repos. * Prefer storing keys once (UI or the `/api/user/provider-keys` endpoints) and then enabling BYOK per request. --- # SillyTavern - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/sillytavern#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/sillytavern#sillytavern-integration) SillyTavern Integration ========================================================================================================== Configure NanoGPT: * Select “OpenAI” as the API type (NanoGPT uses an OpenAI-compatible API) * Enter your NanoGPT API key * Set the API URL to: `https://nano-gpt.com/api/v1` (SillyTavern understands the modern `delta.reasoning` stream) * Set the Model to: `openai/gpt-6.1-sol` (or `anthropic/claude-opus-5.5`, `google/gemini-flash-latest`) **Important Note**: If you choose the Chat Completions endpoint in SillyTavern, you will see NanoGPT automatically appear as an option. [​](https://docs.nano-gpt.com/integrations/sillytavern#image-generation) Image Generation -------------------------------------------------------------------------------------------- SillyTavern has a built-in NanoGPT image source, so you do not need to enter an image API URL. 1. Save your NanoGPT API key under **API Connections** (Chat Completion → NanoGPT). The image source reuses that key. 2. Open **Extensions → Image Generation** and set **Source** to **NanoGPT**. 3. Pick a model from the **Model** list. SillyTavern loads it from NanoGPT’s image catalog. 4. Choose a **Resolution** the model supports. SillyTavern defaults to 512x512, which some models reject. GPT Image 2.5, for example, needs at least 1024x1024 (or another supported size such as 1536x1024). SillyTavern’s **OpenAI** image source always calls OpenAI directly and cannot be pointed at NanoGPT. Use the **NanoGPT** source instead. SillyTavern reads images from the inline `b64_json` field. Very large outputs (roughly over 3.5 MB, for example 4K PNGs) are returned as a download `url` instead, which SillyTavern cannot display. Use a smaller resolution if generation fails for large sizes. --- # Distillation Policy - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#distillation-policy) Distillation Policy ========================================================================================================================= NanoGPT exposes a `distillationPolicy` field that indicates whether a model or provider route is allowed for output-based model training or distillation under NanoGPT’s recorded model-license and provider-terms rules. This metadata is currently API-only. The text models browser UI does not show a distillation filter or badge. Distillation policy metadata is based on NanoGPT’s current interpretation of published model licenses and provider terms. Users are responsible for ensuring their use complies with all applicable terms and laws. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#policy-object) Policy Object ------------------------------------------------------------------------------------------------------------- Text model records and provider rows may include: { "distillationPolicy": { "status": "allowed", "label": "License permits distillation", "basis": "permissive-open-weights", "sourceUrl": "https://example.com/license-or-terms", "note": "Short explanation of the policy signal." } } All fields are additive and optional for backwards compatibility. New API responses include `distillationPolicy` where NanoGPT has recorded policy metadata. | Field | Type | Description | | --- | --- | --- | | `status` | string | One of `allowed`, `disallowed`, or `unknown`. | | `label` | string | Human-readable policy summary. | | `basis` | string | Rule basis used to derive the status. | | `sourceUrl` | string | License or provider terms URL used as the policy source, when recorded. | | `note` | string | Short explanation and caveats for the policy signal. | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#statuses) Statuses --------------------------------------------------------------------------------------------------- | Status | Meaning | | --- | --- | | `allowed` | Distillation is allowed under the current recorded rule set. | | `disallowed` | Distillation is restricted by model or provider terms. | | `unknown` | NanoGPT does not have a clear enough signal. | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#bases) Bases --------------------------------------------------------------------------------------------- | Basis | Meaning | | --- | --- | | `deepseek-api-terms` | DeepSeek explicitly allows use of inputs and outputs for training other models, including distillation. | | `permissive-open-weights` | The underlying model or license permits distillation or derivative model use. | | `provider-output-use-terms` | The provider terms explicitly permit output use. | | `provider-output-use-restriction` | The provider terms restrict output-based training, distillation, model development, or competing model/service creation. | | `closed-provider-restriction` | The model is from a closed provider family that commonly restricts using outputs for competing model training. | | `provider-terms-unknown` | No clear provider or model policy is recorded. | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#model-policy-vs-provider-policy) Model Policy vs Provider Policy ------------------------------------------------------------------------------------------------------------------------------------------------- There are two policy layers: | Layer | Question it answers | | --- | --- | | Model/license policy | Does the underlying model or model family allow distillation? | | Provider/API policy | Does the specific hosted provider route allow users to use API outputs for distillation? | A provider can restrict output use even when the underlying model license is permissive. Provider-specific restrictions override model-level allowances. Provider rows are evaluated with these rules: * Explicit provider restrictions return `disallowed`. * Explicit provider permission returns `allowed`. * If provider terms do not mention output-based training or distillation, and the underlying model/license allows it, NanoGPT treats the provider route as `allowed`. * If the underlying model policy is `unknown` or `disallowed`, provider silence does not make it allowed. Example provider row: { "provider": "fireworks", "distillationPolicy": { "status": "allowed", "label": "Provider terms permit output use", "basis": "provider-output-use-terms", "sourceUrl": "https://fireworks.ai/terms-of-service", "note": "Fireworks permits use of outputs for any lawful purpose, subject to model-provider license and usage restrictions. Model-level signal: license permits distillation." } } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#filtering-text-models) Filtering Text Models ----------------------------------------------------------------------------------------------------------------------------- The explore text model endpoints support `distillation=allowed`. GET /api/explore/text-models?distillation=allowed This returns only text models whose model-level distillation policy is `allowed`. Search supports the same parameter for text search: GET /api/explore/search?type=text&q=qwen&distillation=allowed The filter applies only to text models. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#response-metadata) Response Metadata --------------------------------------------------------------------------------------------------------------------- When the filter is used, responses include: { "meta": { "distillation": "allowed" } } Without the filter, text model responses include: { "meta": { "distillation": "all" } } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#provider-level-behavior) Provider-Level Behavior --------------------------------------------------------------------------------------------------------------------------------- Provider route policy can differ from model-level policy: * DeepSeek models served by DeepSeek are `allowed`. * Fireworks, Together, Nebius, and ArliAI routes on a model whose license permits distillation are `allowed`. * Providers with explicit competing-model or output-training restrictions are `disallowed`. * Providers with no recorded restriction on an allowed open-weight model are `allowed`. * Providers with no recorded restriction on an unknown model or license are `unknown`. For a representative open Qwen model across user-selectable providers, the current provider-level split is `35 allowed`, `21 disallowed`, and `0 unknown`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/distillation-policy#caveats) Caveats ------------------------------------------------------------------------------------------------- * This metadata is informational and is not legal advice. * Provider terms and model licenses can change. * Model licenses can impose attribution, naming, acceptable-use, or derivative-model restrictions even when distillation is allowed. * Provider-specific restrictions override model-level allowances. * Unknown model/license status remains unknown even if a provider is silent. * Inspect `sourceUrl` and `note` before relying on a model or route for distillation. --- # Tool Calling Diagnostics - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics#tool-calling-diagnostics) Tool Calling Diagnostics ======================================================================================================================================== If an agent or coding client fails while using tools through NanoGPT, you can opt in to share the failing turn with NanoGPT support for debugging. This is designed for cases where a model emits malformed tool calls, stops instead of calling a required tool, loops on a tool, or a client shows raw tool markup instead of executing the tool. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics#enable-diagnostics) Enable Diagnostics ---------------------------------------------------------------------------------------------------------------------------- Tool-calling diagnostics are off by default. To enable them: 1. Open [Settings](https://nano-gpt.com/settings#privacy--analytics) . 2. Enable tool-calling diagnostics under Privacy & Analytics. 3. Review what may be stored, choose a retention period, and acknowledge the capture terms. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics#capture-a-failed-turn) Capture A Failed Turn ---------------------------------------------------------------------------------------------------------------------------------- After a tool-calling failure, send this as the next message: nanogpt fix this Use that exact lowercase phrase by itself. Do not include any other words. If diagnostics are not enabled yet, NanoGPT will respond with a link to the settings page instead of storing a capture. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics#what-gets-stored) What Gets Stored ------------------------------------------------------------------------------------------------------------------------ When enabled, NanoGPT stores only the immediately previous request/response cycle visible in the trigger request history. The diagnostic capture can include: * prompts and conversation messages from that cycle * tool schemas, tool arguments, and tool outputs * file paths or other content your client included * model responses and client-visible error details * NanoGPT request metadata such as model, endpoint, request IDs, and stream mode NanoGPT applies best-effort redaction before storing the capture, but you should assume the captured turn may contain sensitive project or conversation data. Only use this feature when you are comfortable sharing that failing turn with NanoGPT support. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics#retention) Retention ---------------------------------------------------------------------------------------------------------- Diagnostic captures are temporary. The default retention period is 14 days, and captures are stored privately for support investigation. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/tool-calling-diagnostics#limits) Limits ---------------------------------------------------------------------------------------------------- Diagnostics are based on the conversation history your client sends with the `nanogpt fix this` trigger. If a client references earlier state by ID instead of including it in the request, NanoGPT may not be able to reconstruct the full failing turn from the trigger alone. --- # Messages Count Tokens - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#content-area) Messages Count Tokens cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/messages/count_tokens import requests url = "https://api.nano-gpt.com/api/v1/messages/count_tokens" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/messages/count_tokens', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/messages/count_tokens",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/messages/count_tokens" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/messages/count_tokens") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/messages/count_tokens") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / v1 / messages / count\_tokens Try it Messages Count Tokens cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/messages/count_tokens import requests url = "https://api.nano-gpt.com/api/v1/messages/count_tokens" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/messages/count_tokens', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/messages/count_tokens",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/messages/count_tokens" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/messages/count_tokens") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/messages/count_tokens") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#overview) Overview ------------------------------------------------------------------------------------------------ Use `POST /api/v1/messages/count_tokens` to estimate the number of input tokens for an Anthropic Messages-format request. This endpoint is useful for request planning, context budgeting, and cost control. The result is an estimate and may not exactly match a provider tokenizer. [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#endpoint) Endpoint ------------------------------------------------------------------------------------------------ POST https://api.nano-gpt.com/api/v1/messages/count_tokens [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#authentication) Authentication ------------------------------------------------------------------------------------------------------------ Use either header: * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#request-body) Request Body -------------------------------------------------------------------------------------------------------- { "model": "claude-3-5-sonnet", "system": "You are concise.", "messages": [\ {\ "role": "user",\ "content": "Hello"\ }\ ], "tools": [], "tool_choice": null } [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#supported-content) Supported Content ------------------------------------------------------------------------------------------------------------------ The request uses Anthropic message format and supports: * text blocks * image and document-like blocks * tool use blocks * tool result blocks * `system` * `tools` * `tool_choice` [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#response) Response ------------------------------------------------------------------------------------------------ { "input_tokens": 123 } [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#example) Example ---------------------------------------------------------------------------------------------- curl -X POST https://api.nano-gpt.com/api/v1/messages/count_tokens \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-3-5-sonnet", "system": "You are concise.", "messages": [\ { "role": "user", "content": "Hello" }\ ] }' [​](https://docs.nano-gpt.com/api-reference/endpoint/messages-count-tokens#notes) Notes ------------------------------------------------------------------------------------------ * This is an estimate for planning and cost control. * It may not exactly match a provider tokenizer. * For generation, use `POST /api/v1/messages`. --- # TEE Signature - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/tee-signature#content-area) cURL cURL curl --request GET \ --url https://api.nano-gpt.com/v1/tee/signature/{requestId} \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/v1/tee/signature/{requestId}" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/v1/tee/signature/{requestId}', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/v1/tee/signature/{requestId}",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/v1/tee/signature/{requestId}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/v1/tee/signature/{requestId}") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/v1/tee/signature/{requestId}") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "signature": "" } { "error": 123, "message": "" } GET / v1 / tee / signature / {requestId} Try it cURL cURL curl --request GET \ --url https://api.nano-gpt.com/v1/tee/signature/{requestId} \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/v1/tee/signature/{requestId}" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/v1/tee/signature/{requestId}', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/v1/tee/signature/{requestId}",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/v1/tee/signature/{requestId}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/v1/tee/signature/{requestId}") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/v1/tee/signature/{requestId}") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "signature": "" } { "error": 123, "message": "" } Fetch an ECDSA signature for a chat request executed in a TEE. #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-signature#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Path Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-signature#parameter-request-id) requestId string required Chat request ID #### Query Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-signature#parameter-model) model string required TEE model to attest [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-signature#parameter-signing-algo) signing\_algo string Signing algorithm to use #### Response 200 application/json TEE signature response [​](https://docs.nano-gpt.com/api-reference/endpoint/tee-signature#response-signature) signature string The ECDSA signature --- # JavaScript Library - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#nanogptjs) NanoGPTJS ============================================================================================ [NanoGPTJS](https://github.com/kilkelly/nanogptjs) is a Node.js library designed to interact with NanoGPT’s API. This library provides an easy way to integrate NanoGPT’s capabilities into your JavaScript applications. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#overview) Overview ------------------------------------------------------------------------------------------ The NanoGPT service enables pay-per-prompt interaction with chat and image generation models. You will need a prefilled NanoGPT wallet and API key to use this library effectively. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#installation) Installation -------------------------------------------------------------------------------------------------- You can install the library using npm: npm install nanogptjs [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#basic-usage) Basic Usage ------------------------------------------------------------------------------------------------ const NanoGPT = require('nanogptjs'); // Initialize with your API key const nanogpt = new NanoGPT('your-api-key'); async function chatExample() { try { const response = await nanogpt.chat({ model: 'openai/gpt-6.1-sol', messages: [\ { role: 'system', content: 'You are a helpful assistant.' },\ { role: 'user', content: 'What is the capital of France?' }\ ] }); console.log(response); } catch (error) { console.error('Error:', error); } } chatExample(); [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#features) Features ------------------------------------------------------------------------------------------ * **Chat Completions**: Generate text responses using various AI models * **Image Generation**: Create images from text prompts * **Model Selection**: Choose from a wide range of available models * **Balance Management**: Check your NanoGPT balance and manage transactions [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#api-methods) API Methods ------------------------------------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#chat) Chat const response = await nanogpt.chat({ model: 'openai/gpt-6.1-sol', messages: [\ { role: 'system', content: 'You are a helpful assistant.' },\ { role: 'user', content: 'Hello, how are you?' }\ ], temperature: 0.7, max_tokens: 150 }); ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#generate-image) Generate Image const response = await nanogpt.generateImage({ prompt: 'A beautiful sunset over the ocean', model: 'recraft-v3', width: 1024, height: 1024 }); ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#check-balance) Check Balance const balance = await nanogpt.checkBalance(); console.log('USD Balance:', balance.usd_balance); console.log('Nano Balance:', balance.nano_balance); [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#error-handling) Error Handling ------------------------------------------------------------------------------------------------------ The library provides robust error handling to manage API response errors: try { const response = await nanogpt.chat({ model: 'openai/gpt-6.1-sol', messages: [\ { role: 'user', content: 'Hello!' }\ ] }); } catch (error) { console.error('Status:', error.status); console.error('Message:', error.message); } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/javascript#resources) Resources -------------------------------------------------------------------------------------------- * [GitHub Repository](https://github.com/kilkelly/nanogptjs) * [NanoGPT API Documentation](https://docs.nano-gpt.com/) * [Get your API Key](https://nano-gpt.com/api) --- # Video Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/video-models#content-area) Video Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/video-models import requests url = "https://api.nano-gpt.com/api/v1/video-models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/video-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/video-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/video-models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/video-models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/video-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body GET / api / v1 / video-models Try it Video Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/video-models import requests url = "https://api.nano-gpt.com/api/v1/video-models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/video-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/video-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/video-models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/video-models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/video-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#overview) Overview --------------------------------------------------------------------------------------- Use `GET /api/v1/video-models` to discover the currently available video models. Do not hardcode video model capabilities in your client; supported settings and availability can change. This endpoint is cacheable. Refresh it periodically and treat new fields as additive. [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#endpoint) Endpoint --------------------------------------------------------------------------------------- GET https://api.nano-gpt.com/api/v1/video-models [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#authentication) Authentication --------------------------------------------------------------------------------------------------- Authentication is optional. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#query-parameters) Query Parameters ------------------------------------------------------------------------------------------------------- | Parameter | Type | Default | Description | | --- | --- | --- | --- | | `detailed` | boolean | `true` | Include names, descriptions, pricing, capabilities, and supported parameters. | [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#response) Response --------------------------------------------------------------------------------------- { "object": "list", "data": [\ {\ "id": "video-model-id",\ "object": "model",\ "name": "Display name",\ "description": "Model description",\ "architecture": {\ "modality": "video",\ "input_modalities": ["text", "image"],\ "output_modalities": ["video"]\ },\ "pricing": {\ "currency": "USD"\ },\ "capabilities": {\ "video_generation": true,\ "text_to_video": true,\ "image_to_video": true,\ "audio_generation": false\ },\ "supported_parameters": {}\ }\ ], "meta": { "count": 1, "generated_at": "2026-05-07T12:00:00.000Z" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#supported-parameters) Supported Parameters --------------------------------------------------------------------------------------------------------------- Supported parameters vary by model. Common examples include: * `duration` * `aspect_ratio` * `resolution` * image input support * audio generation support * video extension support * video recovery support * prompt enhancement or safety controls Use the model’s `supported_parameters` and `capabilities` objects to decide which controls to show and which request fields to send. [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#example) Example ------------------------------------------------------------------------------------- curl "https://api.nano-gpt.com/api/v1/video-models?detailed=true" [​](https://docs.nano-gpt.com/api-reference/endpoint/video-models#notes) Notes --------------------------------------------------------------------------------- * Use this endpoint instead of hardcoding media model capabilities. * The response is cacheable, but model availability can change. * Pricing structures vary by model, for example per generation, per second, duration tier, resolution tier, or feature-specific pricing. --- # Extended Thinking (Reasoning) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#overview) Overview ------------------------------------------------------------------------------------------------- Some models generate a separate **reasoning** stream (sometimes called _thinking_) in addition to the final **answer** content. NanoGPT exposes this in an OpenAI-compatible way for Chat Completions: * Streaming (SSE): `choices[0].delta.reasoning` (or legacy `choices[0].delta.reasoning_content`) * Non-streaming: `choices[0].message.reasoning` (or legacy `choices[0].message.reasoning_content`) Not every model exposes reasoning text. If a model does not emit a reasoning stream, these fields may be absent even if the model internally “reasons”. `:thinking` is model-specific and only works when that exact ID (or a documented alias) exists. `-thinking` is a legacy alias pattern for some model families only, not universal. Do not assume `-thinking` works for arbitrary model IDs. Always check `GET /api/v1/models` for exact valid IDs. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#endpoint-variants-chat-completions) Endpoint Variants (Chat Completions) ------------------------------------------------------------------------------------------------------------------------------------------------------- NanoGPT provides three base paths for chat completions. All accept the same request format and model names, but differ in how reasoning content is delivered: | Base URL | Behavior | Use When | | --- | --- | --- | | `/api/v1/chat/completions` | Reasoning and answer are separate fields (`reasoning` + `content`). | Most OpenAI-compatible clients | | `/api/v1legacy/chat/completions` | Same as `/api/v1/`, but uses the legacy field name `reasoning_content`. | Clients that only parse `reasoning_content` | | `/api/v1thinking/chat/completions` | Reasoning and answer are merged into the normal `content` stream. | Clients that ignore reasoning fields but should still display thoughts | This is the same behavior documented under **Reasoning Streams** on the [Chat Completion](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) page. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#controlling-reasoning-output) Controlling Reasoning Output ----------------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#hide-reasoning) Hide Reasoning To strip reasoning from the response (both streaming and non-streaming), send: { "reasoning": { "exclude": true } } `reasoning.exclude` controls output visibility. It is not the same as disabling reasoning compute. Or append the model suffix: * `:reasoning-exclude` Example: { "model": "anthropic/claude-opus-4.6:reasoning-exclude", "messages": [{ "role": "user", "content": "What is 2+2?" }] } ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#reasoning-effort) Reasoning Effort `reasoning_effort` (or `reasoning.effort`) controls reasoning depth and also acts as an explicit reasoning-mode signal. An accepted value other than `none` requests reasoning/thinking behavior. Available levels and defaults depend on the model. Use `none` to request disabled reasoning only on models that support turning it off. Always-thinking models keep their reasoning requirements; Claude Opus 5.5 rejects attempts to disable thinking. { "reasoning_effort": "high" } Or: { "reasoning": { "effort": "high" } } Both formats are accepted. If both are present, top-level `reasoning_effort` is authoritative for Chat Completions request shaping. NanoGPT accepts `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Not every model supports every level; some routes map an accepted level to the nearest supported effort. `max` is a separate value from `xhigh` where the model supports both. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#claude-opus-5-5) Claude Opus 5.5 `anthropic/claude-opus-5.5` uses adaptive thinking by default. You do not need a `:thinking` suffix or an explicit enable flag. Its native effort values are `low`, `medium`, `high`, `xhigh`, and `max`; NanoGPT defaults to `high` when no effort or thinking budget is supplied. { "model": "anthropic/claude-opus-5.5", "messages": [{ "role": "user", "content": "Review this design for failure cases." }], "reasoning_effort": "max" } Requests such as `reasoning_effort: "none"` or `thinking.enabled: false` return a `reasoning_required` validation error. To hide returned reasoning while preserving thinking, use `reasoning.exclude: true` instead. Adaptive thinking also requires compatible tool choice. Use `tool_choice: "auto"` or `"none"`; forcing a tool with `"required"` or a named tool is unsupported for Opus 5.5. In [OpenCode](https://docs.nano-gpt.com/integrations/opencode#opus-5-5-reasoning-effort) , model-level `reasoning: true` describes a capability to the client. A variant’s `reasoningEffort` sets the API effort; these settings serve different purposes. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#change-effort-within-a-conversation) Change Effort Within a Conversation For GPT-6 Astra and Claude Fable 5.1, use [inline reasoning effort updates](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-reasoning-effort) to change effort while keeping the request-level baseline and earlier history unchanged. Updates can precede a user turn or appear at the end of a request to control its generated answer. Chat Completions accepts empty `system` or `developer` update messages; Responses and Messages have equivalent forms. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#legacy-field-name-compatibility-reasoning_content) Legacy Field Name Compatibility (`reasoning_content`) If a client expects `reasoning_content` instead of `reasoning`, you can: 1. Use `/api/v1legacy/chat/completions`, or 2. Set `reasoning.delta_field: "reasoning_content"`, or 3. Use the shorthands `reasoning_delta_field` / `reasoning_content_compat`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#how-reasoning-appears-in-responses) How Reasoning Appears in Responses ----------------------------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#streaming-sse) Streaming (SSE) Reasoning deltas appear before or alongside content deltas: data: {"choices":[{"index":0,"delta":{"reasoning":"Thinking..."},"finish_reason":null}]} data: {"choices":[{"index":0,"delta":{"content":"Here is the answer."},"finish_reason":null}]} ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#non-streaming) Non-Streaming The final message may include a separate reasoning field: { "choices": [\ {\ "message": {\ "role": "assistant",\ "content": "Here is the answer.",\ "reasoning": "Thinking..."\ }\ }\ ] } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#cost-notes) Cost Notes ----------------------------------------------------------------------------------------------------- Reasoning tokens are billed as output tokens. If you enable higher reasoning effort (or use thinking variants), expect higher `completion_tokens` and higher cost. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#see-also) See Also ------------------------------------------------------------------------------------------------- * Chat Completions: reasoning controls and endpoint variants ([Chat Completion](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) ) * Streaming protocol details across endpoints ([Streaming Protocol](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol) ) --- # Gemini CLI - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/gemini-cli#content-area) The model recommendations below are listed by the website host. To use them, change your client’s API base URL to `https://nano-gpt.com/api/v1`. If you keep the direct API host, choose models from `https://api.nano-gpt.com/api/v1/models` instead. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for request limits and rollout differences. [​](https://docs.nano-gpt.com/integrations/gemini-cli#gemini-cli) Gemini CLI =============================================================================== > Use Gemini CLI with NanoGPT to access Gemini, GPT, Claude, and 400+ models through a single API key. [Get started with NanoGPT](https://nano-gpt.com/api) for pay-as-you-go pricing with no monthly fees. Add credits and start immediately. Gemini CLI is Google’s official command-line interface for Gemini. The official CLI only targets Google endpoints, so use the community fork that adds OpenRouter and OpenAI-compatible support to point it at NanoGPT. [​](https://docs.nano-gpt.com/integrations/gemini-cli#step-1-install-the-openrouter-fork) Step 1: Install the OpenRouter Fork -------------------------------------------------------------------------------------------------------------------------------- Prerequisites: [Node.js 18 or newer](https://nodejs.org/en/download/) git clone https://github.com/heartyguy/gemini-cli cd gemini-cli git checkout feature/openrouter-support npm install This fork is community maintained. If the branch name changes or is missing, check the repository README for the latest OpenRouter-compatible branch. [​](https://docs.nano-gpt.com/integrations/gemini-cli#step-2-configure-nanogpt) Step 2: Configure NanoGPT ------------------------------------------------------------------------------------------------------------ 1 Get API Key * Go to [NanoGPT API](https://nano-gpt.com/api) * Create an account or log in * Copy your API key (starts with `sk-nano-`) 2 Set Environment Variables Set the base URL and API key in the same shell where you will run the CLI: * macOS/Linux * Windows PowerShell export OPENROUTER_BASE_URL="https://api.nano-gpt.com/api/v1" export OPENROUTER_API_KEY="sk-nano-YOUR-API-KEY" $env:OPENROUTER_BASE_URL = "https://api.nano-gpt.com/api/v1" $env:OPENROUTER_API_KEY = "sk-nano-YOUR-API-KEY" For persistent configuration, add the exports to your shell profile: echo 'export OPENROUTER_BASE_URL="https://api.nano-gpt.com/api/v1"' >> ~/.zshrc echo 'export OPENROUTER_API_KEY="sk-nano-YOUR-API-KEY"' >> ~/.zshrc source ~/.zshrc [​](https://docs.nano-gpt.com/integrations/gemini-cli#step-3-start-gemini-cli) Step 3: Start Gemini CLI ---------------------------------------------------------------------------------------------------------- From the `gemini-cli` folder, launch the CLI: npm start On first launch, the CLI may prompt you to select a theme or complete authentication required by the fork. [​](https://docs.nano-gpt.com/integrations/gemini-cli#models) Models ----------------------------------------------------------------------- Once connected, you can use any model listed on the [NanoGPT pricing page](https://nano-gpt.com/pricing) , including: * `google/gemini-pro-latest` * `google/gemini-flash-latest` * `openai/gpt-6.1-sol` * `anthropic/claude-opus-5.5` [​](https://docs.nano-gpt.com/integrations/gemini-cli#optional-verify-your-connection) Optional: Verify Your Connection -------------------------------------------------------------------------------------------------------------------------- curl -X POST "https://api.nano-gpt.com/api/v1/chat/completions" \ -H "Authorization: Bearer sk-nano-YOUR-API-KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "google/gemini-flash-latest", "messages": [{"role": "user", "content": "Hello!"}] }' [​](https://docs.nano-gpt.com/integrations/gemini-cli#troubleshooting) Troubleshooting ----------------------------------------------------------------------------------------- | Issue | Solution | | --- | --- | | `401 Unauthorized` | Check your API key and ensure your account has credits | | `Connection refused` | Verify `OPENROUTER_BASE_URL` is set to `https://api.nano-gpt.com/api/v1` | | `Model not found` | Confirm the model name at [nano-gpt.com/pricing](https://nano-gpt.com/pricing) | | CLI not recognizing variables | Restart your terminal or set the variables in the same session | --- # LibreChat - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/librechat#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/librechat#using-librechat-with-nanogpt) Using LibreChat with NanoGPT ================================================================================================================== A quick guide to setting up LibreChat with NanoGPT’s API. [​](https://docs.nano-gpt.com/integrations/librechat#setup-instructions) Setup Instructions ---------------------------------------------------------------------------------------------- 1. Get your API key from [nano-gpt.com/api](https://nano-gpt.com/api) 2. Locate your LibreChat installation’s `librechat.example.yml` file 3. Create a copy named `librechat.yml` 4. Add the following configuration to your `librechat.yml`: # NanoGPT Example - name: 'NanoGPT' apiKey: '${NANO_GPT_API_KEY}' baseURL: 'https://nano-gpt.com/api/v1/' models: default: [\ "openai/gpt-6.1-sol",\ "anthropic/claude-opus-5.5",\ "google/gemini-flash-latest",\ ] fetch: true addParams: reasoning_content_compat: true titleConvo: true titleModel: 'openai/gpt-6.1-sol' modelDisplayLabel: 'NanoGPT' iconUrl: https://nano-gpt.com/logo.png LibreChat currently streams internal thinking from the legacy `reasoning_content` field. The `addParams` block above enables NanoGPT’s compatibility shim so LibreChat can render thoughts without additional changes. If you would rather not send the compatibility flag, you can instead point LibreChat at `https://nano-gpt.com/api/v1legacy/` which keeps the legacy response shape by default. 5. Set your API key in your environment variables: export NANO_GPT_API_KEY='your-api-key-here' That’s it! Restart LibreChat, and you’ll have access to all NanoGPT models through the interface. [​](https://docs.nano-gpt.com/integrations/librechat#available-models) Available Models ------------------------------------------------------------------------------------------ You can access all our models through this integration, including: * GPT 6.1 Sol * Claude Opus 5.5 * Gemini Flash Latest * Perplexity * And many more! For a complete list of available models and their pricing, visit our [pricing page](https://nano-gpt.com/pricing) . --- # Get Image Model Endpoints - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#content-area) Get Image Model Endpoints cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints import requests url = "https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body GET / api / v1 / images / models / {modelId} / endpoints Try it Get Image Model Endpoints cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints import requests url = "https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images/models/{modelId}/endpoints") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#overview) Overview ---------------------------------------------------------------------------------------------------- Use `GET /api/v1/images/models/{modelId}/endpoints` to inspect public endpoint metadata for a specific image model. The response includes supported parameters, public NanoGPT pricing, streaming support, and image reference constraints when the model supports image inputs. For model IDs that contain slashes, use the `endpoints` URL returned by `GET /api/v1/images/models`. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#authentication) Authentication ---------------------------------------------------------------------------------------------------------------- Authentication is optional. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#request) Request -------------------------------------------------------------------------------------------------- GET /api/v1/images/models/openai/gpt-image-2.5/flare/text-to-image/endpoints [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#response) Response ---------------------------------------------------------------------------------------------------- { "id": "openai/gpt-image-2.5/flare/text-to-image", "endpoints": [\ {\ "provider_name": "OpenAI",\ "provider_slug": "openai",\ "provider_tag": null,\ "supported_parameters": {\ "resolution": {\ "type": "enum",\ "values": ["1k", "2k", "4k"],\ "default": "1k"\ },\ "n": {\ "type": "range",\ "min": 1,\ "max": 4,\ "default": 1\ }\ },\ "allowed_passthrough_parameters": [],\ "supports_streaming": false,\ "pricing": [\ {\ "billable": "output_image",\ "unit": "image",\ "cost_usd": 0.153,\ "resolution": "1k"\ }\ ],\ "input_reference_constraints": {\ "max_items": 16,\ "route": {\ "min_width": 8,\ "min_height": 8,\ "max_bytes": 31457280,\ "formats": ["png", "jpeg", "webp"],\ "source": "route-preflight"\ }\ }\ }\ ] } [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#fields) Fields ------------------------------------------------------------------------------------------------ | Field | Type | Description | | --- | --- | --- | | `id` | string | Image model ID. | | `endpoints` | array | Public endpoint metadata for the model. Currently one public endpoint is returned per model. | | `provider_name` | string | Public provider display name. | | `provider_slug` | string | Public provider slug. | | `provider_tag` | string or null | Currently `null`; provider selection is not exposed on this API surface. | | `supported_parameters` | object | Machine-readable parameter metadata for this model endpoint. | | `allowed_passthrough_parameters` | array | Empty for now; provider passthrough is not supported. | | `supports_streaming` | boolean | Currently `false`. | | `pricing` | array | Public NanoGPT pricing metadata. This is not provider at-cost pricing. | | `input_reference_constraints` | object | Included when the model supports image inputs. | [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#example) Example -------------------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/images/models/openai/gpt-image-2.5/flare/text-to-image/endpoints [​](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints#notes) Notes ---------------------------------------------------------------------------------------------- * Provider selection, provider passthrough options, and provider-specific endpoint choice are not supported yet. * `pricing` uses public NanoGPT pricing. * Check `supported_parameters` before deciding which request controls to show. --- # Data Extraction APIs - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#content-area) Data Extraction APIs cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/firecrawl import requests url = "https://api.nano-gpt.com/api/v1/firecrawl" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/firecrawl', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/firecrawl",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/firecrawl" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/firecrawl") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/firecrawl") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / v1 / firecrawl Try it Data Extraction APIs cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/firecrawl import requests url = "https://api.nano-gpt.com/api/v1/firecrawl" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/firecrawl', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/firecrawl",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/firecrawl" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/firecrawl") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/firecrawl") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#overview) Overview ------------------------------------------------------------------------------------------ NanoGPT exposes data extraction APIs for web, maps, social, and email/domain intelligence workflows. For new integrations that need a stable, discoverable entry point across these tools, use the unified [Data API](https://docs.nano-gpt.com/api-reference/endpoint/data-api) under `/api/v1/data`. It wraps the direct endpoints documented here without changing their response bodies, billing, validation rules, async behavior, or provider-specific options. These endpoints require API key authentication. Each request estimates a maximum charge before running. Some endpoints require `maxTotalChargeUsd` when the result count is unbounded. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#authentication) Authentication ------------------------------------------------------------------------------------------------------ Use either header: * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#shared-billing-and-runtime-behavior) Shared Billing and Runtime Behavior ------------------------------------------------------------------------------------------------------------------------------------------------ * Responses include returned data plus NanoGPT billing metadata. * Partial results may still be billed if the extraction job produced usable data before failing. * Result limits exist, commonly up to 5,000 returned items for social and data scrapers. * Long-running calls can take up to several minutes. * For unbounded searches, set `maxTotalChargeUsd` to cap spend. * Use `resultLimit`, `resultsLimit`, or endpoint-specific max-count fields to keep runs bounded. Typical responses include a data payload and billing metadata: { "data": [], "meta": { "nanogpt": { "costUsd": 0.05, "itemsReturned": 25 } } } [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#endpoints) Endpoints -------------------------------------------------------------------------------------------- | Data API Path | Direct Endpoint | Method | Purpose | | --- | --- | --- | --- | | `/api/v1/data/firecrawl` | `/api/v1/firecrawl` | POST | Web page scraping, site maps, and crawls. | | `/api/v1/data/google-maps/search` | `/api/v1/googlemaps` | GET, POST | Google Maps place search and detail extraction. | | `/api/v1/data/google-maps/reviews` | `/api/v1/googlemaps/reviews` | POST | Google Maps review extraction. | | `/api/v1/data/instagram/profile` | `/api/v1/instagram/profile` | POST | Instagram profile extraction. | | `/api/v1/data/instagram/posts` | `/api/v1/instagram/posts` | POST | Instagram post extraction. | | `/api/v1/data/instagram/reels` | `/api/v1/instagram/reels` | POST | Instagram Reels extraction. | | `/api/v1/data/reddit` | `/api/v1/reddit` | POST | Reddit post, comment, community, and user extraction. | | `/api/v1/data/tiktok` | `/api/v1/tiktok` | POST | TikTok hashtag, profile, search, and post extraction. | | `/api/v1/data/linkedin/profile` | `/api/v1/linkedin/profile` | POST | LinkedIn profile enrichment. | | `/api/v1/data/hunter/{path}` | `/api/v1/hunter/{path}` | GET, POST | Email/domain intelligence pass-through with path selection. | | Not in Data API catalog | `/api/v1/facebook/ads` | POST | Facebook/Meta ad library extraction. | The direct endpoints remain available. Use the Data API paths when you want endpoint discovery, stable public tool IDs, body-style dispatch for dynamic clients, or response headers identifying both the Data API endpoint and direct endpoint. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#web-crawling) Web Crawling -------------------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/firecrawl ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#body) Body { "operation": "scrape", "url": "https://example.com", "formats": ["markdown"], "waitForFinishSecs": 120 } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#operations) Operations * `scrape` * `map` * `crawl` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters) Important Parameters | Parameter | Description | | --- | --- | | `url` | Required target URL. | | `operation` | Operation to run. Must be one of `scrape`, `map`, or `crawl` when provided. | | `limit` | Page or item limit for `map` and `crawl`. | | `search` | Optional search string for `map`. | | `maxReturnedPages` | Maximum pages returned for `crawl`. | | `waitForFinishSecs` | Wait time, capped at 240 seconds. | PDF parsing has max page controls when PDF parsing is enabled. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#google-maps) Google Maps ------------------------------------------------------------------------------------------------ POST https://api.nano-gpt.com/api/v1/googlemaps ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#required-input) Required Input Provide at least one of: * `searchStringsArray` * `startUrls` * `placeIds` * scrape-all-places option, when supported ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters-2) Important Parameters * `maxTotalChargeUsd` * `resultLimit` * `maxCrawledPlacesPerSearch` * `scrapePlaceDetailPage` * `scrapeContacts` * `scrapeSocialMediaProfiles` * `maxReviews` * `maxImages` * filters such as category, rating, website availability, and closed-place handling when supported [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#google-maps-reviews) Google Maps Reviews ---------------------------------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/googlemaps/reviews ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#required-input-2) Required Input Provide at least one of: * `startUrls` * `placeIds` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters-3) Important Parameters * `maxReviews` * `reviewsSort` * `reviewsStartDate` * `maxTotalChargeUsd` * `resultLimit` If you use `reviewsStartDate`, sort reviews by newest first. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#facebook-ads) Facebook Ads -------------------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/facebook/ads ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#required-input-3) Required Input * `startUrls`: at least one Facebook Page URL or Meta Ad Library URL. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters-4) Important Parameters * `resultsLimit` * `activeStatus`: `active` or `inactive` * `maxTotalChargeUsd` * `resultLimit` [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#instagram-profile) Instagram Profile ------------------------------------------------------------------------------------------------------------ POST https://api.nano-gpt.com/api/v1/instagram/profile ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#required-input-4) Required Input * `username` or `usernames`: Instagram username, profile URL, or profile ID. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters-5) Important Parameters * `includeAboutSection` * `maxTotalChargeUsd` * `resultLimit` [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#instagram-posts) Instagram Posts -------------------------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/instagram/posts ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#required-input-5) Required Input * `username`: one or more Instagram usernames, profile URLs, or post URLs. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters-6) Important Parameters * `resultsLimit` * `dataDetailLevel`: `basicData` or `detailedData` * `skipPinnedPosts` * `maxTotalChargeUsd` * `resultLimit` [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#reddit) Reddit -------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/reddit ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#required-input-6) Required Input Provide at least one of: * `startUrls`: Reddit URLs from `reddit.com` or `redd.it` * `searches`: search terms ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters-7) Important Parameters * `maxItems` * `maxPostCount` * `maxComments` * `maxCommunities` * `maxUsers` * `searchPosts` * `searchComments` * `searchCommunities` * `searchUsers` * `maxTotalChargeUsd` * `resultLimit` [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#tiktok) TikTok -------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/tiktok ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#required-input-7) Required Input Provide at least one of: * `hashtags` * `profiles` * `searchQueries` * `postURLs` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#important-parameters-8) Important Parameters * `resultsPerPage` * `maxProfilesPerQuery` * `searchSection` * transcription options, if exposed * `maxTotalChargeUsd` * `resultLimit` [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#hunter) Hunter -------------------------------------------------------------------------------------- Hunter endpoints provide pass-through style email/domain intelligence with NanoGPT billing. Users authenticate with NanoGPT; do not pass a separate Hunter API key. Supported examples include: * `domain-search` * `email-finder` * `email-verifier` * `discover` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#endpoints-2) Endpoints GET https://api.nano-gpt.com/api/v1/hunter/{path} POST https://api.nano-gpt.com/api/v1/hunter/{path} GET https://api.nano-gpt.com/api/v1/hunter?endpoint=domain-search POST https://api.nano-gpt.com/api/v1/hunter For `GET`, query params are forwarded except: * `api_key` * `apiKey` * `endpoint` * `path` For `POST`, JSON body params are forwarded. Use `endpoint` or `path` to select the target path. A nested `params` object is also supported. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#response-shape) Response Shape { "data": {}, "meta": { "nanogpt": { "endpoint": "domain-search", "hunterSearchesBilled": 1, "hunterVerificationsBilled": 0, "hunterEnrichmentsBilled": 0, "costUsd": 0.01 } } } [​](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction#example) Example ---------------------------------------------------------------------------------------- curl -X POST https://api.nano-gpt.com/api/v1/googlemaps \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "searchStringsArray": ["coffee shops in Amsterdam"], "resultLimit": 25, "maxTotalChargeUsd": 1.00, "scrapePlaceDetailPage": true }' --- # TTS Status - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#content-area) [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#overview) Overview ------------------------------------------------------------------------------------- Poll the status of an asynchronous text-to-speech (TTS) job. Use the `runId` and `model` values returned by `POST /api/tts` when the initial response is `202` with `status: "pending"`. For low‑latency, synchronous TTS without polling, use [Speech](https://docs.nano-gpt.com/api-reference/endpoint/speech) (POST `/v1/audio/speech`). ### [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#query-parameters) Query parameters * `runId` (string, required): Job identifier from the submit response * `model` (string, required): The model that was used for the job (e.g., `Elevenlabs-Turbo-V2.5`) * `cost` (number, optional): Cost from the ticket; helps with automatic refunds * `paymentSource` (string, optional): Currency/source from the ticket (e.g., `USD`) * `isApiRequest` (boolean, optional): Pass `true` when polling from API clients Including `cost`, `paymentSource`, and `isApiRequest` from the original ticket helps the platform perform automatic refunds if the upstream provider rejects content after you were charged. [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#usage) Usage ------------------------------------------------------------------------------- Python JavaScript cURL import time import requests BASE = "https://api.nano-gpt.com/api" def get_tts_status(run_id: str, model: str, api_key: str, *, cost=None, payment_source=None, is_api_request=True) -> dict: params = {"runId": run_id, "model": model} if isinstance(cost, (int, float)): params["cost"] = str(cost) if payment_source: params["paymentSource"] = str(payment_source) if isinstance(is_api_request, bool): params["isApiRequest"] = str(is_api_request) resp = requests.get( f"{BASE}/tts/status", headers={"x-api-key": api_key}, params=params, timeout=30, ) resp.raise_for_status() return resp.json() def wait_for_tts(run_id: str, model: str, api_key: str, *, cost=None, payment_source=None, is_api_request=True, max_attempts: int = 60, delay_s: int = 3) -> str: for attempt in range(max_attempts): data = get_tts_status(run_id, model, api_key, cost=cost, payment_source=payment_source, is_api_request=is_api_request) status = data.get("status") if status == "completed" and data.get("audioUrl"): return data["audioUrl"] if status == "error": raise RuntimeError(data.get("error", "TTS generation failed")) time.sleep(delay_s) raise TimeoutError("Polling timeout") const BASE = 'https://api.nano-gpt.com/api'; async function getTTSStatus({ runId, model, cost, paymentSource, isApiRequest = true }, apiKey) { const qs = new URLSearchParams({ runId, model }); if (typeof cost === 'number') qs.set('cost', String(cost)); if (paymentSource) qs.set('paymentSource', String(paymentSource)); if (typeof isApiRequest === 'boolean') qs.set('isApiRequest', String(isApiRequest)); const res = await fetch(`${BASE}/tts/status?${qs.toString()}`, { headers: { 'x-api-key': apiKey } }); if (!res.ok) { const err = await res.json().catch(() => ({})); throw new Error(err.error || `Polling failed (${res.status})`); } return res.json(); } export async function waitForTTS(ticket, apiKey, maxAttempts = 60, delayMs = 3000) { for (let i = 0; i < maxAttempts; i++) { const data = await getTTSStatus(ticket, apiKey); if (data.status === 'completed' && data.audioUrl) return data.audioUrl; if (data.status === 'error') throw new Error(data.error || 'TTS generation failed'); await new Promise(r => setTimeout(r, delayMs)); } throw new Error('Polling timeout'); } # Single status check curl -s "https://api.nano-gpt.com/api/tts/status?runId=RUN_ID&model=Elevenlabs-Turbo-V2.5&cost=0.0050388&paymentSource=USD&isApiRequest=true" \ -H "x-api-key: YOUR_API_KEY" | jq . # Simple poll (every 3s, 3 minutes max) for i in {1..60}; do RESP=$(curl -s "https://api.nano-gpt.com/api/tts/status?runId=RUN_ID&model=Elevenlabs-Turbo-V2.5" -H "x-api-key: YOUR_API_KEY") STATUS=$(echo "$RESP" | jq -r '.status // empty') echo "Attempt $i: status=$STATUS" if [ "$STATUS" = "completed" ]; then echo "$RESP" | jq . break fi if [ "$STATUS" = "error" ]; then echo "$RESP" | jq . exit 1 fi sleep 3 done [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#response-examples) Response examples ------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#pending) Pending { "status": "pending", "runId": "98b0d593-fe8d-49b8-89c9-233022232297", "queuePosition": 3 } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#completed) Completed { "status": "completed", "audioUrl": "https://.../file.mp3", "contentType": "audio/mpeg", "model": "Elevenlabs-Turbo-V2.5" } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#error-generic) Error (generic) { "status": "error", "error": "TTS generation failed. Please try again." } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#error-content-policy) Error (content policy) { "status": "error", "code": "CONTENT_POLICY_VIOLATION", "error": "Content rejected by provider. Please modify your prompt and try again." } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/tts-status#notes) Notes * For Elevenlabs‑family async models (e.g., `Elevenlabs-Turbo-V2.5`, `Elevenlabs-V3`) you will always poll this endpoint until it returns `completed`. * When the job completes, the response includes an `audioUrl` you can download or play in the browser. * If available, include `cost`, `paymentSource`, and `isApiRequest` from the original ticket while polling to improve refund handling. --- # PII Redaction - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#pii-redaction) PII Redaction ======================================================================================================= NanoGPT supports optional PII redaction for API and web chat requests. When redaction is enabled, NanoGPT routes the request through Grepture before it reaches the selected model. Grepture masks supported personal information before the model sees the prompt, then restores masked values in the model response when possible. This is useful when you want to reduce the amount of personal or sensitive data sent to model providers while still getting a useful final answer. PII redaction is opt-in and costs **$0.0005 per redacted request**. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#how-redaction-works) How Redaction Works ------------------------------------------------------------------------------------------------------------------- When redaction is enabled: 1. The user sends a request to NanoGPT. 2. NanoGPT routes that request through Grepture. 3. Grepture detects supported personal information and replaces it with temporary placeholders before the request reaches the model. 4. The model processes the redacted prompt. 5. Grepture restores masked personal information in the response where possible. 6. NanoGPT returns the final response to the user. Simple flow: User -> NanoGPT -> Grepture -> Model -> Grepture -> NanoGPT -> User Credential-like secrets are handled differently from normal PII. If the redaction layer detects API keys, tokens, private keys, webhooks, passwords, or similar secrets, those values are replaced with safe labels and are not restored into the response. This is intentional: a leaked credential should not be reinserted into model output. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#supported-api-endpoints) Supported API Endpoints --------------------------------------------------------------------------------------------------------------------------- PII redaction can be enabled on: * `POST /v1/chat/completions` * `POST /v1/completions` * `POST /v1/responses` [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#enable-with-api-headers) Enable With API Headers --------------------------------------------------------------------------------------------------------------------------- Pass any one of these headers with a truthy value: | Header | Recommended | | --- | --- | | `redaction: true` | Yes | | `redacted: true` | No | | `piiredaction: true` | No | | `piiredacted: true` | No | Truthy values accepted by the API: * `true` * `1` * `yes` * `on` Recommended header: redaction: true ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#chat-completions-example) Chat Completions Example curl https://api.nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -H "redaction: true" \ -d '{ "model": "openai/gpt-5.5", "messages": [\ {\ "role": "user",\ "content": "Email jane@example.com and tell her the appointment is tomorrow."\ }\ ] }' ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#responses-example) Responses Example curl https://api.nano-gpt.com/api/v1/responses \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -H "redaction: true" \ -d '{ "model": "openai/gpt-5.5", "input": "Summarize this customer note: John Smith called from 555-123-4567." }' [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#disable-for-one-request) Disable For One Request --------------------------------------------------------------------------------------------------------------------------- If redaction is enabled by an account-level or API-key default, a request can opt out with any supported redaction header set to a falsy value: | Header | Recommended | | --- | --- | | `redaction: false` | Yes | | `redacted: false` | No | | `piiredaction: false` | No | | `piiredacted: false` | No | Falsy values accepted by the API: * `false` * `0` * `no` * `off` Recommended opt-out header: redaction: false If the same request explicitly enables redaction with a model suffix such as `:redaction`, redaction remains enabled. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#enable-with-model-suffixes) Enable With Model Suffixes --------------------------------------------------------------------------------------------------------------------------------- You can also enable redaction by appending a redaction suffix to the model name: | Suffix | | --- | | `:redaction` | | `:redacted` | | `:piiredaction` | | `:piiredacted` | Example: { "model": "openai/gpt-5.5:redaction", "messages": [\ {\ "role": "user",\ "content": "My phone number is 555-123-4567. Write a short reminder text."\ }\ ] } NanoGPT strips the redaction suffix before sending the request onward, so the model is still resolved as the base model. The suffix is only used to turn redaction on for that request. Redaction suffixes can be combined with other supported NanoGPT model routing suffixes. For example: { "model": "openai/gpt-5.5:redaction:online", "messages": [\ {\ "role": "user",\ "content": "Search for updates related to this customer domain: example.com"\ }\ ] } For general suffix composition rules, see [Model Suffixes](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#enable-in-web-chat) Enable In Web Chat ----------------------------------------------------------------------------------------------------------------- In the NanoGPT web app, users can enable PII redaction from: Settings > Privacy > PII redaction for chats When this setting is enabled, web chat requests are routed through the redaction layer automatically. The same $0.0005 per-request redaction charge applies. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#api-default-settings) API Default Settings --------------------------------------------------------------------------------------------------------------------- Users can enable redaction by default for API requests from: Settings > Privacy > PII redaction for API requests When this account-level API setting is enabled, supported API text requests are routed through the redaction layer by default. Users can still opt out per request with `redaction: false`. API keys can also be configured individually from the API key settings modal: | API key setting | Behavior | | --- | --- | | Inherit account | Use the account-level API default. | | Always redact | Redact requests made with this API key unless the request opts out. | | Never redact | Do not apply the account-level API redaction default to this API key. | Explicit per-request headers and model suffixes are still the clearest way to control redaction for a single request. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#what-gets-redacted) What Gets Redacted ----------------------------------------------------------------------------------------------------------------- The redaction layer is designed to detect and mask common personal information and sensitive credentials. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#personal-information) Personal Information Supported PII categories: | Category | Description | | --- | --- | | Email | Email addresses | | Phone | Phone numbers | | SSN | US Social Security numbers | | Credit card | Payment card numbers | | IP address | IPv4 and IPv6-style network addresses | | Address | Physical addresses | | Name | Person names | | Date of birth | Birth dates and DOB-style values | For these PII categories, values are temporarily replaced with placeholders before reaching the model. When the response comes back, Grepture restores placeholders to the original values where possible. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#secrets-and-credentials) Secrets And Credentials NanoGPT also replaces common credential-like values with safe labels. These values are not restored. Examples of secret categories: | Category | Behavior | | --- | --- | | API keys and access tokens | Replaced with a safe label | | Cloud credentials and session tokens | Replaced with a safe label | | Webhook URLs | Replaced with a safe label | | Private key material | Replaced with a safe label | | Password or secret assignments | Replaced with a safe label | | Service account identifiers | Replaced with a safe label | | FTP-style embedded credentials | Replaced with a safe label | PII such as names, emails, and phone numbers is masked and restored. Credentials such as API keys, private keys, webhooks, and passwords are replaced permanently and are not restored into the model response. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#pricing) Pricing ------------------------------------------------------------------------------------------- PII redaction costs **$0.0005 per redacted request**. This charge is added only when redaction is enabled for the request. It is shown as a separate PII redaction add-on in usage details. The redaction charge is per request, not per token. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#failure-behavior) Failure Behavior ------------------------------------------------------------------------------------------------------------- Redaction is fail-closed. If a request asks for redaction and the redaction layer cannot be used, NanoGPT does not silently retry the request without redaction. If redaction is enabled but the redaction service is unavailable, the request may fail rather than being sent without redaction. This prevents accidental unredacted fallback behavior. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#limitations) Limitations --------------------------------------------------------------------------------------------------- * Redaction is a privacy and safety layer, not a compliance guarantee. * Detection is best-effort and may not catch every possible form of personal information or secret. * PII restoration depends on the placeholder appearing in the model response. If the model rewrites, omits, or transforms the placeholder, restoration may not occur exactly as expected. * Redaction applies to request content that can be processed as text. It should not be treated as pixel-level image redaction, file sanitization, malware scanning, or document de-identification. * Users should still avoid sending unnecessary personal data or credentials to AI systems. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#faq) FAQ ----------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#does-redaction-change-the-model-i-selected) Does redaction change the model I selected? No. Redaction changes the route the request takes before it reaches the model. It does not change the selected model. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#does-redaction-work-with-streaming) Does redaction work with streaming? Yes. Redaction is intended to work with streaming responses. The request is still routed through the redaction layer before the model sees it. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#are-redacted-values-restored-in-the-final-answer) Are redacted values restored in the final answer? For supported personal information categories, yes, where possible. For secrets and credentials, no. Secrets are replaced with safe labels and are not restored. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#can-i-enable-redaction-globally-for-api-requests) Can I enable redaction globally for API requests? Yes. Users can enable an account-level API redaction default in `Settings > Privacy`. API keys can inherit that default, always redact, or opt out of the account default. Per-request headers and model suffixes are also supported. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#can-i-opt-out-if-my-account-or-api-key-has-redaction-enabled-by-default) Can I opt out if my account or API key has redaction enabled by default? Yes. Send `redaction: false` on the request to opt out of account-level or API-key redaction defaults. Model suffixes such as `:redaction` explicitly enable redaction for that request. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction#what-happens-if-i-use-both-the-header-and-the-model-suffix) What happens if I use both the header and the model suffix? Redaction is enabled. There is still only one redaction charge for the request. --- # List Inline Batches - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#content-area) List inline batches cURL curl --request GET \ --url https://api.nano-gpt.com/api/beta/batches \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/beta/batches" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/beta/batches', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/beta/batches",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/beta/batches" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/beta/batches") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/beta/batches") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 401 { "object": "list", "data": [\ {\ "id": "",\ "object": "batch",\ "endpoint": "/v1/chat/completions",\ "model": "",\ "completion_window": "24h",\ "status": "validating",\ "created_at": 123,\ "request_counts": {\ "total": 1,\ "completed": 1,\ "failed": 1\ },\ "results": null,\ "finalized_at": 123,\ "usage": {\ "prompt_tokens": 1,\ "completion_tokens": 1,\ "total_tokens": 1\ },\ "error": {}\ }\ ], "first_id": "", "last_id": "", "has_more": true } { "error": 123, "message": "" } { "error": 123, "message": "" } GET / api / beta / batches Try it List inline batches cURL curl --request GET \ --url https://api.nano-gpt.com/api/beta/batches \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/beta/batches" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/beta/batches', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/beta/batches",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/beta/batches" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/beta/batches") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/beta/batches") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 401 { "object": "list", "data": [\ {\ "id": "",\ "object": "batch",\ "endpoint": "/v1/chat/completions",\ "model": "",\ "completion_window": "24h",\ "status": "validating",\ "created_at": 123,\ "request_counts": {\ "total": 1,\ "completed": 1,\ "failed": 1\ },\ "results": null,\ "finalized_at": 123,\ "usage": {\ "prompt_tokens": 1,\ "completion_tokens": 1,\ "total_tokens": 1\ },\ "error": {}\ }\ ], "first_id": "", "last_id": "", "has_more": true } { "error": 123, "message": "" } { "error": 123, "message": "" } Inline list responses contain metadata only. The `results` field is always `null`, including for completed batches. Retrieve `GET /api/beta/batches/{batch_id}` to obtain completed inline results. See the [Batch API guide](https://docs.nano-gpt.com/api-reference/endpoint/batches#list-batches) for pagination examples, filter rules, and error behavior. #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Query Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#parameter-limit) limit integer default:20 Number of batches to return. Required range: `1 <= x <= 100` [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#parameter-after) after string Return the next page of batches older than this batch ID. Use the current page's last\_id. Cannot be combined with before. [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#parameter-before) before string Return the adjacent page of batches newer than this batch ID, still ordered newest first. Use the current page's first\_id. Cannot be combined with after. [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#parameter-status) status enum\[\] Filter by one or more statuses. Repeat the parameter or provide comma-separated values. Available options: `validating`, `in_progress`, `finalizing`, `completed`, `failed`, `expired`, `cancelling`, `cancelled` [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#parameter-one-of-0) created\_after integerstringintegerstring Return batches created strictly after this boundary. Accepts Unix seconds or a timezone-qualified ISO 8601/RFC 3339 timestamp with at most millisecond precision. [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#parameter-one-of-0) created\_before integerstringintegerstring Return batches created strictly before this boundary. Accepts Unix seconds or a timezone-qualified ISO 8601/RFC 3339 timestamp with at most millisecond precision. #### Response 200 application/json A page of inline batch metadata ordered newest first. [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#response-object) object string required Allowed value: `"list"` [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#response-data) data object\[\] required Inline batch metadata ordered newest first. Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#response-first-id-one-of-0) first\_id string | null required First batch ID in this page, or null for an empty page. Pass as before to return to the adjacent newer page. [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#response-last-id-one-of-0) last\_id string | null required Last batch ID in this page, or null for an empty page. Pass as after to fetch the next older page. [​](https://docs.nano-gpt.com/api-reference/endpoint/inline-batches-list#response-has-more) has\_more boolean required Whether more records exist in the direction being paged. --- # TypeScript Library - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#nanogpt-client) NanoGPT-client ====================================================================================================== [NanoGPT-client](https://github.com/aspic/nanogpt-client) is an unofficial TypeScript implementation of the NanoGPT API. This library aims to provide a type-safe client for both browser and Node.js environments. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#overview) Overview ------------------------------------------------------------------------------------------ NanoGPT-client is built on the inferred OpenAPI spec, providing a strongly-typed interface to interact with the NanoGPT API. This makes it easier to integrate NanoGPT’s capabilities into your TypeScript applications with full type checking and IntelliSense support. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#installation) Installation -------------------------------------------------------------------------------------------------- Install the package via npm: npm install nanogpt-client Or using yarn: yarn add nanogpt-client [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#basic-usage) Basic Usage ------------------------------------------------------------------------------------------------ import { NanoGPTClient } from 'nanogpt-client'; // Initialize with your API key const client = new NanoGPTClient({ apiKey: 'your-api-key' }); async function main() { try { const response = await client.chatCompletions.create({ model: 'openai/gpt-6.1-sol', messages: [\ { role: 'system', content: 'You are a helpful assistant.' },\ { role: 'user', content: 'Explain TypeScript interfaces.' }\ ] }); console.log(response.choices[0].message.content); } catch (error) { console.error('Error:', error); } } main(); [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#features) Features ------------------------------------------------------------------------------------------ * **Type Safety**: Full TypeScript type definitions for all API endpoints and parameters * **Cross-Platform**: Works in both browser and Node.js environments * **Modern Architecture**: Built with modern TypeScript practices * **Comprehensive Coverage**: Supports all NanoGPT API endpoints [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#api-methods) API Methods ------------------------------------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#chat-completions) Chat Completions const completion = await client.chatCompletions.create({ model: 'openai/gpt-6.1-sol', messages: [\ { role: 'user', content: 'Hello, world!' }\ ], temperature: 0.7, max_tokens: 150 }); ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#text-completions) Text Completions const completion = await client.completions.create({ model: 'openai/gpt-6.1-sol', prompt: 'Write a poem about TypeScript', max_tokens: 100 }); ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#image-generation) Image Generation const image = await client.images.generate({ prompt: 'A cat programming in TypeScript', model: 'recraft-v3', n: 1, size: '1024x1024' }); ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#video-generation) Video Generation const video = await client.videos.create({ prompt: 'A short animation of code being written', framework: 'emotional_story', targetLengthInWords: 70 }); ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#check-balance) Check Balance const balance = await client.balance.check(); console.log('Current balance:', balance); [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#advanced-configuration) Advanced Configuration ---------------------------------------------------------------------------------------------------------------------- const client = new NanoGPTClient({ apiKey: 'your-api-key', baseUrl: 'https://custom-domain.com/api', // Optional custom API URL timeout: 30000, // Request timeout in ms headers: { 'Custom-Header': 'value' } }); [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#development) Development ------------------------------------------------------------------------------------------------ The library is open-source and welcomes contributions. To contribute: 1. Fork the [repository](https://github.com/aspic/nanogpt-client) 2. Clone your fork 3. Install dependencies (`npm install` or `yarn`) 4. Make your changes 5. Submit a pull request [​](https://docs.nano-gpt.com/api-reference/miscellaneous/typescript#resources) Resources -------------------------------------------------------------------------------------------- * [GitHub Repository](https://github.com/aspic/nanogpt-client) * [NanoGPT API Documentation](https://docs.nano-gpt.com/) * [Get your API Key](https://nano-gpt.com/api) --- # Video Content - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/video-content#content-area) cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/generate-video/content \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/generate-video/content" headers = {"x-api-key": ""} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/generate-video/content', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/generate-video/content",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/generate-video/content" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/generate-video/content") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/generate-video/content") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 500 {} { "error": 123, "message": "" } { "error": 123, "message": "" } GET https://api.nano-gpt.com/apihttps://nano-gpt.com/api / generate-video / content Try it cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/generate-video/content \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/generate-video/content" headers = {"x-api-key": ""} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/generate-video/content', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/generate-video/content",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/generate-video/content" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/generate-video/content") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/generate-video/content") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 500 {} { "error": 123, "message": "" } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#overview) Overview ---------------------------------------------------------------------------------------- Proxy content retrieval for Sora 2 videos. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#endpoint) Endpoint GET /api/generate-video/content ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#query-parameters) Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `runId` | string | Yes | The run ID | | `model` | string | Yes | Must be `sora-2` | | `variant` | string | No | `video`, `thumbnail`, or `spritesheet` | [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#usage) Usage ---------------------------------------------------------------------------------- curl -s "https://api.nano-gpt.com/api/generate-video/content?runId=RUN_ID&model=sora-2&variant=video" \ -H "x-api-key: YOUR_API_KEY" | jq . #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#authorization-x-api-key) x-api-key string header required #### Query Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#parameter-run-id) runId string required Run ID returned from the POST /generate-video response [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#parameter-model) model string required Must be sora-2 [​](https://docs.nano-gpt.com/api-reference/endpoint/video-content#parameter-variant) variant string video, thumbnail, or spritesheet #### Response 200 application/json Content response The response is of type `object`. --- # Image Edits - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#content-area) Image Edits cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/images/edits import requests url = "https://api.nano-gpt.com/api/v1/images/edits" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/images/edits', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images/edits",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images/edits" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/images/edits") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images/edits") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / v1 / images / edits Try it Image Edits cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/images/edits import requests url = "https://api.nano-gpt.com/api/v1/images/edits" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/images/edits', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/images/edits",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/images/edits" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/images/edits") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/images/edits") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#overview) Overview -------------------------------------------------------------------------------------- Use the image edits endpoint to modify one or more input images with a text prompt. This is an OpenAI-compatible image editing endpoint. GPT Image 2 remains the compatibility choice for requests that include a mask. For natural-language edits without a mask, use `openai/gpt-image-2.5/flare/edit` for the current everyday recommendation. For new JSON-only image-to-image generation flows, also consider the dedicated [Image API](https://docs.nano-gpt.com/api-reference/image-generation) , which uses `input_references` and `POST /api/v1/images`. Both paths are supported aliases: * `POST /api/v1/images/edit` * `POST /api/v1/images/edits` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#authentication) Authentication -------------------------------------------------------------------------------------------------- Use either header: * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#accountless-x402-payment) Accountless x402 Payment ---------------------------------------------------------------------------------------------------------------------- JSON image edit requests can be quoted without an account or API key on supported deployments when you explicitly opt in to the quote flow: curl -i https://nano-gpt.com/api/v1/images/edits \ -H "Content-Type: application/json" \ -H "x-x402: true" \ -d '{ "model": "gpt-image-2", "prompt": "Remove the background", "imageDataUrl": "data:image/png;base64,..." }' To request an accountless x402 quote, send the API request without `Authorization` or `x-api-key`, and include `x-x402: true`. NanoGPT will return `402 Payment Required` with available payment options. This endpoint supports accountless x402 payments where listed by `GET /api/v1/x402/endpoints`, including Lightning L402 when advertised. Multipart uploads require normal authentication before conversion. See [Accountless x402 API Payments](https://docs.nano-gpt.com/api-reference/miscellaneous/x402) for the full flow. If you receive `401 missing_api_key` immediately, check that the initial quote request includes `x-x402: true`. Without that header, NanoGPT does not enter the x402 quote flow. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#multipart-request) Multipart Request -------------------------------------------------------------------------------------------------------- Send `multipart/form-data` when uploading files. | Field | Type | Required | Description | | --- | --- | --- | --- | | `prompt` | string | Yes | Edit instruction. | | `image` | file or string | Yes\* | Input image file, image URL, or data URL. | | `image[]` | repeated file or string | Yes\* | Repeated image inputs for multi-image editing. | | `mask` | file | No | Optional mask image for inpainting-capable models. | | `model` | string | No | Image-edit-capable model. Defaults to an image-edit-capable default when omitted. | | `size` | string | No | Requested output size, when supported by the model. | | `n` | integer | No | Number of outputs, when supported by the model. | \*Provide `image` or one or more `image[]` fields. Other image-generation parameters may pass through when supported by the selected model. curl -X POST https://api.nano-gpt.com/api/v1/images/edits \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -F model=gpt-image-2 \ -F prompt="Remove the background" \ -F image=@product.png \ -F size=1024x1024 ### [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#multi-image-multipart) Multi-image Multipart curl -X POST https://api.nano-gpt.com/api/v1/images/edit \ -H "x-api-key: $NANOGPT_API_KEY" \ -F model=gpt-image-2 \ -F prompt="Combine these references into one product image" \ -F "image[]=@reference-1.png" \ -F "image[]=@reference-2.jpg" [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#json-request) JSON Request ---------------------------------------------------------------------------------------------- Send JSON when you already have images as data URLs. { "model": "gpt-image-2", "prompt": "Remove the background", "imageDataUrl": "data:image/png;base64,...", "maskDataUrl": "data:image/png;base64,..." } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#multi-image-json) Multi-image JSON { "model": "gpt-image-2", "prompt": "Combine these references into one product image", "imageDataUrls": [\ "data:image/png;base64,...",\ "data:image/jpeg;base64,..."\ ] } [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#response) Response -------------------------------------------------------------------------------------- Responses follow the same image response conventions as image generation. Depending on request parameters and model support, returned items may contain `url` or `b64_json`. { "created": 1778155200, "data": [\ {\ "url": "https://..."\ }\ ] } [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#common-errors) Common Errors ------------------------------------------------------------------------------------------------ | Code | Description | | --- | --- | | `missing_image_input` | `image` is required. | | `image_input_too_large` | Upload or input image is too large. | | `invalid_multipart_body` | Multipart body could not be parsed. | | `rate_limit_exceeded` | Too many image edit uploads. | [​](https://docs.nano-gpt.com/api-reference/endpoint/image-edits#notes) Notes -------------------------------------------------------------------------------- * Multipart uploads have strict size limits. * Generated URLs are temporary unless another page explicitly guarantees longer retention. * Use `GET /api/v1/image-models` to discover image-edit-capable models and supported parameters. --- # Embedding Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#content-area) cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/embedding-models \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/embedding-models" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/embedding-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/embedding-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/embedding-models" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/embedding-models") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/embedding-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "object": "list", "data": [\ {\ "id": "text-embedding-3-small",\ "object": "model",\ "created": 1754480583,\ "owned_by": "openai",\ "name": "Text Embedding 3 Small",\ "description": "Most cost-effective OpenAI embedding model with dimension reduction support",\ "dimensions": 1536,\ "supports_dimensions": true,\ "max_tokens": 8191,\ "zero_data_retention": false,\ "pricing": {\ "per_million_tokens": 0.02,\ "currency": "USD"\ }\ }\ ] } { "error": 123, "message": "" } GET https://api.nano-gpt.com/apihttps://nano-gpt.com/api / v1 / embedding-models Try it cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/embedding-models \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/embedding-models" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/embedding-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/embedding-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/embedding-models" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/embedding-models") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/embedding-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "object": "list", "data": [\ {\ "id": "text-embedding-3-small",\ "object": "model",\ "created": 1754480583,\ "owned_by": "openai",\ "name": "Text Embedding 3 Small",\ "description": "Most cost-effective OpenAI embedding model with dimension reduction support",\ "dimensions": 1536,\ "supports_dimensions": true,\ "max_tokens": 8191,\ "zero_data_retention": false,\ "pricing": {\ "per_million_tokens": 0.02,\ "currency": "USD"\ }\ }\ ] } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#overview) Overview ------------------------------------------------------------------------------------------- The `/api/v1/embedding-models` endpoint provides a comprehensive list of available embedding models with detailed information including dimensions, max dimensions, token limits, pricing, and feature support. Use this endpoint instead of hardcoding embedding model capabilities. This endpoint is cacheable. Refresh it periodically because model availability can change. [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#authentication) Authentication ------------------------------------------------------------------------------------------------------- Authentication is optional but may enable user-specific features: | Header | Format | Required | Description | | --- | --- | --- | --- | | `Authorization` | `Bearer {api_key}` | Optional | API key for authenticated access | | `x-api-key` | `{api_key}` | Optional | Alternative API key header | [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#response-format) Response Format --------------------------------------------------------------------------------------------------------- Returns a list of all available embedding models with comprehensive details: { "object": "list", "data": [\ {\ "id": "text-embedding-3-small",\ "object": "model",\ "created": 1754480583,\ "owned_by": "openai",\ "name": "Text Embedding 3 Small",\ "description": "Most cost-effective OpenAI embedding model with dimension reduction support",\ "dimensions": 1536,\ "max_dimensions": 1536,\ "supports_dimensions": true,\ "max_tokens": 8191,\ "zero_data_retention": false,\ "pricing": {\ "per_million_tokens": 0.02,\ "currency": "USD"\ }\ },\ {\ "id": "text-embedding-3-large",\ "object": "model",\ "created": 1754480583,\ "owned_by": "openai",\ "name": "Text Embedding 3 Large",\ "description": "Highest performance OpenAI embedding model with dimension reduction support",\ "dimensions": 3072,\ "max_dimensions": 3072,\ "supports_dimensions": true,\ "max_tokens": 8191,\ "zero_data_retention": false,\ "pricing": {\ "per_million_tokens": 0.13,\ "currency": "USD"\ }\ },\ {\ "id": "BAAI/bge-m3",\ "object": "model",\ "created": 1754480583,\ "owned_by": "nanogpt",\ "name": "BGE M3",\ "description": "Multilingual embedding model with excellent performance across languages",\ "dimensions": 1024,\ "max_dimensions": 1024,\ "supports_dimensions": false,\ "max_tokens": 8192,\ "zero_data_retention": true,\ "pricing": {\ "per_million_tokens": 0.01,\ "currency": "USD"\ }\ }\ // ... more models\ ] } [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#field-descriptions) Field Descriptions --------------------------------------------------------------------------------------------------------------- | Field | Type | Description | | --- | --- | --- | | `id` | string | Unique model identifier to use in embedding requests | | `object` | string | Always “model” for OpenAI compatibility | | `created` | number | Unix timestamp of response creation | | `owned_by` | string | `openai` for OpenAI models, otherwise `nanogpt` | | `name` | string | Human-readable model name | | `description` | string | Detailed model description and use cases | | `dimensions` | number | Default embedding vector dimensions | | `max_dimensions` | number | Maximum embedding vector dimensions supported | | `supports_dimensions` | boolean | Whether custom dimensions are supported | | `max_tokens` | number | Maximum input tokens supported | | `zero_data_retention` | boolean | Whether the model accepts requests while ZDR-only routing is on. Those requests use only providers that declare zero data retention. | | `pricing` | object | Pricing information object | ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#pricing-object-structure) Pricing Object Structure | Field | Type | Description | | --- | --- | --- | | `per_million_tokens` | number | Cost per million tokens in USD | | `currency` | string | Always “USD” | [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#model-categories) Model Categories ----------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#openai-models) OpenAI Models High-quality embeddings with dimension reduction support: * `text-embedding-3-small` - Balance of cost and performance * `text-embedding-3-large` - Maximum accuracy * `text-embedding-ada-002` - Legacy model ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#multilingual-models) Multilingual Models Support for multiple languages: * `BAAI/bge-m3` - Excellent multilingual support ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#language-specific-models) Language-Specific Models Optimized for specific languages: * English: `BAAI/bge-base-en-v1.5`, `BAAI/bge-large-en-v1.5` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#specialized-models) Specialized Models Domain-specific embeddings: * `Qwen/Qwen3-Embedding-0.6B` - Efficient with dimension reduction * `Qwen/Qwen3-Embedding-4B` - Higher quality Qwen embeddings * `Qwen/Qwen3-Embedding-8B` - Long-context Qwen embeddings * `gemini-embedding-001` - Gemini embeddings [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#usage-examples) Usage Examples ------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#basic-request) Basic Request curl "https://api.nano-gpt.com/api/v1/embedding-models" ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#with-authentication) With Authentication curl "https://api.nano-gpt.com/api/v1/embedding-models" \ -H "Authorization: Bearer your_api_key_here" ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#python-example) Python Example import requests # Discover available embedding models response = requests.get("https://api.nano-gpt.com/api/v1/embedding-models") models = response.json() # Display models sorted by price for model in sorted(models["data"], key=lambda x: x["pricing"]["per_million_tokens"]): print(f"{model['id']}: ${model['pricing']['per_million_tokens']}/1M tokens - {model['dimensions']} dims") ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#javascript-example) JavaScript Example // Discover available embedding models const response = await fetch("https://api.nano-gpt.com/api/v1/embedding-models"); const models = await response.json(); // Find models that support dimension reduction const flexibleModels = models.data.filter(m => m.supports_dimensions); console.log("Models with dimension reduction:", flexibleModels.map(m => m.id)); [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#model-selection-guide) Model Selection Guide --------------------------------------------------------------------------------------------------------------------- | Use Case | Recommended Models | Rationale | | --- | --- | --- | | General English text | `text-embedding-3-small` | Best price/performance ratio | | Maximum accuracy | `text-embedding-3-large` | Highest quality embeddings | | Multilingual content | `BAAI/bge-m3` | Excellent cross-language performance | | Code embeddings | `qwen/qwen3-embedding-8b` | Strong code retrieval with a 32K-token context | | Budget-conscious | `BAAI/bge-large-en-v1.5` | $0.01/1M tokens | | Chinese content | `BAAI/bge-m3` | Strong Chinese and multilingual retrieval | | Fast similarity search | Models with `supports_dimensions: true` | Can reduce dimensions for speed | #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Response 200 application/json List of available embedding models [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#response-object) object string required Always 'list' Example: `"list"` [​](https://docs.nano-gpt.com/api-reference/endpoint/embedding-models#response-data) data object\[\] required Array of embedding model objects Show child attributes --- # Moderation Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#content-area) cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/moderation-models \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/moderation-models" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/moderation-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/moderation-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/moderation-models" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/moderation-models") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/moderation-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "object": "list", "data": [\ {\ "id": "moderation-model-id",\ "object": "model",\ "created": 1704067200,\ "owned_by": "model-owner",\ "context_length": 128000,\ "capabilities": {\ "text": true,\ "image": true,\ "batch": true\ },\ "pricing": {\ "prompt": 0.1,\ "completion": 0,\ "currency": "USD",\ "unit": "per_million_tokens"\ }\ }\ ] } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } GET https://api.nano-gpt.com/apihttps://nano-gpt.com/api / v1 / moderation-models Try it cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/moderation-models \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/moderation-models" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/moderation-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/moderation-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/moderation-models" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/moderation-models") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/moderation-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 400 { "object": "list", "data": [\ {\ "id": "moderation-model-id",\ "object": "model",\ "created": 1704067200,\ "owned_by": "model-owner",\ "context_length": 128000,\ "capabilities": {\ "text": true,\ "image": true,\ "batch": true\ },\ "pricing": {\ "prompt": 0.1,\ "completion": 0,\ "currency": "USD",\ "unit": "per_million_tokens"\ }\ }\ ] } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#overview) Overview -------------------------------------------------------------------------------------------- Use `GET /api/v1/moderation-models` to list the moderation models currently available to your account. The response includes model capabilities, context limits, and pricing. Model availability and capabilities can change over time. Use this endpoint as the source of truth before choosing a model for `POST /api/v1/moderations` or [Inline Moderation](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation) . [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#endpoint) Endpoint -------------------------------------------------------------------------------------------- GET https://api.nano-gpt.com/api/v1/moderation-models [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#authentication) Authentication -------------------------------------------------------------------------------------------------------- An API key is required. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#query-parameters) Query Parameters ------------------------------------------------------------------------------------------------------------ | Parameter | Type | Default | Description | | --- | --- | --- | --- | | `detailed` | boolean | `true` | When `false`, returns a compact OpenAI-style model list. | [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#examples) Examples -------------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/moderation-models \ -H "Authorization: Bearer $NANOGPT_API_KEY" curl "https://api.nano-gpt.com/api/v1/moderation-models?detailed=false" \ -H "Authorization: Bearer $NANOGPT_API_KEY" [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#response) Response -------------------------------------------------------------------------------------------- The detailed response returns a model list with capability and pricing metadata. Exact fields can vary by model. { "object": "list", "data": [\ {\ "id": "moderation-model-id",\ "object": "model",\ "created": 1704067200,\ "owned_by": "model-owner",\ "context_length": 128000,\ "capabilities": {\ "text": true,\ "image": true,\ "batch": true\ },\ "pricing": {\ "prompt": 0.10,\ "completion": 0.00,\ "currency": "USD",\ "unit": "per_million_tokens"\ }\ }\ ] } [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#notes) Notes -------------------------------------------------------------------------------------- * This is a paid API feature. * Some moderation models support text only; others support both text and image inputs. * Batch support can vary by model. * Pricing details are returned by this endpoint and can vary by selected model. #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Query Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#parameter-detailed) detailed boolean default:true When false, returns a compact OpenAI-style model list #### Response 200 application/json List of available moderation models [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#response-object) object string required Always 'list' Example: `"list"` [​](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models#response-data) data object\[\] required Array of moderation model objects Show child attributes --- # n8n - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/n8n#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/n8n#overview) Overview -------------------------------------------------------------------- n8n can use any OpenAI-compatible API. With NanoGPT, you get: * One API key for 50+ models (GPT 6.1 Sol, Claude Opus 5.5, Gemini Flash Latest, and more) * The ability to switch models without changing your workflow logic * Unified billing across providers [​](https://docs.nano-gpt.com/integrations/n8n#prerequisites) Prerequisites ------------------------------------------------------------------------------ * An n8n instance (desktop app, self-hosted, or n8n Cloud) * A NanoGPT account and API key from [nano-gpt.com/api](https://nano-gpt.com/api) [​](https://docs.nano-gpt.com/integrations/n8n#step-1-get-your-nanogpt-api-key) Step 1: Get your NanoGPT API key ------------------------------------------------------------------------------------------------------------------- 1. Go to [nano-gpt.com/api](https://nano-gpt.com/api) 2. Click “Create New API Key” 3. Copy the key (format: `sk-nano-...`) 4. Store it securely, you will not be able to view it again [​](https://docs.nano-gpt.com/integrations/n8n#step-2-create-openai-credentials-in-n8n) Step 2: Create OpenAI credentials in n8n ----------------------------------------------------------------------------------------------------------------------------------- 1. Open your n8n instance 2. Go to **Credentials** in the left sidebar 3. Click **\+ Add Credential** 4. Search for and select **OpenAI** 5. Fill in the fields: | Field | Value | | --- | --- | | Credential Name | `NanoGPT` (or any name you prefer) | | API Key | `sk-nano-YOUR-API-KEY` | | Base URL | `https://nano-gpt.com/api/v1` | 6. Click **Save** [​](https://docs.nano-gpt.com/integrations/n8n#step-3-use-nanogpt-in-a-workflow) Step 3: Use NanoGPT in a workflow --------------------------------------------------------------------------------------------------------------------- 1. Go to **Workflows** and click **\+ New Workflow** 2. Add an **OpenAI** node or **Chat OpenAI** node 3. In the node settings: * **Credential:** Select your NanoGPT credential * **Model:** Enter the model name exactly (examples below) * Configure your prompt or messages 4. Click **Execute Node** to test [​](https://docs.nano-gpt.com/integrations/n8n#available-models) Available models ------------------------------------------------------------------------------------ Use any model listed on the [NanoGPT pricing page](https://nano-gpt.com/pricing) . Enter the model name exactly as shown. | Model | Provider | Best for | | --- | --- | --- | | `openai/gpt-6.1-sol` | OpenAI | Best overall | | `anthropic/claude-opus-5.5` | Anthropic | Deep reasoning, writing | | `anthropic/claude-sonnet-4.5` | Anthropic | Coding, analysis | | `google/gemini-flash-latest` | Google | Fast, cost-effective | | `google/gemini-pro-latest` | Google | Long context, reasoning | | `z-ai/glm-latest` | Zhipu | Open model alternative | [​](https://docs.nano-gpt.com/integrations/n8n#example-workflows) Example workflows -------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/integrations/n8n#basic-chat-completion) Basic chat completion [Manual Trigger] -> [OpenAI Chat] -> [Output] OpenAI Chat node: - Credential: NanoGPT - Model: openai/gpt-6.1-sol - Messages: User message from input ### [​](https://docs.nano-gpt.com/integrations/n8n#document-summarization) Document summarization [Webhook] -> [HTTP Request (fetch doc)] -> [OpenAI Chat] -> [Respond to Webhook] OpenAI Chat node: - Model: google/gemini-flash-latest - System: Summarize the following document concisely - User: {{ $json.documentContent }} ### [​](https://docs.nano-gpt.com/integrations/n8n#multi-model-comparison) Multi-model comparison [Input] -> [OpenAI Chat (GPT-4o)] -\ -> [Merge] -> [Compare Results] [Input] -> [OpenAI Chat (Claude)] -/ [​](https://docs.nano-gpt.com/integrations/n8n#troubleshooting) Troubleshooting ---------------------------------------------------------------------------------- | Issue | Solution | | --- | --- | | `401 Unauthorized` | Verify the API key and that your account has credits | | `Invalid API Key` | Ensure there are no extra spaces when copying the key | | `Model not found` | Double-check the model name on the pricing page | | `Connection timeout` | Confirm the Base URL is `https://nano-gpt.com/api/v1` | | `Rate limited` | Add a delay between requests or upgrade your plan | [​](https://docs.nano-gpt.com/integrations/n8n#advanced-http-request-node) Advanced: HTTP Request node --------------------------------------------------------------------------------------------------------- If you need full control over parameters, use the HTTP Request node: 1. Add **HTTP Request** 2. Set: * **Method:** `POST` * **URL:** `https://nano-gpt.com/api/v1/chat/completions` * **Authentication:** Header Auth * **Header Name:** `Authorization` * **Header Value:** `Bearer sk-nano-YOUR-API-KEY` * **Body Content Type:** JSON * **Body:** { "model": "openai/gpt-6.1-sol", "messages": [\ { "role": "user", "content": "{{ $json.prompt }}" }\ ] } [​](https://docs.nano-gpt.com/integrations/n8n#related-links) Related links ------------------------------------------------------------------------------ * [Get API key](https://nano-gpt.com/api) * [Model pricing](https://nano-gpt.com/pricing) * [n8n documentation](https://docs.n8n.io/) * [n8n OpenAI node docs](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatopenai/) --- # Compressed Request Bodies - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#compressed-request-bodies) Compressed Request Bodies ===================================================================================================================================== The text generation APIs accept compressed JSON request bodies. Compress your payload, add a `Content-Encoding` header, and everything else works exactly as before — same request schema, same response. Content-Encoding: gzip [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#why-compress) Why compress? ------------------------------------------------------------------------------------------------------------ Chat requests resend the full conversation history every turn, so request bodies grow with the conversation — multi-hundred-kilobyte payloads are common for agents and long chats, and tool schemas add more. JSON like this compresses roughly **5:1 with gzip**. The win is mostly **your own latency**: the request body has to finish uploading before we can start model dispatch, and a large body costs multiple network round-trips just for TCP to ramp up. Compressing it: * **Cuts time-to-first-token**, most noticeably on long conversations, on high-latency routes, and on constrained uplinks. The further you are from the origin and the bigger your payloads, the more you save on every single request. * **Reduces your egress bandwidth** — relevant for server-to-server integrations that send us high volumes. * **Makes retries cheaper and uploads more robust** on flaky networks: fewer bytes in flight, fewer mid-upload stalls. If your bodies are small (a few KB), compression won’t hurt but also won’t buy you much — it matters once conversations get long. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#supported-endpoints-and-encodings) Supported endpoints and encodings ----------------------------------------------------------------------------------------------------------------------------------------------------- | | | | --- | --- | | Endpoints | `POST /v1/chat/completions` · `POST /v1/responses` · `POST /v1/messages` | | Encodings | `gzip` (also `x-gzip`), `deflate` (zlib-wrapped or raw), `br` (Brotli) | | Content-Type | Must be JSON (`application/json`, `text/json`, or `*+json`) | | Authentication | Required — compressed bodies are only decompressed for authenticated requests, so send your API key as usual | | Size limit | 32 MB, enforced on both the compressed and the decompressed body | A comma-separated `Content-Encoding` list (e.g. `gzip, identity`) is accepted and decoded in reverse order per the HTTP spec, but a single encoding is all you need. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#examples) Examples --------------------------------------------------------------------------------------------------- The OpenAI and Anthropic SDKs don’t compress request bodies on their own, but both let you plug in a custom HTTP transport. The snippets below work with your existing SDK setup — or with plain `fetch`/`requests` if you don’t use an SDK. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#curl) curl echo '{"model":"openai/gpt-6.1-sol","messages":[{"role":"user","content":"Hello!"}]}' \ | gzip \ | curl https://nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -H "Content-Encoding: gzip" \ --data-binary @- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#python) Python requests OpenAI SDK import gzip import json import requests payload = { "model": "openai/gpt-6.1-sol", "messages": [{"role": "user", "content": "Hello!"}], } response = requests.post( "https://nano-gpt.com/api/v1/chat/completions", data=gzip.compress(json.dumps(payload).encode("utf-8")), headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json", "Content-Encoding": "gzip", }, ) import gzip import httpx from openai import OpenAI class GzipJsonTransport(httpx.BaseTransport): """Compress outgoing JSON request bodies with gzip.""" def __init__(self, inner: httpx.BaseTransport | None = None): self._inner = inner or httpx.HTTPTransport() def handle_request(self, request: httpx.Request) -> httpx.Response: body = request.read() content_type = request.headers.get("Content-Type", "") if ( body and "json" in content_type and "Content-Encoding" not in request.headers ): headers = dict(request.headers) headers.pop("content-length", None) headers["content-encoding"] = "gzip" request = httpx.Request( request.method, request.url, headers=headers, content=gzip.compress(body), ) return self._inner.handle_request(request) client = OpenAI( base_url="https://nano-gpt.com/api/v1", api_key=API_KEY, http_client=httpx.Client(transport=GzipJsonTransport()), ) completion = client.chat.completions.create( model="openai/gpt-6.1-sol", messages=[{"role": "user", "content": "Hello!"}], ) ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#javascript-/-typescript) JavaScript / TypeScript fetch OpenAI SDK import { gzipSync } from "node:zlib"; const payload = { model: "openai/gpt-6.1-sol", messages: [{ role: "user", content: "Hello!" }], }; const response = await fetch("https://nano-gpt.com/api/v1/chat/completions", { method: "POST", headers: { Authorization: `Bearer ${process.env.NANOGPT_API_KEY}`, "Content-Type": "application/json", "Content-Encoding": "gzip", }, body: gzipSync(Buffer.from(JSON.stringify(payload))), }); import { gzipSync } from "node:zlib"; import OpenAI from "openai"; // Compress JSON bodies before they leave the process. const gzipFetch = async (url, init = {}) => { const headers = new Headers(init.headers); const contentType = headers.get("content-type") ?? ""; if ( typeof init.body === "string" && contentType.includes("json") && !headers.has("content-encoding") ) { headers.set("content-encoding", "gzip"); return fetch(url, { ...init, headers, body: gzipSync(Buffer.from(init.body)) }); } return fetch(url, init); }; const client = new OpenAI({ baseURL: "https://nano-gpt.com/api/v1", apiKey: process.env.NANOGPT_API_KEY, fetch: gzipFetch, }); const completion = await client.chat.completions.create({ model: "openai/gpt-6.1-sol", messages: [{ role: "user", content: "Hello!" }], }); The same transport works for `/v1/responses` and (with the Anthropic SDK’s equivalent custom-fetch option) `/v1/messages` — the compression handling is identical on all three endpoints. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/request-compression#errors) Errors ----------------------------------------------------------------------------------------------- | Status | Code | Meaning | | --- | --- | --- | | `415` | `unsupported_content_encoding` | `Content-Encoding` value we don’t support (e.g. `zstd`) | | `415` | `unsupported_media_type` | Compressed body without a JSON `Content-Type` | | `401` | `authentication_error` | Compressed body on an unauthenticated request | | `413` | — | Body exceeds the 32 MB limit (compressed or decompressed) | Everything else — validation, billing, streaming — behaves exactly as with uncompressed requests. --- # URL Parameters (Web App) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/web-app/url-parameters#content-area) This document lists the **currently supported** URL parameters for the NanoGPT web app UI. These are intended for browser shortcuts, OpenSearch integration, and sharing prefilled prompts. > Note: Only documented parameters are guaranteed to keep working. Undocumented parameters may change without notice. [​](https://docs.nano-gpt.com/web-app/url-parameters#conversation-urls) Conversation URLs -------------------------------------------------------------------------------------------- **Base URL** * `/conversation/new` **Aliases** * `/conversation` -> redirects to `/conversation/new` * `/ask` -> redirects to `/conversation/new` ### [​](https://docs.nano-gpt.com/web-app/url-parameters#parameters) Parameters * `ask` - Prefills the prompt **and auto-submits** it when the page loads. * Use `encodeURIComponent()` for the value. * This is the closest equivalent to a `?q=` style parameter. * `model` - Selects a model by model id. * If the model is a known image/video/audio model, the mode is switched automatically. * `mode` - Sets the UI mode (only if `model` does not override it). * Allowed values: `chat`, `image`, `video`, `audio`, `voice`. * `online` - Enables web search when set to `true`. * Any other value is ignored. * `source` - Attribution/referral tag. * `source=translate` also disables web search for that session. * `transcriptId` - Internal handoff key used by `/youtube` and `/scrape` to inject large prompts. * Requires a pre-stored value in session storage or the shared content cache; not intended for manual use. ### [​](https://docs.nano-gpt.com/web-app/url-parameters#examples) Examples /conversation/new?ask=Hello%20from%20the%20address%20bar /conversation/new?model=&ask=Summarize%20this%20page /conversation/new?mode=image&model= /conversation/new?online=true&ask=What%27s%20new%20today%3F /conversation/new?source=opensearch&ask=Define%20vector%20search ### [​](https://docs.nano-gpt.com/web-app/url-parameters#notes) Notes * `model` takes precedence over `mode` (a model selection can switch the mode). * There is **no** separate `q` parameter today - use `ask` instead. * Web search provider and depth are **not** configurable via URL; they follow your Settings. [​](https://docs.nano-gpt.com/web-app/url-parameters#media-urls) Media URLs ------------------------------------------------------------------------------ **Base URL** * `/media` **Mode shortcuts** * `/media/image` -> redirects to `/media?mode=image` * `/media/video` -> redirects to `/media?mode=video` * `/media/audio` -> redirects to `/media?mode=audio` ### [​](https://docs.nano-gpt.com/web-app/url-parameters#parameters-2) Parameters * `mode` - Selects the media mode. * Allowed values: `image`, `video`, `audio`. * `model` - Selects a media model by id. * If the model matches a known image/video/audio model, `mode` is switched automatically. * When `audioMode=stt`, `model` may also be a speech-to-text model id. * `audioMode` - Selects audio sub-mode (only in `mode=audio`). * Allowed values: `tts`, `stt`. * `prompt` - Prefills the prompt and is **consumed** on load (removed from the URL). ### [​](https://docs.nano-gpt.com/web-app/url-parameters#examples-2) Examples /media?mode=image&model= /media?mode=video&model=&prompt=Make%20this%20cinematic /media?mode=audio&audioMode=stt&model= ### [​](https://docs.nano-gpt.com/web-app/url-parameters#notes-2) Notes * `model` takes precedence over `mode` (a model selection can switch the mode). * If a model id is unknown or incompatible with the selected mode, it is ignored. * For speech-to-text, include both `audioMode=stt` and a compatible `model` id. [​](https://docs.nano-gpt.com/web-app/url-parameters#opensearch-integration) OpenSearch Integration ------------------------------------------------------------------------------------------------------ An OpenSearch descriptor is available at: /opensearch.xml If you are wiring this into a custom browser keyword/search engine, use the conversation URL with `ask`: /conversation/new?source=opensearch&ask={searchTerms} (Replace `{searchTerms}` with the URL-encoded user query.) --- # Batch API - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/batches#content-area) [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#overview) Overview ---------------------------------------------------------------------------------- The NanoGPT Batch API runs many independent requests asynchronously at a lower token price than the equivalent synchronous calls. It is a good fit for classification, summarization, evals, synthetic data, document processing, and image analysis where immediate results are not required. Choose a workflow: * **File-backed API:** upload JSONL, create a batch, poll its status, then download output and error files. This OpenAI-compatible workflow is best for large or reusable inputs. * **Inline API:** send the requests in the batch creation body and receive the results when polling the completed batch. This is simpler for smaller jobs. * **[Anthropic Message Batches](https://docs.nano-gpt.com/api-reference/endpoint/batches#anthropic-message-batches) :** send native Claude requests with the official Anthropic SDK or HTTP API. Requests run directly through Anthropic at batch token rates, with native JSONL results. The file-backed and inline workflows support rows targeting `/v1/chat/completions` or `/v1/responses`. Native Message Batches use a separate `/v1/messages/batches` endpoint. All rows in one batch must use the same endpoint and the same model. Batch requests are non-streaming and the only supported completion window is `24h`. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#authentication-and-base-urls) Authentication and base URLs -------------------------------------------------------------------------------------------------------------------------- All requests require an API key: Authorization: Bearer $NANOGPT_API_KEY Use the dedicated API host for batch operations: | Workflow | Base URL | | --- | --- | | File-backed | `https://api.nano-gpt.com/api/v1` | | Inline | `https://api.nano-gpt.com/api/beta` | | Anthropic SDK | `https://api.nano-gpt.com/api` (the SDK appends `/v1/messages/batches`) | Use `api.nano-gpt.com` for uploads. The main website host can reject larger multipart requests before they reach the Batch API. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#supported-row-endpoints) Supported row endpoints ---------------------------------------------------------------------------------------------------------------- Each row in a file-backed or inline batch must target one of these endpoints: * `/v1/chat/completions` * `/v1/responses` Completions, embeddings, image generation, audio, video, transcription, TTS, moderation, and other endpoints cannot be used as batch rows. For native Anthropic request bodies, use [Message Batches](https://docs.nano-gpt.com/api-reference/endpoint/batches#anthropic-message-batches) ; `/v1/messages` is not a supported row endpoint for `/api/v1/batches`. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#model-support) Model support -------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#chat-completions-batches) Chat Completions batches `/v1/chat/completions` batches support OpenAI, Claude, and Gemini models, and open-source models such as `openai/gpt-oss-120b`, `moonshotai/kimi-k3`, `z-ai/glm-5.2`, and `deepseek/deepseek-v4-pro`. Always submit the canonical NanoGPT model slug; upstream routing is handled automatically. Open-source model rows run through NanoGPT’s normal routing as individual requests, started at about one row per second, so they behave like synchronous requests: they cost the same or less, can choose a provider with the request’s `provider` field, and accept `tools` and `response_format`. They do not accept NanoGPT add-ons such as web search, scraping, memory, characters, or BYOK, and every token limit they set must be greater than 0. Rows for OpenAI, Claude, and Gemini models run on the upstream batch API and do not accept `tools`, `functions`, `response_format`, or `structured_outputs`. The `:thinking` suffix is accepted where a thinking variant is configured. Claude thinking aliases are also accepted for compatible models; a numeric thinking budget must be lower than `max_tokens`. For the live list, call [`GET /api/v1/models?detailed=true`](https://docs.nano-gpt.com/api-reference/endpoint/models) and select models whose `supported_batch_endpoints` include `/v1/chat/completions`. Model availability changes. Validate a small batch before submitting a large job; an unsupported model returns an `unsupported_model` error. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#responses-batches) Responses batches `/v1/responses` batches currently support direct OpenAI models only. The `openai/` prefix is accepted. `gpt-5.2-pro` and `gpt-5.4-pro`, including dated snapshots, are not available through the upstream Responses Batch API and are rejected. Responses rows support function and custom tools, structured text output, and remote or data-URL image inputs. Provider-hosted tools and stateful Responses features are not supported in batches. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#file-backed-api) File-backed API ------------------------------------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#endpoints) Endpoints * `POST /files` * `GET /files` * `GET /files/{file_id}` * `GET /files/{file_id}/content` * `DELETE /files/{file_id}` * `POST /batches` * `GET /batches` * `GET /batches/{batch_id}` * `POST /batches/{batch_id}/cancel` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#jsonl-rules) JSONL rules Each non-empty line must be a JSON object with: * a unique, non-empty `custom_id` * `method: "POST"` * `url` set to `/v1/chat/completions` or `/v1/responses` * a `body` object containing the model and endpoint-specific input All rows must use the same endpoint and model. `stream: true` is rejected. Chat Completions rows require a non-empty `messages` array and a positive `max_tokens` or `max_completion_tokens`. They support text and compatible `image_url` content. Image URLs may use HTTP, HTTPS, or base64 data URLs for PNG, JPEG, GIF, and WebP images. Responses rows require a non-empty `input` and an integer `max_output_tokens` of at least `16`. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#chat-completions-example) Chat Completions example {"custom_id":"request-1","method":"POST","url":"/v1/chat/completions","body":{"model":"gpt-4.1-mini","messages":[{"role":"user","content":"Summarize this in one sentence: Batch APIs are useful for offline jobs."}],"max_tokens":64}} {"custom_id":"request-2","method":"POST","url":"/v1/chat/completions","body":{"model":"gpt-4.1-mini","messages":[{"role":"user","content":"Classify this review as positive or negative: I loved the product."}],"max_tokens":16}} ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#responses-example) Responses example {"custom_id":"response-1","method":"POST","url":"/v1/responses","body":{"model":"gpt-4.1-mini","input":"Extract three keywords from: Batch APIs process independent prompts asynchronously.","max_output_tokens":64}} {"custom_id":"response-2","method":"POST","url":"/v1/responses","body":{"model":"gpt-4.1-mini","input":"Reply with a JSON object containing a one-sentence summary.","text":{"format":{"type":"json_schema","name":"summary","strict":true,"schema":{"type":"object","properties":{"summary":{"type":"string"}},"required":["summary"],"additionalProperties":false}}},"max_output_tokens":128}} ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#upload-the-file) Upload the file curl https://api.nano-gpt.com/api/v1/files \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -F purpose=batch \ -F file=@batch.jsonl ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#create-the-batch) Create the batch Set `endpoint` to the same endpoint used by every JSONL row: curl https://api.nano-gpt.com/api/v1/batches \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input_file_id": "file_abc123", "endpoint": "/v1/responses", "completion_window": "24h" }' ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#poll-cancel-and-download) Poll, cancel, and download # Retrieve one batch curl https://api.nano-gpt.com/api/v1/batches/batch_abc123 \ -H "Authorization: Bearer $NANOGPT_API_KEY" # Best-effort cancellation curl -X POST https://api.nano-gpt.com/api/v1/batches/batch_abc123/cancel \ -H "Authorization: Bearer $NANOGPT_API_KEY" # Download JSONL output curl https://api.nano-gpt.com/api/v1/files/file_output123/content \ -H "Authorization: Bearer $NANOGPT_API_KEY" Batch statuses are `validating`, `in_progress`, `finalizing`, `completed`, `failed`, `expired`, `cancelling`, and `cancelled`. A completed batch normally has an `output_file_id`; row failures may also produce an `error_file_id`. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#list-and-delete-files) List and delete files Uploaded input files count toward a staged storage allowance of 1 GiB and 100 files per API key until a batch starts from them. An upload that would exceed it returns `429` with `batch_file_storage_quota_exceeded` and the space in use. Delete input files you no longer need, and output or error files you have downloaded: # List files, newest first (purpose, limit 1-10000, order asc|desc, after=) curl "https://api.nano-gpt.com/api/v1/files?purpose=batch&limit=100" \ -H "Authorization: Bearer $NANOGPT_API_KEY" # Delete a file curl -X DELETE https://api.nano-gpt.com/api/v1/files/file_abc123 \ -H "Authorization: Bearer $NANOGPT_API_KEY" The list follows the OpenAI format (`object`, `data`, `first_id`, `last_id`, `has_more`), so `client.files.list()` and `client.files.delete()` in the OpenAI SDKs work with these routes. Deletion returns `{"id": "file_abc123", "object": "file", "deleted": true}` and removes the file’s stored content; batches keep the file ID, but the file can no longer be retrieved, downloaded, or used to create a batch. A file used by a batch that is still running or settling returns `409` with `file_in_use`; retry after the batch finishes, or cancel it first. Files of inline batches and native Message Batches stay with their batch and also return `409`. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#inline-api) Inline API -------------------------------------------------------------------------------------- Inline batches accept up to 10,000 requests, 20 MiB of normalized input, and 250,000 aggregate requested output tokens. Use the file-backed API for larger inputs. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#endpoints-2) Endpoints * `POST /batches` * `GET /batches` * `GET /batches/{batch_id}` * `POST /batches/{batch_id}/cancel` All inline routes use the `https://api.nano-gpt.com/api/beta` base URL. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#create-an-inline-batch) Create an inline batch curl https://api.nano-gpt.com/api/beta/batches \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "/v1/responses", "model": "gpt-4.1-mini", "requests": [\ {\ "custom_id": "response-1",\ "body": { "input": "Summarize this text in one sentence." }\ }\ ] }' Creation returns `202 Accepted`. Poll `GET /api/beta/batches/{batch_id}` and read `results` after completion. Cancel an active job with `POST /api/beta/batches/{batch_id}/cancel`. The batch-level model is inherited by every request body. If an inline row omits its endpoint-specific output cap, NanoGPT applies a 4096-token default. File-backed rows must always include the output cap explicitly. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#list-batches) List batches ------------------------------------------------------------------------------------------ Use the authenticated list route for the workflow you want to inspect. Each route returns only batches visible to the supplied API key, ordered newest first. Native Message Batches have their own [list route and cursor names](https://docs.nano-gpt.com/api-reference/endpoint/batches#list-native-message-batches) . | Workflow | Endpoint | | --- | --- | | Inline | `GET https://api.nano-gpt.com/api/beta/batches` | | All batches (OpenAI-compatible) | `GET https://api.nano-gpt.com/api/v1/batches` | Both routes support the same filters and bidirectional cursor pagination: | Parameter | Description | | --- | --- | | `limit` | Page size from 1 to 100. Defaults to 20. | | `after` | Return the next page of batches older than this batch ID. Pass the current page’s `last_id`. | | `before` | Return the adjacent page of batches newer than this batch ID, still ordered newest first. Pass the current page’s `first_id`. | | `status` | Filter by one or more statuses. Repeat the parameter or provide comma-separated values. | | `created_after` | Return batches created strictly after this boundary. | | `created_before` | Return batches created strictly before this boundary. | `after` and `before` cannot be combined. Cursors are batch IDs, not arbitrary tokens. Creation boundaries accept Unix timestamps in seconds or timezone-qualified ISO 8601/RFC 3339 timestamps with no more than millisecond precision. Supported status values are `validating`, `in_progress`, `finalizing`, `completed`, `failed`, `expired`, `cancelling`, and `cancelled`. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#filter-inline-batches) Filter inline batches curl "https://api.nano-gpt.com/api/beta/batches?limit=20&status=in_progress,completed" \ -H "Authorization: Bearer $NANOGPT_API_KEY" You can also filter by a strict creation-time range: curl "https://api.nano-gpt.com/api/beta/batches?created_after=2026-09-01T00:00:00Z&created_before=2026-09-02T00:00:00Z" \ -H "Authorization: Bearer $NANOGPT_API_KEY" ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#filter-all-batches) Filter all batches curl "https://api.nano-gpt.com/api/v1/batches?limit=50&status=failed&created_after=1788192000" \ -H "Authorization: Bearer $NANOGPT_API_KEY" ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#response-and-pagination) Response and pagination Both endpoints return the standard list envelope: { "object": "list", "data": [], "first_id": null, "last_id": null, "has_more": false } * `data` is always ordered newest first. * `first_id` and `last_id` are `null` for an empty page. * To fetch older batches, send `after=` with the same filters. * To return to the adjacent newer page, send `before=` with the same filters. * `has_more` indicates that more records exist in the direction being paged. For example: # Fetch the next, older page curl "https://api.nano-gpt.com/api/v1/batches?limit=20&status=completed&after=batch_older_cursor" \ -H "Authorization: Bearer $NANOGPT_API_KEY" # Return to the adjacent newer page curl "https://api.nano-gpt.com/api/v1/batches?limit=20&status=completed&before=batch_newer_cursor" \ -H "Authorization: Bearer $NANOGPT_API_KEY" Inline list responses contain metadata only. `results` is always `null`, including for completed batches. Retrieve `GET /api/beta/batches/{batch_id}` to obtain a completed inline batch’s results. Inline list items include `id`, `object`, `endpoint`, `model`, `completion_window`, `status`, `created_at`, `finalized_at`, `request_counts`, `usage`, `error`, and a `results` field that is always `null`. The OpenAI-compatible list includes both inline and file-backed jobs. Its items retain the standard batch shape, including `input_file_id`, `output_file_id`, `error_file_id`, lifecycle timestamps, `request_counts`, `metadata`, `usage`, and `errors` where applicable. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#listing-errors) Listing errors Both list routes return: * `401` for missing or invalid authentication. * `400` when `after` and `before` are both present. * `400` for an unknown or inaccessible cursor. The inline-only route also rejects a cursor that identifies a non-inline batch. A cursor does not need to match the active filters; it only supplies the page boundary. * `400` for an unsupported `status` value. * `400` for an invalid creation timestamp or a reversed creation-time range. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#anthropic-message-batches) Anthropic Message Batches -------------------------------------------------------------------------------------------------------------------- Use native Anthropic request shapes for asynchronous Claude jobs, including custom tools, thinking, prompt caching, images, and documents where the selected model supports them. Submit up to 100,000 requests for one supported Claude model per batch. Requests go directly to Anthropic and use batch token pricing, paid from your NanoGPT balance. The official Anthropic SDK works with a NanoGPT API key and `baseURL: 'https://api.nano-gpt.com/api'` (Python: `base_url`). It appends `/v1/messages/batches`. The shorter `/v1/messages/batches` alias also works with `https://api.nano-gpt.com` as the SDK base URL. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#native-endpoints) Native endpoints | Method | URL path | Purpose | | --- | --- | --- | | POST | `/api/v1/messages/batches` | Create a batch | | GET | `/api/v1/messages/batches` | List native Message Batches | | GET | `/api/v1/messages/batches/{id}` | Retrieve status and request counts | | POST | `/api/v1/messages/batches/{id}/cancel` | Request cancellation | | GET | `/api/v1/messages/batches/{id}/results` | Download native result JSONL | | DELETE | `/api/v1/messages/batches/{id}` | Delete an ended batch from NanoGPT’s native API | All routes also accept the `/v1/messages/batches` prefix. Authenticate with `x-api-key` or `Authorization: Bearer` using your NanoGPT API key. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#create-a-native-batch) Create a native batch Send a `requests` array containing `custom_id` and native Messages `params`. No file upload is required. curl https://api.nano-gpt.com/api/v1/messages/batches \ -H "x-api-key: $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: example-anthropic-batch-001" \ -d '{ "requests": [{\ "custom_id": "summary-1",\ "params": {\ "model": "anthropic/claude-sonnet-5.5",\ "max_tokens": 1024,\ "messages": [{ "role": "user", "content": "Explain when batch processing is useful." }]\ }\ }] }' Or use `@anthropic-ai/sdk`: import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: process.env.NANOGPT_API_KEY, baseURL: 'https://api.nano-gpt.com/api', }); const batch = await client.messages.batches.create({ requests: [{\ custom_id: 'summary-1',\ params: {\ model: 'anthropic/claude-sonnet-5.5',\ max_tokens: 1024,\ messages: [{ role: 'user', content: 'Explain when batch processing is useful.' }],\ },\ }], }, { headers: { 'Idempotency-Key': 'example-anthropic-batch-001' } }); // Retrieve periodically until processing_status is "ended". const current = await client.messages.batches.retrieve(batch.id); if (current.processing_status === 'ended' && current.results_url) { for await (const row of await client.messages.batches.results(batch.id)) { console.log(row.custom_id, row.result); } } Choose a new `Idempotency-Key` for each distinct batch. Reuse the same key and body when retrying a submission; a different payload with the same key returns 409. A stored creation failure can also be replayed, so use a new key for a new submission after correcting that failure. The header is optional, but recommended for retries. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#native-request-limits-and-compatibility) Native request limits and compatibility * Send 1–100,000 requests with unique, non-empty `custom_id` values. * Use the same supported Claude model for every request. Thinking controls may vary by request. Support for a model on synchronous `/v1/messages` does not imply native batch support. * Haiku 5.5 accepts `anthropic/claude-haiku-5.5`, `claude-haiku-5-5`, and `anthropic/claude-haiku-latest`. Use `thinking: { "type": "adaptive" }` with `output_config: { "effort": "medium" }` to set its default thinking behavior explicitly; fixed `budget_tokens` controls are unsupported by Haiku 5.5. * Haiku 5.5 also accepts `thinking: { "type": "disabled" }` at `low`, `medium`, or `high` effort. Disabled thinking with `xhigh` or `max` is rejected. * Each `params` requires `model`, `messages`, and a positive integer `max_tokens` within the model’s output limit. NanoGPT’s maximum accepted cap is 1,000,000; model limits can be lower. The first message must have the `user` role; use the top-level `system` field for a system prompt. * The request body and stored normalized input must each fit within 200 MiB. Normalization can make the stored input larger than the original body. * The completion window is 24 hours. Streaming generation is unsupported; result downloads use JSONL. * Native custom tools and tool-result history, thinking, `output_config`, and prompt-cache controls are supported where the selected model supports them. Use native `thinking` controls, not OpenAI `reasoning` or `reasoning_effort` fields. * Images accept URL or base64 sources; documents accept URL, base64, or plaintext sources. Provider-managed file references, containers, MCP servers, hosted tools, and video blocks are rejected. * URL or base64 documents reserve enough balance for a full context window because their token count is unknown before processing. Final billing still uses actual token usage. * Caller `anthropic-beta` flags are forwarded alongside any flags required by the request. A beta header does not enable fields rejected by NanoGPT’s batch validation. * Keys or teams requiring Zero Data Retention cannot create batches because batch processing retains input. Native Message Batches use the official Anthropic SDK. NanoGPT’s general-purpose SDKs do not expose these batch methods. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#native-status-results-cancellation-and-deletion) Native status, results, cancellation, and deletion Creation returns a `message_batch` object. Poll retrieval until `processing_status` is `ended`; the other states are `in_progress` and `canceling`. An ended batch can contain unsuccessful requests, so inspect `request_counts` and each result: * `request_counts` contains `processing`, `succeeded`, `errored`, `canceled`, and `expired`. * `results_url` is available when results can be downloaded. Results are native JSONL rows with `custom_id` and `result`; match by `custom_id` and inspect `result.type`, rather than assuming input order or success. * Results requested before they are available return 409. Download available results before provider archival; an ended status alone does not guarantee results remain available. * Cancellation is best-effort. Requests that complete can still incur usage charges. * Delete only after processing ends. Deletion hides the batch from NanoGPT’s native API; it does not reverse billing or promise deletion of Anthropic’s retained data. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#list-native-message-batches) List native Message Batches `GET /api/v1/messages/batches` returns native batches visible to the supplied API key, newest first, with `data`, `has_more`, `first_id`, and `last_id`. Use `limit` from 1 to 100 (default 20), `after_id=` for older batches, or `before_id=` for newer batches. Do not combine both cursor parameters. Use the native list for native Message Batches; the `/api/v1/batches` list uses the OpenAI-compatible representation. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#responses-batch-restrictions) Responses Batch restrictions -------------------------------------------------------------------------------------------------------------------------- Responses Batch is stateless and executes directly through the upstream batch service. NanoGPT forces `store: false` and rejects: * `previous_response_id`, `conversation`, and `background: true` * reusable `prompt` references * `input_file`, `item_reference`, video inputs, and `input_image.file_id` * provider-hosted tools; function and custom tools remain supported * NanoGPT-only features such as Advisor, memory, scraping, retention overrides, provider or BYOK controls, caching controls, and billing overrides Remote HTTP(S) image URLs and image data URLs are accepted. Structured output through the Responses `text.format` field is supported. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#billing) Billing -------------------------------------------------------------------------------- Batch jobs use NanoGPT account balance and do not use subscription included tokens. At creation, NanoGPT checks the balance against a conservative maximum-liability estimate based on the input and output caps. Completed usage is charged once after the batch reaches a terminal state. If there is no billable usage, no usage charge is created. * **OpenAI, Claude, and Gemini models, and some fine-tuned models:** token usage is priced 50% below the equivalent synchronous request. Non-token charges, where supported, keep their normal rate. * **Other open-source models:** each row is charged exactly what the same synchronous request costs, including the automatic routing price, your subscriber discount, and the price of any provider you select. Rows are priced in USD, and a batch never costs more than the amount reserved when it was created. * **Open-source models with a batch price:** some models, such as `moonshotai/kimi-k3`, have a lower batch price for rows that use automatic routing. An alias such as `moonshotai/kimi-latest` uses the batch price of the model it points to. A row that sets `provider` pays that provider’s normal price instead. A row never costs more than the same synchronous request. Each model page shows its Batch API price. Use the live pricing page or pricing API as the source of truth. [​](https://docs.nano-gpt.com/api-reference/endpoint/batches#common-errors) Common errors -------------------------------------------------------------------------------------------- * **Unsupported endpoint:** file-backed and inline rows must use `/v1/chat/completions` or `/v1/responses`, consistently across all rows. Native Claude requests use `/v1/messages/batches`. * **Missing output cap:** add `max_tokens` or `max_completion_tokens` for Chat Completions, or `max_output_tokens >= 16` for Responses. * **Mixed model:** every row must use the same model. * **Streaming unsupported:** remove `stream: true`. * **Unsupported Responses model:** choose a direct OpenAI model supported by the upstream Batch API. * **Unsupported Responses field:** remove stateful features, provider-hosted tools, file references, or NanoGPT-only extensions. --- # Feedback API - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/feedback#content-area) Retrieve feedback status and latest team response cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/feedback/{id} \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/feedback/{id}" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/feedback/{id}', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/feedback/{id}",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/feedback/{id}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/feedback/{id}") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/feedback/{id}") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 Example { "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", "object": "feedback", "status": "pending", "visibility": "private", "created_at": "2023-11-07T05:31:56Z", "type": "bug", "title": "", "updated_at": "2023-11-07T05:31:56Z", "delete_after": "2023-11-07T05:31:56Z", "latest_response": { "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", "content": "", "created_at": "2023-11-07T05:31:56Z" } } GET https://api.nano-gpt.com/apihttps://nano-gpt.com/api / v1 / feedback / {id} Try it Retrieve feedback status and latest team response cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/feedback/{id} \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/v1/feedback/{id}" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/v1/feedback/{id}', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/feedback/{id}",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/feedback/{id}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/feedback/{id}") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/feedback/{id}") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 Example { "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", "object": "feedback", "status": "pending", "visibility": "private", "created_at": "2023-11-07T05:31:56Z", "type": "bug", "title": "", "updated_at": "2023-11-07T05:31:56Z", "delete_after": "2023-11-07T05:31:56Z", "latest_response": { "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", "content": "", "created_at": "2023-11-07T05:31:56Z" } } Use the Feedback API to report a reproducible bug, documentation issue, missing feature, or model-quality problem. Reports remain private. Integrations should submit reports only when explicitly requested, rather than automatically reporting transient errors. | Operation | Endpoint | | --- | --- | | Submit a report | `POST https://api.nano-gpt.com/api/v1/feedback` | | Read its status and latest team reply | `GET https://api.nano-gpt.com/api/v1/feedback/{id}` | The `/v1/feedback` and `/v1/feedback/{id}` paths are aliases. The full request and response schemas are also available in the [OpenAPI contract](https://nano-gpt.com/openapi.json) . [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#authentication-and-access) Authentication and access --------------------------------------------------------------------------------------------------------------------- Send a valid inference API key in `Authorization: Bearer ...` or `x-api-key`. Use the **same key that submitted the report** for retrieval. A different key, even on the same account, receives `404 feedback_not_found`. Key rotation does not transfer API access; the account owner can still use [website support](https://nano-gpt.com/support) . Key expiry, revocation, account restrictions and allowed Origin rules apply. Browser cookies, management tokens, partner tokens and accountless x402 do not grant access. If both credential headers are sent, they must identify the same key. Feedback requests do not incur usage charges. [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#submit-feedback) Submit feedback ------------------------------------------------------------------------------------------------- Send uncompressed JSON, at most **16 KiB**, with an `Idempotency-Key` header. Choose a new idempotency key for each new report. Keep the key and body when retrying the same report after a network failure or temporary error. curl -i 'https://api.nano-gpt.com/api/v1/feedback' \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: feedback-example-001' \ --data '{ "type": "documentation", "title": "Clarify a retrieval example", "description": "The example does not explain which ID to use for the status lookup." }' | Field | Requirements | | --- | --- | | `type` | Required: `bug`, `feature_request`, `documentation`, or `model_quality`. | | `title` | Required: 4-200 characters. | | `description` | Required: 10-8,000 characters. | | `request_id` | Optional diagnostic reference, up to 200 characters. Use a captured `X-Request-ID` when available. | | `endpoint` | Optional API path such as `/api/v1/chat/completions`, up to 200 characters. | | `model` | Optional model ID, up to 200 characters. | | `expected`, `actual`, `steps` | Optional text, up to 2,000 characters each. | Unknown fields are rejected. `Idempotency-Key` must contain 8-128 ASCII letters, digits, dots, underscores, colons or hyphens, starting with a letter or digit. The OpenAPI contract specifies the full field patterns. HTTP `201` returns a receipt and a `Location` header for retrieval: { "id": "10000000-0000-4000-8000-000000000001", "object": "feedback", "status": "pending", "visibility": "private", "created_at": "2026-09-29T12:00:00.000Z" } An identical retry with the same API key and idempotency key returns the original receipt, including its original `pending` status. Use GET for the current status. Changed normalized fields return `409 idempotency_conflict`. Replaying a deleted or archived report returns `410` and does not recreate it. Receipt acceptance does not promise a fix or a response deadline. [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#retrieve-status) Retrieve status ------------------------------------------------------------------------------------------------- Use the UUID from the submission receipt or its `Location` header. The website support ticket ID is a different identifier and cannot be used for this lookup. Send no query parameters. A GET request needs neither a body nor an `Idempotency-Key` header. curl -i 'https://api.nano-gpt.com/api/v1/feedback/10000000-0000-4000-8000-000000000001' \ -H "Authorization: Bearer $NANOGPT_API_KEY" HTTP `200` includes `type`, `title`, current `status`, `created_at`, `updated_at`, `delete_after`, and `latest_response`, alongside the receipt ID, object and visibility. `latest_response` is the latest visible team reply with `id`, `content` and `created_at`, or `null` when no reply is available. Internal notes and attachment data are excluded. Statuses are `pending`, `accepted`, `in-progress`, `done`, and `rejected`. Wait at least **five minutes** between successful polls (`Retry-After: 300`). Stop polling on `done`, `rejected`, `404`, or `410`. Closed support tickets normally expire after three days unless retention is extended through the website; `delete_after` exposes the scheduled deletion time, or is `null` when none is set. [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#retrieval-error-codes) Retrieval error codes ------------------------------------------------------------------------------------------------------------- Use the **HTTP status and `error.code` together**. In particular, `feedback_unavailable` means permanent deletion or archiving with `410`, and a temporary failure with `503`. Do not decide whether to retry by code alone. { "error": { "type": "invalid_request_error", "code": "feedback_not_found", "message": "Feedback not found." } } | HTTP status | `error.code` | Meaning and action | | --- | --- | --- | | `400` | `invalid_request` | The ID is not a UUID v4, or query parameters were supplied. Correct the request. | | `400` | `conflicting_credentials` | `Authorization` and `x-api-key` disagree. Send one credential. | | `401` | `missing_api_key` | Supply an inference API key. | | `401` | `malformed_api_key` | Correct the API key format. | | `401` | `invalid_api_key` | The key is invalid, expired, revoked, or unsupported for feedback. Correct authentication before retrying. | | `403` | `api_key_origin_not_allowed` | The request violates the key’s Origin restriction. Correct the request Origin or key policy. | | `403` | `payment_review_required` | Account API access is restricted pending review. Use website support. | | `404` | `feedback_not_found` | No report is accessible with this API key. Check the receipt ID and submitting key, then stop automatic retries. This response does not reveal whether another key owns a report. | | `410` | `feedback_unavailable` | The report was deleted or archived. Stop polling; this response does not include retry advice. | | `429` | `rate_limit_exceeded` | A feedback request quota was reached. Honor `Retry-After`. | | `429` | `authentication_rate_limited` | Repeated invalid credentials triggered a temporary block. Correct the credentials and honor `Retry-After`. | | `500` or `503` | `internal_error` | Authentication encountered a server failure. Retry with bounded backoff; `Retry-After` may be absent. | | `503` | `feedback_unavailable` | A temporary feedback failure. Honor `Retry-After: 30` and retain `X-Request-ID` for support. | | `503` | `rate_limit_unavailable` | The rate-limit service could not check the request. Honor `Retry-After`. | Treat `error.message` as explanatory text that may change. Clients should tolerate new fields and codes and use the HTTP status as a fallback. [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#submission-only-errors) Submission-only errors --------------------------------------------------------------------------------------------------------------- POST also uses the authentication, rate-limit, server, `404`, and `410` errors above, and can return `400 invalid_request` for query parameters. These additional errors apply only to submission: | HTTP status | `error.code` | Action | | --- | --- | --- | | `400` | `invalid_idempotency_key` | Supply a header matching the format above. | | `400` | `invalid_json` | Send a valid JSON object. | | `400` | `invalid_feedback` | Correct invalid fields or remove unknown fields. | | `409` | `idempotency_conflict` | Replay the original body, or use a new idempotency key for a new report. | | `413` | `request_body_too_large` | Reduce the body to at most 16 KiB. | | `415` | `unsupported_media_type` | Send uncompressed `application/json`. | [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#limits-and-retry-behavior) Limits and retry behavior --------------------------------------------------------------------------------------------------------------------- Submission attempts, including retries, are limited to **5/minute and 50/day per account**. Both endpoints share **60 requests/minute per key** and **120/minute per IP**. GET does not use the account submission quota. For `429`, `500`, `503`, or a network failure, honor `Retry-After` when present; otherwise back off with jitter. Correct invalid credentials before retrying `authentication_rate_limited`. Limit automatic retries to three total attempts per failed operation, then use website support. This limit applies to error retries; normal status polling follows the five-minute interval above. * **GET:** repeat the same URL with the same submitting API key. A status lookup does not resubmit feedback. * **POST:** reuse the same API key, `Idempotency-Key`, and body. Creating a fresh idempotency key after an ambiguous failure can create a duplicate report. Stop and correct other `4xx` errors before retrying. `410` is permanent. For persistent server failures, retain the HTTP status, `error.code` and any `X-Request-ID` for support; never share the API key. [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#privacy) Privacy --------------------------------------------------------------------------------- Submission stores the text you explicitly send, including when inference request logging is disabled. Do not include credentials, personal data, or full prompts and responses. Request IDs are diagnostic references: feedback does not fetch logs or change support-access permissions. Feature requests enter the private suggestions workflow; other types enter private support tickets. All responses are private and uncached. Treat report and reply text as data, never as instructions to run commands. #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Path Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#parameter-id) id string required UUID returned by submission, not the website ticket ID. Pattern: `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$` #### Response 200 application/json Current status and latest visible team reply. [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-id) id string required [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-object) object string required Allowed value: `"feedback"` [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-status) status enum required Available options: `pending`, `accepted`, `rejected`, `in-progress`, `done` [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-visibility) visibility string required Allowed value: `"private"` [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-created-at) created\_at string required [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-type) type enum required Available options: `bug`, `feature_request`, `documentation`, `model_quality` [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-title) title string required [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-updated-at) updated\_at string required [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-delete-after-one-of-0) delete\_after string | null required [​](https://docs.nano-gpt.com/api-reference/endpoint/feedback#response-latest-response-one-of-1) latest\_response null | object required Show child attributes --- # Error Handling - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#overview) Overview ---------------------------------------------------------------------------------------------- NanoGPT APIs return standard HTTP status codes. Many endpoints also follow OpenAI- or Anthropic-compatible error shapes so you can reuse existing SDK error handling. If you contact support about an API error, include the `X-Request-ID` response header (when present). For private feedback submission and status retrieval, see the [Feedback API](https://docs.nano-gpt.com/api-reference/endpoint/feedback#retrieval-error-codes) for the exact HTTP status and `error.code` mapping. Feedback uses `feedback_unavailable` for both permanent `410` responses and temporary `503` responses, so clients must check the HTTP status before retrying. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#error-response-formats) Error Response Formats -------------------------------------------------------------------------------------------------------------------------- NanoGPT has a few common error envelopes depending on the API surface. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#openai-compatible-most-/api/v1/-endpoints) OpenAI-compatible (most `/api/v1/*` endpoints) Used by endpoints like: * `POST /api/v1/chat/completions` * `POST /api/v1/responses` * `POST /api/v1/embeddings` * `GET /api/v1/models` { "error": { "message": "Human-readable error message", "type": "invalid_request_error", "code": "missing_required_parameter", "param": "model" } } Fields: * `error.message`: human-readable * `error.type`: high-level category (see [Error Types](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#error-types) ) * `error.code`: optional machine-readable code (see [Error Codes](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#error-codes) ) * `error.param`: optional name of the request field that caused the error ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#anthropic-compatible-post-/api/v1/messages) Anthropic-compatible (`POST /api/v1/messages`) The Messages API uses the Anthropic-style wrapper: { "type": "error", "error": { "type": "invalid_request_error", "message": "max_tokens is required", "param": "max_tokens" } } ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#legacy-/-simple-format-some-/api/-endpoints) Legacy / simple format (some `/api/*` endpoints) Some older endpoints return a simpler body: { "error": "Insufficient balance", "status": 402 } Some responses also include a structured object and convenience fields (for example, `requiredBalance` on `402`). [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#status-codes) Status Codes ------------------------------------------------------------------------------------------------------ This table covers the most common HTTP error statuses you may encounter. | Status | Meaning | Typical client action | | --- | --- | --- | | `400` | Invalid request / validation failed | Fix the request, then retry | | `401` | Missing/invalid API key | Do not retry until credentials are fixed | | `402` | Insufficient balance | Add funds or disable paid enhancements, then retry | | `403` | Authenticated but not permitted | Choose an allowed model/feature or change permissions | | `404` | Resource not found | Check the model/resource ID | | `408` / `504` | Timeout | Retry with backoff | | `409` | Conflict | Resolve state (duplicate/redeemed/already processed) | | `413` | Payload too large | Reduce payload size and retry | | `429` | Rate limited | Wait (use `Retry-After` if present), then retry. This can be a per-second throughput limit or a per-key daily limit. | | `500` | Server error | Retry with backoff | | `503` | Temporarily unavailable | Retry with backoff; consider changing model if persistent | Notes: * Some endpoints include convenience fields like `status` in the JSON body mirroring the HTTP status code. * Some error responses include `Retry-After` (seconds) for `429`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#error-types) Error Types ---------------------------------------------------------------------------------------------------- Depending on the endpoint, you may see different type strings. Common values include: * `invalid_request_error` (400) * `authentication_error` (401) * `permission_denied_error` or `permission_error` (403) * `not_found_error` (404) * `rate_limit_error` (429) * `server_error`, `service_unavailable`, or `api_error` (500/503) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#error-codes) Error Codes ---------------------------------------------------------------------------------------------------- Not every error includes a `code`. When present, codes are useful for programmatic handling. Common codes include: ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#request-validation) Request validation * `missing_required_parameter` * `invalid_parameter_value` * `invalid_json` * `invalid_json_schema` * `tool_choice_unsupported` * `image_input_not_supported` * `conflicting_moderation_model` * `inline_moderation_requires_api_key` * `empty_moderation_input` * `unsupported_moderation_input` * `unsupported_input_modality` * `unsupported_batch_input` ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#content-and-context) Content and context * `content_policy_violation` * `context_length_exceeded` * `empty_response` ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#model-and-routing) Model and routing * `model_not_found` * `model_not_allowed` * `model_not_available` * `all_fallbacks_failed` * `no_fallback_available` * `fallback_blocked_for_cache_consistency` * `native_web_search_unavailable` (native web search was requested, but the allowed providers cannot run it) ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#balance-and-payment) Balance and payment * `memory_balance_required` * `webSearch_balance_required` * `both_balance_required` ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#rate-limiting) Rate limiting * `rate_limit_exceeded` * `daily_rpd_limit_exceeded` * `daily_usd_limit_exceeded` [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#streaming-errors) Streaming Errors -------------------------------------------------------------------------------------------------------------- When using Server-Sent Events (`"stream": true`), errors can happen: * Before streaming begins (you get a normal JSON error response with an HTTP status code) * Mid-stream (you may receive an error frame/chunk, or the connection may terminate) Example (mid-stream error frame): data: {"id":"chatcmpl_...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"error"}],"error":{"status":503,"message":"Service temporarily unavailable. Please try again later.","code":"service_unavailable"}} data: [DONE] If an error happens mid-stream, treat it as a failed request: * Surface/log the error message * Log the `X-Request-ID` header if available * Retry only when the status/category indicates it is safe to retry (for example 408/429/500/503) A stream failure does not by itself establish whether a charge was recorded. Capture `X-Request-ID` before reading the stream and use [Request Billing](https://docs.nano-gpt.com/api-reference/endpoint/request-billing) with the same API key to check the original primary charge. Repeating inference can create a separate charge; a reused request ID does not deduplicate it. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#retry-guidance) Retry Guidance ---------------------------------------------------------------------------------------------------------- General retry recommendations: * Retry: `408`, `429`, `500`, `503` (use exponential backoff and respect `Retry-After`) * Do not blindly retry: `400`, `401`, `402`, `403`, `404`, `409`, `413` Suggested backoff (example): Attempt 1: 1s Attempt 2: 2s Attempt 3: 4s Add jitter to avoid synchronized retries. **Billing lookup exception:** A `404` from [Request Billing](https://docs.nano-gpt.com/api-reference/endpoint/request-billing) can mean accounting is still pending. Wait at least its `Retry-After: 30` delay plus jitter before looking up the same ID again. Honor larger retry delays on `429` and `503`; stop on `200`, permanent errors, or no later than 24 hours after the original request. A `404` can also mean expired, absent, or inaccessible records, so it never proves zero cost. If you need current guidance on global rate limits, see [Rate Limits](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#daily-per-key-limit-notes) Daily Per-Key Limit Notes -------------------------------------------------------------------------------------------------------------------------------- NanoGPT can enforce optional per-key daily limits (Requests/Day and USD/Day). When a daily limit is exceeded, the API returns `429` and typically includes a `Retry-After` header indicating the number of seconds until the next reset at **00:00 UTC**. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#balance-errors-402) Balance Errors (402) -------------------------------------------------------------------------------------------------------------------- Some endpoints return `402 Payment Required` when payment is needed before the request can run. There are two common cases. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#authenticated-balance-error) Authenticated Balance Error { "error": "Insufficient balance", "requiredBalance": 0.0035, "status": 402 } This is the ordinary insufficient-balance response for authenticated requests. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#accountless-x402-payment-challenge) Accountless x402 Payment Challenge Supported endpoints can also be called without `Authorization` or `x-api-key` when the client explicitly opts in to accountless x402 quote generation. To request an accountless x402 quote, send the API request without `Authorization` or `x-api-key`, and include `x-x402: true`. NanoGPT will return `402 Payment Required` with available payment options and a stable top-level `payment` object plus legacy OpenAI-compatible error fields. If you receive `401 missing_api_key` immediately, check that the initial quote request includes `x-x402: true`. Without that header, NanoGPT does not enter the x402 quote flow. Detect accountless x402 by checking for the top-level `payment` object, not a single `error.code` value. { "error": { "type": "insufficient_quota", "code": "insufficient_quota", "message": "Payment required to complete this request." }, "payment": { "version": 1, "paymentId": "pay_...", "requestHash": "sha256:...", "expiresAt": "2026-06-09T12:00:00.000Z", "amountUsd": "0.0714", "statusUrl": "https://nano-gpt.com/api/x402/status/pay_...", "completeUrl": "https://nano-gpt.com/api/x402/complete/pay_...", "accepted": [\ {\ "scheme": "nano",\ "protocolScheme": "nano",\ "network": "nano-mainnet",\ "amount": "...",\ "amountFormatted": "0.17067988 XNO",\ "amountUsd": "0.0714",\ "payTo": "nano_...",\ "paymentId": "pay_...",\ "statusUrl": "https://nano-gpt.com/api/x402/status/pay_...",\ "completeUrl": "https://nano-gpt.com/api/x402/complete/pay_..."\ },\ {\ "scheme": "x402-solana-usdc",\ "protocolScheme": "exact",\ "network": "solana",\ "amount": "1500",\ "amountFormatted": "0.0015 USDC",\ "amountUsd": "0.0015",\ "payTo": "",\ "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",\ "feePayer": "",\ "paymentId": "pay_...",\ "expiresAt": "2026-06-09T12:00:00.000Z"\ },\ {\ "scheme": "lightning-l402",\ "protocolScheme": "lightning-l402",\ "network": "bitcoin-lightning",\ "amount": "9",\ "amountFormatted": "9 sats",\ "amountUsd": "0.0054",\ "payTo": "lnbc...",\ "invoice": "lnbc...",\ "paymentHash": "...",\ "l402Token": "..."\ }\ ] }, "x402Version": 1, "accepts": [] } The legacy `accepts` array may still appear for backwards-compatible and lower-level protocol clients, but new clients should use `payment.accepted[]`. Exact rails such as `nano-exact`, `x402-exact`, and `x402-solana-usdc` replay the original request with `X-PAYMENT`; polling-style rails such as `nano` and `base-usdc` use `statusUrl` and `completeUrl`; Lightning L402 replays the exact original request with `Authorization: L402 :` and does not use `X-PAYMENT` or `completeUrl`. See [Accountless x402 API Payments](https://docs.nano-gpt.com/api-reference/miscellaneous/x402) for the complete flow and supported endpoint matrix. Feature-specific variants may include a structured error `code` such as `memory_balance_required` or `webSearch_balance_required`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#content-policy-and-empty-responses) Content Policy and Empty Responses -------------------------------------------------------------------------------------------------------------------------------------------------- * If a request is blocked by safety checks (`content_policy_violation`), the API will return a `400` error and is intended to avoid charging for the blocked generation request. If [Inline Moderation](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation) blocked the request, the separate moderation preflight is still charged. * If the API returns `empty_response`, the request is intended to avoid charging (common causes: stop sequences, very low `max_tokens`, or filtering). [​](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling#byok-notes) BYOK Notes -------------------------------------------------------------------------------------------------- When using BYOK (Bring Your Own Key), some error messages may reference “your API key” because the upstream credentials belong to you. --- # Video Recover - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#content-area) cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/generate-video/recover \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/generate-video/recover" headers = {"x-api-key": ""} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/generate-video/recover', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/generate-video/recover",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/generate-video/recover" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/generate-video/recover") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/generate-video/recover") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 500 {} { "error": 123, "message": "" } { "error": 123, "message": "" } GET https://api.nano-gpt.com/apihttps://nano-gpt.com/api / generate-video / recover Try it cURL cURL curl --request GET \ --url https://api.nano-gpt.com/api/generate-video/recover \ --header 'x-api-key: ' import requests url = "https://api.nano-gpt.com/api/generate-video/recover" headers = {"x-api-key": ""} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {'x-api-key': ''}}; fetch('https://api.nano-gpt.com/api/generate-video/recover', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/generate-video/recover",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/generate-video/recover" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/generate-video/recover") .header("x-api-key", "") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/generate-video/recover") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body 200 400 500 {} { "error": 123, "message": "" } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#overview) Overview ---------------------------------------------------------------------------------------- Recover recent video generation runs for a user. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#endpoint) Endpoint GET /api/generate-video/recover ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#query-parameters) Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `model` | string | No | Filter by model | | `limit` | number | No | Max results (default 10, max 50) | | `conversationUUID` | string | No | Filter by conversation | ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#rate-limit) Rate limit 20 requests/minute per IP [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#usage) Usage ---------------------------------------------------------------------------------- curl -s "https://api.nano-gpt.com/api/generate-video/recover?limit=10" \ -H "x-api-key: YOUR_API_KEY" | jq . [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#response) Response ---------------------------------------------------------------------------------------- { "data": [\ {\ "runId": "vid_m1abc123def456",\ "id": "vid_m1abc123def456",\ "model": "sora-2",\ "status": "completed",\ "createdAt": "2025-01-17T12:34:56.000Z",\ "conversationUUID": "b7c75a5e-1e2a-4d4f-9e5b-6c6e2e2f9a17"\ }\ ] } Notes: * New runs return NanoGPT job IDs (`vid_...`); legacy runs may return provider request IDs. #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#authorization-x-api-key) x-api-key string header required #### Query Parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#parameter-model) model string Optional model filter [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#parameter-limit) limit integer Max results (default 10, max 50) Required range: `1 <= x <= 50` [​](https://docs.nano-gpt.com/api-reference/endpoint/video-recover#parameter-conversation-uuid) conversationUUID string Filter by conversation #### Response 200 application/json Recovered runs The response is of type `object`. --- # Video Extend - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/generate-video/extend \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "taskId": "vid_m1abc123def456", "index": 0 } ' import requests url = "https://api.nano-gpt.com/api/generate-video/extend" payload = { "taskId": "vid_m1abc123def456", "index": 0 } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({taskId: 'vid_m1abc123def456', index: 0}) }; fetch('https://api.nano-gpt.com/api/generate-video/extend', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/generate-video/extend",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'taskId' => 'vid_m1abc123def456',\ 'index' => 0\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/generate-video/extend" payload := strings.NewReader("{\n \"taskId\": \"vid_m1abc123def456\",\n \"index\": 0\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/generate-video/extend") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"taskId\": \"vid_m1abc123def456\",\n \"index\": 0\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/generate-video/extend") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"taskId\": \"vid_m1abc123def456\",\n \"index\": 0\n}" response = http.request(request) puts response.read_body 202 400 500 { "runId": "", "status": "pending", "model": "", "projectId": "", "cost": 123, "paymentSource": "", "remainingBalance": 123, "prechargeLabel": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / generate-video / extend Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/generate-video/extend \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "taskId": "vid_m1abc123def456", "index": 0 } ' import requests url = "https://api.nano-gpt.com/api/generate-video/extend" payload = { "taskId": "vid_m1abc123def456", "index": 0 } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({taskId: 'vid_m1abc123def456', index: 0}) }; fetch('https://api.nano-gpt.com/api/generate-video/extend', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/generate-video/extend",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'taskId' => 'vid_m1abc123def456',\ 'index' => 0\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/generate-video/extend" payload := strings.NewReader("{\n \"taskId\": \"vid_m1abc123def456\",\n \"index\": 0\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/generate-video/extend") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"taskId\": \"vid_m1abc123def456\",\n \"index\": 0\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/generate-video/extend") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"taskId\": \"vid_m1abc123def456\",\n \"index\": 0\n}" response = http.request(request) puts response.read_body 202 400 500 { "runId": "", "status": "pending", "model": "", "projectId": "", "cost": 123, "paymentSource": "", "remainingBalance": 123, "prechargeLabel": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#overview) Overview --------------------------------------------------------------------------------------- This endpoint is the task-based extension flow for Midjourney videos. For all other extend models, use `POST /api/generate-video` with a source video. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#endpoint) Endpoint POST /api/generate-video/extend ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#rate-limit) Rate limit 20 requests/minute per IP ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#supported-models-task-based) Supported models (task-based) * `midjourney-video` (extend a Midjourney video created via `POST /api/generate-video`) ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#required-fields-midjourney-extend) Required fields (Midjourney extend) * `runId` (preferred) or `taskId` (legacy alias): the job ID from the original Midjourney video request * `index` (0-3) `index` maps to the 4 videos returned by the original Midjourney request. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#request-notes) Request notes * Send the same authentication headers as `/api/generate-video`. * Session ownership is enforced; requests for jobs you do not own return `403`. * This endpoint does not accept `video`, `videoUrl`, `videoDataUrl`, or `videoAttachmentId`. * The response format matches the standard generation response (`runId`, `id`, `status`, `model`, `cost`). [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#source-video-extend-use-/api/generate-video) Source video extend (use `/api/generate-video`) ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Use `POST /api/generate-video` with an extend model and a source video input. **Extend model examples**: * `wan-wavespeed-22-spicy-extend` * `wan-wavespeed-25-extend` * `veo3-1-extend` * `veo3-1-fast-extend` * `bytedance-seedance-v1.5-pro-extend` **Required fields**: * `prompt` * `videoUrl` (or `videoDataUrl` / `videoAttachmentId`) **Notes**: * `video` is only accepted by specific models (for example, `wan-wavespeed-25-extend`). * `wan-wavespeed-22-spicy-extend` accepts `videoUrl`, `videoDataUrl`, or `videoAttachmentId` only. * Max source video length: 120 seconds. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#example-midjourney-extend-task-based) Example: Midjourney extend (task-based) { "runId": "vid_m1abc123def456", "index": 0 } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#example-response) Example response { "success": true, "runId": "vid_m1abc123def456", "id": "vid_m1abc123def456", "taskId": "vid_m1abc123def456", "status": "pending", "model": "midjourney-video", "message": "Extending video 1 by 5 seconds...", "eta": 60 } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#example-source-video-extend-/api/generate-video) Example: Source video extend (`/api/generate-video`) { "model": "wan-wavespeed-22-spicy-extend", "prompt": "Extend the clip with smooth motion and warm light", "videoUrl": "https://example.com/source.mp4", "resolution": "480p", "duration": 5, "seed": -1 } `seed` is model/provider-route dependent and may improve reproducibility where supported; it does not guarantee identical output. #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#authorization-x-api-key) x-api-key string header required #### Body application/json Midjourney extension request payload (taskId from the original run + index). [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#body-task-id) taskId string required Run ID from the original Midjourney video request. [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#body-index) index integer required Zero-based index of the Midjourney video to extend (0-3). Required range: `0 <= x <= 3` #### Response 202 application/json Video extension request submitted successfully (asynchronous processing) [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-run-id) runId string required Unique identifier for the video generation request [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-status) status enum default:pending required Current status of the generation Available options: `pending`, `processing`, `completed`, `failed` [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-model) model string required The model used for generation [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-project-id) projectId string Project identifier (for LongStories models) [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-cost) cost number Cost of the video generation [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-payment-source) paymentSource string Payment source used (USD or XNO) [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-remaining-balance) remainingBalance number Remaining balance after the generation [​](https://docs.nano-gpt.com/api-reference/endpoint/video-extend#response-precharge-label) prechargeLabel string Provider label for the precharge --- # Partner Auth - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#overview) Overview -------------------------------------------------------------------------------------------- Partner Auth lets your backend authenticate one of your users to NanoGPT without giving you direct access to NanoGPT account credentials or API keys. You send a short-lived JWT signed by your backend. NanoGPT verifies it, maps your user ID to a normal NanoGPT account behind the scenes, and runs requests against that linked account. The same partner user always maps to the same NanoGPT account. Partner Auth is available by request. Contact NanoGPT to configure your partner slug, JWT audience, public signing key, redirect allowlist, and optional commercial settings before production use. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#how-it-works) How It Works ---------------------------------------------------------------------------------------------------- Your backend owns the private key. NanoGPT stores only the public key. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#what-nanogpt-configures) What NanoGPT Configures -------------------------------------------------------------------------------------------------------------------------- Before launch, NanoGPT configures: * Your partner slug, for example `example` * Your JWT audience, for example `nanogpt-partner-api:example` * Your public signing key and key ID, for example `example-2026-04` * Allowed browser redirect URLs for SSO * Optional referral revenue share * Optional partner tiers for discounts and request-access allowance rules You keep the private key in your own secret manager. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#jwt-requirements) JWT Requirements ------------------------------------------------------------------------------------------------------------ Every partner-authenticated request uses: Authorization: Bearer JWT header: { "alg": "ES256", "kid": "example-2026-04" } JWT claims: { "iss": "example", "aud": "nanogpt-partner-api:example", "sub": "your-opaque-user-id", "iat": 1770000000, "exp": 1770000300, "jti": "unique-request-id", "scope": ["request:create"] } Rules: * Use `ES256` or `RS256`. * `exp - iat` must be at most 5 minutes. * `jti` must be unique per request token. * `sub` must be your stable user identifier, opaque to NanoGPT. * Do not send emails, names, or other personal data as `sub`. * NanoGPT stores `HMAC-SHA256(sub)`, not the raw `sub`. * Create JWTs on your backend only. Never sign tokens in the browser. Optional tier claim: { "tier": "premium" } NanoGPT validates the tier against your active partner tier configuration. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#scopes) Scopes ---------------------------------------------------------------------------------------- Use the smallest scope needed for each request. | Scope | Purpose | | --- | --- | | `request:create` | Create AI requests such as chat, image, video, or audio requests | | `session:web` | Create a one-time browser login link | | `balance:read` | Read the linked user’s NanoGPT balance | | `deposit:create` | Create a deposit or top-up request | | `usage:read` | Read usage for the JWT `sub` | | `usage:read:any` | Backend-only scope to read usage for another `subject` query param | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#send-ai-requests) Send AI Requests ------------------------------------------------------------------------------------------------------------ Use a partner JWT instead of a NanoGPT API key. curl -X POST "https://nano-gpt.com/api/v1/chat/completions" \ -H "Authorization: Bearer $PARTNER_JWT" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5", "messages": [\ { "role": "user", "content": "Summarize this article in three bullets." }\ ] }' The JWT must include: request:create The request is charged to the linked NanoGPT account for the JWT `sub`. See also: [Chat Completion](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) , [Image Generation](https://docs.nano-gpt.com/api-reference/image-generation) , and [Video Generation](https://docs.nano-gpt.com/api-reference/video-generation) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#check-user-balance) Check User Balance ---------------------------------------------------------------------------------------------------------------- curl -X POST "https://nano-gpt.com/api/check-balance" \ -H "Authorization: Bearer $PARTNER_JWT" The JWT must include: balance:read The response includes the linked user’s balance and deposit details. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#initiate-a-top-up) Initiate A Top-Up -------------------------------------------------------------------------------------------------------------- Partner-authenticated top-ups are not limited to Nano. The same linked NanoGPT account can be funded through enabled NanoGPT deposit methods, including: * Native Nano direct deposits: read the linked user’s `nanoDepositAddress` from the balance response and show that address to the user. No deposit call is needed; incoming Nano credits automatically. See [Check User Balance](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#check-user-balance) . * Stablecoins and major chains (`usdc`, `usdt`, `sol`, `eth`, `base`, `arbitrum`, `polygon`, `bnb`, `trx`): call `POST /api/transaction/create/boomfi/{ticker}` to create a hosted payment for the linked user. * Crypto invoice or swap deposits (`btc`, `btc-ln`, `ltc`, `ltc-mweb`, `xmr`, `doge`, `dash`, `zec`): call `POST /api/transaction/create/{ticker}`. * Card deposits where enabled for the partner integration. Deposit creation, status polling, and cancellation all require the `deposit:create` scope on the partner JWT. Available methods can change by region, provider status, amount, and partner configuration. Ask NanoGPT which top-up methods should be enabled for your integration before launch. For invoice-style payment methods, create the payment request for the linked user with the ticker route: curl -X POST "https://nano-gpt.com/api/transaction/create/btc-ln" \ -H "Authorization: Bearer $PARTNER_JWT" \ -H "Content-Type: application/json" \ -d '{"amount": 0.00001}' The JWT must include: deposit:create NanoGPT resolves the user from the JWT `sub` and returns deposit details for that linked account. For ticker-specific limits, request bodies, status polling, and supported payment methods, see [Crypto Deposits](https://docs.nano-gpt.com/api-reference/endpoint/crypto-deposits) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#browser-sso) Browser SSO -------------------------------------------------------------------------------------------------- Use browser SSO when you want to send a user from your product into NanoGPT already signed in as the linked account. Create a one-time login link: curl -X POST "https://nano-gpt.com/api/partners/auth/login-links" \ -H "Authorization: Bearer $PARTNER_JWT" \ -H "Content-Type: application/json" \ -d '{ "redirect_url": "https://your-product.example/account/ai" }' The JWT must include: session:web NanoGPT returns: { "url": "https://nano-gpt.com/auth/partner/example?token=...", "expiresAt": "2026-05-07T12:00:00.000Z" } The login token is one-time use and short-lived. Absolute redirect URLs must be allowlisted. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#read-user-usage) Read User Usage ---------------------------------------------------------------------------------------------------------- Read usage for the JWT `sub`: curl "https://nano-gpt.com/api/partners/users/usage?duration=month" \ -H "Authorization: Bearer $PARTNER_JWT" The JWT must include: usage:read Backend service usage lookup for a specific user: curl "https://nano-gpt.com/api/partners/users/usage?subject=your-opaque-user-id&duration=month" \ -H "Authorization: Bearer $PARTNER_SERVICE_JWT" If `subject` differs from the JWT `sub`, the JWT must also include: usage:read:any Use `usage:read:any` only from trusted backend services. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#funding-options) Funding Options ---------------------------------------------------------------------------------------------------------- NanoGPT supports user-funded usage by default: * Each linked user has their own NanoGPT balance. * Your product can show the user’s balance and top-up options. * If the linked user has no balance, paid requests return the normal insufficient-balance response. * If configured, your partner account can earn referral revenue from user-funded top-ups. Partner tiers can configure usage discounts once NanoGPT enables tiers for your integration: * `free`: no discount * `basic`: 5% discount * `premium`: 10% discount Tier names and discount rates are configurable per partner. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#request-access-funding-features) Request-Access Funding Features ------------------------------------------------------------------------------------------------------------------------------------------ Some funding options require NanoGPT approval and explicit configuration before they can be used: * Free starter prompts or free starter credits * Partner-funded daily, weekly, monthly, or one-time allowances * Custom per-tier discounts * Partner settlement for sponsored usage These options are not automatically available just because Partner Auth is enabled. Treat them as request-access features: describe the desired user plans, allowance amounts, discount rates, expected volume, and settlement model to NanoGPT before launch. Allowance rules are modeled for partner-funded usage: * one-time signup allowance * weekly allowance * monthly allowance Allowance settlement is not an active production payment source unless NanoGPT explicitly enables it for your integration. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#error-handling) Error Handling -------------------------------------------------------------------------------------------------------- Common responses: | Status | Meaning | | --- | --- | | `401` | Missing, invalid, expired, replayed, or unauthorized partner JWT, including a JWT missing the required scope | | `402` | Linked user needs balance before the request can run | | `403` | Reading another user’s usage with `subject` without the `usage:read:any` scope | | `429` | Too many requests or too many auth failures | | `500` | NanoGPT could not complete the server-side operation | Retry only when the error is transient, such as `429` or `500`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#security-checklist) Security Checklist ---------------------------------------------------------------------------------------------------------------- * Sign JWTs only on your backend. * Keep private keys in your secret manager. * Use short-lived JWTs, max 5 minutes. * Use a unique `jti` per request token. * Use opaque stable user IDs as `sub`. * Never put PII in `sub`. * Request only the scopes needed for the operation. * Do not expose `usage:read:any` or `deposit:create` from browser code. * Rotate keys periodically and revoke old keys after rollout. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/partner-auth#minimal-backend-flow) Minimal Backend Flow -------------------------------------------------------------------------------------------------------------------- 1. User opens your AI feature. 2. Your backend signs a JWT with `sub = your user id` and the needed scope. 3. Your backend calls NanoGPT with `Authorization: Bearer `. 4. NanoGPT verifies the JWT and maps the user to a linked NanoGPT account. 5. NanoGPT runs the request, checks balance, applies configured partner discount, and records usage. 6. Your product renders the result to the user. --- # Inline Moderation - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#overview) Overview ------------------------------------------------------------------------------------------------- Inline moderation lets authenticated API-key callers ask NanoGPT to run a paid input safety check before a text, image, or video generation request is dispatched to the target model provider. It is opt-in per request and configured with HTTP headers. If the submitted input is flagged, NanoGPT charges only the moderation check, skips generation, and returns a content policy error. If the input passes, NanoGPT charges the moderation check, then continues with the normal generation request and normal generation billing. Inline moderation is an input preflight only. It does not moderate generated outputs. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#supported-routes) Supported Routes ----------------------------------------------------------------------------------------------------------------- Inline moderation is supported on authenticated API-key requests to: * `POST /api/v1/chat/completions` * `POST /api/v1/responses` * `POST /api/v1/completions` * `POST /api/v1/messages` * `POST /api/v1/images/generations` * `POST /api/v1/images/edits` * NanoGPT image generation compatibility routes that flow through the canonical image handler * NanoGPT video generation requests that flow through the canonical video handler Accountless x402/exact-payment requests are not supported for inline moderation in this version. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#enabling-inline-moderation) Enabling Inline Moderation ------------------------------------------------------------------------------------------------------------------------------------- Use the `moderation` header. To enable moderation with the default moderation model: moderation: true Truthy values all enable the default moderation model: * `true` * `1` * `yes` * `on` Falsy values disable inline moderation: * `false` * `0` * `no` * `off` [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#selecting-a-moderation-model) Selecting a Moderation Model ----------------------------------------------------------------------------------------------------------------------------------------- Supported moderation model IDs are listed by: GET /api/v1/moderation-models There are two ways to choose a moderation model. Pass the model ID directly in the `moderation` header: moderation: meta-llama/llama-guard-4-12b Or enable moderation with `moderation: true` and select the model with `moderation-model`: moderation: true moderation-model: meta-llama/llama-guard-4-12b `moderation-model` only selects the model when the `moderation` header is also present. A request with only `moderation-model` does not enable inline moderation. If both headers specify model IDs and they differ, the request fails: { "error": { "message": "Conflicting moderation headers.", "type": "invalid_request_error", "code": "conflicting_moderation_model", "param": "moderation" } } Unknown moderation model IDs use the normal `model_not_found` behavior. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#what-gets-moderated) What Gets Moderated ----------------------------------------------------------------------------------------------------------------------- Inline moderation checks user-facing request input before generation. For text APIs, NanoGPT moderates: * chat messages * Responses API instructions * Responses API input, including merged `conversation.messages` and `previous_response_id` history when applicable * Responses API text content parts such as `input_text`, `output_text`, and tool output text * completions prompts, including prompt arrays * image content parts when they are provided as HTTP(S) image URLs or `data:image/...` URLs For image and video APIs, NanoGPT moderates: * `prompt` * multi-prompt text fields * submitted images * reference images * start/end/first/last frame images when those fields are used For image and video requests, submitted images must be inspectable as HTTP(S) image URLs or `data:image/...` URLs. If a request includes an image input that cannot be inspected, such as a bare base64 string or a provider-specific file/asset reference, inline moderation fails closed with `unsupported_moderation_input`. NanoGPT does not moderate: * generated outputs * raw video inputs * provider configuration fields * `negative_prompt` * arbitrary non-user-facing model configuration If moderation is requested but NanoGPT cannot extract any text or image input to moderate, the request fails with `empty_moderation_input`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#billing-behavior) Billing Behavior ----------------------------------------------------------------------------------------------------------------- Inline moderation is a separate paid preflight. If the moderation check passes: * NanoGPT charges the moderation request. * NanoGPT continues with normal generation. * Normal generation billing still applies. If the moderation check flags the input: * NanoGPT charges the moderation request. * NanoGPT does not dispatch the generation request to the target provider. * NanoGPT does not charge generation. * The response is `400 content_policy_violation`. If the moderation provider is unavailable or returns malformed output: * NanoGPT fails closed with `503`. * NanoGPT does not charge moderation. * NanoGPT does not dispatch generation. * NanoGPT does not charge generation. Inline moderation is currently supported only for authenticated API-key billing. Accountless x402/exact-payment requests return: { "error": { "message": "Inline moderation is currently supported for authenticated API-key requests only.", "type": "invalid_request_error", "code": "inline_moderation_requires_api_key", "param": "moderation" } } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#response-headers) Response Headers ----------------------------------------------------------------------------------------------------------------- When inline moderation runs and the request is not blocked, successful moderated generation responses include moderation metadata headers: x-nanogpt-inline-moderation-model: omni-moderation-latest x-nanogpt-inline-moderation-flagged: false x-nanogpt-inline-moderation-cost-usd: 0.00000123 When inline moderation blocks a request, the blocked response also includes: x-nanogpt-inline-moderation-model: omni-moderation-latest x-nanogpt-inline-moderation-flagged: true x-nanogpt-inline-moderation-cost-usd: 0.00000123 Whitelabel responses scrub NanoGPT-specific response headers. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#blocked-response-shape) Blocked Response Shape ----------------------------------------------------------------------------------------------------------------------------- When moderation flags the input, NanoGPT returns `400` with a standard error object and moderation metadata. The original input content is not echoed. { "error": { "message": "Your request was blocked by content moderation.", "type": "invalid_request_error", "code": "content_policy_violation" }, "moderation": { "id": "modr_abc123", "model": "omni-moderation-latest", "results": [\ {\ "flagged": true,\ "categories": {\ "sexual": true\ },\ "category_scores": {\ "sexual": 0.98\ }\ }\ ], "usage": { "prompt_tokens": 120, "completion_tokens": 0, "total_tokens": 120 } } } Exact category names and score shapes depend on the moderation model. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#common-errors) Common Errors ----------------------------------------------------------------------------------------------------------- | Code | Meaning | | --- | --- | | `conflicting_moderation_model` | Both `moderation` and `moderation-model` specify different moderation model IDs. | | `model_not_found` | The selected moderation model ID is not supported. | | `inline_moderation_requires_api_key` | Inline moderation was requested without a supported authenticated API-key billing context. | | `empty_moderation_input` | Moderation was requested but no text or image input could be extracted. | | `unsupported_moderation_input` | The request contains input that inline moderation cannot inspect safely, such as an unsupported image file reference or non-URL image payload. | | `unsupported_input_modality` | The selected moderation model cannot moderate one of the submitted modalities, for example image input with a text-only moderation model. | | `unsupported_batch_input` | The selected moderation model does not support batched moderation input. | | `context_length_exceeded` | The moderation input exceeds the selected moderation model’s input limit. | | `content_policy_violation` | Moderation flagged the input. | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#examples) Examples ------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#chat-completions) Chat Completions curl https://api.nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -H "moderation: true" \ -d '{ "model": "openai/gpt-4o-mini", "messages": [\ { "role": "user", "content": "Write a short product description for a hiking backpack." }\ ] }' ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#responses-api-with-a-specific-moderation-model) Responses API with a Specific Moderation Model curl https://api.nano-gpt.com/api/v1/responses \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -H "moderation: true" \ -H "moderation-model: meta-llama/llama-guard-4-12b" \ -d '{ "model": "openai/gpt-4o-mini", "instructions": "Answer clearly and briefly.", "input": "Summarize what inline moderation does." }' ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#image-generation) Image Generation curl https://api.nano-gpt.com/api/v1/images/generations \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -H "moderation: true" \ -d '{ "model": "openai/gpt-image-2.5/flare/text-to-image", "prompt": "A clean product photo of a ceramic coffee mug on a kitchen counter" }' ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#image-or-video-request-with-reference-images) Image or Video Request with Reference Images Reference images are moderated when they are provided as inspectable URLs: { "model": "some-image-or-video-model", "prompt": "Use this product photo as a style reference.", "referenceImages": [\ { "url": "https://example.com/reference.png" }\ ] } Unsupported image payloads fail closed: { "error": { "message": "Inline moderation does not support one or more submitted image inputs. Use an HTTP(S) image URL or data:image URL instead.", "type": "invalid_request_error", "code": "unsupported_moderation_input", "param": "moderation" } } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation#notes-for-integrators) Notes for Integrators --------------------------------------------------------------------------------------------------------------------------- Inline moderation is best for callers who want NanoGPT to enforce a paid input safety preflight before generation. It is not a substitute for output moderation, downstream user reporting, or product-specific policy controls. Because moderation is charged separately, clients should treat inline moderation as an additional paid feature. If a request is blocked, the caller still pays for moderation, but not for generation. To avoid accidental no-op configuration, always send `moderation: true` or `moderation: ` when you want inline moderation enabled. --- # Codex CLI - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/codex-cli#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/codex-cli#codex-cli) Codex CLI ============================================================================ > Use OpenAI’s Codex CLI with NanoGPT to access GPT 6.1 Sol, Claude Opus 5.5, Gemini Flash Latest, and 400+ AI models through a single API key. [Get started with NanoGPT](https://nano-gpt.com/api) for pay-as-you-go pricing with no monthly fees. Add credits and start coding immediately. NanoGPT provides an OpenAI API-compatible endpoint that works seamlessly with Codex CLI. This allows you to: * Use Codex CLI with your NanoGPT credits * Access OpenAI models (GPT 6.1 Sol and more) without a separate OpenAI account * Route to 400+ other models including Claude Opus 5.5, Gemini Flash Latest, and GLM Latest [​](https://docs.nano-gpt.com/integrations/codex-cli#step-1-install-codex-cli) Step 1: Install Codex CLI ----------------------------------------------------------------------------------------------------------- * Recommended Installation Method * Cursor Guided Installation Method Prerequisites: [Node.js 22 or newer](https://nodejs.org/en/download/) # Install Codex CLI npm install -g @openai/codex # Navigate to your project cd your-awesome-project # Start Codex codex If you are not familiar with npm but have Cursor, you can enter the command in Cursor, and Cursor will guide you through the installation. https://developers.openai.com/codex/cli/ Help me install Codex CLI **Note**: If you encounter permission issues during installation, try using `sudo` (macOS/Linux) or running the command prompt as an administrator (Windows) to re-execute the installation command. [​](https://docs.nano-gpt.com/integrations/codex-cli#step-2-configure-nanogpt) Step 2: Configure NanoGPT ----------------------------------------------------------------------------------------------------------- 1 Get API Key * Go to [NanoGPT API](https://nano-gpt.com/api) * Create an account or log in * Copy your API key 2 Configure Codex Set up Codex using one of the following methods: * One-Click Setup (Mac/Linux) * Manual Configuration (All Platforms) * Environment Variables Only (Quick) Run this command in your terminal: curl -O "https://nano-gpt.com/install/codex_nanogpt.sh" && bash ./codex_nanogpt.sh The script will: 1. Prompt for your API key 2. Create `~/.codex/config.toml` using a model available to your API key on the configured API host 3. Add `NANOGPT_API_KEY` to your shell profile The installer now supports browser-based login. When the script starts, choose: 1. Browser login (recommended) - it will open a verification URL, wait for approval, and then save your key in `~/.codex/config.toml`. 2. Paste API key - manual fallback if you prefer. If a browser does not open automatically, copy the printed URL into your browser and approve the request.For local or self-hosted testing, `NANOGPT_BASE_URL` keeps login and API traffic on the same origin. To override only the Codex API endpoint, set `NANOGPT_API_BASE_URL` to the complete versioned base URL, including `/api/v1` (for example, `https://api.nano-gpt.example/api/v1`).For more details on the browser login flow, see [CLI login](https://docs.nano-gpt.com/integrations/cli-login) . **Step 1**: Create `~/.codex/config.toml`: model_provider = "nanogpt" model = "openai/gpt-6.1-sol" [model_providers.nanogpt] name = "NanoGPT" base_url = "https://nano-gpt.com/api/v1" env_key = "NANOGPT_API_KEY" wire_api = "responses" Recent Codex CLI versions require `wire_api = "responses"`. Older examples that use `wire_api = "chat"` will fail on current Codex CLI releases.This manual configuration uses the website host for the recommended model. For long-running sessions with large payloads, use `https://api.nano-gpt.com/api/v1` and choose a model from that host’s catalog. The installer keeps the direct host and chooses the newest recommended Sol model permitted by your API key, or another permitted model with tool support. If no permitted model supports tools, setup stops and asks you to update the key’s model access. It preserves an existing model selection.**Step 2**: Set your API key as an environment variable:**macOS/Linux** (add to `~/.zshrc` or `~/.bashrc`): export NANOGPT_API_KEY="your_nanogpt_api_key" **Windows Cmd**: setx NANOGPT_API_KEY your_nanogpt_api_key **Windows PowerShell**: [System.Environment]::SetEnvironmentVariable('NANOGPT_API_KEY', 'your_nanogpt_api_key', 'User') Replace `your_nanogpt_api_key` with your actual API key. Open a new terminal for changes to take effect. If you just want to override the default OpenAI endpoint without a config file: export OPENAI_BASE_URL="https://nano-gpt.com/api/v1" export OPENAI_API_KEY="your_nanogpt_api_key" This method works but does not persist across terminal sessions unless added to your shell profile. [​](https://docs.nano-gpt.com/integrations/codex-cli#step-3-start-using-codex) Step 3: Start Using Codex ----------------------------------------------------------------------------------------------------------- Once configured, start Codex in your terminal: codex Or explicitly use the current recommendation on the website host for one run: codex --model openai/gpt-6.1-sol --config 'model_providers.nanogpt.base_url="https://nano-gpt.com/api/v1"' After one-click setup, plain `codex` uses the model selected from the direct host’s catalog. For larger requests, keep that host and select a model it lists; the website override above has a smaller ingress limit. * * * [​](https://docs.nano-gpt.com/integrations/codex-cli#faq) FAQ ---------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/integrations/codex-cli#what-models-can-i-use) What Models Can I Use? NanoGPT supports 400+ models. These recommendations use the manual website configuration above. One-click setup uses the direct host, whose model catalog can differ during a rollout. | Use Case | Recommended Model | Config | | --- | --- | --- | | Best overall | `openai/gpt-6.1-sol` | `model = "openai/gpt-6.1-sol"` | | Best Claude | `anthropic/claude-opus-5.5` | `model = "anthropic/claude-opus-5.5"` | | Fast/cheap | `google/gemini-flash-latest` | `model = "google/gemini-flash-latest"` | | Long context | `google/gemini-pro-latest` | `model = "google/gemini-pro-latest"` | | Open model | `z-ai/glm-latest` | `model = "z-ai/glm-latest"` | List available models with `GET https://nano-gpt.com/api/v1/models` for the website configuration, or `GET https://api.nano-gpt.com/api/v1/models` for one-click setup’s direct host. ### [​](https://docs.nano-gpt.com/integrations/codex-cli#how-do-i-change-models) How Do I Change Models? **Option 1**: Edit `~/.codex/config.toml`: model = "openai/gpt-6.1-sol" For this recommendation, also set `base_url = "https://nano-gpt.com/api/v1"` in the existing `[model_providers.nanogpt]` section. To retain the direct host, choose a model from its catalog instead. **Option 2**: Use CLI flag: codex --model openai/gpt-6.1-sol --config 'model_providers.nanogpt.base_url="https://nano-gpt.com/api/v1"' ### [​](https://docs.nano-gpt.com/integrations/codex-cli#configuration-not-working) Configuration Not Working? 1. **Check your API key**: Ensure `NANOGPT_API_KEY` is set echo $NANOGPT_API_KEY 2. **Verify config file**: Check `~/.codex/config.toml` exists and has valid TOML syntax 3. **Open a new terminal**: Environment variable changes require a new shell session 4. **Reset configuration**: Delete `~/.codex/config.toml` and run the setup script again ### [​](https://docs.nano-gpt.com/integrations/codex-cli#how-is-this-different-from-using-openai-directly) How Is This Different From Using OpenAI Directly? | Feature | OpenAI Direct | NanoGPT | | --- | --- | --- | | Pricing | Monthly subscription or API credits | Pay-as-you-go, no minimums | | Models | OpenAI only | OpenAI + Claude + 400 other models | | Billing | Separate OpenAI account | Single NanoGPT balance | | Rate limits | OpenAI limits | NanoGPT limits | ### [​](https://docs.nano-gpt.com/integrations/codex-cli#can-i-use-both-claude-code-and-codex) Can I Use Both Claude Code and Codex? Yes. Both can be configured to use NanoGPT simultaneously: * **Claude Code**: Uses `~/.claude/settings.json` with Anthropic API format * **Codex CLI**: Uses `~/.codex/config.toml` with OpenAI API format Both tools share the same NanoGPT credit balance. ### [​](https://docs.nano-gpt.com/integrations/codex-cli#need-help) Need Help? * Check your balance at [nano-gpt.com/balance](https://nano-gpt.com/balance) * View API usage at [nano-gpt.com/usage](https://nano-gpt.com/usage) * Create or manage API keys at [nano-gpt.com/api](https://nano-gpt.com/api) * Contact support via the chat widget on [nano-gpt.com](https://nano-gpt.com/) --- # Claude Code - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/claude-code#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/claude-code#claude-code) Claude Code ================================================================================== > Use Claude Code with NanoGPT to access Claude and 400+ AI models through a single API key. [Get started with NanoGPT](https://nano-gpt.com/api) for pay-as-you-go pricing with no monthly fees. NanoGPT provides an Anthropic API-compatible endpoint that works seamlessly with Claude Code. This allows you to: * Use Claude Code with your NanoGPT credits * Access the real Claude models (Sonnet, Opus, Haiku) * Optionally route to 400+ other models (GPT-4o, Gemini, DeepSeek, and more) [​](https://docs.nano-gpt.com/integrations/claude-code#step-1-install-claude-code) Step 1: Install Claude Code ----------------------------------------------------------------------------------------------------------------- * Recommended Installation Method * Cursor Guided Installation Method Prerequisites: [Node.js 18 or newer](https://nodejs.org/en/download/) # Install Claude Code npm install -g @anthropic-ai/claude-code # Navigate to your project cd your-awesome-project # Start Claude Code claude If you are not familiar with npm but have Cursor, enter the command below in Cursor and it will guide you through the installation of Claude Code. https://docs.anthropic.com/en/docs/claude-code/overview Help me install Claude Code **Note**: If you encounter permission issues during installation, try using `sudo` (macOS/Linux) or running the command prompt as an administrator (Windows) to re-execute the installation command. [​](https://docs.nano-gpt.com/integrations/claude-code#step-2-configure-nanogpt) Step 2: Configure NanoGPT ------------------------------------------------------------------------------------------------------------- 1 Get API Key * Go to [NanoGPT API](https://nano-gpt.com/api) * Create an account or log in * Copy your API key 2 Configure Environment Variables Set up environment variables using one of the following methods: **Note**: Some commands show no output when setting environment variables. This is normal as long as no errors appear. * One-Click Setup (Mac/Linux) * Manual Configuration (All Platforms) Run this command in your terminal: curl -O "https://nano-gpt.com/install/claude_code_nanogpt.sh" && bash ./claude_code_nanogpt.sh The script will prompt for your API key and automatically configure `~/.claude/settings.json`: { "env": { "ANTHROPIC_AUTH_TOKEN": "your_nanogpt_api_key", "ANTHROPIC_BASE_URL": "https://nano-gpt.com/api/v1", "API_TIMEOUT_MS": "600000" } } The installer now supports browser-based login. When the script starts, choose: 1. Browser login (recommended) - it will open a verification URL, wait for approval, and then save your key in `~/.claude/settings.json`. 2. Paste API key - manual fallback if you prefer. If a browser does not open automatically, copy the printed URL into your browser and approve the request.For more details on the browser login flow, see [CLI login](https://docs.nano-gpt.com/integrations/cli-login) . **macOS & Linux**: Edit `~/.claude/settings.json` (create the file if it doesn’t exist): { "env": { "ANTHROPIC_AUTH_TOKEN": "your_nanogpt_api_key", "ANTHROPIC_BASE_URL": "https://nano-gpt.com/api/v1" } } **Windows Cmd**: setx ANTHROPIC_AUTH_TOKEN your_nanogpt_api_key setx ANTHROPIC_BASE_URL https://nano-gpt.com/api/v1 **Windows PowerShell**: [System.Environment]::SetEnvironmentVariable('ANTHROPIC_AUTH_TOKEN', 'your_nanogpt_api_key', 'User') [System.Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL', 'https://nano-gpt.com/api/v1', 'User') Replace `your_nanogpt_api_key` with your actual API key. A new terminal window is required for changes to take effect. [​](https://docs.nano-gpt.com/integrations/claude-code#step-3-start-using-claude-code) Step 3: Start Using Claude Code ------------------------------------------------------------------------------------------------------------------------- Once configured, start Claude Code in your terminal: cd your-project-directory claude > If prompted with “Do you want to use this API key,” select “Yes.” Grant Claude Code permission to access files in your folder and you’re ready to go. * * * [​](https://docs.nano-gpt.com/integrations/claude-code#faq) FAQ ------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/integrations/claude-code#what-models-does-this-use) What Models Does This Use? Claude Code sends its selected model ID to NanoGPT. To choose our current Claude recommendations explicitly, add these variables to the `env` section of `~/.claude/settings.json`: { "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5.5", "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-5.5", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-latest" } | Claude Code Model | NanoGPT Routes To | | --- | --- | | Opus | Claude Opus 5.5 | | Sonnet | Claude Sonnet 5.5 | | Haiku | Claude Haiku 5.5 (adaptive thinking) | These settings select the public NanoGPT model IDs shown above. Haiku Latest now uses Haiku 5.5 with a 1M-token context window and 128K maximum output. Its adaptive thinking defaults to medium effort. Existing configurations pinned to Haiku 4.5 keep using Haiku 4.5. ### [​](https://docs.nano-gpt.com/integrations/claude-code#can-i-use-other-models) Can I Use Other Models? Yes. NanoGPT supports 400+ models. You can configure Claude Code to use different models by adding model mappings to your `~/.claude/settings.json`: { "env": { "ANTHROPIC_AUTH_TOKEN": "your_nanogpt_api_key", "ANTHROPIC_BASE_URL": "https://nano-gpt.com/api/v1", "ANTHROPIC_DEFAULT_SONNET_MODEL": "openai/gpt-6.1-sol", "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5.5", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "google/gemini-flash-latest" } } Recommended models: | Use Case | Recommended Model | | --- | --- | | Best overall | `openai/gpt-6.1-sol`, `anthropic/claude-opus-5.5` | | Fast/cheap | `google/gemini-flash-latest` | List available models with `GET https://nano-gpt.com/api/v1/models`. ### [​](https://docs.nano-gpt.com/integrations/claude-code#configuration-not-working) Configuration Not Working? If your configuration changes don’t take effect: 1. **Restart Claude Code**: Close all Claude Code windows, open a new terminal, and run `claude` again 2. **Check JSON syntax**: Ensure your `settings.json` has valid JSON (no trailing commas, proper quotes) 3. **Reset configuration**: Delete `~/.claude/settings.json` and reconfigure from scratch ### [​](https://docs.nano-gpt.com/integrations/claude-code#how-do-i-check-my-configuration) How Do I Check My Configuration? Run `/status` inside Claude Code to see your current model configuration. ### [​](https://docs.nano-gpt.com/integrations/claude-code#recommended-claude-code-version) Recommended Claude Code Version We recommend using the latest version of Claude Code: # Check current version claude --version # Upgrade to latest claude update NanoGPT is compatible with Claude Code 1.0.0 and newer. ### [​](https://docs.nano-gpt.com/integrations/claude-code#how-is-this-different-from-using-anthropic-directly) How Is This Different From Using Anthropic Directly? | Feature | Anthropic Direct | NanoGPT | | --- | --- | --- | | Pricing | Monthly subscription or API credits | Pay-as-you-go, no minimums | | Models | Claude only | Claude + 400 other models | | Billing | Separate Anthropic account | Single NanoGPT account | | Rate limits | Anthropic limits | NanoGPT limits | ### [​](https://docs.nano-gpt.com/integrations/claude-code#need-help) Need Help? * Check your balance at [nano-gpt.com/balance](https://nano-gpt.com/balance) * View API usage at [nano-gpt.com/usage](https://nano-gpt.com/usage) * Create or manage API keys at [nano-gpt.com/api](https://nano-gpt.com/api) * Contact support via the chat widget on [nano-gpt.com](https://nano-gpt.com/) --- # Context Memory - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#overview) Overview ---------------------------------------------------------------------------------------------- Large Language Models are limited by their context window. As conversations grow, models forget details, degrade in quality, or hit hard limits. **Context Memory** solves this with lossless, hierarchical compression of your entire conversation history, enabling unlimited-length coding sessions and conversations while preserving full awareness. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#the-problem) The Problem ---------------------------------------------------------------------------------------------------- Traditional memory solutions are semantic and store general facts. They miss episodic memory: recalling specific events at the right level of detail. Simple summarization drops critical details, while RAG surfaces isolated chunks without surrounding context. Without proper episodic memory: * Important details get lost during summarization * Conversations are cut short when context limits are reached * Agents lose track of previous work [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#how-it-works) How It Works ------------------------------------------------------------------------------------------------------ Context Memory builds a tree where upper levels contain summaries and lower levels preserve verbatim detail. Relevant sections are expanded while others remain compressed: * High-level summaries provide overall context * Mid-level sections explain relationships * Verbatim details are retrieved precisely when needed Example from a coding session: Token estimation function refactoring ├── Initial user request ├── Refactoring to support integer inputs ├── Error: "exceeds the character limit" │ └── Fixed by changing test params from strings to integers └── Variable name refactoring Ask, “What errors did we encounter?” and the relevant section expands automatically—no overload, no missing context. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#benefits) Benefits ---------------------------------------------------------------------------------------------- * **For Developers**: Long coding sessions without losing context; agents learn from past mistakes; documentation retains project-wide context * **For Conversations**: Extended discussions with continuity; research that compounds; complex problem-solving with full history [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#use-cases) Use Cases ------------------------------------------------------------------------------------------------ * **Role‑playing and Storytelling**: Preserve 500k+ tokens of story history while delivering 8k–20k tokens of perfectly relevant context * **Software Development**: Summaries keep the big picture; verbatim code snippets are restored only when needed—no overload, no omissions [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#using-context-memory) Using Context Memory ---------------------------------------------------------------------------------------------------------------------- You can enable Context Memory in the `POST /v1/chat/completions` endpoint in two ways: * **Model suffix**: Append `:memory` to any model name * **Header**: Add `memory: true` * **Combine**: Use with web search via `:online:memory` For complete suffix composition rules, see [Model Suffixes](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes) . Python JavaScript cURL import requests BASE_URL = "https://nano-gpt.com/api/v1" API_KEY = "YOUR_API_KEY" headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" } # Use the :memory suffix payload = { "model": "openai/gpt-6.1-sol:memory", "messages": [\ {"role": "user", "content": "Remember our plan and continue from step 3."}\ ] } r = requests.post(f"{BASE_URL}/chat/completions", headers=headers, json=payload) print(r.json()) const BASE_URL = "https://nano-gpt.com/api/v1"; const API_KEY = "YOUR_API_KEY"; // Enable memory via header const res = await fetch(`${BASE_URL}/chat/completions`, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', 'memory': 'true' }, body: JSON.stringify({ model: 'openai/gpt-6.1-sol', messages: [{ role: 'user', content: 'Continue the previous discussion but keep all earlier decisions.' }] }) }); const data = await res.json(); # Memory + Web Search combined curl -X POST https://nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-6.1-sol:online:memory", "messages": [\ {"role": "user", "content": "Research alternatives we discussed and continue our plan."}\ ] }' [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#retention-and-caching) Retention and Caching ------------------------------------------------------------------------------------------------------------------------ * **Default retention**: 30 days. * **Configure via model suffix**: `:memory-` where `` is 1..365 * Example: `openai/gpt-6.1-sol:memory-90` * **Configure via header**: `memory_expiration_days: ` (1..365) * Example: curl -X POST https://nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "memory: true" \ -H "memory_expiration_days: 45" \ -d '{ "model": "openai/gpt-6.1-sol", "messages": [{"role": "user", "content": "Hello"}] }' * **Precedence**: If both suffix and header are provided, the header value takes precedence for retention. * **Data lifecycle**: The compressed chat state is retained server‑side for the configured period (or until you delete the conversation). When you delete conversations locally, no memory data persists on Polychat’s systems. * **Caching**: The Context Memory backend may cache portions of repeated prefixes and report them as cached input tokens in usage. Cached input tokens (when present) are billed at the cached input rate (see Pricing below). [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#technical-details) Technical Details ---------------------------------------------------------------------------------------------------------------- Context Memory is implemented as a B‑tree with lossless compression over message histories. Upper nodes store summaries; leaves retain verbatim excerpts relevant to recent turns. Retrieval returns details contextualized by their summaries—unlike RAG which returns isolated chunks. Using messages as identifiers supports: * Natural conversation branching * Easy reversion to earlier states * No complex indexing Compression targets 8k–20k tokens of output—about 10% of Claude’s context window—while preserving access to full history. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#privacy-&-partnership) Privacy & Partnership ------------------------------------------------------------------------------------------------------------------------ We partner with **Polychat** to provide this technology. * API usage of Context Memory does not send data to Google Analytics or use cookies * Only your conversation messages are sent to Polychat for compression * No email, IP address, or other metadata is shared beyond prompts * When you delete conversations locally, no memory data persists on Polychat’s systems See Polychat’s full privacy policy at [https://polychat.co/legal/privacy](https://polychat.co/legal/privacy) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#pricing) Pricing -------------------------------------------------------------------------------------------- Context Memory is billed as a separate feature, in addition to your model inference costs. * **Input (non-cached)**: $3.75 per 1M tokens * **Input (cached)**: $1.00 per 1M tokens * **Output**: $1.25 per 1M tokens Typical usage is often ~8k–20k tokens per session, but depends on your conversation length and how much needs to be expanded. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/context-memory#getting-started) Getting Started ------------------------------------------------------------------------------------------------------------ 1. Append `:memory` to any model name 2. Or send the `memory: true` header 3. Optionally combine with other features like `:online` Context Memory ensures your AI remembers everything that matters—for coding, research, and long‑form conversations. --- # Image Models - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/image-models#content-area) Image Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/image-models import requests url = "https://api.nano-gpt.com/api/v1/image-models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/image-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/image-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/image-models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/image-models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/image-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body GET / api / v1 / image-models Try it Image Models cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/image-models import requests url = "https://api.nano-gpt.com/api/v1/image-models" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/image-models', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/image-models",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/image-models" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/image-models") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/image-models") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#overview) Overview --------------------------------------------------------------------------------------- Use `GET /api/v1/image-models` to discover the currently available image models and their capabilities. Do not hardcode image model capability tables in your client; model availability and supported parameters can change. For new integrations using the normalized Image API, prefer [`GET /api/v1/images/models`](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models) . That newer route returns model-specific `supported_parameters`, endpoint metadata links, and input-reference capabilities for use with [`POST /api/v1/images`](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate) . This endpoint is cacheable. Refresh it periodically and handle new fields as additive. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#endpoint) Endpoint --------------------------------------------------------------------------------------- GET https://api.nano-gpt.com/api/v1/image-models [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#authentication) Authentication --------------------------------------------------------------------------------------------------- Authentication is optional. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#query-parameters) Query Parameters ------------------------------------------------------------------------------------------------------- | Parameter | Type | Default | Description | | --- | --- | --- | --- | | `detailed` | boolean | `true` | Include names, descriptions, pricing, capabilities, and supported parameters. | [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#response) Response --------------------------------------------------------------------------------------- { "object": "list", "data": [\ {\ "id": "pruna-ai/p-image/text-to-image",\ "object": "model",\ "created": 1778544000,\ "owned_by": "prunaai",\ "name": "P-Image",\ "description": "Fast text-to-image generation for low-cost drafts, social visuals, and rapid creative iteration.",\ "architecture": {\ "modality": "text->image",\ "input_modalities": ["text"],\ "output_modalities": ["image"]\ },\ "pricing": {\ "per_image": {\ "1024*1024": 0.005,\ "1376*768": 0.005\ },\ "currency": "USD"\ },\ "capabilities": {\ "image_generation": true,\ "image_to_image": false,\ "inpainting": false,\ "nsfw": false\ },\ "supported_parameters": {\ "resolutions": ["1024x1024", "1376x768", "1184x896"],\ "max_images": 4\ },\ "icon_url": "/icons/PrunaAI.svg",\ "tags": ["text-to-image", "prunaai", "wavespeed"],\ "category": "image"\ }\ ], "meta": { "count": 169, "generated_at": "2026-05-14T00:00:00.000Z" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#supported-parameters) Supported Parameters --------------------------------------------------------------------------------------------------------------- Supported parameters vary by model. Common fields include: * `resolutions`: array of supported resolution values for this model. * `max_images`: maximum number of images that can be requested at once. * `rendering_speed`: available rendering speed values, when the model exposes speed tiers. * `fixed_image_count`: fixed output count for models that do not allow custom `n`. Use `supported_parameters.resolutions` to populate resolution or size controls. Treat the values as model-specific strings. Most image generation models use pixel dimensions such as `1024x1024`, but some models use values such as `auto`, aspect ratios, quality tiers, or scale factors. Use the model’s `supported_parameters` and `capabilities` objects to decide which controls to show and which request fields to send. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#fields) Fields ----------------------------------------------------------------------------------- | Field | Type | Description | | --- | --- | --- | | `id` | string | Model ID to pass to image generation or image editing endpoints. | | `object` | string | Always `model`. | | `created` | integer | Unix timestamp derived from the model’s added date. | | `owned_by` | string | Provider or owner identifier. | | `name` | string | Human-readable model name. | | `description` | string | Short model description. | | `architecture` | object | Modality metadata, including input and output modalities. | | `pricing` | object | USD pricing metadata. Shape can vary by model. | | `capabilities` | object | Feature flags such as `image_generation`, `image_to_image`, and `inpainting`. | | `capabilities.nsfw` | boolean | Whether the model is uncensored / NSFW-capable. | | `supported_parameters` | object | Model-specific parameters such as sizes, counts, quality settings, seeds, or image input controls. | | `supported_parameters.resolutions` | string\[\] | Model-specific supported output resolution values. Usually pixel dimensions like `1024x1024`; may also be symbolic values such as `auto` or model-specific scale factors. | | `supported_parameters.max_images` | integer | Maximum number of images the model supports per request. | | `supported_parameters.rendering_speed` | string\[\] | Optional list of rendering speed tiers. Present only for models that expose speed choices. | | `supported_parameters.fixed_image_count` | integer | Optional fixed output image count. Present when the model always returns a fixed number of images. | | `icon_url` | string | Optional provider icon path. | | `tags` | string\[\] | Optional model tags. | | `category` | string | Model category. Usually `image`. | `supported_parameters`, including `supported_parameters.resolutions`, is included only in detailed responses. `detailed=true` is the default. If you pass `detailed=false`, each item may include only basic identifiers such as `id`, `object`, `created`, and `owned_by`. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#example) Example ------------------------------------------------------------------------------------- curl "https://api.nano-gpt.com/api/v1/image-models?detailed=true" \ -H "Authorization: Bearer $NANOGPT_API_KEY" [​](https://docs.nano-gpt.com/api-reference/endpoint/image-models#notes) Notes --------------------------------------------------------------------------------- * Supported parameters vary by model. * Use this endpoint instead of hardcoding media model capabilities. * The response is cacheable, but model availability can change. * Pricing values are in USD unless otherwise documented in the response. --- # CLI Device Login - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/cli-login#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/cli-login#nanogpt-cli-device-login-integration-guide) NanoGPT CLI Device Login Integration Guide ============================================================================================================================================== This guide explains how to integrate device login into your CLI application so users can authenticate without embedding a browser. [​](https://docs.nano-gpt.com/integrations/cli-login#overview) Overview -------------------------------------------------------------------------- The NanoGPT CLI device login flow works like the GitHub CLI or Claude Code login: 1. Your CLI requests a login code from NanoGPT. 2. User opens a URL in their browser and signs in. 3. User approves the CLI access. 4. Your CLI receives an API key (`sk-nano-...`). [​](https://docs.nano-gpt.com/integrations/cli-login#step-1-start-the-login-flow) Step 1: Start the login flow ----------------------------------------------------------------------------------------------------------------- Make a POST request to initiate login: curl -X POST "https://nano-gpt.com/api/cli-login/start" \ -H "Content-Type: application/json" \ -d '{"client_name": "your-app-name"}' ### [​](https://docs.nano-gpt.com/integrations/cli-login#request-body) Request body | Field | Type | Required | Description | | --- | --- | --- | --- | | `client_name` | string | No | Your application name (max 64 chars). Used to identify the API key in the user’s account. | ### [​](https://docs.nano-gpt.com/integrations/cli-login#response) Response { "device_code": "0Reyai4sGnBE8em8lMLRxDhC-XtQMC2obf8hnVDUWws", "user_code": "VS8Q-ZY3Q", "verification_uri": "https://nano-gpt.com/cli-login/verify", "verification_uri_complete": "https://nano-gpt.com/cli-login/verify?code=VS8Q-ZY3Q", "expires_in": 600, "interval": 2 } | Field | Description | | --- | --- | | `device_code` | Secret token for polling. Keep this secure and do not display to the user. | | `user_code` | Human-readable code displayed on the approval page. | | `verification_uri` | Base URL for the user to visit. | | `verification_uri_complete` | Full URL with the code pre-filled. Display this to the user. | | `expires_in` | Seconds until the code expires (600 = 10 minutes). | | `interval` | Recommended polling interval in seconds. | [​](https://docs.nano-gpt.com/integrations/cli-login#step-2-direct-the-user-to-approve) Step 2: Direct the user to approve ----------------------------------------------------------------------------------------------------------------------------- Display the `verification_uri_complete` URL to the user. They should open it in their browser. Example output in your CLI: To authenticate, open this URL in your browser: https://nano-gpt.com/cli-login/verify?code=VS8Q-ZY3Q Waiting for approval... When the user opens the URL: 1. They sign in with their NanoGPT account (Google, Discord, etc.). 2. They see the verification code and click “Approve”. 3. They can close the browser and return to the CLI. [​](https://docs.nano-gpt.com/integrations/cli-login#step-3-poll-for-approval) Step 3: Poll for approval ----------------------------------------------------------------------------------------------------------- Poll the status endpoint until you receive the API key: curl -X POST "https://nano-gpt.com/api/cli-login/poll" \ -H "Content-Type: application/json" \ -d '{"device_code": "0Reyai4sGnBE8em8lMLRxDhC-XtQMC2obf8hnVDUWws"}' ### [​](https://docs.nano-gpt.com/integrations/cli-login#response-codes) Response codes | Status | Response | Action | | --- | --- | --- | | `202` | `{"status": "authorization_pending"}` | Continue polling | | `200` | `{"status": "approved", "key": "sk-nano-..."}` | Success. Store the key | | `410` | `{"status": "expired"}` | Code expired. Restart the flow | | `409` | `{"status": "consumed"}` | Key already delivered. Check your storage | | `404` | `{"error": "invalid_code"}` | Invalid `device_code` | ### [​](https://docs.nano-gpt.com/integrations/cli-login#polling-example-bash) Polling example (bash) while true; do response=$(curl -sS -X POST "https://nano-gpt.com/api/cli-login/poll" \ -H "Content-Type: application/json" \ -d "{\"device_code\":\"$DEVICE_CODE\"}") echo "$response" if echo "$response" | grep -q '"status":"approved"'; then API_KEY=$(echo "$response" | jq -r '.key') echo "Success! API key: $API_KEY" break fi if echo "$response" | grep -q '"status":"expired"'; then echo "Code expired. Please restart." exit 1 fi sleep 2 done [​](https://docs.nano-gpt.com/integrations/cli-login#step-4-use-the-api-key) Step 4: Use the API key ------------------------------------------------------------------------------------------------------- Once you have the API key, use it for all NanoGPT API requests. List available models: curl "https://nano-gpt.com/api/v1/models" \ -H "Authorization: Bearer sk-nano-..." Chat completions (OpenAI-compatible): curl "https://nano-gpt.com/api/v1/chat/completions" \ -H "Authorization: Bearer sk-nano-..." \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-6.1-sol", "messages": [{"role": "user", "content": "Hello from my CLI!"}], "stream": true }' [​](https://docs.nano-gpt.com/integrations/cli-login#complete-integration-example) Complete integration example ------------------------------------------------------------------------------------------------------------------ import time import requests def nanogpt_login(client_name="my-cli-app"): """Authenticate with NanoGPT using device login flow.""" start_response = requests.post( "https://nano-gpt.com/api/cli-login/start", json={"client_name": client_name} ) start_data = start_response.json() device_code = start_data["device_code"] verification_url = start_data["verification_uri_complete"] interval = start_data["interval"] print("\nTo authenticate, open this URL in your browser:\n") print(f" {verification_url}\n") print("Waiting for approval...") while True: poll_response = requests.post( "https://nano-gpt.com/api/cli-login/poll", json={"device_code": device_code} ) if poll_response.status_code == 200: poll_data = poll_response.json() if poll_data.get("status") == "approved": print("\nAuthentication successful!") return poll_data["key"] elif poll_response.status_code == 410: raise Exception("Login expired. Please try again.") time.sleep(interval) api_key = nanogpt_login("my-awesome-cli") print(f"API Key: {api_key}") [​](https://docs.nano-gpt.com/integrations/cli-login#api-key-management) API key management ---------------------------------------------------------------------------------------------- * API keys created through this flow are named `CLI ()` in the user’s account. * Users can view and revoke keys at [https://nano-gpt.com/api](https://nano-gpt.com/api) . * If the same `client_name` is used multiple times, the existing key is reused. * Keys do not expire unless manually revoked. [​](https://docs.nano-gpt.com/integrations/cli-login#error-handling) Error handling -------------------------------------------------------------------------------------- | Scenario | How to handle | | --- | --- | | User does not approve in time | Codes expire after 10 minutes. Restart the flow. | | Invalid `device_code` | Check you are using the exact code from `/start`. | | 401 on API requests | Key may have been revoked. Re-authenticate. | | Rate limited | `/start`: 10 req/min, `/poll`: 60 req/min per IP. Use the recommended interval. | [​](https://docs.nano-gpt.com/integrations/cli-login#security-best-practices) Security best practices -------------------------------------------------------------------------------------------------------- 1. Store the API key securely (OS keychain, encrypted config, or secure credential storage). 2. Never log or display the `device_code`. 3. Handle key revocation by prompting the user to re-authenticate on 401s. 4. Use HTTPS only (`https://nano-gpt.com`). [​](https://docs.nano-gpt.com/integrations/cli-login#rate-limits) Rate limits -------------------------------------------------------------------------------- | Endpoint | Limit | | --- | --- | | `POST /api/cli-login/start` | 10 requests per minute per IP | | `POST /api/cli-login/poll` | 60 requests per minute per IP | [​](https://docs.nano-gpt.com/integrations/cli-login#summary) Summary ------------------------------------------------------------------------ | Endpoint | Method | Purpose | | --- | --- | --- | | `/api/cli-login/start` | POST | Start login, get `device_code` and verification URL | | `/api/cli-login/poll` | POST | Poll for approval status and retrieve API key | | `/cli-login/verify?code=...` | GET | Browser page where the user approves | --- # Model Suffixes - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#model-suffixes) Model Suffixes ========================================================================================================== Append supported suffixes to the `model` value to request optional behavior for a single request. Most suffixes are stripped before the base model is routed. Model identity suffixes, such as supported `:thinking` variants, are preserved because they identify a distinct model or alias. Suffix parsing is case-insensitive for provider routing and provider suffixes. Avoid combining multiple suffixes that make conflicting provider-selection requests. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#provider-routing-preference-suffixes) Provider Routing Preference Suffixes ------------------------------------------------------------------------------------------------------------------------------------------------------ These apply only to provider-selection-capable models. | Suffix | Meaning | | --- | --- | | `:speed` | Pick the provider with the best estimated completion time, using TTFT plus TPS. | | `:fast` | Alias for `:speed`. | | `:throughput` | Pick the provider with the highest tokens per second. | | `:latency` | Pick the provider with the lowest time to first token. | | `:price` | Pick the lowest estimated request cost, based on expected input/output usage and customer-facing rates, including opt-in providers. Stays on Auto routing, billed at the Auto price, when Auto is no more expensive. | | `:cheap` | Alias for `:price`. | | `:floor` | Alias for `:price`. | | `:tools` | Route to a tools-capable provider path for models that support tools provider selection. | | `:caching` | Require routing to a cache-capable provider, equivalent to top-level `caching: true`. | | `:cache` | Alias for `:caching`. | | `:cached` | Alias for `:caching`. | { "model": "zai-org/glm-5:fast", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "zai-org/glm-5:cheap", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "moonshotai/kimi-k2.6:thinking:caching", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "moonshotai/kimi-k2.6:tools", "messages": [{ "role": "user", "content": "Hello" }], "tools": [{ "type": "function", "function": { "name": "lookup", "parameters": { "type": "object", "properties": {} } } }] } Rules: * Routing preference suffixes only consider user-selectable providers. Internal routing-only providers are excluded. * Routing preference suffixes are stripped before model mapping/routing. Non-routing identity suffixes such as `:thinking` are preserved. * Do not combine `:speed`, `:fast`, `:throughput`, `:latency`, `:price`, `:cheap`, or `:floor` with `X-Provider`, body `provider`, or a provider model suffix. * Do not combine `:tools` with a routing preference suffix, `X-Provider`, body `provider`, a provider model suffix, or `caching: true`. * Do not combine `:caching`, `:cache`, or `:cached` with `:tools`, `X-Provider`, body `provider`, a provider model suffix, or another routing preference suffix. * Routing preference requests are billed like explicit provider-selection requests. * Conflict error codes use the existing `speed_suffix_*` family for API compatibility, even when the suffix is not literally `:speed`. Price ranking is recalculated for every request and may switch providers, reducing cache reuse. It does not predict future cache hits. See [price routing, caps, and cache reuse](https://docs.nano-gpt.com/api-reference/miscellaneous/provider-selection#price-caps-and-cache-reuse) . The caching suffixes are provider-capability routing, not prompt-cache annotation. They do not add Anthropic-style `cache_control` markers, configure cache TTLs, or force a cache write. For details, see [Prompt Caching](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#cache-capable-provider-routing) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#provider-suffixes) Provider Suffixes ---------------------------------------------------------------------------------------------------------------- The API accepts a trailing provider suffix for public user-selectable provider IDs: { "model": "zai-org/glm-5:cerebras", "messages": [{ "role": "user", "content": "Hello" }] } Recommended: use `X-Provider` for explicit provider overrides. The API also accepts a trailing provider suffix for user-selectable providers, such as `model-id:cerebras`, but `X-Provider` is clearer and easier to validate against provider-discovery responses. Provider suffixes must match a public user-selectable provider ID. They are case-insensitive, cannot be combined with routing preference suffixes or `:tools`, and are billed like explicit provider selection. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#web-search-suffixes) Web Search Suffixes -------------------------------------------------------------------------------------------------------------------- | Suffix | Meaning | | --- | --- | | `:online` | Default web search, standard depth. GPT-5+ and o-series models use native search unless a provider is explicit; other models use Linkup. | | `:online/native` | The model’s own search, on GPT-5+ and o-series, Claude 4+, Gemini 3+, and Grok 4.20+ (not image, multi-agent, or `:free` variants). Other models fall back to Linkup. | | `:online/linkup` | Linkup standard. | | `:online/linkup-deep` | Linkup deep. | | `:online/tavily` | Tavily standard. | | `:online/tavily-deep` | Tavily deep. | | `:online/brave` | Brave standard. | | `:online/brave-deep` | Brave deep. | | `:online/sofya` | Sofya search. Returns extracted page content; Sofya currently supports standard depth only. | | `:online/exa-fast` | Exa fast. | | `:online/exa-auto` | Exa auto. | | `:online/exa-neural` | Exa neural. | | `:online/exa-deep` | Exa deep. | | `:online/exa-deep-reasoning` | Exa deep-reasoning. | | `:online/exa-instant` | Exa instant. | | `:online/kagi` | Kagi standard search. | | `:online/kagi-web` | Kagi standard web. | | `:online/kagi-news` | Kagi standard news. | | `:online/kagi-search` | Kagi deep search. | | `:online/perplexity` | Perplexity standard. | | `:online/perplexity-deep` | Perplexity deep. | | `:online/valyu` | Valyu standard, all sources. | | `:online/valyu-deep` | Valyu deep, all sources. | | `:online/valyu-web` | Valyu standard, web only. | | `:online/valyu-web-deep` | Valyu deep, web only. | | `:online/firecrawl` | Firecrawl standard. | | `:online/firecrawl-deep` | Firecrawl deep. | Web search suffixes can compose with memory and reasoning-exclude suffixes. If request body `web_search.enabled` (or the `webSearch` / legacy `linkup` alias) is true, body configuration takes precedence over model suffix configuration. `web_search: false` does not switch off a suffix’s search. See [Web Search](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion#web-search) . Search has separate charges: see [hosted web search pricing](https://docs.nano-gpt.com/api-reference/endpoint/web-search#pricing-hosted-key) . Chat requests also incur model token charges. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#memory-suffixes) Memory Suffixes ------------------------------------------------------------------------------------------------------------ | Suffix | Meaning | | --- | --- | | `:memory` | Enable Context Memory with default 30-day retention. | | `:memory-` | Enable Context Memory with retention clamped to 1..365 days. | Header `memory_expiration_days` takes precedence over `:memory-`. `memory: false` in the request body explicitly disables memory even if the model has a memory suffix. Memory can compose with web search, for example `openai/gpt-6.1-sol:online:memory-90`. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#pii-redaction-suffixes) PII Redaction Suffixes -------------------------------------------------------------------------------------------------------------------------- | Suffix | Meaning | | --- | --- | | `:redaction` | Enable PII redaction for this request. | | `:redacted` | Alias for `:redaction`. | | `:piiredaction` | Alias for `:redaction`. | | `:piiredacted` | Alias for `:redaction`. | Redaction suffixes are stripped before model routing and can compose with other supported NanoGPT suffixes, such as `:online`. If a request explicitly enables redaction with a model suffix, redaction remains enabled even if an account-level or API-key default would otherwise be disabled for that request. For details, pricing, and limitations, see [PII Redaction](https://docs.nano-gpt.com/api-reference/miscellaneous/pii-redaction) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#reasoning-effort-suffixes) Reasoning Effort Suffixes -------------------------------------------------------------------------------------------------------------------------------- If a custom-provider client such as Chatbox or Cherry Studio does not expose a reasoning-effort setting, enter the effort in the model ID: { "model": "openai/gpt-latest:reasoning-effort/high", "messages": [{ "role": "user", "content": "Analyze the tradeoffs of this design." }] } On Chat Completions, this is equivalent to `model: "openai/gpt-latest"` with `reasoning_effort: "high"`. NanoGPT removes the suffix before model checks and routing, then resolves the base ID or compatibility alias normally. These are request shortcuts, not additional models: they do not appear in the model picker or `/v1/models`. Add the suffixed ID manually in your client; the shortcut does not enable the client’s reasoning-setting UI. | Suffix | Requested effort | | --- | --- | | `:reasoning-effort/none` | `none` — request disabled reasoning where supported | | `:reasoning-effort/low` | `low` | | `:reasoning-effort/medium` | `medium` | | `:reasoning-effort/high` | `high` | | `:reasoning-effort/xhigh` | `xhigh` | | `:reasoning-effort/max` | `max` | Supported on `/v1/chat/completions`, `/v1/responses`, and `/v1/messages`, for streaming and non-streaming requests. Responses uses `reasoning.effort`; Messages uses `output_config.effort` for enabled reasoning levels. For `none`, Messages instead supplies `thinking: { type: "disabled" }`, because `output_config.effort` does not accept `none`. Tool-call turns and post-tool continuations accept the same suffix; include it on each request where you want the default effort. Rules: * Explicit request-body generation settings take precedence, including an effort, thinking budget, or disabled-thinking setting. For `none`, an explicit enabled-thinking setting also takes precedence. The suffix supplies a default only. Existing endpoint rules still determine precedence between body parameters. * Reasoning visibility is separate: `reasoning.exclude: true` hides reasoning without cancelling the suffix’s requested effort. On endpoints supporting `:reasoning-exclude`, that suffix can also be combined with the effort suffix. * `none` requests disabled reasoning; it is not just an output-visibility filter. Models that require reasoning keep their existing restrictions. Use `:reasoning-exclude` where supported if you only want to hide reasoning output. * Effort support remains model/provider-specific. A suffix does not add reasoning capability or new effort levels to a model. `max` and `xhigh` are distinct inputs; existing provider-specific mappings still apply. * Effort suffixes are case-insensitive and can appear before or after other supported suffixes, such as `:thinking`, `:speed`, or a provider suffix. Other suffixes keep their normal compatibility and billing rules. * Use one effort suffix. If repeated, the rightmost recognized effort wins. * Unknown effort values are not stripped or silently replaced. They remain part of the model ID and are subject to normal model validation. The suffix shortcut accepts only the six values above; `minimal` remains available only through request-body controls on models that support it. { "model": "openai/gpt-latest:reasoning-effort/none", "messages": [{ "role": "user", "content": "Reply briefly." }] } { "model": "openai/gpt-latest:reasoning-effort/high:reasoning-exclude", "messages": [{ "role": "user", "content": "Solve the problem." }] } { "model": "z-ai/glm-5.3-flash:reasoning-effort/max", "messages": [{ "role": "user", "content": "Check this algorithm." }] } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#reasoning-and-thinking-suffixes) Reasoning and Thinking Suffixes -------------------------------------------------------------------------------------------------------------------------------------------- | Suffix | Meaning | | --- | --- | | `:thinking` | Model-specific thinking/reasoning variant when that exact ID or documented alias exists. | | `-thinking` | Legacy alias pattern for some model families only, not universal. | | `:` on Anthropic thinking IDs | Thinking budget suffix for mapped Anthropic thinking aliases, for example `claude-sonnet-4-thinking:8192`. | | `:reasoning-exclude` | Equivalent to `reasoning: { "exclude": true }`; hides reasoning fields/blocks and strips the suffix before routing. | `:reasoning-exclude` works on Chat Completions and Text Completions. It composes with other suffixes such as `:thinking`, `:online`, and `:memory`. `:thinking` is model identity, not provider routing, and is not universal. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#official-and-original-route-suffixes) Official and Original Route Suffixes ------------------------------------------------------------------------------------------------------------------------------------------------------ Some model families expose `:official` / `:original` aliases to force the official-provider route. These are model-specific; check the model page or provider-selection docs for supported IDs. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#conflict-rules) Conflict Rules ---------------------------------------------------------------------------------------------------------- Do not combine conflicting routing directives: { "model": "zai-org/glm-5:fast:cerebras" } { "model": "zai-org/glm-5:cheap", "provider": "cerebras" } { "model": "zai-org/glm-5:tools:fast" } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#examples) Examples ---------------------------------------------------------------------------------------------- { "model": "zai-org/glm-5:fast", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "zai-org/glm-5:cheap", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "zai-org/glm-5:thinking:fast", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "moonshotai/kimi-k2.6:thinking:caching", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "openai/gpt-6.1-sol:online/exa-instant:memory-30", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "openai/gpt-6.1-sol:redaction:online", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "anthropic/claude-opus-4.6:memory-30:online/linkup-deep:reasoning-exclude", "messages": [{ "role": "user", "content": "Hello" }] } --- # Completions - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/completion#content-area) cURL cURL curl --request POST \ --url https://nano-gpt.com/api/v1/completions \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "model": "minimax/minimax-m2.7", "prompt": "", "billing_mode": "", "billingMode": "", "provider": "", "max_tokens": 2, "temperature": 1, "top_p": 1, "stream": false, "stop": "", "frequency_penalty": 0, "presence_penalty": 0, "repetition_penalty": 0, "top_k": 123, "top_a": 123, "min_p": 0.5, "tfs": 0.5, "eta_cutoff": 123, "epsilon_cutoff": 123, "typical_p": 0.5, "mirostat_tau": 123, "mirostat_eta": 123, "min_tokens": 0, "stop_token_ids": [\ 123\ ], "include_stop_str_in_output": false, "ignore_eos": false, "no_repeat_ngram_size": 1, "custom_token_bans": [\ 123\ ], "logit_bias": {}, "logprobs": true, "prompt_logprobs": true, "seed": 123 } ' import requests url = "https://nano-gpt.com/api/v1/completions" payload = { "model": "minimax/minimax-m2.7", "prompt": "", "billing_mode": "", "billingMode": "", "provider": "", "max_tokens": 2, "temperature": 1, "top_p": 1, "stream": False, "stop": "", "frequency_penalty": 0, "presence_penalty": 0, "repetition_penalty": 0, "top_k": 123, "top_a": 123, "min_p": 0.5, "tfs": 0.5, "eta_cutoff": 123, "epsilon_cutoff": 123, "typical_p": 0.5, "mirostat_tau": 123, "mirostat_eta": 123, "min_tokens": 0, "stop_token_ids": [123], "include_stop_str_in_output": False, "ignore_eos": False, "no_repeat_ngram_size": 1, "custom_token_bans": [123], "logit_bias": {}, "logprobs": True, "prompt_logprobs": True, "seed": 123 } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ model: 'minimax/minimax-m2.7', prompt: '', billing_mode: '', billingMode: '', provider: '', max_tokens: 2, temperature: 1, top_p: 1, stream: false, stop: '', frequency_penalty: 0, presence_penalty: 0, repetition_penalty: 0, top_k: 123, top_a: 123, min_p: 0.5, tfs: 0.5, eta_cutoff: 123, epsilon_cutoff: 123, typical_p: 0.5, mirostat_tau: 123, mirostat_eta: 123, min_tokens: 0, stop_token_ids: [123], include_stop_str_in_output: false, ignore_eos: false, no_repeat_ngram_size: 1, custom_token_bans: [123], logit_bias: {}, logprobs: true, prompt_logprobs: true, seed: 123 }) }; fetch('https://nano-gpt.com/api/v1/completions', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://nano-gpt.com/api/v1/completions",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'model' => 'minimax/minimax-m2.7',\ 'prompt' => '',\ 'billing_mode' => '',\ 'billingMode' => '',\ 'provider' => '',\ 'max_tokens' => 2,\ 'temperature' => 1,\ 'top_p' => 1,\ 'stream' => false,\ 'stop' => '',\ 'frequency_penalty' => 0,\ 'presence_penalty' => 0,\ 'repetition_penalty' => 0,\ 'top_k' => 123,\ 'top_a' => 123,\ 'min_p' => 0.5,\ 'tfs' => 0.5,\ 'eta_cutoff' => 123,\ 'epsilon_cutoff' => 123,\ 'typical_p' => 0.5,\ 'mirostat_tau' => 123,\ 'mirostat_eta' => 123,\ 'min_tokens' => 0,\ 'stop_token_ids' => [\ 123\ ],\ 'include_stop_str_in_output' => false,\ 'ignore_eos' => false,\ 'no_repeat_ngram_size' => 1,\ 'custom_token_bans' => [\ 123\ ],\ 'logit_bias' => [\ \ ],\ 'logprobs' => true,\ 'prompt_logprobs' => true,\ 'seed' => 123\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://nano-gpt.com/api/v1/completions" payload := strings.NewReader("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"\",\n \"billing_mode\": \"\",\n \"billingMode\": \"\",\n \"provider\": \"\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 0,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://nano-gpt.com/api/v1/completions") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"\",\n \"billing_mode\": \"\",\n \"billingMode\": \"\",\n \"provider\": \"\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 0,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}") .asString(); require 'uri' require 'net/http' url = URI("https://nano-gpt.com/api/v1/completions") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"\",\n \"billing_mode\": \"\",\n \"billingMode\": \"\",\n \"provider\": \"\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 0,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}" response = http.request(request) puts response.read_body 200 400 { "id": "", "object": "", "created": 123, "model": "", "choices": [\ {\ "text": "",\ "index": 123,\ "logprobs": {},\ "finish_reason": "stop"\ }\ ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123 } } { "error": 123, "message": "" } POST https://nano-gpt.com/apihttps://api.nano-gpt.com/api / v1 / completions Try it cURL cURL curl --request POST \ --url https://nano-gpt.com/api/v1/completions \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "model": "minimax/minimax-m2.7", "prompt": "", "billing_mode": "", "billingMode": "", "provider": "", "max_tokens": 2, "temperature": 1, "top_p": 1, "stream": false, "stop": "", "frequency_penalty": 0, "presence_penalty": 0, "repetition_penalty": 0, "top_k": 123, "top_a": 123, "min_p": 0.5, "tfs": 0.5, "eta_cutoff": 123, "epsilon_cutoff": 123, "typical_p": 0.5, "mirostat_tau": 123, "mirostat_eta": 123, "min_tokens": 0, "stop_token_ids": [\ 123\ ], "include_stop_str_in_output": false, "ignore_eos": false, "no_repeat_ngram_size": 1, "custom_token_bans": [\ 123\ ], "logit_bias": {}, "logprobs": true, "prompt_logprobs": true, "seed": 123 } ' import requests url = "https://nano-gpt.com/api/v1/completions" payload = { "model": "minimax/minimax-m2.7", "prompt": "", "billing_mode": "", "billingMode": "", "provider": "", "max_tokens": 2, "temperature": 1, "top_p": 1, "stream": False, "stop": "", "frequency_penalty": 0, "presence_penalty": 0, "repetition_penalty": 0, "top_k": 123, "top_a": 123, "min_p": 0.5, "tfs": 0.5, "eta_cutoff": 123, "epsilon_cutoff": 123, "typical_p": 0.5, "mirostat_tau": 123, "mirostat_eta": 123, "min_tokens": 0, "stop_token_ids": [123], "include_stop_str_in_output": False, "ignore_eos": False, "no_repeat_ngram_size": 1, "custom_token_bans": [123], "logit_bias": {}, "logprobs": True, "prompt_logprobs": True, "seed": 123 } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ model: 'minimax/minimax-m2.7', prompt: '', billing_mode: '', billingMode: '', provider: '', max_tokens: 2, temperature: 1, top_p: 1, stream: false, stop: '', frequency_penalty: 0, presence_penalty: 0, repetition_penalty: 0, top_k: 123, top_a: 123, min_p: 0.5, tfs: 0.5, eta_cutoff: 123, epsilon_cutoff: 123, typical_p: 0.5, mirostat_tau: 123, mirostat_eta: 123, min_tokens: 0, stop_token_ids: [123], include_stop_str_in_output: false, ignore_eos: false, no_repeat_ngram_size: 1, custom_token_bans: [123], logit_bias: {}, logprobs: true, prompt_logprobs: true, seed: 123 }) }; fetch('https://nano-gpt.com/api/v1/completions', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://nano-gpt.com/api/v1/completions",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'model' => 'minimax/minimax-m2.7',\ 'prompt' => '',\ 'billing_mode' => '',\ 'billingMode' => '',\ 'provider' => '',\ 'max_tokens' => 2,\ 'temperature' => 1,\ 'top_p' => 1,\ 'stream' => false,\ 'stop' => '',\ 'frequency_penalty' => 0,\ 'presence_penalty' => 0,\ 'repetition_penalty' => 0,\ 'top_k' => 123,\ 'top_a' => 123,\ 'min_p' => 0.5,\ 'tfs' => 0.5,\ 'eta_cutoff' => 123,\ 'epsilon_cutoff' => 123,\ 'typical_p' => 0.5,\ 'mirostat_tau' => 123,\ 'mirostat_eta' => 123,\ 'min_tokens' => 0,\ 'stop_token_ids' => [\ 123\ ],\ 'include_stop_str_in_output' => false,\ 'ignore_eos' => false,\ 'no_repeat_ngram_size' => 1,\ 'custom_token_bans' => [\ 123\ ],\ 'logit_bias' => [\ \ ],\ 'logprobs' => true,\ 'prompt_logprobs' => true,\ 'seed' => 123\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://nano-gpt.com/api/v1/completions" payload := strings.NewReader("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"\",\n \"billing_mode\": \"\",\n \"billingMode\": \"\",\n \"provider\": \"\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 0,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://nano-gpt.com/api/v1/completions") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"\",\n \"billing_mode\": \"\",\n \"billingMode\": \"\",\n \"provider\": \"\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 0,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}") .asString(); require 'uri' require 'net/http' url = URI("https://nano-gpt.com/api/v1/completions") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"\",\n \"billing_mode\": \"\",\n \"billingMode\": \"\",\n \"provider\": \"\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 0,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}" response = http.request(request) puts response.read_body 200 400 { "id": "", "object": "", "created": 123, "model": "", "choices": [\ {\ "text": "",\ "index": 123,\ "logprobs": {},\ "finish_reason": "stop"\ }\ ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123 } } { "error": 123, "message": "" } `POST /api/v1/completions` is available on a best-effort basis for legacy OpenAI compatibility. Performance and behavior may be less consistent than `POST /api/v1/chat/completions` because not all upstream providers support the legacy completions API. `POST /api/v1/completions` supports the same model suffix parser for provider routing (`:fast`, `:cheap`, etc.) and `:reasoning-exclude`, but this endpoint remains best-effort legacy compatibility. Prefer Chat Completions for new integrations. See [Model Suffixes](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes) . The body `provider` field accepts either the existing provider ID string or a structured routing object with fields such as `order`, `only`, `ignore`, `sort`, `max_price`, `allow_fallbacks`, and `require_parameters`. See [Provider Selection > Provider Routing Object](https://docs.nano-gpt.com/api-reference/miscellaneous/provider-selection#provider-routing-object) . #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Headers [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#parameter-x-provider) X-Provider string Optional explicit provider override for supported open-source models (case-insensitive). Explicit provider selection is billed pay-as-you-go at the selected provider's price, including provider-selection markup; for subscription users it bypasses subscription coverage for that request. [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#parameter-x-billing-mode) X-Billing-Mode string Optional billing override to force pay-as-you-go without an explicit provider, or to apply saved provider preferences to subscription-included traffic (e.g., paygo). Header name is case-insensitive. #### Body application/json Parameters for text completion [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-model) model string default:minimax/minimax-m2.7 required The model to use for completion. The model value may include supported model suffixes, including web search (':online', ':online/'), memory (':memory', ':memory-'), reasoning visibility (':reasoning-exclude'), thinking variants where listed by the model catalog (':thinking'), and provider routing preferences for eligible models (':fast', ':cheap', ':caching', etc.). Examples: `"minimax/minimax-m2.7"` `"zai-org/glm-5:fast"` `"zai-org/glm-5:cheap"` `"openai/gpt-6.1-sol:online/exa-instant"` `"openai/gpt-6.1-sol:online/exa-deep-reasoning"` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-prompt) prompt string required The text prompt to complete [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-billing-mode) billing\_mode string Billing override to force pay-as-you-go without an explicit provider, or to apply saved provider preferences to subscription-included traffic. Accepted values (case-insensitive): paygo, pay-as-you-go, pay\_as\_you\_go, paid, payg. [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-billing-mode) billingMode string Alias for billing\_mode. [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-provider-one-of-0) provider stringobjectstringobject Optional provider override or structured provider routing controls for provider-selection-capable models. A string explicitly selects one provider. An object can set soft order, hard pins, exclusions, sort preference, price caps, fallback behavior, and parameter-capability requirements. [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-max-tokens) max\_tokens integer Upper bound on generated tokens. If omitted, NanoGPT does not enforce an explicit default and the routed provider/model default applies Required range: `x >= 1` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-temperature) temperature number Classic randomness control. Accepts any decimal between 0-2. If omitted, NanoGPT does not force a value and the routed provider/model default applies Required range: `0 <= x <= 2` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-top-p) top\_p number default:1 Nucleus sampling. When set below 1.0, trims candidate tokens to the smallest set whose cumulative probability exceeds top\_p. Works well as an alternative to tweaking temperature Required range: `0 <= x <= 1` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-stream) stream boolean default:false Whether to stream the response [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-stop-one-of-0) stop stringstring\[\]stringstring\[\] Stop sequences. Accepts string or array of strings. Values are passed directly to upstream providers [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-frequency-penalty) frequency\_penalty number default:0 Penalizes tokens proportionally to how often they appeared previously. Negative values encourage repetition; positive values discourage it Required range: `-2 <= x <= 2` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-presence-penalty) presence\_penalty number default:0 Penalizes tokens based on whether they appeared at all. Good for keeping the model on topic without outright banning words Required range: `-2 <= x <= 2` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-repetition-penalty) repetition\_penalty number Provider-agnostic repetition modifier (distinct from OpenAI penalties). Values >1 discourage repetition Required range: `-2 <= x <= 2` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-top-k) top\_k integer Caps sampling to the top-k highest probability tokens per step [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-top-a) top\_a number Combines top-p and temperature behavior; leave unset unless a model description explicitly calls for it [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-min-p) min\_p number Ensures each candidate token probability exceeds a floor (0-1). Helpful for stopping models from collapsing into low-entropy loops Required range: `0 <= x <= 1` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-tfs) tfs number Tail free sampling. Values between 0-1 let you shave the long tail of the distribution; 1.0 disables the feature Required range: `0 <= x <= 1` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-eta-cutoff) eta\_cutoff number Cut probabilities as soon as they fall below the specified tail threshold [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-epsilon-cutoff) epsilon\_cutoff number Cut probabilities as soon as they fall below the specified tail threshold [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-typical-p) typical\_p number Typical sampling (aka entropy-based nucleus). Works like top\_p but preserves tokens whose surprise matches the expected entropy Required range: `0 <= x <= 1` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-mirostat-mode) mirostat\_mode enum Enables Mirostat sampling for models that support it. Set to 1 or 2 to activate Available options: `0`, `1`, `2` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-mirostat-tau) mirostat\_tau number Mirostat target entropy parameter. Used when mirostat\_mode is enabled [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-mirostat-eta) mirostat\_eta number Mirostat learning rate parameter. Used when mirostat\_mode is enabled [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-min-tokens) min\_tokens integer default:0 For providers that support it, enforces a minimum completion length before stop conditions fire Required range: `x >= 0` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-stop-token-ids) stop\_token\_ids integer\[\] Numeric array that lets callers stop generation on specific token IDs. Not supported by many providers [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-include-stop-str-in-output) include\_stop\_str\_in\_output boolean default:false When true, keeps the stop sequence in the final text. Not supported by many providers [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-ignore-eos) ignore\_eos boolean default:false Allows completions to continue even if the model predicts EOS internally. Useful for long creative writing runs [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-no-repeat-ngram-size) no\_repeat\_ngram\_size integer Extension that forbids repeating n-grams of the given size. Not supported by many providers Required range: `x >= 0` [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-custom-token-bans) custom\_token\_bans integer\[\] List of token IDs to fully block [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-logit-bias) logit\_bias object Object mapping token IDs to additive logits. Works just like OpenAI's version Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-logprobs-one-of-0) logprobs booleanintegerbooleaninteger When true or a number, forwards the request to providers that support returning token-level log probabilities [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-prompt-logprobs) prompt\_logprobs boolean Requests logprobs on the prompt itself when the upstream API allows it [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#body-seed) seed integer Optional integer forwarded on model/provider routes that support seeded sampling. This may improve reproducibility but does not guarantee identical output. Results can change if NanoGPT selects a different automatic or fallback route, or if the provider changes its backend. #### Response 200 application/json Text completion response [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#response-id) id string Unique identifier for the completion [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#response-object) object string Object type, always 'text\_completion' [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#response-created) created integer Unix timestamp of when the completion was created [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#response-model) model string Model used for completion [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#response-choices) choices object\[\] Array of completion choices Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/completion#response-usage) usage object Show child attributes --- # Quickstart - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/quickstart#content-area) [​](https://docs.nano-gpt.com/quickstart#get-your-api-key) Get your API key ------------------------------------------------------------------------------ Generate an API key on our [API page](https://nano-gpt.com/api) . [​](https://docs.nano-gpt.com/quickstart#add-balance) Add Balance -------------------------------------------------------------------- If you haven’t deposited yet, add some funds to [your balance](https://nano-gpt.com/balance) . Minimum deposit is just $1, or $0.10 when using crypto. Send API requests to `https://api.nano-gpt.com`. The direct API host allows larger uploads and longer-running calls than the website host. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for SDK base URLs. ### [​](https://docs.nano-gpt.com/quickstart#api-usage-examples) API usage examples Text Generation Here’s a simple example using our OpenAI-compatible chat completions endpoint: import requests import json BASE_URL = "https://api.nano-gpt.com/api/v1" API_KEY = "YOUR_API_KEY" # Replace with your API key headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json", "Accept": "text/event-stream" # Required for SSE streaming } def stream_chat_completion(messages, model="minimax/minimax-m2.7"): """ Send a streaming chat completion request using the OpenAI-compatible endpoint. """ data = { "model": model, "messages": messages, "stream": True # Enable streaming } response = requests.post( f"{BASE_URL}/chat/completions", headers=headers, json=data, stream=True ) if response.status_code != 200: raise Exception(f"Error: {response.status_code}") for line in response.iter_lines(): if line: line = line.decode('utf-8') if line.startswith('data: '): line = line[6:] if line == '[DONE]': break try: chunk = json.loads(line) if chunk['choices'][0]['delta'].get('content'): yield chunk['choices'][0]['delta']['content'] except json.JSONDecodeError: continue # Example usage messages = [\ {"role": "system", "content": "You are a helpful assistant."},\ {"role": "user", "content": "Please explain the concept of artificial intelligence."}\ ] try: print("Assistant's Response:") for content_chunk in stream_chat_completion(messages): print(content_chunk, end='', flush=True) print("") except Exception as e: print(f"Error: {str(e)}") #### [​](https://docs.nano-gpt.com/quickstart#routing-preferences) Routing preferences For supported open-source models, you can request routing preferences with model suffixes: { "model": "zai-org/glm-5:fast", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "zai-org/glm-5:cheap", "messages": [{ "role": "user", "content": "Hello" }] } { "model": "moonshotai/kimi-k2.6:thinking:caching", "messages": [{ "role": "user", "content": "Hello" }] } Use `:fast` for fastest estimated completion, `:cheap` for lowest provider price, and `:caching` to require a cache-capable provider. These are pay-as-you-go provider-selection requests. See [Model Suffixes](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes) for the full list.For more detailed examples and other text generation endpoints, check out our [Text Generation Guide](https://docs.nano-gpt.com/api-reference/text-generation) . Image Generation #### [​](https://docs.nano-gpt.com/quickstart#openai-compatible-endpoint-v1/images/generations) OpenAI-Compatible Endpoint (v1/images/generations) You can also generate images using our OpenAI-compatible endpoint: curl https://api.nano-gpt.com/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "hidream", "prompt": "A serene landscape at sunset", "n": 1, "size": "1024x1024" }' Here’s an example using the OpenAI-compatible endpoint in Python: import base64 import requests API_KEY = "YOUR_API_KEY" def generate_image(prompt, model="hidream", size="1024x1024"): response = requests.post( "https://api.nano-gpt.com/v1/images/generations", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }, json={ "model": model, "prompt": prompt, "n": 1, "size": size, "response_format": "b64_json" } ) response.raise_for_status() return response.json() # Example usage prompt = "A serene landscape with mountains and a lake at sunset, digital art style" result = generate_image(prompt) image_bytes = base64.b64decode(result["data"][0]["b64_json"]) with open("generated_image.png", "wb") as f: f.write(image_bytes) print("Image generated successfully!") print("Image saved as 'generated_image.png'") For more detailed examples and other image generation options, check out our [Image Generation Guide](https://docs.nano-gpt.com/api-reference/image-generation) . Video Generation Submit a video generation job, then poll the status endpoint until the video is ready: RUN_ID=$(curl -s -X POST https://api.nano-gpt.com/api/generate-video \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "veo2-video", "prompt": "A cinematic shot of a mountain lake at sunrise" }' | jq -r '.runId') curl "https://api.nano-gpt.com/api/video/status?requestId=$RUN_ID" \ -H "Authorization: Bearer YOUR_API_KEY" For more detailed examples and model-specific options, check out our [Video Generation Guide](https://docs.nano-gpt.com/api-reference/video-generation) . --- # Create Invitation - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/invitations/create \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "amount": 1, "currency": "", "recipientName": "", "issuerName": "", "issuerNote": "" } ' import requests url = "https://api.nano-gpt.com/api/invitations/create" payload = { "amount": 1, "currency": "", "recipientName": "", "issuerName": "", "issuerNote": "" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ amount: 1, currency: '', recipientName: '', issuerName: '', issuerNote: '' }) }; fetch('https://api.nano-gpt.com/api/invitations/create', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/invitations/create",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'amount' => 1,\ 'currency' => '',\ 'recipientName' => '',\ 'issuerName' => '',\ 'issuerNote' => ''\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/invitations/create" payload := strings.NewReader("{\n \"amount\": 1,\n \"currency\": \"\",\n \"recipientName\": \"\",\n \"issuerName\": \"\",\n \"issuerNote\": \"\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/invitations/create") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"amount\": 1,\n \"currency\": \"\",\n \"recipientName\": \"\",\n \"issuerName\": \"\",\n \"issuerNote\": \"\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/invitations/create") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"amount\": 1,\n \"currency\": \"\",\n \"recipientName\": \"\",\n \"issuerName\": \"\",\n \"issuerNote\": \"\"\n}" response = http.request(request) puts response.read_body 200 400 401 500 { "insertId": "", "redeemCode": "", "url": "", "type": "invitation", "amount": 123, "currency": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / invitations / create Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/invitations/create \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "amount": 1, "currency": "", "recipientName": "", "issuerName": "", "issuerNote": "" } ' import requests url = "https://api.nano-gpt.com/api/invitations/create" payload = { "amount": 1, "currency": "", "recipientName": "", "issuerName": "", "issuerNote": "" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ amount: 1, currency: '', recipientName: '', issuerName: '', issuerNote: '' }) }; fetch('https://api.nano-gpt.com/api/invitations/create', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/invitations/create",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'amount' => 1,\ 'currency' => '',\ 'recipientName' => '',\ 'issuerName' => '',\ 'issuerNote' => ''\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/invitations/create" payload := strings.NewReader("{\n \"amount\": 1,\n \"currency\": \"\",\n \"recipientName\": \"\",\n \"issuerName\": \"\",\n \"issuerNote\": \"\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/invitations/create") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"amount\": 1,\n \"currency\": \"\",\n \"recipientName\": \"\",\n \"issuerName\": \"\",\n \"issuerNote\": \"\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/invitations/create") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"amount\": 1,\n \"currency\": \"\",\n \"recipientName\": \"\",\n \"issuerName\": \"\",\n \"issuerNote\": \"\"\n}" response = http.request(request) puts response.read_body 200 400 401 500 { "insertId": "", "redeemCode": "", "url": "", "type": "invitation", "amount": 123, "currency": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#overview) Overview --------------------------------------------------------------------------------------------- Create an invitation or referral link with an optional credit amount. Invitation links can include a fixed credit amount, while referral links always have a zero amount. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#authentication) Authentication --------------------------------------------------------------------------------------------------------- This endpoint supports two authentication methods: * Session-based authentication (browser session cookie) * API key authentication via request headers ### [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#api-key-headers) API Key Headers * `x-api-key: YOUR_API_KEY` or * `Authorization: Bearer YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#request) Request ------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#headers) Headers * `Content-Type: application/json` * `x-api-key: YOUR_API_KEY` (required for API key auth) ### [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#body) Body | Field | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | Either `"invitation"` or `"referralLink"`. Defaults to `"invitation"`. | | `amount` | number | No | Credit amount to include with the invitation. Must be non-negative. Ignored for referral links (always 0). | | `currency` | string | No | Currency for the amount. Required if `amount > 0`. Use `"USD"` for US dollars. | | `recipientName` | string | No | Name of the invitation recipient. | | `issuerName` | string | No | Name of the person sending the invitation. | | `issuerNote` | string | No | Personal note to include with the invitation. | [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#response) Response --------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#success-200-ok) Success (200 OK) { "insertId": "12345", "redeemCode": "ABC123XY", "url": "https://example.com/invite/ABC123XY", "type": "invitation", "amount": 10, "currency": "USD" } | Field | Type | Description | | --- | --- | --- | | `insertId` | string | Database ID of the created invitation. | | `redeemCode` | string | Unique code the recipient uses to redeem the invitation. | | `url` | string | Full URL to share with the recipient. | | `type` | string | The invitation type (`"invitation"` or `"referralLink"`). | | `amount` | number | Credit amount attached to this invitation. | | `currency` | string \| null | Currency of the amount, or `null` if amount is 0 (recipient chooses currency). | [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#errors) Errors ----------------------------------------------------------------------------------------- | Status | Body | Description | | --- | --- | --- | | 400 | `"Invalid request body"` | Request body is not valid JSON. | | 400 | `"InvalidAmount"` | The provided amount is negative. | | 400 | `"InsufficientBalance"` | Your account balance is insufficient for the specified amount. | | 401 | `"Invalid session"` | Session is missing required data. | | 401 | `"Unable to get session"` | Authentication failed. | | 500 | `"Failed to create invitation"` | Server error during invitation creation. | [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#notes) Notes --------------------------------------------------------------------------------------- * When `amount` is 0 or not provided, the `currency` in the response is `null`, allowing the recipient to choose their preferred currency upon redemption. * Referral links always have an amount of 0, regardless of what value is passed. * The `redeemCode` uses a URL-safe alphabet that avoids ambiguous characters (no 0, O, 1, l). * Ensure your account has sufficient balance before creating invitations with credit amounts. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#examples) Examples --------------------------------------------------------------------------------------------- cURL cURL cURL curl -X POST https://nano-gpt.com/api/invitations/create \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "amount": 10, "currency": "USD", "recipientName": "Jane Doe", "issuerName": "John Smith", "issuerNote": "Welcome to the platform!" }' curl -X POST https://nano-gpt.com/api/invitations/create \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "type": "referralLink", "issuerName": "John Smith" }' curl -X POST https://nano-gpt.com/api/invitations/create \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "recipientName": "Jane Doe" }' #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Body application/json Invitation creation parameters [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#body-type) type enum Either "invitation" or "referralLink". Defaults to "invitation". Available options: `invitation`, `referralLink` [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#body-amount) amount number Credit amount to include with the invitation. Must be non-negative. Ignored for referral links (always 0). Required range: `x >= 0` [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#body-currency) currency string Currency for the amount. Required if amount > 0. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#body-recipient-name) recipientName string Name of the invitation recipient. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#body-issuer-name) issuerName string Name of the person sending the invitation. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#body-issuer-note) issuerNote string Personal note to include with the invitation. #### Response 200 application/json Invitation created [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#response-insert-id) insertId string required Database ID of the created invitation. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#response-redeem-code) redeemCode string required Unique code the recipient uses to redeem the invitation. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#response-url) url string required Full URL to share with the recipient. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#response-type) type enum required The invitation type. Available options: `invitation`, `referralLink` [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#response-amount) amount number required Credit amount attached to this invitation. [​](https://docs.nano-gpt.com/api-reference/endpoint/invitations-create#response-currency-one-of-0) currency string | null required Currency of the amount, or null if amount is 0. --- # Streaming Protocol (SSE) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#overview) Overview -------------------------------------------------------------------------------------------------- NanoGPT supports streaming responses via Server-Sent Events (SSE). Streaming is available on these endpoints: | Endpoint | Style | Content-Type | | --- | --- | --- | | `POST /v1/chat/completions` | OpenAI Chat Completions compatible | `text/event-stream` | | `POST /v1/messages` | Anthropic Messages compatible | `text/event-stream` (named SSE events) | | `POST /v1/responses` | OpenAI Responses API compatible | `text/event-stream` | All SSE streams are delivered as a sequence of `data:` frames separated by a blank line. Some endpoints also include an `event:` line to name the event type. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#recover-billing-after-a-disconnect) Recover billing after a disconnect ------------------------------------------------------------------------------------------------------------------------------------------------------ For Chat Completions, save the server-generated `X-Request-ID` response header before reading the stream. If the final usage chunk is lost, use that ID and the same inference API key with [Request Billing](https://docs.nano-gpt.com/api-reference/endpoint/request-billing) to look up the recorded primary charge within its rolling 24-hour window. Accounting token counts may be estimated after an interrupted stream. Billing can take time to appear. A lookup `404` does not mean the request was free; honor its `Retry-After: 30` header. Looking up billing does not repeat inference. Repeating inference can create another charge, even if you reuse `X-Request-ID`: it is a correlation ID, not an idempotency key. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#enabling-streaming) Enabling Streaming ---------------------------------------------------------------------------------------------------------------------- Set `"stream": true` in the JSON request body. Chat Completions: { "model": "openai/gpt-6.1-sol", "messages": [{ "role": "user", "content": "Hello!" }], "stream": true } Messages: { "model": "claude-sonnet-4-5-20250929", "max_tokens": 1024, "messages": [{ "role": "user", "content": "Hello!" }], "stream": true } Responses: { "model": "openai/gpt-6.1-sol", "input": "Hello!", "stream": true } If `stream` is omitted or `false`, the endpoint returns a single JSON response. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#chat-completions-streaming-/v1/chat/completions) Chat Completions Streaming (`/v1/chat/completions`) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Chat Completions streams OpenAI-style `chat.completion.chunk` objects. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#frame-format) Frame Format Each SSE frame is a JSON object in a `data:` line: data: {"id":"chatcmpl_...","object":"chat.completion.chunk","created":1700000000,"model":"...","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]} The first chunk often includes `delta.role: "assistant"`. Subsequent chunks typically include only incremental deltas like `delta.content`. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#finish-reasons) Finish Reasons The final chunk has a non-null `finish_reason`: * `stop` * `length` * `tool_calls` * `content_filter` ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#end-of-stream) End of Stream After the final chunk, the stream terminates with: data: [DONE] Clients should treat `[DONE]` as a literal string (do not JSON-parse it). ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#reasoning-/-thinking-deltas) Reasoning / Thinking Deltas Some models stream reasoning alongside content. Depending on the endpoint variant you use, the delta field may be `reasoning` or `reasoning_content`. Example: data: {"choices":[{"index":0,"delta":{"reasoning":"Thinking..."},"finish_reason":null}]} data: {"choices":[{"index":0,"delta":{"content":"Answer text..."},"finish_reason":null}]} ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#tool-call-deltas) Tool Call Deltas Tool calls stream via `delta.tool_calls[]`. Accumulate `function.arguments` across frames for the same `tool_calls[index]`. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#usage-in-streaming) Usage In Streaming Usage is not included by default in streaming. To receive usage, set: { "stream": true, "stream_options": { "include_usage": true } } If enabled, the **final chunk** includes a `usage` field. (Some features, like prompt caching helpers, can cause usage to be included automatically.) `usage` can include provider-dependent fields beyond basic token counters, including nested details and cache fields: * `prompt_tokens` * `completion_tokens` * `total_tokens` * `prompt_tokens_details.cached_tokens` * `prompt_tokens_details.audio_tokens` * `completion_tokens_details.reasoning_tokens` * `completion_tokens_details.audio_tokens` * `completion_tokens_details.accepted_prediction_tokens` * `completion_tokens_details.rejected_prediction_tokens` * `reasoning_tokens` * `citation_tokens` * `num_search_queries` * `cache_creation_input_tokens` * `cache_read_input_tokens` * `input_tokens` When provider usage is missing or zero, NanoGPT may backfill final usage counts from pricing metadata (`x_nanogpt_pricing.inputTokens` / `x_nanogpt_pricing.outputTokens`) for consistency. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#x_nanogpt_pricing-in-streaming) `x_nanogpt_pricing` In Streaming `x_nanogpt_pricing` is an extension object: * In streaming: appears on the **final chunk only** * In non-stream JSON responses: appears as a top-level field Stable/core fields: * `amount?: number` * `currency?: string` * `error?: { status?: number; message: string }` (`message` is sanitized) Common optional fields: * `cost?: number` * `paymentSource?: string` * `inputTokens?: number` * `outputTokens?: number` * `cacheCost?: number` * `billedToTeam?: boolean` * `billedTeamId?: number | null` * `billedTeamName?: string | null` Compatibility rule: clients must tolerate additional fields and ignore unknown keys. Example final chunk: { "id": "chatcmpl_x", "object": "chat.completion.chunk", "created": 1772346058, "model": "gpt-5.1", "choices": [{ "index": 0, "delta": {}, "finish_reason": "stop" }], "usage": { "prompt_tokens": 123, "completion_tokens": 20, "total_tokens": 143, "prompt_tokens_details": { "cached_tokens": 123, "audio_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 12, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0 }, "cache_creation_input_tokens": 123, "cache_read_input_tokens": 123 }, "x_nanogpt_pricing": { "cost": 0.000169, "inputTokens": 9, "outputTokens": 20, "cacheCost": 0, "paymentSource": "USD", "billedToTeam": false, "billedTeamId": null, "billedTeamName": null } } [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#messages-streaming-/v1/messages) Messages Streaming (`/v1/messages`) ---------------------------------------------------------------------------------------------------------------------------------------------------- The Messages endpoint streams Anthropic-style **named SSE events**. Each event includes an `event:` line and a `data:` line. Typical sequence: 1. `message_start` 2. `content_block_start` 3. `content_block_delta` (repeated) 4. `content_block_stop` 5. `message_delta` 6. `message_stop` Example (end of stream): event: message_stop data: {"type":"message_stop"} ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#tool-use) Tool Use Tool calls appear as `tool_use` content blocks. Tool input streams as `input_json_delta` fragments inside `content_block_delta` events. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#thinking-blocks) Thinking Blocks Thinking can appear as a separate content block type (`thinking`) before normal text blocks. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#usage) Usage Usage information is included near the end of the stream (for example on `message_delta`), and includes `input_tokens` and `output_tokens`. When prompt caching is active, cache token fields may also appear. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#responses-streaming-/v1/responses) Responses Streaming (`/v1/responses`) -------------------------------------------------------------------------------------------------------------------------------------------------------- Responses streams a sequence of typed objects. NanoGPT emits these as SSE `data:` frames containing JSON with a `type` field (for example `response.created`, `response.output_text.delta`, etc.). Example: data: {"type":"response.created","response":{...},"sequence_number":0} data: {"type":"response.output_text.delta","item_id":"msg_...","output_index":0,"content_index":0,"delta":"Hello","sequence_number":3} data: {"type":"response.completed","response":{...},"sequence_number":11} data: [DONE] Terminal events include: * `response.completed` * `response.incomplete` * `response.failed` ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#tool-calls) Tool Calls Tool calls appear as `function_call` output items. Arguments stream via `response.function_call_arguments.delta` frames and finish with `response.function_call_arguments.done`. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#usage-2) Usage Usage appears on the terminal event inside the full `response` object (for example `response.completed.response.usage`). [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#error-handling-notes) Error Handling Notes -------------------------------------------------------------------------------------------------------------------------- * If an error happens before streaming begins, you will receive a normal JSON error response with an HTTP status code. * If an error happens mid-stream, the stream may end early. Your parser should handle EOF without a terminal marker as an error/retry condition. For general status-code handling and retry guidance, see [Error Handling](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol#raw-sse-parsing-tips) Raw SSE Parsing Tips -------------------------------------------------------------------------------------------------------------------------- When parsing SSE manually: * Events are separated by a blank line (`\\n\\n` or `\\r\\n\\r\\n`). * A single event can include multiple `data:` lines; concatenate them with `\\n` before parsing as JSON. * Handle `[DONE]` as a sentinel string. --- # Grok CLI - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/grok-cli#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/grok-cli#grok-cli) Grok CLI ========================================================================= > Use Grok CLI with NanoGPT to access Grok models and 50+ other models through a single API key. [Get started with NanoGPT](https://nano-gpt.com/api) for pay-as-you-go pricing with no monthly fees. NanoGPT provides an OpenAI-compatible endpoint that works with the Grok CLI. This lets you: * Use Grok CLI with your NanoGPT credits * Access Grok models without a separate xAI account * Use any other NanoGPT model through the same CLI [​](https://docs.nano-gpt.com/integrations/grok-cli#step-1-install-grok-cli) Step 1: Install Grok CLI -------------------------------------------------------------------------------------------------------- Prerequisites: [Node.js 18 or newer](https://nodejs.org/en/download/) # Install Grok CLI npm install -g @vibe-kit/grok-cli # Verify installation grok --version **Note**: If you encounter permission issues during installation, try using `sudo` (macOS/Linux) or running the command prompt as an administrator (Windows) to re-execute the installation command. [​](https://docs.nano-gpt.com/integrations/grok-cli#step-2-configure-nanogpt) Step 2: Configure NanoGPT ---------------------------------------------------------------------------------------------------------- 1 Get API Key * Go to [NanoGPT API](https://nano-gpt.com/api) * Create an account or log in * Copy your API key 2 Set Required Environment Variables Grok CLI reads these environment variables: | Variable | Value | Description | | --- | --- | --- | | `GROK_BASE_URL` | `https://nano-gpt.com/api/v1` | NanoGPT OpenAI-compatible endpoint | | `GROK_API_KEY` | `sk-nano-YOUR-API-KEY` | Your NanoGPT API key | * macOS & Linux * Windows PowerShell * Windows Cmd export GROK_BASE_URL="https://nano-gpt.com/api/v1" export GROK_API_KEY="sk-nano-YOUR-API-KEY" $env:GROK_BASE_URL = "https://nano-gpt.com/api/v1" $env:GROK_API_KEY = "sk-nano-YOUR-API-KEY" set GROK_BASE_URL=https://nano-gpt.com/api/v1 set GROK_API_KEY=sk-nano-YOUR-API-KEY Replace `sk-nano-YOUR-API-KEY` with your actual API key. Open a new terminal for changes to take effect if you set persistent variables. 3 Optional: Make It Persistent Add the variables to your shell profile (for example, `~/.zshrc` or `~/.bashrc`): echo 'export GROK_BASE_URL="https://nano-gpt.com/api/v1"' >> ~/.zshrc echo 'export GROK_API_KEY="sk-nano-YOUR-API-KEY"' >> ~/.zshrc source ~/.zshrc [​](https://docs.nano-gpt.com/integrations/grok-cli#step-3-start-using-grok-cli) Step 3: Start Using Grok CLI ---------------------------------------------------------------------------------------------------------------- Launch Grok CLI with a specific model: grok --model grok-3 Since you are connected to NanoGPT, you can use any available model: # Grok models grok --model grok-3 grok --model grok-3-fast grok --model grok-3-mini # Other providers through NanoGPT grok --model openai/gpt-6.1-sol grok --model anthropic/claude-opus-5.5 grok --model google/gemini-flash-latest Model names are listed on our [pricing page](https://nano-gpt.com/pricing) . [​](https://docs.nano-gpt.com/integrations/grok-cli#available-grok-models) Available Grok Models --------------------------------------------------------------------------------------------------- | Model | Description | | --- | --- | | `grok-3` | xAI flagship model | | `grok-3-fast` | Faster, more cost-effective version | | `grok-3-mini` | Lightweight version | [​](https://docs.nano-gpt.com/integrations/grok-cli#known-limitations) Known Limitations ------------------------------------------------------------------------------------------- Grok CLI has limited compatibility with thinking or reasoning models. When you use a thinking model, the full reasoning content may be shown in the output. If you want first-party CLI support for NanoGPT, consider [Claude Code](https://docs.nano-gpt.com/integrations/claude-code) or [Codex CLI](https://docs.nano-gpt.com/integrations/codex-cli) . [​](https://docs.nano-gpt.com/integrations/grok-cli#troubleshooting) Troubleshooting --------------------------------------------------------------------------------------- | Issue | Solution | | --- | --- | | `401 Unauthorized` | Check your API key is correct and has credits | | `GROK_BASE_URL not set` | Ensure the environment variable is exported | | `Model not found` | Verify the model name at [nano-gpt.com/pricing](https://nano-gpt.com/pricing) | | `Command not found: grok` | Run `npm install -g @vibe-kit/grok-cli` again | | Thinking content flooding output | Use a non-thinking model variant | [​](https://docs.nano-gpt.com/integrations/grok-cli#faq) FAQ --------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/integrations/grok-cli#is-grok-cli-official-xai-software) Is Grok CLI official xAI software? No. Grok CLI is a third-party package. NanoGPT works with it by providing an OpenAI-compatible endpoint. ### [​](https://docs.nano-gpt.com/integrations/grok-cli#can-i-access-grok-models-from-other-clients) Can I access Grok models from other clients? Yes. You can use Grok models from Claude Code, Cursor, or any OpenAI-compatible client by setting the base URL to NanoGPT. [​](https://docs.nano-gpt.com/integrations/grok-cli#api-details-reference) API Details (Reference) ----------------------------------------------------------------------------------------------------- | Setting | Value | | --- | --- | | Base URL | `https://nano-gpt.com/api/v1` | | Chat Completions Endpoint | `POST /chat/completions` | | Models Endpoint | `GET /models` | | Auth Header | `Authorization: Bearer sk-nano-...` | ### [​](https://docs.nano-gpt.com/integrations/grok-cli#example-curl-verify-connection) Example cURL (verify connection) curl -X POST "https://nano-gpt.com/api/v1/chat/completions" \ -H "Authorization: Bearer sk-nano-YOUR-API-KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-3-fast", "messages": [{"role": "user", "content": "Hello!"}] }' --- # Auto Recharge - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/auto-recharge#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/auto-recharge#auto-recharge) Auto Recharge ======================================================================================================= It’s possible to turn on auto-recharge so that you can be sure not to run out of funds while using our API. This will automatically top-up your account from your credit card when your balance falls beneath a minimum that you specify. Note that you must have made a payment or make a payment first to be able to enable auto recharge. Payment details are stored by our payment provider (Stripe) only, we do not store these on our own servers. You can request deletion of your personal information directly from Stripe by visiting their [data deletion request page](https://docs.nano-gpt.com/api-reference/miscellaneous/support.stripe.com/questions/i-would-like-to-delete-the-information-stripe-has-collected-from-me) . We detect low balances every 5 minutes, so make sure to leave some buffer in your minimum before a recharge happens. Minimum auto-recharge is $10. --- # Embeddings - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/embeddings \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "input": "", "model": "text-embedding-3-small", "encoding_format": "float", "dimensions": 256, "user": "" } ' import requests url = "https://api.nano-gpt.com/api/v1/embeddings" payload = { "input": "", "model": "text-embedding-3-small", "encoding_format": "float", "dimensions": 256, "user": "" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ input: '', model: 'text-embedding-3-small', encoding_format: 'float', dimensions: 256, user: '' }) }; fetch('https://api.nano-gpt.com/api/v1/embeddings', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/embeddings",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'input' => '',\ 'model' => 'text-embedding-3-small',\ 'encoding_format' => 'float',\ 'dimensions' => 256,\ 'user' => ''\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/embeddings" payload := strings.NewReader("{\n \"input\": \"\",\n \"model\": \"text-embedding-3-small\",\n \"encoding_format\": \"float\",\n \"dimensions\": 256,\n \"user\": \"\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/embeddings") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"input\": \"\",\n \"model\": \"text-embedding-3-small\",\n \"encoding_format\": \"float\",\n \"dimensions\": 256,\n \"user\": \"\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/embeddings") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"input\": \"\",\n \"model\": \"text-embedding-3-small\",\n \"encoding_format\": \"float\",\n \"dimensions\": 256,\n \"user\": \"\"\n}" response = http.request(request) puts response.read_body 200 400 { "object": "list", "data": [\ {\ "object": "embedding",\ "index": 0,\ "embedding": [\ 123\ ]\ }\ ], "model": "text-embedding-3-small", "usage": { "prompt_tokens": 8, "total_tokens": 8 } } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / v1 / embeddings Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/embeddings \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "input": "", "model": "text-embedding-3-small", "encoding_format": "float", "dimensions": 256, "user": "" } ' import requests url = "https://api.nano-gpt.com/api/v1/embeddings" payload = { "input": "", "model": "text-embedding-3-small", "encoding_format": "float", "dimensions": 256, "user": "" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ input: '', model: 'text-embedding-3-small', encoding_format: 'float', dimensions: 256, user: '' }) }; fetch('https://api.nano-gpt.com/api/v1/embeddings', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/embeddings",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'input' => '',\ 'model' => 'text-embedding-3-small',\ 'encoding_format' => 'float',\ 'dimensions' => 256,\ 'user' => ''\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/embeddings" payload := strings.NewReader("{\n \"input\": \"\",\n \"model\": \"text-embedding-3-small\",\n \"encoding_format\": \"float\",\n \"dimensions\": 256,\n \"user\": \"\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/embeddings") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"input\": \"\",\n \"model\": \"text-embedding-3-small\",\n \"encoding_format\": \"float\",\n \"dimensions\": 256,\n \"user\": \"\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/embeddings") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"input\": \"\",\n \"model\": \"text-embedding-3-small\",\n \"encoding_format\": \"float\",\n \"dimensions\": 256,\n \"user\": \"\"\n}" response = http.request(request) puts response.read_body 200 400 { "object": "list", "data": [\ {\ "object": "embedding",\ "index": 0,\ "embedding": [\ 123\ ]\ }\ ], "model": "text-embedding-3-small", "usage": { "prompt_tokens": 8, "total_tokens": 8 } } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#overview) Overview ------------------------------------------------------------------------------------- Create embeddings for text using OpenAI-compatible and alternative embedding models. NanoGPT supports 20+ embedding models (and this list changes over time); use `GET /api/v1/embedding-models` for the source-of-truth list. [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#available-models) Available Models ----------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#openai-models) OpenAI Models * `text-embedding-3-small` - 1536 dimensions, $0.02/1M tokens - Most cost-effective with dimension reduction support * `text-embedding-3-large` - 3072 dimensions, $0.13/1M tokens - Highest performance with dimension reduction support * `text-embedding-ada-002` - 1536 dimensions, $0.10/1M tokens - Legacy model ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#alternative-models) Alternative Models **Multilingual:** * `BAAI/bge-m3` - 1024 dimensions, $0.01/1M tokens - Multilingual support **Language-Specific:** * `BAAI/bge-base-en-v1.5` - 768 dimensions, $0.005/1M tokens - English (base) * `BAAI/bge-large-en-v1.5` - 1024 dimensions, $0.01/1M tokens - English optimized **Specialized:** * `Qwen/Qwen3-Embedding-0.6B` - 1024 dimensions, $0.01/1M tokens - Supports dimension reduction * `Qwen/Qwen3-Embedding-4B` - 2560 dimensions, $0.02/1M tokens - Supports dimension reduction * `Qwen/Qwen3-Embedding-8B` - 4096 dimensions, $0.01/1M tokens - Supports dimension reduction * `gemini-embedding-001` - 3072 dimensions, $0.15/1M tokens [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#request-parameters) Request Parameters --------------------------------------------------------------------------------------------------------- | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `input` | string or array | Yes | Single text string or array of up to 2048 strings to embed | | `model` | string | Yes | ID of the embedding model to use | | `encoding_format` | string | No | Format for embeddings: `"float"` (default) or `"base64"` | | `dimensions` | integer | No | Reduce embedding dimensions (only for supported models) | | `user` | string | No | Optional identifier for tracking usage | [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#response-format) Response Format --------------------------------------------------------------------------------------------------- { "object": "list", "data": [\ {\ "object": "embedding",\ "index": 0,\ "embedding": [0.023, -0.012, 0.045, ...]\ }\ ], "model": "text-embedding-3-small", "usage": { "prompt_tokens": 8, "total_tokens": 8 } } [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#code-examples) Code Examples ----------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#python-with-openai-sdk) Python with OpenAI SDK from openai import OpenAI # Initialize client pointing to NanoGPT client = OpenAI( api_key="YOUR_NANOGPT_API_KEY", base_url="https://api.nano-gpt.com/api/v1" ) # Create embedding response = client.embeddings.create( input="Your text to embed", model="text-embedding-3-small" ) # Access the embedding embedding = response.data[0].embedding print(f"Embedding dimensions: {len(embedding)}") ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#javascript/typescript) JavaScript/TypeScript import OpenAI from 'openai'; // Initialize client pointing to NanoGPT const openai = new OpenAI({ apiKey: 'YOUR_NANOGPT_API_KEY', baseURL: 'https://api.nano-gpt.com/api/v1' }); // Create embedding const response = await openai.embeddings.create({ input: "Your text to embed", model: "text-embedding-3-small" }); // Access the embedding const embedding = response.data[0].embedding; console.log(`Embedding dimensions: ${embedding.length}`); ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#curl) cURL curl https://api.nano-gpt.com/api/v1/embeddings \ -H "Authorization: Bearer YOUR_NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "Your text to embed", "model": "text-embedding-3-small" }' ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#batch-processing) Batch Processing # Process multiple texts in a single request texts = [\ "First text to embed",\ "Second text to embed",\ "Third text to embed"\ ] response = client.embeddings.create( input=texts, # Pass array of strings model="text-embedding-3-small" ) # Access embeddings by index for i, data in enumerate(response.data): print(f"Text {i}: {len(data.embedding)} dimensions") ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#dimension-reduction) Dimension Reduction For models that support it (`text-embedding-3-small`, `text-embedding-3-large`, `Qwen/Qwen3-Embedding-0.6B`, `Qwen/Qwen3-Embedding-4B`, `Qwen/Qwen3-Embedding-8B`): # Reduce dimensions to 256 for faster similarity comparisons response = client.embeddings.create( input="Your text to embed", model="text-embedding-3-small", dimensions=256 # Reduce from 1536 to 256 ) [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#use-cases) Use Cases --------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#semantic-search) Semantic Search import numpy as np from sklearn.metrics.pairwise import cosine_similarity # Create embeddings for your documents documents = ["Document 1 text", "Document 2 text", "Document 3 text"] doc_embeddings = [] for doc in documents: response = client.embeddings.create(input=doc, model="text-embedding-3-small") doc_embeddings.append(response.data[0].embedding) # Create embedding for search query query = "Search query text" query_response = client.embeddings.create(input=query, model="text-embedding-3-small") query_embedding = query_response.data[0].embedding # Calculate similarities similarities = cosine_similarity([query_embedding], doc_embeddings)[0] # Find most similar documents top_matches = np.argsort(similarities)[::-1][:3] for idx in top_matches: print(f"Document {idx}: {similarities[idx]:.3f} similarity") ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#rag-retrieval-augmented-generation) RAG (Retrieval Augmented Generation) # 1. Embed and store your knowledge base knowledge_base = [\ {"text": "Fact 1...", "embedding": None},\ {"text": "Fact 2...", "embedding": None},\ ] for item in knowledge_base: response = client.embeddings.create( input=item["text"], model="text-embedding-3-small" ) item["embedding"] = response.data[0].embedding # 2. For a user query, find relevant context user_query = "What is...?" query_response = client.embeddings.create( input=user_query, model="text-embedding-3-small" ) query_embedding = query_response.data[0].embedding # 3. Find most relevant facts # relevant_facts = find_similar_texts(query_embedding, knowledge_base, top_k=3) # 4. Use retrieved context with chat completion chat_response = client.chat.completions.create( model="gpt-4", messages=[\ {"role": "system", "content": f"Context: {relevant_facts}"},\ {"role": "user", "content": user_query}\ ] ) [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#best-practices) Best Practices ------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#model-selection) Model Selection * **General English text**: Use `text-embedding-3-small` for best price/performance * **Maximum accuracy**: Use `text-embedding-3-large` * **Multilingual**: Use `BAAI/bge-m3` or `qwen/qwen3-embedding-8b` * **Code**: Use `qwen/qwen3-embedding-8b` * **Budget-conscious**: Use BAAI models at $0.01/1M tokens ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#performance-optimization) Performance Optimization * **Batch requests**: Send up to 2048 texts in a single request * **Use dimension reduction**: Reduce dimensions for faster similarity calculations when exact precision isn’t critical * **Cache embeddings**: Store computed embeddings to avoid re-processing identical texts * **Choose appropriate models**: Don’t use 3072-dimension models if 768 dimensions suffice ### [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#cost-optimization) Cost Optimization * **Monitor token usage**: Track the `usage` field in responses * **Use smaller models**: Start with `text-embedding-3-small` before upgrading * **Implement caching**: Avoid re-embedding identical content * **Batch processing**: Reduce API call overhead [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#rate-limits) Rate Limits ------------------------------------------------------------------------------------------- Rate limits vary by endpoint and account. See [Rate Limits](https://docs.nano-gpt.com/api-reference/miscellaneous/rate-limits) . [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#error-handling) Error Handling ------------------------------------------------------------------------------------------------- The API returns standard HTTP status codes and OpenAI-compatible error responses: See also: [Error Handling](https://docs.nano-gpt.com/api-reference/miscellaneous/error-handling) . { "error": { "message": "Invalid model specified", "type": "invalid_request_error", "param": "model", "code": null } } Common error codes: * `401`: Invalid or missing API key * `400`: Invalid request parameters * `429`: Rate limit exceeded * `500`: Server error #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Body application/json Parameters for creating embeddings [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#body-input-one-of-0) input stringstring\[\]stringstring\[\] required Text to embed - single string or array of up to 2048 strings [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#body-model) model string required ID of the embedding model to use Example: `"text-embedding-3-small"` [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#body-encoding-format) encoding\_format enum default:float Format for embeddings Available options: `float`, `base64` [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#body-dimensions) dimensions integer Reduce embedding dimensions (only for supported models) Example: `256` [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#body-user) user string Optional identifier for tracking usage #### Response 200 application/json Embedding response [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#response-object) object string required Always 'list' for embeddings Example: `"list"` [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#response-data) data object\[\] required Array of embedding objects Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#response-model) model string required Model used for embeddings Example: `"text-embedding-3-small"` [​](https://docs.nano-gpt.com/api-reference/endpoint/embeddings#response-usage) usage object required Show child attributes --- # Context Memory (Standalone) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/memory#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/memory \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "messages": [\ {\ "content": ""\ }\ ], "expiration_days": 30, "model_context_limit": 128000 } ' import requests url = "https://api.nano-gpt.com/api/v1/memory" payload = { "messages": [{ "content": "" }], "expiration_days": 30, "model_context_limit": 128000 } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ messages: [{content: ''}], expiration_days: 30, model_context_limit: 128000 }) }; fetch('https://api.nano-gpt.com/api/v1/memory', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/memory",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'messages' => [\ [\ 'content' => ''\ ]\ ],\ 'expiration_days' => 30,\ 'model_context_limit' => 128000\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/memory" payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"\"\n }\n ],\n \"expiration_days\": 30,\n \"model_context_limit\": 128000\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/memory") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"messages\": [\n {\n \"content\": \"\"\n }\n ],\n \"expiration_days\": 30,\n \"model_context_limit\": 128000\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/memory") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"messages\": [\n {\n \"content\": \"\"\n }\n ],\n \"expiration_days\": 30,\n \"model_context_limit\": 128000\n}" response = http.request(request) puts response.read_body 200 400 402 429 { "messages": [\ {\ "role": "",\ "content": ""\ }\ ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123, "prompt_tokens_details": { "cached_tokens": 123 } } } { "error": 123, "message": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / v1 / memory Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/memory \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "messages": [\ {\ "content": ""\ }\ ], "expiration_days": 30, "model_context_limit": 128000 } ' import requests url = "https://api.nano-gpt.com/api/v1/memory" payload = { "messages": [{ "content": "" }], "expiration_days": 30, "model_context_limit": 128000 } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ messages: [{content: ''}], expiration_days: 30, model_context_limit: 128000 }) }; fetch('https://api.nano-gpt.com/api/v1/memory', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/memory",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'messages' => [\ [\ 'content' => ''\ ]\ ],\ 'expiration_days' => 30,\ 'model_context_limit' => 128000\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/memory" payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"\"\n }\n ],\n \"expiration_days\": 30,\n \"model_context_limit\": 128000\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/memory") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"messages\": [\n {\n \"content\": \"\"\n }\n ],\n \"expiration_days\": 30,\n \"model_context_limit\": 128000\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/memory") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"messages\": [\n {\n \"content\": \"\"\n }\n ],\n \"expiration_days\": 30,\n \"model_context_limit\": 128000\n}" response = http.request(request) puts response.read_body 200 400 402 429 { "messages": [\ {\ "role": "",\ "content": ""\ }\ ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123, "prompt_tokens_details": { "cached_tokens": 123 } } } { "error": 123, "message": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#overview) Overview --------------------------------------------------------------------------------- The standalone Context Memory endpoint compresses an entire conversation into a single memory message. This endpoint does not run a model. It returns the compressed memory message and usage so you can pipe it into your own chat completion request or store it. * No model inference is performed * Pass your `messages` array and optional settings [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#authentication) Authentication --------------------------------------------------------------------------------------------- * `Authorization: Bearer YOUR_API_KEY` or * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#request) Request ------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#headers) Headers * `Content-Type: application/json` * `Authorization: Bearer YOUR_API_KEY` or `x-api-key: YOUR_API_KEY` * `memory_expiration_days: <1..365>` (optional) — overrides body; defaults to 30 ### [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#body) Body { "messages": [\ { "role": "system", "content": "You are a helpful assistant." },\ { "role": "user", "content": "Summarize our previous discussion and continue." }\ ], "expiration_days": 45, "model_context_limit": 128000 } * `messages` (required): OpenAI-style messages. `user`, `assistant`, `system`, `tool`, and `function` roles are accepted. Assistant `tool_calls` are ignored during compression. * `expiration_days` (optional): 1..365; default 30. If both header and body are provided, the header takes precedence. * `model_context_limit` (optional): Context target for compression. Default 128k; values below 10k are clamped internally. [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#response) Response --------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#success-200) Success (200) { "messages": [\ { "role": "system", "content": "..." }\ ], "usage": { "prompt_tokens": 51234, "completion_tokens": 1234, "total_tokens": 52468, "prompt_tokens_details": { "cached_tokens": 4096 } } } * `messages`: The single memory-compressed message array to use as your full context in a chat completion request * `usage`: Token usage. When available, `prompt_tokens_details.cached_tokens` indicates discounted cached input tokens ### [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#error-examples) Error Examples 400 Bad Request { "error": "messages must be a non-empty array" } 401 Unauthorized { "error": "Invalid session" } 402 Payment Required { "error": "Insufficient balance" } 429 Too Many Requests { "error": "Rate limit exceeded. Please wait before sending another request." } [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#pricing-&-billing) Pricing & Billing --------------------------------------------------------------------------------------------------- * Non-cached input tokens: $5.00 / 1M * Cached input tokens: $2.50 / 1M (when applicable) * Output tokens: $10.00 / 1M Note: This endpoint only charges for memory compression. If you later call `/v1/chat/completions`, model costs are billed separately. [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#retention) Retention ----------------------------------------------------------------------------------- * Default retention: 30 days * Configure via body `expiration_days` or header `memory_expiration_days` * Header value takes precedence over body when both are supplied [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#examples) Examples --------------------------------------------------------------------------------- JavaScript Python cURL const res = await fetch('https://api.nano-gpt.com/api/v1/memory', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', 'memory_expiration_days': '45' }, body: JSON.stringify({ messages: [\ { role: 'system', content: 'You are a helpful assistant.' },\ { role: 'user', content: 'Optimize our previous plan and continue.' }\ ] }) }); const { messages, usage } = await res.json(); // Use `messages` as the full context for a subsequent /v1/chat/completions call import requests url = 'https://api.nano-gpt.com/api/v1/memory' headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } data = { 'messages': [\ { 'role': 'system', 'content': 'You are a helpful assistant.' },\ { 'role': 'user', 'content': 'Summarize and continue.' }\ ], 'expiration_days': 30, 'model_context_limit': 128000 } r = requests.post(url, headers=headers, json=data) result = r.json() print(result['messages'][0]['content'][:200]) print(result['usage']) curl -X POST https://api.nano-gpt.com/api/v1/memory \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "memory_expiration_days: 90" \ -d '{ "messages": [\ {"role": "system", "content": "You are a helpful assistant."},\ {"role": "user", "content": "Compress our conversation and continue."}\ ] }' #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Body application/json Parameters for memory compression [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#body-messages) messages object\[\] required OpenAI-style messages array to compress Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#body-expiration-days) expiration\_days integer default:30 Retention in days (1..365). Defaults to 30 if not provided. Required range: `1 <= x <= 365` [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#body-model-context-limit) model\_context\_limit integer default:128000 Target context size for compression (minimum enforced 10,000) #### Response 200 application/json Memory compression response [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#response-messages) messages object\[\] required Compressed memory message array Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/memory#response-usage) usage object required Show child attributes --- # v1/audio/speech (TTS + Music) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/speech#content-area) v1/audio/speech (TTS + Music) cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/audio/speech import requests url = "https://api.nano-gpt.com/api/v1/audio/speech" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/audio/speech', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/audio/speech",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/audio/speech" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/audio/speech") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/audio/speech") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / v1 / audio / speech Try it v1/audio/speech (TTS + Music) cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/audio/speech import requests url = "https://api.nano-gpt.com/api/v1/audio/speech" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/v1/audio/speech', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/audio/speech",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/audio/speech" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/audio/speech") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/audio/speech") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#overview) Overview --------------------------------------------------------------------------------- Synthesize speech (TTS) or generate music with a single request. The OpenAI-compatible `POST /v1/audio/speech` endpoint returns audio bytes directly in the HTTP response. Optional chunked streaming is available with `stream: true`. In streaming mode, audio bytes are delivered progressively as generated, which reduces time-to-first-byte (TTFB) for real-time playback. Default behavior is unchanged: omit `stream` (or set `false`) to receive one buffered audio file after generation completes. When you use a music model (for example `Minimax-Music-02`), the `input` field is treated as a music prompt (not text to speak) and `voice` is ignored. For a dedicated music guide and model list, see `api-reference/music-generation.mdx`. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#endpoint) Endpoint --------------------------------------------------------------------------------- * Method/Path: `POST https://api.nano-gpt.com/api/v1/audio/speech` * Auth: `Authorization: Bearer ` * Required header: `Content-Type: application/json` * You may see older examples using `POST https://api.nano-gpt.com/api/v1/speech`. Prefer `/api/v1/audio/speech` for OpenAI SDK compatibility. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#request-parameters) Request Parameters ----------------------------------------------------------------------------------------------------- | Parameter | Type | Default | Description | | --- | --- | --- | --- | | `model` | string | None | Audio-speech model ID (TTS or music). | | `input` | string | None | Text to speak (TTS) or a music prompt (music models). | | `voice` | string | None | Voice preset for TTS. Ignored for music models. If your client requires this field, pass any string (for example `"alloy"`). | | `response_format` | string | `mp3` | Output format when supported by the selected provider/model. | | `speed` | number | `1` | Speaking rate multiplier for TTS (for example `0.5`\-`2.0`). Ignored for music models. | | `instructions` | string | None | Voice/style instructions (supported by some models/providers). | | `stream` | boolean | `false` | When `true`, returns chunked audio bytes progressively. | Notes: * Some provider-backed models may support additional fields; accepted parameters vary by model. * For unsupported models, `stream: true` is ignored and the endpoint returns the normal buffered response. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#streaming-support-tts-models) Streaming Support (TTS Models) --------------------------------------------------------------------------------------------------------------------------- | Model | Provider | Streaming Support | | --- | --- | --- | | `tts-1` | OpenAI | Yes | | `tts-1-hd` | OpenAI | Yes | | `gpt-4o-mini-tts` | OpenAI | Yes | | `Elevenlabs-Turbo-V2.5` | ElevenLabs (via FAL) | Yes | | `Elevenlabs-V3` | ElevenLabs (via FAL) | Yes | All other TTS models (Gemini, Inworld, Kokoro, Qwen, MiniMax, and others) ignore `stream` and return buffered responses. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#response-behavior) Response Behavior --------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#non-streaming-default) Non-streaming (default) * Status: `200 OK` * Body: complete audio file returned once generation finishes * Headers: typically includes `Content-Length` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#streaming-stream-true) Streaming (`stream: true`) * Status: `200 OK` * Body: audio bytes arrive progressively in chunks * Headers: no `Content-Length`; uses `Transfer-Encoding: chunked` * Client can start playback/processing as soon as the first chunk arrives * `Content-Type` by provider: * OpenAI TTS models: matches the selected output format (for example `audio/mpeg`, `audio/wav`, `audio/opus`, `audio/flac`, `audio/aac`, `audio/pcm`) * ElevenLabs TTS models: always `audio/mpeg` ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#errors) Errors * If an error happens before streaming starts, the API returns the standard OpenAI-style JSON error envelope: { "error": { "message": "...", "type": "invalid_request_error", "param": null, "code": "invalid_request" } } * If streaming fails after bytes have started, the connection is terminated and clients may receive partial/corrupt audio. Common error types: `invalid_model`, `invalid_voice`, `unsupported_format`, `input_too_long`, `rate_limit_exceeded`. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#examples) Examples --------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#non-streaming-request-unchanged) Non-streaming request (unchanged) curl -X POST \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ https://api.nano-gpt.com/api/v1/audio/speech \ -d '{ "model": "gpt-4o-mini-tts", "input": "Hello from NanoGPT!", "voice": "alloy", "response_format": "mp3" }' \ --output speech.mp3 ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#streaming-request-curl) Streaming request (cURL) curl -X POST \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ https://api.nano-gpt.com/api/v1/audio/speech \ -d '{ "model": "gpt-4o-mini-tts", "input": "Hello, this is a streaming test with a longer message to observe progressive chunking.", "voice": "alloy", "response_format": "mp3", "stream": true }' \ --output speech.mp3 ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#openai-node-js-sdk-streaming) OpenAI Node.js SDK (streaming) import OpenAI from "openai"; import { createWriteStream } from "node:fs"; const client = new OpenAI({ apiKey: process.env.NANOGPT_API_KEY, baseURL: "https://api.nano-gpt.com/api/v1", }); const response = await client.audio.speech.create({ model: "gpt-4o-mini-tts", voice: "alloy", input: "Hello from the streaming API!", response_format: "mp3", stream: true, }); if (!response.body) throw new Error("Missing response body stream"); const out = createWriteStream("output.mp3"); const reader = response.body.getReader(); while (true) { const { done, value } = await reader.read(); if (done) break; out.write(Buffer.from(value)); } out.end(); ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#openai-python-sdk-streaming) OpenAI Python SDK (streaming) from openai import OpenAI client = OpenAI( api_key="your-nanogpt-api-key", base_url="https://api.nano-gpt.com/api/v1", ) with client.audio.speech.with_streaming_response.create( model="gpt-4o-mini-tts", voice="alloy", input="Hello from the streaming API!", response_format="mp3", extra_body={"stream": True}, ) as response: with open("output.mp3", "wb") as f: for chunk in response.iter_bytes(chunk_size=4096): f.write(chunk) ### [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#compare-ttfb-streaming-vs-non-streaming) Compare TTFB (streaming vs non-streaming) curl -X POST https://api.nano-gpt.com/api/v1/audio/speech \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4o-mini-tts","input":"A longer sentence to demonstrate the streaming improvement.","voice":"alloy","stream":true}' \ -o streaming.mp3 \ -w "\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n" [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#notes-&-limits) Notes & Limits --------------------------------------------------------------------------------------------- * Max input length: depends on model; measured in characters or tokens. For short, interactive prompts, prefer under ~1-2k characters. * Typical latency: scales with input length and output format; compressed formats like `mp3` are often faster than `wav`. * Usage metering: billed by input characters for TTS models; output file size does not affect billing. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#audio-format-support-by-provider) Audio Format Support by Provider --------------------------------------------------------------------------------------------------------------------------------- | Provider | Supported `response_format` values | | --- | --- | | OpenAI (`tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`) | `mp3` (default), `opus`, `aac`, `flac`, `wav`, `pcm` | | ElevenLabs (`Elevenlabs-Turbo-V2.5`, `Elevenlabs-V3`) | Always returns `audio/mpeg` (MP3). `response_format` is ignored. | [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#voices) Voices ----------------------------------------------------------------------------- * Voice IDs vary by model/provider. See model-specific voices on Text-to-Speech: `api-reference/text-to-speech.mdx`. * If a voices listing endpoint is available (for example `GET /v1/voices`), it returns available voice IDs and metadata (language coverage, gender/pitch, sample links). [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#errors-&-troubleshooting) Errors & Troubleshooting ----------------------------------------------------------------------------------------------------------------- * `invalid_model`, `invalid_voice`, `unsupported_format`: Verify `model`, `voice`, and `response_format`. * `input_too_long`: Reduce length; split long text into chunks and stitch audio client-side. * `rate_limit_exceeded`: Exponential backoff; retry after the window resets. * Network/client tips: set `Accept` to your preferred audio type and write raw response bytes directly to a file/stream. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#security) Security --------------------------------------------------------------------------------- * Do not expose API keys in browsers. Proxy via your server. * Redact PII in logs; avoid logging raw text/audio in production. * Rate-limit public routes. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#pricing-quotas-and-rate-limits) Pricing, Quotas, and Rate Limits ------------------------------------------------------------------------------------------------------------------------------- * Billing is based on input character count, not output audio size. * For streaming requests, billing is recorded after the first audio chunk is confirmed. If the upstream provider fails before any audio is produced, no charge is applied. * If the client disconnects mid-stream after audio starts, the charge still applies because generation already began upstream. * Rate limits: per-minute/day caps; contact support to request increases. See `api-reference/miscellaneous/pricing.mdx` and `api-reference/miscellaneous/rate-limits.mdx`. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#migration-from-job-based-tts) Migration from Job-based TTS ------------------------------------------------------------------------------------------------------------------------- Already using the async `POST /tts` + `GET /tts/status` flow? * When to switch: choose `v1/audio/speech` for short prompts, low latency, and direct playback; keep job-based TTS for long/batch generation and webhook workflows. * Parameter mapping: `text` -> `input`, `voice` stays `voice`, and output format can be requested with `response_format` when supported. * Retries/timeouts: `v1/audio/speech` returns inline; implement client-side timeouts and simple retries on 5xx. [​](https://docs.nano-gpt.com/api-reference/endpoint/speech#see-also) See Also --------------------------------------------------------------------------------- * Async/job-based TTS: `api-reference/endpoint/tts.mdx` * TTS Status polling: `api-reference/endpoint/tts-status.mdx` --- # OpenCode - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations/opencode#content-area) These examples use the website API host, which currently lists their recommended models. The direct API host can have a different catalog during rollouts. For larger requests or longer runtimes, use `https://api.nano-gpt.com/api/v1` with a model from that host’s catalog. See [API Hosts](https://docs.nano-gpt.com/api-reference/miscellaneous/api-hosts) for limits and availability checks. [​](https://docs.nano-gpt.com/integrations/opencode#opencode-integration) OpenCode Integration ================================================================================================= Use NanoGPT with [OpenCode](https://opencode.ai/) , the open source AI coding agent for your terminal. [​](https://docs.nano-gpt.com/integrations/opencode#requirements) Requirements --------------------------------------------------------------------------------- * [OpenCode](https://opencode.ai/) installed (`curl -fsSL https://opencode.ai/install | bash`) * A NanoGPT account with API access [​](https://docs.nano-gpt.com/integrations/opencode#one-click-setup-mac/linux) One-Click Setup (Mac/Linux) ------------------------------------------------------------------------------------------------------------- Run this command in your terminal: curl -fsSL "https://nano-gpt.com/install/opencode_nanogpt.sh" | bash This will: 1. Open your browser to authenticate with NanoGPT (or let you paste an API key) 2. Configure OpenCode to use NanoGPT as your AI provider 3. Add starter model definitions while preserving existing model selections, filters, and connection options OpenCode also includes NanoGPT models from its built-in [Models.dev](https://models.dev/) catalogue. You do not need to define each of those models manually. The installer adds starter model definitions; these do not restrict the model list. Python 3 is required to merge existing OpenCode files. The installer stops if an existing JSON file cannot be read, rather than replacing it. It updates `opencode.json`; if you use `opencode.jsonc`, follow the manual setup below and merge the settings into your existing file. Setup replaces NanoGPT authentication with your chosen login or pasted key. It removes provider-level `options.apiKey` and `Authorization` overrides in provider and model headers from `opencode.json` so the new credentials in `auth.json` take effect, while preserving unrelated headers and custom model settings. [​](https://docs.nano-gpt.com/integrations/opencode#manual-setup) Manual Setup --------------------------------------------------------------------------------- If you prefer to configure manually: ### [​](https://docs.nano-gpt.com/integrations/opencode#1-create-the-auth-file) 1\. Create the auth file Add your NanoGPT API key to `~/.local/share/opencode/auth.json`. If the file already exists, merge the `nano-gpt` entry into it and keep your other authentication entries: { "nano-gpt": { "type": "api", "key": "your-nano-gpt-api-key" } } ### [​](https://docs.nano-gpt.com/integrations/opencode#2-create-the-config-file) 2\. Create the config file Create `~/.config/opencode/opencode.json`, or merge these settings into your existing config: { "$schema": "https://opencode.ai/config.json", "model": "nano-gpt/anthropic/claude-sonnet-5.5", "provider": { "nano-gpt": { "npm": "@ai-sdk/openai-compatible", "name": "NanoGPT", "options": { "baseURL": "https://nano-gpt.com/api/v1" } } } } This uses OpenCode’s built-in NanoGPT catalogue. A `models` block is optional for models already in that catalogue. Use it to add a missing model or override model settings, as described in [Adding More Models](https://docs.nano-gpt.com/integrations/opencode#adding-more-models) . OpenCode also supports `opencode.jsonc` for configs with comments. The examples here use strict JSON. [​](https://docs.nano-gpt.com/integrations/opencode#usage) Usage ------------------------------------------------------------------- After setup, start OpenCode: opencode ### [​](https://docs.nano-gpt.com/integrations/opencode#switching-models) Switching Models Use the `/models` command inside OpenCode to switch between models, or edit the `model` field in your `opencode.json`: { "model": "nano-gpt/deepseek/deepseek-v4-pro" } ### [​](https://docs.nano-gpt.com/integrations/opencode#available-models) Available Models Examples of NanoGPT models are listed below. OpenCode’s built-in catalogue and your custom definitions determine which models appear in `/models`; the list is not limited to entries in your `models` block. | Model ID | Description | | --- | --- | | `nano-gpt/anthropic/claude-sonnet-5.5` | Claude Sonnet 5.5 (default) | | `nano-gpt/anthropic/claude-opus-5.5` | Claude Opus 5.5 | | `nano-gpt/openai/gpt-6.1-sol` | GPT 6.1 Sol | | `nano-gpt/deepseek/deepseek-v4-pro` | DeepSeek V4 Pro | | `nano-gpt/deepseek/deepseek-v4-pro:thinking` | DeepSeek V4 Pro Thinking | | `nano-gpt/deepseek/deepseek-v4-flash` | DeepSeek V4 Flash | | `nano-gpt/deepseek/deepseek-v4-flash:thinking` | DeepSeek V4 Flash Thinking | | `nano-gpt/google/gemini-flash-latest` | Gemini Flash Latest | | `nano-gpt/google/gemini-3.1-pro-preview` | Gemini 3.1 Pro Preview | | `nano-gpt/z-ai/glm-5.3` | GLM 5.3 | ### [​](https://docs.nano-gpt.com/integrations/opencode#adding-more-models) Adding More Models The `models` block adds model definitions or overrides settings for existing models. It does **not** hide models that you have not listed. If a model already appears in OpenCode and you do not need custom settings, you can omit its entry. Keep entries for missing models or custom names, options, variants, and context/output limits. To add or override a model, merge its definition into `provider.nano-gpt.models`: { "provider": { "nano-gpt": { "models": { "z-ai/glm-5.3": { "name": "GLM 5.3", "limit": { "context": 1048576, "output": 131072 } } } } } } List NanoGPT API models with `GET https://nano-gpt.com/api/v1/models`. OpenCode’s catalogue can lag behind the API, so a model missing from OpenCode may need a manual definition. A model appearing in the API list does not necessarily support the tool calls needed by OpenCode. ### [​](https://docs.nano-gpt.com/integrations/opencode#limiting-the-model-list) Limiting the Model List To show only selected NanoGPT models, add `whitelist` under `provider.nano-gpt`. Merge this example into your existing config, keeping your connection settings and any model overrides: { "model": "nano-gpt/anthropic/claude-sonnet-5.5", "provider": { "nano-gpt": { "whitelist": [\ "anthropic/claude-sonnet-5.5",\ "z-ai/glm-5.3"\ ] } } } Use model IDs **without** the `nano-gpt/` prefix inside `whitelist`, `blacklist`, and `models`. The top-level `model` field uses the full `nano-gpt/model-id` format. Alternatively, `blacklist` hides specific models while keeping the rest. If both filters are set, a model must be in `whitelist` and must not be in `blacklist`. Keep the selected default model inside your allowed list, then restart OpenCode after saving. [​](https://docs.nano-gpt.com/integrations/opencode#claude-prompt-caching) Claude Prompt Caching --------------------------------------------------------------------------------------------------- OpenCode adds explicit `cache_control` markers to Claude requests automatically. Its markers omit the TTL and use the five-minute default unless you request a different TTL. You do not need a `promptCaching` block or an `anthropic-beta` header just to use OpenCode’s default Claude caching. A cache marker requests caching; it does not guarantee a cache hit. The prompt must meet the selected model’s minimum cacheable size, and later requests must reuse the same prefix before the cache expires. On NanoGPT’s Chat Completions endpoint, supported explicit cache controls use pay-as-you-go billing, including markers OpenCode adds automatically. They bypass subscription coverage for that request. See [subscription billing for prompt caching](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#subscription-billing-for-chat-completions) . ### [​](https://docs.nano-gpt.com/integrations/opencode#one-hour-caching) One-Hour Caching To request one-hour caching for Opus 5.5, merge this configuration into your existing `opencode.json`. Keep your NanoGPT authentication in `auth.json`: { "$schema": "https://opencode.ai/config.json", "model": "nano-gpt/anthropic/claude-opus-5.5", "provider": { "nano-gpt": { "npm": "@ai-sdk/openai-compatible", "name": "NanoGPT", "options": { "baseURL": "https://nano-gpt.com/api/v1" }, "models": { "anthropic/claude-opus-5.5": { "options": { "promptCaching": { "enabled": true, "ttl": "1h" } } } } } } } OpenCode forwards the model’s `options.promptCaching` as the top-level `promptCaching` field in the API request. NanoGPT applies the requested TTL to the cache boundaries, including OpenCode’s existing markers. No additional `anthropic-beta` header is required. One-hour caching has a higher cache-write price than five-minute caching on standard Claude cache pricing. Choose it when you expect to reuse a large prefix after pauses longer than five minutes. See [cache pricing](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#pricing) . The example leaves `stickyProvider` at its default, `false`, so NanoGPT can fail over when a service is unavailable. Adding `"stickyProvider": true` inside `promptCaching` disables failover and can return a `503` instead. It is optional and does not enable caching by itself. ### [​](https://docs.nano-gpt.com/integrations/opencode#which-model-settings-should-i-keep) Which Model Settings Should I Keep? | Setting | Purpose | When to keep it | | --- | --- | --- | | `name` | Display label in OpenCode | When you want a custom label or are defining a missing model. | | `reasoning: true` | Tells OpenCode that the model supports reasoning; it is capability metadata, not an API instruction to enable thinking. | When defining a missing model or correcting stale catalogue metadata. Usually unnecessary for a correctly listed model. | | `variants` | Adds selectable settings such as reasoning effort | When you want custom choices or a choice missing from your OpenCode version. | | `options.promptCaching` | Sends NanoGPT cache controls | When overriding the default TTL, disabling explicit caching, or setting other cache controls. | | `options.provider.zdr` | A request field forwarded by OpenCode; it is not NanoGPT-wide ZDR enforcement | Keep intentional privacy settings. To require NanoGPT ZDR routing, use your account or API key’s **ZDR only** setting. | | `promptCaching.stickyProvider` | Prevents failover for explicit caching | Only when preserving the cache matters more than request availability. | | `headers.anthropic-beta` | Alternative way to request Claude cache controls | Unnecessary when using the `promptCaching` helper above. | Removing the entire `options` block also removes your caching and request-level privacy settings. Removing `variants` only removes your custom effort choices. ### [​](https://docs.nano-gpt.com/integrations/opencode#opus-5-5-reasoning-effort) Opus 5.5 Reasoning Effort Opus 5.5 uses adaptive thinking automatically. You do not need `reasoning: true` or custom variants to enable its thinking. Supported effort values are `low`, `medium`, `high`, `xhigh`, and `max`; `none` cannot disable this model’s thinking. If your OpenCode version does not offer the choices you want, merge these variants into `provider.nano-gpt.models["anthropic/claude-opus-5.5"]`, alongside the existing `options`: { "reasoning": true, "variants": { "low": { "reasoningEffort": "low" }, "medium": { "reasoningEffort": "medium" }, "high": { "reasoningEffort": "high" }, "xhigh": { "reasoningEffort": "xhigh" }, "max": { "reasoningEffort": "max" } } } OpenCode maps the selected variant’s `reasoningEffort` to NanoGPT’s `reasoning_effort` request field. See [reasoning controls](https://docs.nano-gpt.com/api-reference/miscellaneous/extended-thinking#claude-opus-5-5) for the distinction between generating thinking and displaying it. The snippet includes `reasoning: true` so OpenCode can expose reasoning choices even with missing or stale catalogue metadata. You can omit it when the catalogue already describes the model correctly. ### [​](https://docs.nano-gpt.com/integrations/opencode#checking-cache-hits) Checking Cache Hits Look for `cache_creation_input_tokens` on an eligible write and `cache_read_input_tokens > 0` on a subsequent request that reuses the prefix. A successful answer alone does not establish a cache hit or the requested TTL. Raw API responses can also include `x_nanogpt_pricing.cacheTTL` for the billing TTL. If your OpenCode version does not display these fields, use the [API cache verification examples](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#usage-fields-how-to-verify-cache-hits) . A short prompt can return zero cached tokens even with a correct configuration. The request format above was checked with OpenCode 1.14.48 and `@ai-sdk/openai-compatible`. Other SDKs or older client versions can map options differently. [​](https://docs.nano-gpt.com/integrations/opencode#troubleshooting) Troubleshooting --------------------------------------------------------------------------------------- **OpenCode not finding the config?** Use `opencode.json` or `opencode.jsonc`, without a leading dot: * Global config: `~/.config/opencode/opencode.json`, or `$XDG_CONFIG_HOME/opencode/opencode.json` when `XDG_CONFIG_HOME` is set. * Project config: `opencode.json` in your project. OpenCode merges config sources. Project settings can override global settings, and a custom config set with `OPENCODE_CONFIG` can add another source. See [OpenCode’s config documentation](https://opencode.ai/docs/config/#locations) for the full precedence rules. **More models appear than expected?** Check that `whitelist` is inside `provider.nano-gpt`, not inside `models`. Defining a `models` block does not filter the catalogue. Also check project configs and `opencode.jsonc` for settings that override your global filters. **The installer cannot merge your config?** Install Python 3 when updating existing OpenCode files. The installer reads strict JSON only; if your config contains comments, use manual setup in `opencode.jsonc`. The installer stops before authentication or file updates if existing auth or JSON config files cannot be read or parsed. **Authentication errors?** Check that your API key is correctly set in `~/.local/share/opencode/auth.json` (as an object with `type` and `key`) and that the key name matches the provider ID (`nano-gpt`). **Claude caching is not being used?** If you configured a TTL override, check that `promptCaching` is inside the selected model’s `options`, that `enabled` is `true`, and that the TTL is exactly `"5m"` or `"1h"`. Keep reusable instructions and tool definitions at the beginning of the prompt. Changes to that prefix, insufficient prompt length, expiration, or failover can prevent a cache hit. **A request returns “temporarily unavailable”?** If you set `promptCaching.stickyProvider: true`, a `503` can mean failover was prevented to preserve the cache. Privacy and provider restrictions can also reduce the available routes. Keep intentional privacy requirements; a service error alone does not establish that those requirements caused the failure. Retry, and send support the new request ID, model ID, and approximate time if the error continues. --- # Image Generation (OpenAI-Compatible) - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/v1/images/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "prompt": "", "model": "hidream", "n": 1, "size": "1024x1024", "response_format": "b64_json", "user": "", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": [\ "data:image/jpeg;base64,/9j/4AAQ...",\ "data:image/png;base64,iVBORw0KGgo..."\ ], "maskDataUrl": "data:image/png;base64,iVBORw0KGgo...", "strength": 0.8, "guidance_scale": 7.5, "num_inference_steps": 30, "seed": 42, "kontext_max_mode": false } ' import requests url = "https://api.nano-gpt.com/v1/images/generations" payload = { "prompt": "", "model": "hidream", "n": 1, "size": "1024x1024", "response_format": "b64_json", "user": "", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": ["data:image/jpeg;base64,/9j/4AAQ...", "data:image/png;base64,iVBORw0KGgo..."], "maskDataUrl": "data:image/png;base64,iVBORw0KGgo...", "strength": 0.8, "guidance_scale": 7.5, "num_inference_steps": 30, "seed": 42, "kontext_max_mode": False } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ prompt: '', model: 'hidream', n: 1, size: '1024x1024', response_format: 'b64_json', user: '', imageDataUrl: 'data:image/jpeg;base64,/9j/4AAQ...', imageDataUrls: ['data:image/jpeg;base64,/9j/4AAQ...', 'data:image/png;base64,iVBORw0KGgo...'], maskDataUrl: 'data:image/png;base64,iVBORw0KGgo...', strength: 0.8, guidance_scale: 7.5, num_inference_steps: 30, seed: 42, kontext_max_mode: false }) }; fetch('https://api.nano-gpt.com/v1/images/generations', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/v1/images/generations",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'prompt' => '',\ 'model' => 'hidream',\ 'n' => 1,\ 'size' => '1024x1024',\ 'response_format' => 'b64_json',\ 'user' => '',\ 'imageDataUrl' => 'data:image/jpeg;base64,/9j/4AAQ...',\ 'imageDataUrls' => [\ 'data:image/jpeg;base64,/9j/4AAQ...',\ 'data:image/png;base64,iVBORw0KGgo...'\ ],\ 'maskDataUrl' => 'data:image/png;base64,iVBORw0KGgo...',\ 'strength' => 0.8,\ 'guidance_scale' => 7.5,\ 'num_inference_steps' => 30,\ 'seed' => 42,\ 'kontext_max_mode' => false\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/v1/images/generations" payload := strings.NewReader("{\n \"prompt\": \"\",\n \"model\": \"hidream\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\",\n \"user\": \"\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"data:image/png;base64,iVBORw0KGgo...\"\n ],\n \"maskDataUrl\": \"data:image/png;base64,iVBORw0KGgo...\",\n \"strength\": 0.8,\n \"guidance_scale\": 7.5,\n \"num_inference_steps\": 30,\n \"seed\": 42,\n \"kontext_max_mode\": false\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/v1/images/generations") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"prompt\": \"\",\n \"model\": \"hidream\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\",\n \"user\": \"\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"data:image/png;base64,iVBORw0KGgo...\"\n ],\n \"maskDataUrl\": \"data:image/png;base64,iVBORw0KGgo...\",\n \"strength\": 0.8,\n \"guidance_scale\": 7.5,\n \"num_inference_steps\": 30,\n \"seed\": 42,\n \"kontext_max_mode\": false\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/v1/images/generations") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"prompt\": \"\",\n \"model\": \"hidream\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\",\n \"user\": \"\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"data:image/png;base64,iVBORw0KGgo...\"\n ],\n \"maskDataUrl\": \"data:image/png;base64,iVBORw0KGgo...\",\n \"strength\": 0.8,\n \"guidance_scale\": 7.5,\n \"num_inference_steps\": 30,\n \"seed\": 42,\n \"kontext_max_mode\": false\n}" response = http.request(request) puts response.read_body 200 url { "created": 123, "data": [\ {\ "url": "https://...signed-url..."\ }\ ], "cost": 123, "paymentSource": "", "remainingBalance": 123 } POST / v1 / images / generations Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/v1/images/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "prompt": "", "model": "hidream", "n": 1, "size": "1024x1024", "response_format": "b64_json", "user": "", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": [\ "data:image/jpeg;base64,/9j/4AAQ...",\ "data:image/png;base64,iVBORw0KGgo..."\ ], "maskDataUrl": "data:image/png;base64,iVBORw0KGgo...", "strength": 0.8, "guidance_scale": 7.5, "num_inference_steps": 30, "seed": 42, "kontext_max_mode": false } ' import requests url = "https://api.nano-gpt.com/v1/images/generations" payload = { "prompt": "", "model": "hidream", "n": 1, "size": "1024x1024", "response_format": "b64_json", "user": "", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": ["data:image/jpeg;base64,/9j/4AAQ...", "data:image/png;base64,iVBORw0KGgo..."], "maskDataUrl": "data:image/png;base64,iVBORw0KGgo...", "strength": 0.8, "guidance_scale": 7.5, "num_inference_steps": 30, "seed": 42, "kontext_max_mode": False } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({ prompt: '', model: 'hidream', n: 1, size: '1024x1024', response_format: 'b64_json', user: '', imageDataUrl: 'data:image/jpeg;base64,/9j/4AAQ...', imageDataUrls: ['data:image/jpeg;base64,/9j/4AAQ...', 'data:image/png;base64,iVBORw0KGgo...'], maskDataUrl: 'data:image/png;base64,iVBORw0KGgo...', strength: 0.8, guidance_scale: 7.5, num_inference_steps: 30, seed: 42, kontext_max_mode: false }) }; fetch('https://api.nano-gpt.com/v1/images/generations', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/v1/images/generations",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'prompt' => '',\ 'model' => 'hidream',\ 'n' => 1,\ 'size' => '1024x1024',\ 'response_format' => 'b64_json',\ 'user' => '',\ 'imageDataUrl' => 'data:image/jpeg;base64,/9j/4AAQ...',\ 'imageDataUrls' => [\ 'data:image/jpeg;base64,/9j/4AAQ...',\ 'data:image/png;base64,iVBORw0KGgo...'\ ],\ 'maskDataUrl' => 'data:image/png;base64,iVBORw0KGgo...',\ 'strength' => 0.8,\ 'guidance_scale' => 7.5,\ 'num_inference_steps' => 30,\ 'seed' => 42,\ 'kontext_max_mode' => false\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/v1/images/generations" payload := strings.NewReader("{\n \"prompt\": \"\",\n \"model\": \"hidream\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\",\n \"user\": \"\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"data:image/png;base64,iVBORw0KGgo...\"\n ],\n \"maskDataUrl\": \"data:image/png;base64,iVBORw0KGgo...\",\n \"strength\": 0.8,\n \"guidance_scale\": 7.5,\n \"num_inference_steps\": 30,\n \"seed\": 42,\n \"kontext_max_mode\": false\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/v1/images/generations") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"prompt\": \"\",\n \"model\": \"hidream\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\",\n \"user\": \"\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"data:image/png;base64,iVBORw0KGgo...\"\n ],\n \"maskDataUrl\": \"data:image/png;base64,iVBORw0KGgo...\",\n \"strength\": 0.8,\n \"guidance_scale\": 7.5,\n \"num_inference_steps\": 30,\n \"seed\": 42,\n \"kontext_max_mode\": false\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/v1/images/generations") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"prompt\": \"\",\n \"model\": \"hidream\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\",\n \"user\": \"\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"data:image/png;base64,iVBORw0KGgo...\"\n ],\n \"maskDataUrl\": \"data:image/png;base64,iVBORw0KGgo...\",\n \"strength\": 0.8,\n \"guidance_scale\": 7.5,\n \"num_inference_steps\": 30,\n \"seed\": 42,\n \"kontext_max_mode\": false\n}" response = http.request(request) puts response.read_body 200 url { "created": 123, "data": [\ {\ "url": "https://...signed-url..."\ }\ ], "cost": 123, "paymentSource": "", "remainingBalance": 123 } [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#overview) Overview -------------------------------------------------------------------------------------------------- Generate images from text prompts or base64 image inputs using the OpenAI-compatible endpoint. Responses include base64 bytes (`b64_json`) by default or signed URLs (`url`) when `response_format: "url"`. For new integrations that do not need OpenAI-compatible request shapes, use the dedicated [Image API](https://docs.nano-gpt.com/api-reference/image-generation) . It supports image model discovery, endpoint metadata, public pricing metadata, and normalized generation through `POST /api/v1/images`. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#endpoint) Endpoint -------------------------------------------------------------------------------------------------- * Method/Path: `POST https://api.nano-gpt.com/v1/images/generations` * Auth: `Authorization: Bearer ` * Required header: `Content-Type: application/json` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#request-body-json) Request Body (JSON) ---------------------------------------------------------------------------------------------------------------------- Core fields: * `prompt` (string, required): Text prompt to generate an image from. * `model` (string, optional): Model ID (default `hidream`). * `n` (integer, optional): Number of images to generate (default `1`). * `size` (string, optional): Requested output size or model-specific resolution value. Use `GET /api/v1/image-models?detailed=true` and read `supported_parameters.resolutions` for the selected model’s supported values. * `response_format` (string, optional): `b64_json` (default) or `url`. * `user` (string, optional): End-user identifier. Image inputs (img2img/inpainting): * `imageDataUrl` (string, optional): Base64 data URL for a single input image. * `imageDataUrls` (array, optional): Multiple base64 data URLs for supported models. * `maskDataUrl` (string, optional): Base64 mask data URL for inpainting. Generation controls (model-specific): * `strength`, `guidance_scale`, `num_inference_steps`, `kontext_max_mode`. * `seed` is an optional model-specific hint that may improve reproducibility where supported. Identical results are not guaranteed. Check the selected model’s `supported_parameters` metadata before using this field. GPT Image output controls (`gpt-image-1`, `gpt-image-1.5`, `gpt-image-2`, and the GPT Image 2.5 Flare and Sunburst models): * `quality` (string, optional): Model-specific quality level, for example `low`, `medium`, or `high`. GPT Image 2.5 also accepts `xhigh` and `max`. * `output_format` (string, optional): `png`, `jpeg`, or `webp`. * `output_compression` (integer, optional): `0`–`100`. Applies to `jpeg` and `webp` output only. * `background` (string, optional, not supported by `gpt-image-2`): `auto` (default), `opaque`, or `transparent`. `transparent` requires `output_format` `png` or `webp`. If the prompt describes a backdrop, the model may draw it instead of leaving the background transparent. Requests with `opaque` or `transparent` are only routed to providers that support the setting, so they never fall back to one that would ignore it. See [Supported Parameter Discovery](https://docs.nano-gpt.com/api-reference/image-generation#supported-parameter-discovery) for the discovery workflow. If a model/provider route offers a stronger reproducibility guarantee, rely only on documentation for that specific route. For OpenAI-compatible image editing, use [Image Edits](https://docs.nano-gpt.com/api-reference/endpoint/image-edits) . [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#response) Response -------------------------------------------------------------------------------------------------- * Each `data[i]` contains either `b64_json` (default) or `url` (when `response_format: "url"`), never both. * When requesting `response_format: "url"`, the API may still return `b64_json` if URL generation (upload/presign) fails, as a fallback. * Signed URLs expire after a short period (currently ~1 hour). Download promptly for long-term storage. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#examples) Examples -------------------------------------------------------------------------------------------------- cURL (basic) cURL (response\_format: "url") cURL (transparent background) Python (img2img) curl https://api.nano-gpt.com/v1/images/generations \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "hidream", "prompt": "A sunset over a mountain range", "n": 1, "size": "1024x1024" }' curl https://api.nano-gpt.com/v1/images/generations \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "hidream", "prompt": "A neon city skyline at night", "n": 1, "size": "1024x1024", "response_format": "url" }' curl https://api.nano-gpt.com/v1/images/generations \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-image-2.5/flare/text-to-image", "prompt": "A glossy red game controller icon, isolated object", "n": 1, "size": "1024x1024", "background": "transparent", "output_format": "png" }' import base64 import requests API_KEY = "YOUR_API_KEY" with open("input.jpg", "rb") as f: encoded = base64.b64encode(f.read()).decode("utf-8") image_data_url = f"data:image/jpeg;base64,{encoded}" response = requests.post( "https://api.nano-gpt.com/v1/images/generations", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json", }, json={ "model": "flux-kontext", "prompt": "Transform this image into a watercolor painting", "n": 1, "size": "1024x1024", "imageDataUrl": image_data_url, }, ) result = response.json() [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#notes-&-limits) Notes & Limits -------------------------------------------------------------------------------------------------------------- * Input images must be provided as base64 data URLs; download and convert remote images before sending. * Uploads should be 4 MB or smaller after encoding. Compress or resize large assets before sending. * Use `GET /api/v1/image-models?detailed=true` to discover current image model capabilities and supported resolution values. For seed and other model-specific fields, also consult the [Image API supported-parameter guidance](https://docs.nano-gpt.com/api-reference/image-generation#supported-parameter-discovery) . #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Headers [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#parameter-x-x402) x-x402 enum Set to true on unauthenticated accountless x402 quote requests. Without this header, unauthenticated requests return 401 missing\_api\_key. Available options: `true` #### Body application/json Parameters for image generation [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-prompt) prompt string required The text prompt to generate an image from [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-model) model string default:hidream The model to use for generation [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-n) n integer default:1 Number of images to generate [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-size) size string Requested output size or model-specific resolution value. Use GET /api/v1/image-models?detailed=true and read supported\_parameters.resolutions for the selected model's supported values. Examples: `"1024x1024"` `"1376x768"` `"auto"` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-response-format) response\_format enum default:b64\_json The format in which the generated images are returned. Use "b64\_json" (default) to receive base64-encoded image bytes in data\[i\].b64\_json, or "url" to receive a time-limited, signed download URL in data\[i\].url (expires after a short period, currently ~1 hour). Note: When requesting "url", the API may still return "b64\_json" if URL generation (upload/presign) fails, as a fallback. Available options: `url`, `b64_json` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-user) user string A unique identifier representing your end-user [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-image-data-url) imageDataUrl string Base64-encoded image data URL for img2img generation. Single image input for models that support image-to-image transformation. Format: data:image/\[type\];base64,\[data\]. Note: Direct URL input is not supported - images must be converted to base64 data URLs before submission. Example: `"data:image/jpeg;base64,/9j/4AAQ..."` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-image-data-urls) imageDataUrls string\[\] Array of base64-encoded image data URLs for models supporting multiple image inputs (e.g., flux-kontext, gpt-4o-image, gpt-image-1). Each URL must follow the format: data:image/\[type\];base64,\[data\] Example: `[ "data:image/jpeg;base64,/9j/4AAQ...", "data:image/png;base64,iVBORw0KGgo..." ]` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-mask-data-url) maskDataUrl string Base64-encoded mask image data URL for inpainting models (e.g., flux-lora/inpainting). White areas indicate regions to edit. Format: data:image/\[type\];base64,\[data\] Example: `"data:image/png;base64,iVBORw0KGgo..."` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-strength) strength number default:0.8 Controls how much the output differs from the input image in img2img mode. Lower values produce outputs closer to the input. Required range: `0 <= x <= 1` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-guidance-scale) guidance\_scale number default:7.5 How closely the model follows the text prompt. Higher values result in images more closely aligned with the prompt. Required range: `0 <= x <= 20` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-num-inference-steps) num\_inference\_steps integer default:30 Number of denoising steps. More steps generally produce higher quality but take longer. Required range: `1 <= x <= 100` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-seed) seed integer Optional model-specific seed that may improve reproducibility where supported by the model/provider route. Identical results are not guaranteed. Check the selected model's supported\_parameters metadata before using this field. Example: `42` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#body-kontext-max-mode) kontext\_max\_mode boolean default:false Enable enhanced context mode for flux-kontext model. Provides better understanding of input images. #### Response 200 application/json Image generation response. Each data\[i\] contains either { url } or { b64\_json }. When requesting response\_format: "url", the API may fall back to returning { b64\_json } if URL generation (upload/presign) fails. [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#response-created) created integer Unix timestamp of when the image was created [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#response-data) data object\[\] List of generated images. Each entry contains either a hosted URL (data\[i\].url) or base64-encoded bytes (data\[i\].b64\_json), never both. * Option 1 * Option 2 Show child attributes Example: `{ "url": "https://...signed-url..." }` [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#response-cost) cost number Cost of the generation [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#response-payment-source) paymentSource string Payment source used [​](https://docs.nano-gpt.com/api-reference/endpoint/image-generation-openai#response-remaining-balance) remainingBalance number Remaining balance after the generation --- # Moderations - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/moderations#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/moderations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "input": "Text to classify for safety.", "model": "moderation-model-id" } ' import requests url = "https://api.nano-gpt.com/api/v1/moderations" payload = { "input": "Text to classify for safety.", "model": "moderation-model-id" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({input: 'Text to classify for safety.', model: 'moderation-model-id'}) }; fetch('https://api.nano-gpt.com/api/v1/moderations', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/moderations",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'input' => 'Text to classify for safety.',\ 'model' => 'moderation-model-id'\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/moderations" payload := strings.NewReader("{\n \"input\": \"Text to classify for safety.\",\n \"model\": \"moderation-model-id\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/moderations") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"input\": \"Text to classify for safety.\",\n \"model\": \"moderation-model-id\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/moderations") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"input\": \"Text to classify for safety.\",\n \"model\": \"moderation-model-id\"\n}" response = http.request(request) puts response.read_body 200 400 402 403 404 503 { "id": "modr_...", "model": "moderation-model-id", "results": [\ {\ "flagged": false,\ "categories": {\ "category_name": false\ },\ "category_scores": {\ "category_name": 0.01\ }\ }\ ], "usage": { "prompt_tokens": 12, "completion_tokens": 100, "total_tokens": 112 } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / v1 / moderations Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/v1/moderations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "input": "Text to classify for safety.", "model": "moderation-model-id" } ' import requests url = "https://api.nano-gpt.com/api/v1/moderations" payload = { "input": "Text to classify for safety.", "model": "moderation-model-id" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: JSON.stringify({input: 'Text to classify for safety.', model: 'moderation-model-id'}) }; fetch('https://api.nano-gpt.com/api/v1/moderations', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/moderations",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'input' => 'Text to classify for safety.',\ 'model' => 'moderation-model-id'\ ]),\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer ",\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/moderations" payload := strings.NewReader("{\n \"input\": \"Text to classify for safety.\",\n \"model\": \"moderation-model-id\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/v1/moderations") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"input\": \"Text to classify for safety.\",\n \"model\": \"moderation-model-id\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/moderations") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"input\": \"Text to classify for safety.\",\n \"model\": \"moderation-model-id\"\n}" response = http.request(request) puts response.read_body 200 400 402 403 404 503 { "id": "modr_...", "model": "moderation-model-id", "results": [\ {\ "flagged": false,\ "categories": {\ "category_name": false\ },\ "category_scores": {\ "category_name": 0.01\ }\ }\ ], "usage": { "prompt_tokens": 12, "completion_tokens": 100, "total_tokens": 112 } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#overview) Overview -------------------------------------------------------------------------------------- Use `POST /api/v1/moderations` to classify text, image, or mixed content for safety before you store, display, or send user-generated content to another model endpoint. If you want NanoGPT to run a paid input safety preflight automatically before supported generation requests, use [Inline Moderation](https://docs.nano-gpt.com/api-reference/miscellaneous/inline-moderation) instead. The endpoint is synchronous and returns an OpenAI-compatible moderation response shape where practical. It is a paid API feature and bills proportionally to usage with no separate minimum charge. [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#endpoint) Endpoint -------------------------------------------------------------------------------------- POST https://api.nano-gpt.com/api/v1/moderations [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#authentication) Authentication -------------------------------------------------------------------------------------------------- An API key is required. * `Authorization: Bearer YOUR_API_KEY` * `x-api-key: YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#model-selection) Model Selection ---------------------------------------------------------------------------------------------------- The `model` field is optional. If omitted, NanoGPT uses the default moderation model. Available input types, batch support, context limits, and pricing depend on the selected model. Use [Moderation Models](https://docs.nano-gpt.com/api-reference/endpoint/moderation-models) before choosing a model instead of hardcoding capabilities. [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#request-body) Request Body ---------------------------------------------------------------------------------------------- | Field | Type | Required | Description | | --- | --- | --- | --- | | `model` | string | No | Moderation model ID. Omit to use the default moderation model. | | `input` | string, array, or content parts | Yes | Content to classify. | [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#input-examples) Input Examples -------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#single-text-input) Single Text Input { "model": "moderation-model-id", "input": "Text to classify." } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#batch-text-input) Batch Text Input { "model": "moderation-model-id", "input": [\ "First item to classify.",\ "Second item to classify."\ ] } Batch support can vary by model. If a selected model does not support batched input, the API returns an error before billing. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#text-content-part) Text Content Part { "model": "moderation-model-id", "input": [\ {\ "type": "text",\ "text": "Text to classify."\ }\ ] } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#image-input) Image Input { "model": "moderation-model-id", "input": [\ {\ "type": "image_url",\ "image_url": {\ "url": "https://example.com/image.png"\ }\ }\ ] } Image support depends on the selected model. Text-only models reject image input before billing. [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#example) Example ------------------------------------------------------------------------------------ curl https://api.nano-gpt.com/api/v1/moderations \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "moderation-model-id", "input": "Text to classify for safety." }' [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#response) Response -------------------------------------------------------------------------------------- { "id": "modr_...", "model": "moderation-model-id", "results": [\ {\ "flagged": false,\ "categories": {\ "category_name": false\ },\ "category_scores": {\ "category_name": 0.01\ }\ }\ ], "usage": { "prompt_tokens": 12, "completion_tokens": 100, "total_tokens": 112 } } | Field | Description | | --- | --- | | `flagged` | `true` when the selected model classifies the content as unsafe. | | `categories` | Category-level boolean results. Exact category names are model-dependent. | | `category_scores` | Category-level confidence scores when available. Exact category names are model-dependent. | | `usage` | Token usage used for billing and diagnostics. | [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#billing) Billing ------------------------------------------------------------------------------------ The endpoint is paid and bills proportionally to usage. There is no extra minimum charge. General billing behavior: * Input tokens are billed according to the selected moderation model’s input rate. * Output tokens may be billed when the selected model returns billable classification output. * NanoGPT performs a preflight balance check before dispatching the request. * The final charge is based on measured or estimated usage recorded for the completed request. * Pricing details are returned by `GET /api/v1/moderation-models`. [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#rate-limits-and-access-controls) Rate Limits And Access Controls ------------------------------------------------------------------------------------------------------------------------------------ The endpoint uses standard NanoGPT API authentication, balance checks, API-key limits, and account/team access controls. * API keys can be subject to model allowlists. * API keys can be subject to spending and token limits. * Team billing and team restrictions apply where configured. * Requests can be rate limited. [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#errors) Errors ---------------------------------------------------------------------------------- Errors follow the standard NanoGPT/OpenAI-compatible error shape: { "error": { "message": "Invalid request parameters. Please check your input and try again.", "type": "invalid_request_error", "code": "unsupported_input_modality", "param": "input" } } | Status | Code | Meaning | | --- | --- | --- | | 400 | `empty_input` | The request did not include moderatable text or image content. | | 400 | `unsupported_input_modality` | The selected model does not support the submitted input type. | | 400 | `unsupported_batch_input` | The selected model does not support batched input. | | 400 | `context_length_exceeded` | The input is too large for the selected model. | | 401 | `missing_api_key` or `invalid_api_key` | Authentication failed. | | 402 | varies | The account does not have enough balance. | | 403 | `paid_features_disabled` | Paid API features are disabled for the account. | | 404 | `model_not_found` | The requested moderation model does not exist or is unavailable. | | 429 | `rate_limit_exceeded` | The caller exceeded a rate limit. | | 503 | `provider_error` or similar | The upstream moderation service was temporarily unavailable or returned an invalid response. | #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Body application/json Parameters for creating a moderation classification [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#body-input-one-of-0) input stringstring · object · object\[\]stringstring · object · object\[\] required Content to classify Example: `"Text to classify for safety."` [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#body-model) model string Moderation model ID. Omit to use the default moderation model. Example: `"moderation-model-id"` #### Response 200 application/json Moderation classification response [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#response-id) id string required Moderation request identifier Example: `"modr_..."` [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#response-model) model string required Moderation model used for classification Example: `"moderation-model-id"` [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#response-results) results object\[\] required Moderation results for each classified input Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/moderations#response-usage) usage object Token usage used for billing and diagnostics Show child attributes --- # Data API - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/data-api#content-area) Data API cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/data import requests url = "https://api.nano-gpt.com/api/v1/data" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/data', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/data",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/data" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/data") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/data") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body GET / api / v1 / data Try it Data API cURL curl --request GET \ --url https://api.nano-gpt.com/api/v1/data import requests url = "https://api.nano-gpt.com/api/v1/data" response = requests.get(url) print(response.text) const options = {method: 'GET'}; fetch('https://api.nano-gpt.com/api/v1/data', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/v1/data",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/v1/data" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/v1/data") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/v1/data") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#overview) Overview ----------------------------------------------------------------------------------- NanoGPT exposes a unified Data API under `/api/v1/data`. It gives customers one discoverable entry point for web search, URL scraping, maps data, social data, and business enrichment. The Data API is a wrapper around the existing direct endpoints. It does not change the underlying response bodies, validation rules, billing, rate limits, async behavior, provider options, authentication, or x402 behavior unless noted here. Direct endpoints remain available for compatibility. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#base-url) Base URL ----------------------------------------------------------------------------------- https://api.nano-gpt.com/api/v1/data Local development: http://localhost:3000/api/v1/data [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#authentication) Authentication ----------------------------------------------------------------------------------------------- Use the same NanoGPT API key authentication as existing API routes: Authorization: Bearer YOUR_API_KEY The public accountless x402 contract is available on selected Data API paths. To request an accountless x402 quote, send the API request without `Authorization` or `x-api-key`, and include `x-x402: true`. NanoGPT will return `402 Payment Required` with available payment options. An unauthenticated request without `x-x402: true` is treated as a normal unauthenticated request and returns `401 missing_api_key`. Currently documented accountless Data API paths: * `POST /api/v1/data/web/search` * `POST /api/v1/data/url/scrape` Use `GET /api/v1/x402/endpoints` as the deployment source of truth, including Lightning L402 availability when advertised. See [Accountless x402 API Payments](https://docs.nano-gpt.com/api-reference/miscellaneous/x402) for completion, replay, and polling behavior. Direct legacy routes remain available, but accountless docs prefer the public v1 data paths. Some underlying endpoints may also support browser-session flows. The Data API forwards authentication and payment-related headers to the underlying route. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#discovery) Discovery ------------------------------------------------------------------------------------- List available Data API endpoints: GET /api/v1/data Alias: GET /api/v1/data/endpoints The catalog response is cacheable: Cache-Control: public, max-age=300, stale-while-revalidate=3600 ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#example-catalog-response) Example catalog response { "object": "list", "data": [\ {\ "id": "web.search",\ "object": "data.endpoint",\ "name": "Web Search",\ "description": "Search the web through NanoGPT search providers.",\ "category": "search",\ "provider": "NanoGPT",\ "methods": ["POST"],\ "endpoint": "/api/v1/data/web/search",\ "url": "https://api.nano-gpt.com/api/v1/data/web/search",\ "direct_endpoint": "/api/web",\ "pricing": "Usage-based; estimated from provider, depth, and partner markup.",\ "status": "available"\ }\ ], "meta": { "count": 20, "providers": ["Apify", "Firecrawl", "Hunter", "NanoGPT"], "categories": ["business", "maps", "scraping", "search", "social"], "dispatch": { "endpoint": "/api/v1/data", "body": { "endpoint": "web.search", "input": { "query": "latest AI news" } } } } } [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#endpoint-metadata) Endpoint Metadata ----------------------------------------------------------------------------------------------------- For endpoints that do not support `GET`, calling their Data API path with `GET` returns the public metadata object instead of dispatching the tool. GET /api/v1/data/web/search For endpoints that do support `GET`, the request is forwarded to the underlying endpoint. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#calling-endpoints) Calling Endpoints ----------------------------------------------------------------------------------------------------- The Data API supports path-style dispatch and body-style dispatch. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#path-style-dispatch) Path-style dispatch Use a stable Data API path and send the underlying endpoint’s normal input body. curl https://api.nano-gpt.com/api/v1/data/web/search \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "latest AI model releases", "depth": "standard" }' Path-style dispatch is the simplest format for fixed integrations because each tool has a URL. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#body-style-dispatch) Body-style dispatch Use `POST /api/v1/data` and specify the target endpoint in the request body. curl https://api.nano-gpt.com/api/v1/data \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "web.search", "input": { "query": "latest AI model releases", "depth": "standard" } }' The dispatch key can be `endpoint`, `id`, or `type`. Endpoint input can be provided in an `input` object: { "endpoint": "web.search", "input": { "query": "latest AI model releases" } } It can also be provided directly in the dispatch body: { "endpoint": "web.search", "query": "latest AI model releases" } If `input` is present, it is forwarded. If `data` is present and `input` is absent, `data` is forwarded. Otherwise, all fields except `endpoint`, `id`, `type`, `input`, and `data` are forwarded as the endpoint input. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#request-forwarding-behavior) Request Forwarding Behavior ------------------------------------------------------------------------------------------------------------------------- The Data API: * Preserves request query parameters. * Preserves request headers except hop-by-hop headers such as `connection`, `content-length`, `host`, `keep-alive`, `transfer-encoding`, and `upgrade`. * Forces `Content-Type: application/json` when it forwards a JSON body. * Forwards JSON request bodies to `POST` routes. * Allows empty-body path-style `POST` requests and forwards `{}`. * Requires a valid JSON body for body-style `POST /api/v1/data`. * Adds tracking headers to dispatched responses. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#response-headers) Response Headers --------------------------------------------------------------------------------------------------- Dispatched responses include: x-nanogpt-data-endpoint: web.search x-nanogpt-direct-endpoint: /api/web These headers are exposed to browser clients through: Access-Control-Expose-Headers: x-nanogpt-data-endpoint, x-nanogpt-direct-endpoint Use these headers for client-side observability, debugging, analytics, and support traces. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#error-format) Error Format ------------------------------------------------------------------------------------------- Errors generated by the Data API wrapper use this shape: { "error": { "message": "Unknown data endpoint: not.real", "type": "invalid_request_error", "code": "unknown_endpoint" } } Common wrapper-level errors: | Status | Code | Meaning | | --- | --- | --- | | `400` | `invalid_json` | Request body is missing or invalid JSON where JSON is required. | | `400` | `invalid_body` | Body-style dispatch body is not an object. | | `400` | `missing_endpoint` | Body-style dispatch did not include `endpoint`, `id`, or `type`. | | `404` | `unknown_endpoint` | Endpoint id or path is not recognized. | | `405` | `method_not_allowed` | Endpoint exists but does not support the requested method. | | `500` | `unsupported_data_endpoint` | Catalog entry exists but no dispatcher implementation matched it. | Once a request is forwarded, the underlying endpoint may return its own existing error format. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#endpoint-catalog) Endpoint Catalog --------------------------------------------------------------------------------------------------- | Endpoint ID | Data API Path | Direct Endpoint | Methods | Category | Provider | Pricing Note | | --- | --- | --- | --- | --- | --- | --- | | `web.search` | `/api/v1/data/web/search` | `/api/web` | `POST` | search | NanoGPT | Usage-based; estimated from provider, depth, and partner markup. | | `url.scrape` | `/api/v1/data/url/scrape` | `/api/scrape-urls` | `POST` | scraping | NanoGPT | Per URL, with higher pricing for stealth mode. | | `firecrawl` | `/api/v1/data/firecrawl` | `/api/v1/firecrawl` | `POST` | scraping | Firecrawl | Credit-based Firecrawl pricing with NanoGPT markup. | | `google_maps.search` | `/api/v1/data/google-maps/search` | `/api/v1/googlemaps` | `GET`, `POST` | maps | Apify | Apify charged-event pricing with NanoGPT markup. | | `google_maps.reviews` | `/api/v1/data/google-maps/reviews` | `/api/v1/googlemaps/reviews` | `POST` | maps | Apify | Apify charged-event pricing with NanoGPT markup. | | `reddit.scrape` | `/api/v1/data/reddit` | `/api/v1/reddit` | `POST` | social | Apify | Apify charged-event pricing with NanoGPT markup. | | `linkedin.profile` | `/api/v1/data/linkedin/profile` | `/api/v1/linkedin/profile` | `POST` | business | Apify | Apify charged-event pricing with NanoGPT markup. | | `instagram.profile` | `/api/v1/data/instagram/profile` | `/api/v1/instagram/profile` | `POST` | social | Apify | Apify charged-event pricing with NanoGPT markup. | | `instagram.posts` | `/api/v1/data/instagram/posts` | `/api/v1/instagram/posts` | `POST` | social | Apify | Apify charged-event pricing with NanoGPT markup. | | `instagram.reels` | `/api/v1/data/instagram/reels` | `/api/v1/instagram/reels` | `POST` | social | Apify | Apify charged-event pricing with NanoGPT markup. | | `tiktok.scrape` | `/api/v1/data/tiktok` | `/api/v1/tiktok` | `POST` | social | Apify | Apify charged-event pricing with NanoGPT markup. | | `x.read` | `/api/v1/data/x` | `/api/v1/x` | `GET`, `POST` | social | NanoGPT | Endpoint-specific usage pricing. | | `hunter.discover` | `/api/v1/data/hunter/discover` | `/api/v1/hunter/discover` | `POST` | business | Hunter | Free. | | `hunter.domain_search` | `/api/v1/data/hunter/domain-search` | `/api/v1/hunter/domain-search` | `GET`, `POST` | business | Hunter | Hunter search-credit pricing with NanoGPT markup. | | `hunter.email_finder` | `/api/v1/data/hunter/email-finder` | `/api/v1/hunter/email-finder` | `GET`, `POST` | business | Hunter | Hunter search-credit pricing with NanoGPT markup. | | `hunter.email_verifier` | `/api/v1/data/hunter/email-verifier` | `/api/v1/hunter/email-verifier` | `GET`, `POST` | business | Hunter | Hunter verification-credit pricing with NanoGPT markup. | | `hunter.person_enrichment` | `/api/v1/data/hunter/people/find` | `/api/v1/hunter/people/find` | `GET`, `POST` | business | Hunter | Hunter enrichment-credit pricing with NanoGPT markup. | | `hunter.company_enrichment` | `/api/v1/data/hunter/companies/find` | `/api/v1/hunter/companies/find` | `GET`, `POST` | business | Hunter | Hunter enrichment-credit pricing with NanoGPT markup. | | `hunter.combined_enrichment` | `/api/v1/data/hunter/combined/find` | `/api/v1/hunter/combined/find` | `GET`, `POST` | business | Hunter | Hunter enrichment-credit pricing with NanoGPT markup. | | `hunter.email_count` | `/api/v1/data/hunter/email-count` | `/api/v1/hunter/email-count` | `GET`, `POST` | business | Hunter | Free. | [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#endpoint-aliases) Endpoint Aliases --------------------------------------------------------------------------------------------------- Body-style dispatch accepts canonical endpoint IDs and these aliases: | Alias | Resolves To | | --- | --- | | `googlemaps` | `google_maps.search` | | `googlemaps.search` | `google_maps.search` | | `google-maps.search` | `google_maps.search` | | `maps.search` | `google_maps.search` | | `maps.reviews` | `google_maps.reviews` | | `linkedin` | `linkedin.profile` | | `linked-in.profile` | `linkedin.profile` | | `ig.profile` | `instagram.profile` | | `ig.posts` | `instagram.posts` | | `ig.reels` | `instagram.reels` | | `twitter.read` | `x.read` | | `twitter` | `x.read` | | `x` | `x.read` | | `search` | `web.search` | | `web` | `web.search` | | `scrape` | `url.scrape` | | `urls.scrape` | `url.scrape` | | `url_scrape` | `url.scrape` | | `hunter.domain-search` | `hunter.domain_search` | | `hunter.email-finder` | `hunter.email_finder` | | `hunter.email-verifier` | `hunter.email_verifier` | | `hunter.people.find` | `hunter.person_enrichment` | | `hunter.person` | `hunter.person_enrichment` | | `hunter.company` | `hunter.company_enrichment` | | `hunter.companies.find` | `hunter.company_enrichment` | | `hunter.combined.find` | `hunter.combined_enrichment` | | `hunter.email-count` | `hunter.email_count` | The resolver also normalizes endpoint IDs by trimming slashes, accepting `api/v1/data/...`\-style strings, converting path slashes to dots, and converting hyphens to underscores. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#x/twitter-subpaths) X/Twitter Subpaths ------------------------------------------------------------------------------------------------------- `x.read` is special. The catalog lists the base X endpoint: /api/v1/data/x The dispatcher also supports dynamic X subpaths and forwards them to `/api/v1/x/...`. Examples: GET /api/v1/data/x/search?query=nanogpt POST /api/v1/data/x/search?query=nanogpt GET /api/v1/data/x/user?username=nanogpt GET /api/v1/data/x/tweet?id=1234567890 For path-style `POST` requests with no body, the wrapper forwards `{}` and preserves the query string. This supports query-only X calls. [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#examples) Examples ----------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#web-search) Web Search curl https://api.nano-gpt.com/api/v1/data/web/search \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "NanoGPT API data endpoints", "provider": "linkup", "depth": "standard", "outputType": "searchResults" }' Body-style dispatch: curl https://api.nano-gpt.com/api/v1/data \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "web.search", "input": { "query": "NanoGPT API data endpoints", "provider": "linkup", "depth": "standard", "outputType": "searchResults" } }' ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#scrape-urls) Scrape URLs curl https://api.nano-gpt.com/api/v1/data/url/scrape \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://nano-gpt.com"], "stealthMode": false }' ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#accountless-x402-data-request) Accountless x402 Data Request curl -i https://api.nano-gpt.com/api/v1/data/web/search \ -H "Content-Type: application/json" \ -H "x-x402: true" \ -d '{ "query": "NanoGPT API data endpoints", "provider": "linkup", "depth": "standard", "outputType": "searchResults" }' curl -i https://api.nano-gpt.com/api/v1/data/url/scrape \ -H "Content-Type: application/json" \ -H "x-x402: true" \ -d '{ "urls": ["https://nano-gpt.com"], "stealthMode": false }' Both examples return `402 Payment Required` with a `payment` object when accountless x402 is enabled and the request can be quoted. If you receive `401 missing_api_key` immediately, check that the initial quote request includes `x-x402: true`. Without that header, NanoGPT does not enter the x402 quote flow. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#google-maps-search) Google Maps Search curl https://api.nano-gpt.com/api/v1/data/google-maps/search \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "searchStringsArray": ["coffee shops in Amsterdam"], "maxCrawledPlacesPerSearch": 10 }' Google Maps search also supports `GET` for the same behavior exposed by the direct `/api/v1/googlemaps` endpoint, including polling async runs when applicable. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#hunter-domain-search) Hunter Domain Search curl "https://api.nano-gpt.com/api/v1/data/hunter/domain-search?domain=example.com" \ -H "Authorization: Bearer $NANOGPT_API_KEY" curl https://api.nano-gpt.com/api/v1/data/hunter/domain-search \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domain": "example.com" }' Body-style dispatch: curl https://api.nano-gpt.com/api/v1/data \ -H "Authorization: Bearer $NANOGPT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "hunter.domain_search", "input": { "domain": "example.com" } }' ### [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#x-search-with-query-parameters) X Search With Query Parameters curl "https://api.nano-gpt.com/api/v1/data/x/search?query=nanogpt" \ -H "Authorization: Bearer $NANOGPT_API_KEY" Path-style `POST` also works for query-only X calls: curl -X POST "https://api.nano-gpt.com/api/v1/data/x/search?query=nanogpt" \ -H "Authorization: Bearer $NANOGPT_API_KEY" [​](https://docs.nano-gpt.com/api-reference/endpoint/data-api#related-docs) Related Docs ------------------------------------------------------------------------------------------- * [Direct Web Search API](https://docs.nano-gpt.com/api-reference/endpoint/web-search) * [Web Scraping](https://docs.nano-gpt.com/api-reference/endpoint/scrape-urls) * [Data Extraction APIs](https://docs.nano-gpt.com/api-reference/endpoint/data-extraction) * [x402 Payments](https://docs.nano-gpt.com/api-reference/miscellaneous/x402) --- # Subscription Usage - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#content-area) Read subscription usage and routing advice cURL curl --request GET \ --url https://api.nano-gpt.com/api/subscription/v1/usage \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/subscription/v1/usage" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/subscription/v1/usage', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/subscription/v1/usage",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/subscription/v1/usage" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/subscription/v1/usage") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/subscription/v1/usage") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 { "active": true, "state": "active", "limits": { "dailyInputTokens": 123, "weeklyInputTokens": 123, "dailyImages": 123 }, "dailyInputTokens": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "weeklyInputTokens": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "dailyImages": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "period": { "currentPeriodEnd": "2023-11-07T05:31:56Z" }, "tokens": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "usageUnits": "tokens", "tokenLimits": { "total": 123 }, "routing": { "recommendedMode": "subscription", "reason": "", "subscriptionQuotaAvailable": true, "paidSpendPolicyAllowsBalance": true } } GET https://api.nano-gpt.com/apihttps://nano-gpt.com/api / subscription / v1 / usage Try it Read subscription usage and routing advice cURL curl --request GET \ --url https://api.nano-gpt.com/api/subscription/v1/usage \ --header 'Authorization: Bearer ' import requests url = "https://api.nano-gpt.com/api/subscription/v1/usage" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.text) const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://api.nano-gpt.com/api/subscription/v1/usage', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/subscription/v1/usage",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "GET",\ CURLOPT_HTTPHEADER => [\ "Authorization: Bearer "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/subscription/v1/usage" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.get("https://api.nano-gpt.com/api/subscription/v1/usage") .header("Authorization", "Bearer ") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/subscription/v1/usage") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body 200 { "active": true, "state": "active", "limits": { "dailyInputTokens": 123, "weeklyInputTokens": 123, "dailyImages": 123 }, "dailyInputTokens": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "weeklyInputTokens": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "dailyImages": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "period": { "currentPeriodEnd": "2023-11-07T05:31:56Z" }, "tokens": { "used": 123, "remaining": 123, "percentUsed": 123, "resetAt": 123, "degraded": true }, "usageUnits": "tokens", "tokenLimits": { "total": 123 }, "routing": { "recommendedMode": "subscription", "reason": "", "subscriptionQuotaAvailable": true, "paidSpendPolicyAllowsBalance": true } } [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#choose-the-right-credential) Choose the right credential ----------------------------------------------------------------------------------------------------------------------------------- For a quota widget or monitoring script, use a [Usage only management token](https://docs.nano-gpt.com/api-reference/management-api) . It can read subscription quotas without permission to run models or spend your balance. This endpoint uses an **inference API key** and also returns billing-routing advice specific to that key. Management tokens are accepted only at `GET /api/management/v1/subscription/usage`. [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#request) Request ------------------------------------------------------------------------------------------- * Method: `GET` * Path: `/api/subscription/v1/usage` (alias: `/api/v1/subscription/usage`) * Auth: `Authorization: Bearer ` or `x-api-key: ` curl https://api.nano-gpt.com/api/subscription/v1/usage \ -H "Authorization: Bearer $NANOGPT_API_KEY" [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response) Response --------------------------------------------------------------------------------------------- The response includes `active`, `state`, `limits`, `dailyInputTokens`, `weeklyInputTokens`, `dailyImages`, `period`, and `routing`. See the [quota example and field definitions](https://docs.nano-gpt.com/api-reference/management-api#read-subscription-usage) for the shared usage fields. The inference-authenticated response also includes subscription metadata and `allowOverage`. Input-token quotas count tokens, not operation counts or dollars. Image quotas count images. `percentUsed` is a fraction and may exceed 1. Quota `resetAt` values are UNIX epoch milliseconds; `period.currentPeriodEnd` is an ISO timestamp or null. Use returned limits and reset times instead of hardcoding them. A null quota/limit is not configured or applicable. When a lookup is unavailable, counters are null with `degraded: true`. Display **unknown**, not a full allowance. Token-based trials also include `usageUnits`, `tokenLimits`, and `tokens`. [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#billing-routing-advice) Billing-routing advice ------------------------------------------------------------------------------------------------------------------------- Use `routing.recommendedMode` when choosing between included subscription usage and pay-as-you-go billing: | Value | Meaning | | --- | --- | | `subscription` | This key permits subscription billing and quota is available or temporarily unknown, rather than known to be exhausted | | `paygo` | Subscription use is unavailable or exhausted and the key’s policy permits paid-balance spending | | `unavailable` | Neither billing mode is usable under the known subscription and key policy | `routing.reason` explains the recommendation. `subscriptionQuotaAvailable` is `true`, `false`, or `null` (unknown). The weekly routing calculation includes the service’s small enforcement allowance, so the displayed base quota can be exhausted before the recommendation switches to paid usage. The advice checks billing policy and known subscription quotas. It does not check current cash balance, consumed non-zero request/spend caps, the cost of a particular request, or provider health. The generation endpoint remains authoritative. A configured zero daily request or input-token cap makes the recommendation unavailable. `active: true` alone does not prove quota remains, and a zero cash balance does not prove included subscription tokens are exhausted. Use [Check Balance](https://docs.nano-gpt.com/api-reference/endpoint/check-balance) separately when you need cash balances. Clients can reuse advice briefly, but should refresh it after quota or billing errors. Never force a subscription-only key onto paid billing. Retain the NanoGPT request ID when reporting a transient billing issue. #### Authorizations bearerAuthapiKeyAuthbearerAuthapiKeyAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#authorization-authorization) Authorization string header required Bearer authentication header of the form `Bearer `, where `` is your auth token. #### Response 200 application/json Subscription quotas and billing-routing advice. Unavailable counters are null with degraded=true. [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-active) active boolean required [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-state) state enum required Available options: `active`, `grace`, `inactive` [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-limits) limits object required Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-daily-input-tokens-one-of-0) dailyInputTokens object | null required Null when this quota is not configured or applicable. Unavailable counters are null with degraded=true. percentUsed is a fraction and may exceed 1. resetAt is UNIX epoch milliseconds. Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-weekly-input-tokens-one-of-0) weeklyInputTokens object | null required Null when this quota is not configured or applicable. Unavailable counters are null with degraded=true. percentUsed is a fraction and may exceed 1. resetAt is UNIX epoch milliseconds. Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-daily-images-one-of-0) dailyImages object | null required Null when this quota is not configured or applicable. Unavailable counters are null with degraded=true. percentUsed is a fraction and may exceed 1. resetAt is UNIX epoch milliseconds. Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-period) period object required Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-tokens-one-of-0) tokens object | null Null when this quota is not configured or applicable. Unavailable counters are null with degraded=true. percentUsed is a fraction and may exceed 1. resetAt is UNIX epoch milliseconds. Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-usage-units) usageUnits enum Present for token-based trials. Available options: `tokens` [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-token-limits) tokenLimits object Present for token-based trials. Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/subscription-usage#response-routing) routing object Inference-key-specific billing-policy advice. Does not check current balance, consumed nonzero spend/request caps, or provider health. Show child attributes --- # Integrations - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/integrations#content-area) [​](https://docs.nano-gpt.com/integrations#integrations) Integrations ======================================================================== NanoGPT works with OpenAI-compatible tools and a growing set of coding agents, chat frontends, automation platforms, and local clients. Use these guides to connect your NanoGPT API key to the tool you want to use. [​](https://docs.nano-gpt.com/integrations#popular-guides) Popular Guides ---------------------------------------------------------------------------- * [OpenCode](https://docs.nano-gpt.com/integrations/opencode) - Configure OpenCode to use NanoGPT models from your terminal. * [SillyTavern](https://docs.nano-gpt.com/integrations/sillytavern) - Connect character-based chats to NanoGPT. * [Kilo Code](https://docs.nano-gpt.com/integrations/kilocode) - Add NanoGPT as an OpenAI-compatible provider. * [Fluent](https://docs.nano-gpt.com/integrations/fluent) - Use NanoGPT models and MCP tools in Fluent for macOS. * [JanitorAI](https://docs.nano-gpt.com/integrations/janitorai) - Route JanitorAI proxy chats through NanoGPT. * [RisuAI](https://docs.nano-gpt.com/integrations/risuai) - Use NanoGPT with RisuAI chats and characters. * [OpenWebUI](https://docs.nano-gpt.com/integrations/openwebui) - Add NanoGPT as an OpenAI-compatible connection. [​](https://docs.nano-gpt.com/integrations#coding-agents) Coding Agents -------------------------------------------------------------------------- * [Claude Code](https://docs.nano-gpt.com/integrations/claude-code) * [Cline](https://docs.nano-gpt.com/integrations/cline) * [Codex CLI](https://docs.nano-gpt.com/integrations/codex-cli) * [Cursor](https://docs.nano-gpt.com/integrations/cursor) * [Gemini CLI](https://docs.nano-gpt.com/integrations/gemini-cli) * [Grok CLI](https://docs.nano-gpt.com/integrations/grok-cli) * [OpenCode](https://docs.nano-gpt.com/integrations/opencode) * [OpenHands](https://docs.nano-gpt.com/integrations/openhands) * [Roo Code](https://docs.nano-gpt.com/integrations/roocode) [​](https://docs.nano-gpt.com/integrations#chat-frontends) Chat Frontends ---------------------------------------------------------------------------- * [JanitorAI](https://docs.nano-gpt.com/integrations/janitorai) * [LibreChat](https://docs.nano-gpt.com/integrations/librechat) * [OpenClaw](https://docs.nano-gpt.com/integrations/openclaw) * [OpenWebUI](https://docs.nano-gpt.com/integrations/openwebui) * [Otaku](https://docs.nano-gpt.com/integrations/otaku) * [RisuAI](https://docs.nano-gpt.com/integrations/risuai) * [SillyTavern](https://docs.nano-gpt.com/integrations/sillytavern) * [TypingMind](https://docs.nano-gpt.com/integrations/typingmind) [​](https://docs.nano-gpt.com/integrations#automation-and-api-tools) Automation And API Tools ------------------------------------------------------------------------------------------------ * [CLI Login](https://docs.nano-gpt.com/integrations/cli-login) * [Droid](https://docs.nano-gpt.com/integrations/droid) * [Fluent](https://docs.nano-gpt.com/integrations/fluent) * [LiteLLM](https://docs.nano-gpt.com/integrations/litellm) * [MCP](https://docs.nano-gpt.com/integrations/mcp) * [n8n](https://docs.nano-gpt.com/integrations/n8n) --- # Image API - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/image-generation#content-area) [​](https://docs.nano-gpt.com/api-reference/image-generation#overview) Overview ---------------------------------------------------------------------------------- NanoGPT provides a dedicated Image API for discovering image models, inspecting supported parameters and pricing, and generating images through a normalized endpoint. Use this API when you want one image workflow: * Discover available image models with machine-readable capabilities. * Inspect a model’s public endpoint metadata, supported parameters, pricing, and image-input constraints. * Generate text-to-image and image-to-image outputs through `POST /api/v1/images`. Existing image routes remain supported for compatibility: * `POST /api/v1/images/generations` * `POST /api/v1/images/edits` * `POST /api/v1/images/edit` * `GET /api/v1/image-models` The dedicated Image API is additive. New integrations should prefer the normalized routes below. [​](https://docs.nano-gpt.com/api-reference/image-generation#authentication) Authentication ---------------------------------------------------------------------------------------------- Use the same NanoGPT API key authentication as other API routes: Authorization: Bearer YOUR_API_KEY or: x-api-key: YOUR_API_KEY Model discovery routes can be called without authentication. Generation requests require an API key. [​](https://docs.nano-gpt.com/api-reference/image-generation#quickstart) Quickstart -------------------------------------------------------------------------------------- curl https://api.nano-gpt.com/api/v1/images/models curl https://api.nano-gpt.com/api/v1/images/models/openai/gpt-image-2.5/flare/text-to-image/endpoints curl https://api.nano-gpt.com/api/v1/images \ -H "Content-Type: application/json" \ -H "x-api-key: $NANOGPT_API_KEY" \ -d '{ "model": "openai/gpt-image-2.5/flare/text-to-image", "prompt": "A clean product photo of a matte black espresso machine", "resolution": "1k", "quality": "high", "n": 1 }' [​](https://docs.nano-gpt.com/api-reference/image-generation#discover-image-models) Discover Image Models ------------------------------------------------------------------------------------------------------------ List image models: GET /api/v1/images/models Response: { "object": "list", "data": [\ {\ "id": "openai/gpt-image-2.5/flare/text-to-image",\ "name": "GPT Image 2.5 Flare",\ "description": "Model description...",\ "created": 1760000000,\ "owned_by": "openai",\ "architecture": {\ "input_modalities": ["text", "image"],\ "output_modalities": ["image"]\ },\ "supported_parameters": {\ "resolution": {\ "type": "enum",\ "values": ["1k", "2k", "4k"],\ "default": "1k"\ },\ "n": {\ "type": "range",\ "min": 1,\ "max": 4,\ "default": 1\ },\ "quality": {\ "type": "enum",\ "values": ["low", "medium", "high", "xhigh", "max"],\ "default": "high"\ },\ "input_references": {\ "type": "range",\ "min": 0,\ "max": 16\ }\ },\ "supports_streaming": false,\ "endpoints": "/api/v1/images/models/openai/gpt-image-2.5/flare/text-to-image/endpoints",\ "capabilities": {\ "image_generation": true,\ "image_to_image": true,\ "inpainting": false,\ "nsfw": false\ },\ "category": "image"\ }\ ], "meta": { "count": 201, "generated_at": "2026-06-25T00:00:00.000Z" } } Notes: * `id` is the model ID to use in `POST /api/v1/images`. * `endpoints` is the URL for endpoint and pricing metadata for that model. * `supported_parameters` is machine-readable and varies by model. * `supports_streaming` is currently always `false`. * Model IDs may contain slashes. Prefer using the returned `endpoints` URL directly. See [List Image Models](https://docs.nano-gpt.com/api-reference/endpoint/image-api-models) for the endpoint reference. [​](https://docs.nano-gpt.com/api-reference/image-generation#inspect-endpoint-metadata-and-pricing) Inspect Endpoint Metadata And Pricing -------------------------------------------------------------------------------------------------------------------------------------------- Get public endpoint metadata for a model: GET /api/v1/images/models/{modelId}/endpoints Example: GET /api/v1/images/models/openai/gpt-image-2.5/flare/text-to-image/endpoints For model IDs that contain slashes, use the `endpoints` path returned by `GET /api/v1/images/models`. Response: { "id": "openai/gpt-image-2.5/flare/text-to-image", "endpoints": [\ {\ "provider_name": "OpenAI",\ "provider_slug": "openai",\ "provider_tag": null,\ "supported_parameters": {\ "resolution": {\ "type": "enum",\ "values": ["1k", "2k", "4k"],\ "default": "1k"\ },\ "n": {\ "type": "range",\ "min": 1,\ "max": 4,\ "default": 1\ }\ },\ "allowed_passthrough_parameters": [],\ "supports_streaming": false,\ "pricing": [\ {\ "billable": "output_image",\ "unit": "image",\ "cost_usd": 0.153,\ "resolution": "1k"\ }\ ],\ "input_reference_constraints": {\ "max_items": 16,\ "route": {\ "min_width": 8,\ "min_height": 8,\ "max_bytes": 31457280,\ "formats": ["png", "jpeg", "webp"],\ "source": "route-preflight"\ }\ }\ }\ ] } Notes: * NanoGPT currently returns one public endpoint per model. * `provider_tag` is `null` because provider selection is not exposed yet. * `allowed_passthrough_parameters` is an empty array for now. * `pricing` uses public NanoGPT pricing, not provider at-cost rates. * `input_reference_constraints` is included when the model supports image inputs. See [Get Image Model Endpoints](https://docs.nano-gpt.com/api-reference/endpoint/image-api-model-endpoints) for the endpoint reference. [​](https://docs.nano-gpt.com/api-reference/image-generation#generate-images) Generate Images ------------------------------------------------------------------------------------------------ Generate images with: POST /api/v1/images Content-Type: application/json Text-to-image request: { "model": "openai/gpt-image-2.5/flare/text-to-image", "prompt": "A clean product photo of a matte black espresso machine on a white counter", "resolution": "1k", "quality": "high", "n": 1 } Image-to-image request: { "model": "openai/gpt-image-2.5/flare/text-to-image", "prompt": "Make this look like a polished studio product photo", "input_references": [\ {\ "type": "image_url",\ "image_url": {\ "url": "https://example.com/reference.png"\ }\ }\ ], "resolution": "1k", "quality": "high", "n": 1 } Use `n` to request the number of output images. Internally, `n` is normalized to NanoGPT’s existing `nImages` parameter. If both are supplied, `nImages` takes precedence. See [Generate Images](https://docs.nano-gpt.com/api-reference/endpoint/image-api-generate) for the endpoint reference. [​](https://docs.nano-gpt.com/api-reference/image-generation#image-references) Image References -------------------------------------------------------------------------------------------------- `input_references` accepts an array of image references. Supported entries: [\ "https://example.com/image.png",\ "data:image/png;base64,...",\ {\ "type": "image_url",\ "image_url": {\ "url": "https://example.com/image.png"\ }\ }\ ] Do not mix `input_references` with legacy image aliases such as `imageDataUrl`, `imageDataUrls`, `image_url`, or `images` in the same request. The route returns `conflicting_image_inputs` if both styles are supplied. [​](https://docs.nano-gpt.com/api-reference/image-generation#supported-parameter-discovery) Supported Parameter Discovery ---------------------------------------------------------------------------------------------------------------------------- Parameter support varies by model. Always check `supported_parameters` from: GET /api/v1/images/models Common fields include: * `model` * `prompt` * `n` * `resolution` * `aspect_ratio` * `quality` * `output_format` * `background` (GPT Image 1, 1.5, and 2.5: `auto`, `opaque`, or `transparent`; transparent needs `png` or `webp` output) * `seed` * `input_references` NanoGPT exposes many model-specific parameters. Treat them as discoverable via `supported_parameters`, not as globally supported fields. `seed` is an optional model-specific hint that may improve reproducibility where supported by the model/provider route. Identical results are not guaranteed. Check the selected model’s `supported_parameters` before using it. Any stronger reproducibility guarantee belongs in documentation for the specific model/provider route, not this generic endpoint guide. [​](https://docs.nano-gpt.com/api-reference/image-generation#unsupported-features-for-now) Unsupported Features For Now -------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/image-generation#streaming) Streaming `stream: true` is not supported yet. { "error": { "message": "stream is not supported for /api/v1/images yet. Use non-streaming requests or /api/v1/images/generations.", "type": "invalid_request_error", "code": "unsupported_stream", "parameter": "stream" }, "code": "unsupported_stream" } ### [​](https://docs.nano-gpt.com/api-reference/image-generation#provider-selection) Provider Selection Provider selection and provider passthrough are not supported yet on `POST /api/v1/images`. Do not send provider routing or provider passthrough options: { "provider": { "only": ["openai"] } } Non-empty provider objects return: { "error": { "message": "Provider selection and provider passthrough options are not supported for /api/v1/images yet.", "type": "invalid_request_error", "code": "unsupported_provider_options", "parameter": "provider" }, "code": "unsupported_provider_options" } Empty provider objects are ignored, but clients should not rely on that behavior. [​](https://docs.nano-gpt.com/api-reference/image-generation#migration-notes) Migration Notes ------------------------------------------------------------------------------------------------ Use the dedicated Image API when building new image integrations. It provides model discovery, endpoint metadata, public pricing metadata, image-input constraints, and normalized JSON generation in one workflow. Use the legacy routes when you need their existing compatibility behavior: * Use `POST /api/v1/images/generations` or `POST /v1/images/generations` for OpenAI-compatible image generation request shapes. * Use `POST /api/v1/images/edits` or `POST /api/v1/images/edit` for OpenAI-compatible image editing. * Use `GET /api/v1/image-models` if your integration already depends on the older image model list format. Do not assume field names are interchangeable between the normalized Image API and legacy endpoints. For example, `POST /api/v1/images` uses `input_references`; older routes support aliases such as `imageDataUrl` and `imageDataUrls`. [​](https://docs.nano-gpt.com/api-reference/image-generation#error-reference) Error Reference ------------------------------------------------------------------------------------------------ ### [​](https://docs.nano-gpt.com/api-reference/image-generation#missing-model) Missing Model { "error": { "message": "model is required for /api/v1/images.", "type": "invalid_request_error", "code": "missing_model", "parameter": "model" }, "code": "missing_model" } ### [​](https://docs.nano-gpt.com/api-reference/image-generation#invalid-content-type) Invalid Content Type `POST /api/v1/images` accepts JSON only. { "error": { "message": "/api/v1/images accepts application/json requests.", "type": "invalid_request_error", "code": "invalid_content_type" }, "code": "invalid_content_type" } ### [​](https://docs.nano-gpt.com/api-reference/image-generation#invalid-input-references) Invalid Input References { "error": { "message": "input_references must be an array of image URL strings or image_url objects.", "type": "invalid_request_error", "code": "invalid_input_references", "parameter": "input_references" }, "code": "invalid_input_references" } ### [​](https://docs.nano-gpt.com/api-reference/image-generation#conflicting-image-inputs) Conflicting Image Inputs { "error": { "message": "Use input_references or image input aliases, not both.", "type": "invalid_request_error", "code": "conflicting_image_inputs", "parameter": "input_references" }, "code": "conflicting_image_inputs" } --- # Prompt Caching - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#content-area) [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#overview) Overview ---------------------------------------------------------------------------------------------- Prompt caching lets you cache large, reusable prompt prefixes (system prompts, reference documents, tool definitions, and long conversation history) so follow-up requests can reuse the cached prefix instead of reprocessing it from scratch. Benefits: * Up to ~90% cost reduction on cached input tokens (cache hits) * Lower latency on requests with large static prefixes NanoGPT supports two caching modes: * **Implicit caching (default):** For providers/models that support provider-native prompt reuse (including OpenAI, Gemini, and many open-source provider routes), caching is applied automatically when eligible. No extra request fields are required. * **Explicit prompt caching (Claude):** Claude caching uses request controls (`prompt_caching`/`promptCaching`/body-level `cache_control`, or inline `cache_control`) to mark reusable prefixes and select TTLs. You can add these yourself, or your client can supply them automatically. [OpenCode adds Claude cache markers automatically](https://docs.nano-gpt.com/integrations/opencode#claude-prompt-caching) . Its default markers use a five-minute TTL. To request one-hour caching, set `enabled: true` and `ttl: "1h"` in the helper; you do not also need an `anthropic-beta` header. NanoGPT also supports **cache-capable provider routing** with top-level `caching: true`. This is not a prompt annotation mode. It only requires routing to a provider that supports prompt/input caching and, by default, tries to keep later matching requests on the same provider. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#supported-models) Supported Models -------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#implicit-caching-automatic) Implicit caching (automatic) NanoGPT automatically uses implicit caching on providers/models that support it, including OpenAI and Gemini model families plus many open-source provider/model routes. No cache-control flags are required for this mode. For normal automatic routing, NanoGPT also tries cache-affinity routing when it can help: it hashes the request shape with the user/API-key or session identity and tries to route later matching requests to the same provider. This applies only to eligible automatic routes. Explicit provider selection and routing preferences use their own routing rules. Claude routes also need caller cache intent, and `prompt_caching.enabled: false` disables that cache affinity. If the provider that would be used does not support caching, NanoGPT does not apply cache-affinity routing for that request because there is no provider-side cache to reuse. Cache-affinity routing by itself does not add explicit cache-write annotations. For models/routes that require explicit writes, such as Claude, the request still needs a helper or cache markers, whether supplied by you or your client. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#cache-capable-provider-routing) Cache-Capable Provider Routing Set top-level `caching: true` when you want NanoGPT to route the request to any available provider that supports prompt/input caching. This is capability-based routing: you do not need to choose a provider. If no cache-capable provider is available for the model, the request fails rather than silently using a non-caching provider. { "model": "model-id", "caching": true, "messages": [\ { "role": "user", "content": "Hello" }\ ] } `caching: true` prefers the provider from your previous matching request (soft affinity). `stickyProvider` defaults to `false`; set it to `true` to disable cross-provider fallback. Neither setting guarantees a cache hit. To disable cross-provider fallback for a cache-capable request: { "model": "model-id", "caching": true, "stickyprovider": true, "messages": [\ { "role": "user", "content": "Hello" }\ ] } Top-level `stickyProvider` is accepted as a camelCase alias for `stickyprovider`. `true` disables cross-provider fallback. `false` allows fallback, but explicit caching still keeps soft affinity to a previous eligible provider. The affinity record expires after about one hour without a successful matching request. This is separate from the provider’s cache TTL and does not guarantee a warm cache for one hour. **Price routing is a different goal.** `provider.sort: "price"`, `:price`, or `max_price` without `order` can activate price ranking, which takes precedence over cache-affinity selection and can change providers between requests. See [routing examples and precedence](https://docs.nano-gpt.com/api-reference/miscellaneous/provider-selection#price-caps-and-cache-reuse) . You can request the same behavior with a model suffix: { "model": "moonshotai/kimi-k2.6:thinking:caching", "messages": [\ { "role": "user", "content": "Hello" }\ ] } The suffix aliases `:cache` and `:cached` are also accepted. Use `prompt_caching` / `promptCaching` only when you need provider-specific cache-control annotations or TTL behavior. Top-level `caching: true` does not add Anthropic-style `cache_control` markers or configure cache TTLs. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#explicit-prompt-caching-controls-claude) Explicit prompt caching controls (Claude) Explicit prompt-caching controls are available on Claude models, including these families (examples): | Model family | Example model IDs | | --- | --- | | Claude 3.5 Sonnet v2 | `claude-3-5-sonnet-20241022` | | Claude 3.5 Haiku | `claude-3-5-haiku-20241022` | | Claude 3.7 Sonnet | `claude-3-7-sonnet-20250219` (and `:thinking` variants) | | Claude Sonnet 4 | `claude-sonnet-4-20250514` (and `:thinking` variants) | | Claude Sonnet 4.5 | `claude-sonnet-4-5-20250929` (and `:thinking` variants) | | Claude Haiku 4.5 | `claude-haiku-4-5-20251001` | | Claude Haiku 5.5 | `anthropic/claude-haiku-5.5` (also `anthropic/claude-haiku-latest`) | | Claude Opus 4 | `claude-opus-4-20250514` (and `:thinking` variants) | | Claude Opus 4.1 | `claude-opus-4-1-20250805` (and `:thinking` variants) | | Claude Opus 4.5 | `claude-opus-4-5-20251101` (and `:thinking` variants) | | Claude Opus 4.6 | `claude-opus-4-6` (and `:thinking` variants) | | Claude Sonnet 5.5 | `anthropic/claude-sonnet-5.5` | | Claude Opus 5.5 | `anthropic/claude-opus-5.5` | | Claude Fable 5.1 | `anthropic/claude-fable-5.1` | For legacy IDs, `anthropic/` aliases are also available (for example `anthropic/claude-sonnet-4.5`, `anthropic/claude-opus-4.6:thinking`). Use the exact ID returned by the model catalogue rather than constructing an alias. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#claude-minimum-cacheable-tokens) Claude minimum cacheable tokens Minimum cacheable sizes depend on the model version and upstream route. A minimum for an older Claude model does not establish the minimum for Claude 5.5. See the [Claude prompt caching documentation](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for native model thresholds. If your cached prefix is smaller than the selected route’s minimum, the request can still succeed without creating a cache entry. Verify caching with write/read usage fields rather than a successful response alone. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#subscription-billing-for-chat-completions) Subscription Billing for Chat Completions ---------------------------------------------------------------------------------------------------------------------------------------------------------------- On `POST /api/v1/chat/completions`, supported explicit cache controls select pay-as-you-go billing and bypass subscription coverage for that request. This includes the body helper and inline `cache_control` markers added by clients such as OpenCode. This rule does not mean an implicit cache hit alone switches a request to pay-as-you-go, and it should not be used to infer billing on the separate [Messages endpoint](https://docs.nano-gpt.com/api-reference/endpoint/messages) . See [pay-as-you-go billing controls](https://docs.nano-gpt.com/api-reference/miscellaneous/billing-override) for other billing overrides. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#how-to-enable-explicit-prompt-caching-claude) How To Enable Explicit Prompt Caching (Claude) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Prompt caching works on `POST /api/v1/chat/completions`. You can enable it in 3 ways. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#option-1-body-level-helper-promptcaching-/-prompt_caching-/-cache_control) Option 1: body-level helper (`promptCaching` / `prompt_caching` / `cache_control`) Add a top-level helper object: { "model": "anthropic/claude-sonnet-4.5", "messages": [\ { "role": "system", "content": "Your large static content..." },\ { "role": "user", "content": "Summarize the key points." }\ ], "promptCaching": { "enabled": true, "ttl": "5m", "cutAfterMessageIndex": 0 } } Parameters: | Parameter | Type | Default | Description | | --- | --- | --- | --- | | `enabled` | boolean | — | Set `true` to enable or `false` to disable explicit caching. A helper containing only `ttl` does not enable caching. | | `ttl` | `"5m"` or `"1h"` | `"5m"` | Cache time-to-live. Only the exact string `"1h"` selects one hour; omitted or unrecognized helper values use `"5m"`. | | `cutAfterMessageIndex` / `cut_after_message_index` | integer | — | Zero-based last message index eligible for automatic cache-boundary placement. Existing inline markers are preserved. | | `stickyProvider` | boolean | `false` | When `true`, avoid failover to preserve cache consistency (see [stickyProvider](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#cache-consistency-with-stickyprovider)
) | | `explicitCacheControl` / `explicit_cache_control` | boolean | `false` | When `true`, use only existing inline `cache_control` boundaries and do not add automatic cache breakpoints. | **`explicitCacheControl`** _(boolean, default `false`)_ When `true`, no additional cache breakpoints are added automatically. Use it when you want to control every boundary yourself. For a helper with `ttl: "1h"`, existing message, system, and tool markers are updated to one hour whether this flag is `true` or `false`. You do not need `explicitCacheControl: true` to apply a one-hour TTL to OpenCode’s markers. Leaving it `false` also allows NanoGPT to add automatic breakpoints within the request’s block limit. Also accepts the snake\_case alias `explicit_cache_control`. Aliases are accepted: * `promptCaching` * `prompt_caching` * `cache_control` (body-level helper alias) Passing `true` instead of an object defaults to: { "enabled": true, "ttl": "5m" } If `cutAfterMessageIndex` is omitted, NanoGPT selects cache boundaries automatically. The helper is sufficient for both TTLs. NanoGPT applies the cache settings upstream, so callers do not need to add beta headers alongside it. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#option-2-inline-cache_control-markers) Option 2: inline `cache_control` markers Attach `cache_control` directly to content blocks you want cached: { "model": "anthropic/claude-sonnet-4.5", "messages": [\ {\ "role": "system",\ "content": [\ {\ "type": "text",\ "text": "Your long reference document...",\ "cache_control": { "type": "ephemeral" }\ }\ ]\ },\ { "role": "user", "content": "Live question goes here" }\ ] } ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#combining-inline-markers-with-body-level-settings) Combining inline markers with body-level settings { "model": "anthropic/claude-sonnet-4.5", "messages": [\ {\ "role": "system",\ "content": [\ {\ "type": "text",\ "text": "You are a helpful coding assistant with access to a large codebase...",\ "cache_control": { "type": "ephemeral" }\ }\ ]\ },\ {\ "role": "user",\ "content": "Summarize the auth module"\ }\ ], "promptCaching": { "enabled": true, "ttl": "1h", "explicitCacheControl": true } } In this example, the system prompt’s `cache_control` marker is preserved and its TTL is set to `1h`. The user message does not receive an auto-generated cache breakpoint. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#option-3-anthropic-beta-header-claude-compatible) Option 3: `anthropic-beta` header (Claude-compatible) The Anthropic-compatible header is supported as an alternative on models with Claude cache controls. It is optional when using the body helper or inline markers: anthropic-beta: prompt-caching-2024-07-31 To request one hour through the header alternative: anthropic-beta: prompt-caching-2024-07-31,extended-cache-ttl-2025-04-11 A body helper’s explicit `ttl` takes precedence over the header’s TTL. A body-level `enabled: false` disables explicit caching even if the header requests it. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#controlling-what-gets-cached) Controlling What Gets Cached -------------------------------------------------------------------------------------------------------------------------------------- > **Note:** `cutAfterMessageIndex` limits where new cache breakpoints can be placed automatically. `explicitCacheControl: true` disables new automatic breakpoints, so the cut index has no effect on placement in that mode. Applying a one-hour helper TTL to existing markers does not depend on this flag. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#cutaftermessageindex) `cutAfterMessageIndex` Override automatic cache breakpoints by setting the last cached message index: { "promptCaching": { "enabled": true, "cutAfterMessageIndex": 4 } } This sets the last message eligible for automatic breakpoint placement to index `4`. A breakpoint caches the prefix up to that boundary. It does not remove existing inline markers after that index. You can also set this via request header: x-prompt-caching-cut-after: 4 The depth header selects a boundary only when explicit caching is otherwise enabled; it does not enable caching by itself. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#cache-block-limit) Cache block limit A maximum of 4 `cache_control` breakpoints are allowed per request across system prompt, tools, and messages. Excess breakpoints are pruned automatically without removing prompt content. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#forcing-a-cache-write) Forcing a Cache Write ------------------------------------------------------------------------------------------------------------------------ There is no separate “force write” flag. Enable prompt caching and send the request. The first eligible request writes cache automatically (if provider thresholds/availability allow it). Repeated requests with the same cached prefix read from cache. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#usage-fields-how-to-verify-cache-hits) Usage Fields (How To Verify Cache Hits) ---------------------------------------------------------------------------------------------------------------------------------------------------------- When caching is active (implicit or explicit), responses can include: * `cache_creation_input_tokens`: tokens written to cache on this request * `cache_read_input_tokens`: tokens read from cache on this request (cache hit when `> 0`) * `prompt_tokens_details.cached_tokens`: OpenAI-style cached token count Compare an eligible cache write with a subsequent request that reuses the same prefix before expiration: First eligible write Subsequent cache hit { "usage": { "prompt_tokens": 8500, "completion_tokens": 200, "cache_creation_input_tokens": 8000, "cache_read_input_tokens": 0 } } { "usage": { "prompt_tokens": 8500, "completion_tokens": 200, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 8000 } } These are illustrative counts. A response can contain both writes and reads; the important evidence of a hit is a positive read count. When present, `x_nanogpt_pricing` includes cache pricing breakdown fields such as `cacheCreationInputTokens`, `cacheReadInputTokens`, `cacheTTL`, and `cacheCost`. `cacheTTL` describes the billing TTL; check write/read counts separately to establish cache use. For streaming Chat Completions, request usage explicitly and inspect the final usage event: { "stream": true, "stream_options": { "include_usage": true } } If both cache counts stay at zero, check the prefix length, markers and TTL, prefix changes, expiration, and routing changes. Repeated short prompts are not a reliable caching test. For the SSE shape, see [Streaming Protocol](https://docs.nano-gpt.com/api-reference/miscellaneous/streaming-protocol) . [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#pricing) Pricing -------------------------------------------------------------------------------------------- Cache writes and reads are billed differently by provider. Implicit-caching providers apply their cache pricing automatically when eligible. Explicit Claude caching uses the TTL settings below. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#gemini-pro-models-implicit-caching-provider-native) Gemini Pro models (implicit caching, provider-native) | Token type | Rate (per 1M tokens) | Notes | | --- | --- | --- | | Regular input | $2.00 | — | | Cache write surcharge | +$0.375 | Added on top of input cost | | Cache read | $0.20 | 90% cheaper than input | Example: writing 10,000 cached tokens costs `(10k × $2.00/M) + (10k × $0.375/M) = $0.02375`. Reading 10,000 cached tokens costs `10k × $0.20/M = $0.002`. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#gemini-flash-models-implicit-caching-provider-native) Gemini Flash models (implicit caching, provider-native) | Token type | Rate (per 1M tokens) | Notes | | --- | --- | --- | | Regular input | Varies by model | — | | Cache write surcharge | +$0.083 | Added on top of input cost | | Cache read | 10% of input rate | 90% cheaper than input | For Gemini 2.0 models, cache reads are 25% of the base input rate (75% cheaper), not 10%. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#claude-models-explicit-caching) Claude models (explicit caching) The standard Claude cache multipliers are below. Model- or route-specific rates can differ; use the selected model’s pricing and the response’s billing breakdown when available. | TTL | Creation multiplier on cached input tokens | Read multiplier | | --- | --- | --- | | `5m` | `1.25x` | `0.1x` | | `1h` | `2.0x` | `0.1x` | Claude Sonnet 5.5, including its Thinking and Latest aliases, uses a `0.05x` cache-read multiplier: $0.10 per million cached input tokens. Cache creation remains `1.25x` for five minutes and `2.0x` for one hour. Claude Haiku 5.5, including Haiku Latest, charges $0.01 per million cached input tokens for prompts up to 100K tokens and $0.05 above 100K. The prompt length determines the pricing tier, including cached tokens. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#ttl-options-explicit-claude-controls) TTL Options (Explicit Claude Controls) -------------------------------------------------------------------------------------------------------------------------------------------------------- | TTL | Duration | Description | | --- | --- | --- | | `"5m"` | 5 minutes | Default. Suitable for interactive sessions. | | `"1h"` | 1 hour | Extended. Useful for batch processing or long-running sessions. | [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#structuring-prompts-for-cache-hits) Structuring Prompts for Cache Hits -------------------------------------------------------------------------------------------------------------------------------------------------- Cache hits require the cached prefix to be byte-identical across requests. Best practices: * Put static content first (system prompt, reference docs, tool definitions). * Keep cached content identical across requests (no timestamps, request IDs, or dynamic inserts). * Put dynamic content after the cache boundary (typically the latest user message). For explicit Claude caches, reuse refreshes the TTL. If the cache expires without reuse, an eligible later request writes it again. Changing content before a boundary prevents reuse of that complete prefix; an earlier unchanged cached prefix may still be reused. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#large-tool-catalogs-and-hosted-search) Large tool catalogs and hosted search An eagerly loaded function catalog is part of the initial prompt prefix. Adding, removing, or changing any eager definition changes that prefix and can prevent reuse of the earlier cached prompt. On compatible Responses models, [hosted tool search](https://docs.nano-gpt.com/api-reference/miscellaneous/hosted-tool-search) keeps a small search-tool definition in the initial prefix and reveals relevant functions later. This can reduce initial input tokens and improve the opportunity for cache reuse across catalog changes. It does not guarantee a cache hit: exact-prefix rules, minimum token thresholds, TTLs, and the selected model route still apply. ### [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#gemini-implicit-caching) Gemini implicit caching Gemini caches automatically, but it does not reuse every shared prefix. In our tests with Gemini 4 Argon and Gemini 3.8 Flash, Google reused checkpoints from recent requests, and the results were the same on every route to Google we tried: * **Appending reuses everything.** When a request resends the previous request unchanged and adds the model’s reply plus a new user message, the whole previous input is reused. * **An identical repeat reuses most of the prompt.** Expect all but roughly the last 2,000 tokens to be reported as cached. * **Rewriting the end of the previous request falls back to an earlier checkpoint.** If content near the end of the previous request changes, such as the previous assistant reply or a large block in the latest user message, reuse drops to an earlier checkpoint like the start of the previous request’s final user message. A shared prefix followed by a different ending of several thousand tokens can get no reuse at all. * **Every system message counts as part of the opening instructions.** Gemini places all system messages in its system instruction, which comes before the conversation. Changing any system message, even one placed after the conversation history, invalidates the whole cached prefix. * **There is no explicit cache for Gemini 4 Argon.** Google supports only implicit caching for this model, and `cache_control` markers have no effect on it. To get consistent reuse with Gemini: * Keep every system message fixed across turns. Put per-turn instructions or notes at the end of the latest user message. * Build each request as an extension of the previous one: resend earlier messages exactly as sent, including the assistant reply exactly as the model returned it, and append the new turn. * Keep content that changes every turn small and at the end of the request. The first request with a new prefix is always uncached, and an individual request can occasionally miss even when it is identical to a recent one. Check `prompt_tokens_details.cached_tokens` over several turns rather than a single request. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#cache-consistency-with-stickyprovider-explicit-caching) Cache Consistency with `stickyProvider` (Explicit Caching) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Each provider keeps its own cache. If a request fails over to another provider, the previous cache may be unavailable. If cache consistency matters more than availability, set: { "promptCaching": { "enabled": true, "ttl": "5m", "stickyProvider": true } } Behavior: * `stickyProvider: false` (default): the request may succeed even if routing changes, but you might rebuild caches. * `stickyProvider: true`: if a fallback would be required, the request returns `503` instead. Leave `promptCaching.stickyProvider` unset unless you accept reduced availability to preserve the cache. It does not extend the TTL or guarantee a hit. Top-level `stickyprovider` / `stickyProvider` and nested `promptCaching.stickyProvider` control the same fallback switch. If both are supplied, the top-level value takes precedence. With `caching: true`, soft affinity remains even when the switch is `false`. Privacy, price, and provider restrictions still constrain eligible routes. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#nanogpt-web-ui) NanoGPT Web UI ---------------------------------------------------------------------------------------------------------- In the NanoGPT web UI, models with explicit prompt-caching controls show a prompt caching toggle where you can choose cache duration. [​](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#limitations-and-caveats) Limitations and Caveats ---------------------------------------------------------------------------------------------------------------------------- * Provider-side minimum token thresholds still apply before a cache entry is created. * A maximum of 4 cache breakpoints (`cache_control`) are supported per request. * Some models report aggregate prompt usage differently; use `cache_creation_input_tokens` and `cache_read_input_tokens` for authoritative cached token counts. * On cache hits, a small non-zero `cache_creation_input_tokens` can appear due to per-request overhead and does not necessarily indicate a cache miss. * Implicit caching behavior (eligibility, TTL behavior, and exact discounts) is provider-dependent. * Gemini 4 Argon supports implicit caching only. See [Gemini implicit caching](https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching#gemini-implicit-caching) for the request shapes that reuse cached input. --- # Voice Cloning - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#content-area) Voice Cloning cURL curl --request POST \ --url https://api.nano-gpt.com/api/voice-clone/minimax import requests url = "https://api.nano-gpt.com/api/voice-clone/minimax" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/voice-clone/minimax', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/voice-clone/minimax",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/voice-clone/minimax" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/voice-clone/minimax") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/voice-clone/minimax") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body POST / api / voice-clone / minimax Try it Voice Cloning cURL curl --request POST \ --url https://api.nano-gpt.com/api/voice-clone/minimax import requests url = "https://api.nano-gpt.com/api/voice-clone/minimax" response = requests.post(url) print(response.text) const options = {method: 'POST'}; fetch('https://api.nano-gpt.com/api/voice-clone/minimax', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/voice-clone/minimax",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/voice-clone/minimax" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/voice-clone/minimax") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/voice-clone/minimax") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#overview) Overview ---------------------------------------------------------------------------------------- NanoGPT supports voice cloning so you can create reusable custom voices from short reference audio clips and then use them in text-to-speech (TTS). There are two voice-clone providers exposed via NanoGPT: * **MiniMax voice clone**: creates a reusable `customVoiceId` you can pass as `voice` when using compatible MiniMax Speech TTS models. * **Qwen voice clone (1.7B)**: generates a speaker embedding file URL that you can pass to Qwen 3 TTS as `speaker_voice_embedding_file_url`. Both flows are asynchronous: 1. Submit a clone job, receive a `runId` (HTTP 202). 2. Poll the status endpoint until `status: "completed"`. [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#authentication) Authentication ---------------------------------------------------------------------------------------------------- All voice clone endpoints support: * API key auth: `x-api-key: ` (or `Authorization: Bearer `) * Session auth (web app): browser cookies [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#endpoints) Endpoints ------------------------------------------------------------------------------------------ | Provider | Submit | Status | | --- | --- | --- | | MiniMax | `POST /api/voice-clone/minimax` | `POST /api/voice-clone/minimax/status` | | Qwen | `POST /api/voice-clone/qwen` | `POST /api/voice-clone/qwen/status` | [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#minimax-voice-clone) MiniMax Voice Clone -------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#submit-a-clone-job) Submit a Clone Job POST /api/voice-clone/minimax Supports: * `multipart/form-data` (upload an audio file) * `application/json` (provide `audioUrl`) **JSON request** { "audioUrl": "https://example.com/reference-audio.mp3", "customVoiceId": "MyVoice001", "voiceCloneModel": "speech-02-hd", "needNoiseReduction": false, "needVolumeNormalization": false, "accuracy": 0.7, "text": "Hello! This is a preview of my cloned voice." } **Form fields** | Field | Type | Required | Notes | | --- | --- | --- | --- | | `audio` | file | Yes (if no `audioUrl`) | MP3, M4A, WAV | | `audioUrl` | string | Yes (if no `audio`) | Hosted audio URL | | `customVoiceId` / `custom_voice_id` | string | Yes | Must match `^[A-Za-z][A-Za-z0-9]{7,}$` | | `voiceCloneModel` / `model` | string | No | Example values: `speech-02-hd`, `speech-02-turbo` | | `needNoiseReduction` / `need_noise_reduction` | boolean | No | Default `false` | | `needVolumeNormalization` / `need_volume_normalization` | boolean | No | Default `false` | | `accuracy` | number | No | 0 to 1, default `0.7` | | `text` / `previewText` | string | No | Preview text | **Response (202)** { "status": "pending", "runId": "abc123-def456", "model": "MiniMax-Voice-Clone", "cost": 1.0, "paymentSource": "USD", "isApiRequest": true, "fileName": "reference.mp3", "fileSize": 245000 } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#poll-job-status) Poll Job Status POST /api/voice-clone/minimax/status **Request body** { "runId": "abc123-def456", "cost": 1.0, "paymentSource": "USD", "isApiRequest": true } **Response (in progress)** { "status": "processing" } **Response (completed)** { "status": "completed", "audioUrls": ["https://cdn.example.com/preview-audio.mp3"], "metadata": { "model": "MiniMax-Voice-Clone" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#qwen-voice-clone-1-7b) Qwen Voice Clone (1.7B) -------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#submit-a-clone-job-2) Submit a Clone Job POST /api/voice-clone/qwen Supports: * `multipart/form-data` (upload an audio file) * `application/json` (provide `audioUrl`) **JSON request** { "audioUrl": "https://example.com/reference-audio.mp3", "referenceText": "Optional transcript of the reference clip." } **Form fields** | Field | Type | Required | Notes | | --- | --- | --- | --- | | `audio` | file | Yes (if no `audioUrl`) | MP3, OGG, WAV, M4A, AAC | | `audioUrl` / `audio_url` | string | Yes (if no `audio`) | Hosted audio URL | | `referenceText` / `reference_text` | string | No | Optional transcript | **Response (202)** { "status": "pending", "runId": "vc_run_789", "model": "qwen-voice-clone", "cost": 0.25, "paymentSource": "USD", "isApiRequest": true, "fileName": "audio_file", "fileSize": 0 } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#poll-job-status-2) Poll Job Status POST /api/voice-clone/qwen/status **Request body** { "runId": "vc_run_789", "cost": 0.25, "paymentSource": "USD", "isApiRequest": true } **Response headers** While the job is still processing, the response may include an `X-Poll-After` header indicating how many seconds to wait before polling again. **Response (completed)** { "status": "completed", "speakerEmbeddingUrl": "https://storage.example.com/speaker-embedding.safetensors", "metadata": { "model": "qwen-voice-clone" } } [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#using-cloned-voices-with-tts) Using Cloned Voices with TTS -------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#minimax-cloned-voice-customvoiceid) MiniMax cloned voice (`customVoiceId`) Use your `customVoiceId` as the normal `voice` on `POST /api/tts` with a compatible MiniMax Speech TTS model: { "text": "Text you want spoken in the cloned voice.", "voice": "MyVoice001", "model": "Minimax-Speech-02-HD", "speed": 1 } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#qwen-cloned-voice-speakerembeddingurl) Qwen cloned voice (`speakerEmbeddingUrl`) Use `speakerEmbeddingUrl` as `speaker_voice_embedding_file_url` on `POST /api/tts` with `Qwen-3-TTS-1.7B`: { "text": "Text you want spoken in the cloned voice.", "model": "Qwen-3-TTS-1.7B", "speaker_voice_embedding_file_url": "https://storage.example.com/speaker-embedding.safetensors", "reference_text": "Optional: transcript of the original reference audio.", "language": "Auto" } [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#saving-minimax-voice-ids-web-app) Saving MiniMax Voice IDs (Web App) ------------------------------------------------------------------------------------------------------------------------------------------ If you use the NanoGPT web app, you can save and list your MiniMax `customVoiceId` values. These endpoints are **session-authenticated only** (they do not support API key auth). ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#list-saved-voice-ids) List Saved Voice IDs GET /api/user/voice-ids **Response** { "voiceIds": ["MyVoice001", "MyVoice002"] } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#save-a-voice-id) Save a Voice ID POST /api/user/voice-ids **Request body** { "voiceId": "MyVoice001" } **Response** { "success": true, "voiceIds": ["MyVoice001", "MyVoice002"] } [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#voice-clone-storage-and-retention) Voice Clone Storage and Retention ------------------------------------------------------------------------------------------------------------------------------------------ Last verified: February 21, 2026. Retention depends on the provider behind each voice clone model: * `minimax-voice-clone` (WaveSpeed + MiniMax): New cloned voice IDs are temporary. If a cloned voice is not used in a real TTS synthesis call within 7 days (168 hours), it is deleted. If it is used at least once in TTS within that window, it is kept long-term. Preview generated during clone creation does not activate or persist the voice. * `qwen-voice-clone` (fal.ai): The returned speaker embedding file URL is hosted by fal. fal guarantees hosted generated files for at least 7 days, then they may be removed at any time. Download and store the embedding yourself immediately for long-term reuse. * `inworld-voice-clone` (Inworld Voice API, if enabled in your workspace): Inworld does not publish a fixed auto-delete window for cloned voices in public docs. Treat cloned voices as persistent until explicitly deleted from your workspace. Note: Inworld’s Zero Data Retention mode explicitly does not apply to voice-cloning audio samples. [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#how-to-keep-and-reuse-voice-clones) How to Keep and Reuse Voice Clones -------------------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#minimax-/-wavespeed-customvoiceid) MiniMax / WaveSpeed (`customVoiceId`) 1. Save the returned voice ID (`customVoiceId`; provider docs may also call this `voice_id`). 2. Run at least one real TTS synthesis with that voice ID within 7 days. 3. Reuse the same voice ID in later TTS requests. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#qwen-speakerembeddingurl) Qwen (`speakerEmbeddingUrl`) 1. Save the returned `speakerEmbeddingUrl` (`speaker_embedding_url` in some provider docs). 2. Download the embedding file right away. 3. Store it in your own durable storage (S3, R2, etc.). 4. Use your stored URL later as `speaker_voice_embedding_file_url`. Example: curl -L "$SPEAKER_EMBEDDING_URL" -o my-voice.safetensors ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#inworld-voice_id-if-enabled) Inworld (`voice_id`, if enabled) 1. Save the returned `voice_id`. 2. Reuse it directly for Inworld TTS. 3. If deleted from Inworld, it must be re-cloned. [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#can-i-download-the-clone-if-it-gets-deleted) Can I Download the Clone if It Gets Deleted? --------------------------------------------------------------------------------------------------------------------------------------------------------------- * MiniMax / WaveSpeed: no portable voice embedding download is documented; keep the voice ID active by using it in time. * Qwen: yes, download the speaker embedding file from `speakerEmbeddingUrl` / `speaker_embedding_url`. * Inworld: no documented voice-embedding export endpoint; keep the `voice_id` and avoid accidental deletion. > **Warning:** Provider retention policies may change. This page reflects provider docs as of February 21, 2026. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#provider-source-links) Provider Source Links * MiniMax voice cloning intro: [https://platform.minimax.io/docs/api-reference/voice-cloning-intro](https://platform.minimax.io/docs/api-reference/voice-cloning-intro) * MiniMax voice clone endpoint: [https://platform.minimax.io/docs/api-reference/voice-cloning-clone](https://platform.minimax.io/docs/api-reference/voice-cloning-clone) * MiniMax FAQ (voice ID validity, activation, preview behavior): [https://platform.minimax.io/docs/faq/about-apis](https://platform.minimax.io/docs/faq/about-apis) * WaveSpeed MiniMax voice clone persistence notes: [https://wavespeed.ai/docs/docs-api/minimax/minimax-voice-clone](https://wavespeed.ai/docs/docs-api/minimax/minimax-voice-clone) * fal FAQ (file retention): [https://fal-d8505a2e.mintlify.app/model-apis/faq](https://fal-d8505a2e.mintlify.app/model-apis/faq) * fal Queue API (`X-Fal-Object-Lifecycle-Preference`): [https://fal-d8505a2e.mintlify.app/model-apis/mndpoints/queue](https://fal-d8505a2e.mintlify.app/model-apis/mndpoints/queue) * Inworld clone voice API: [https://docs.inworld.ai/api-reference/voiceAPI/voiceservice/clone-voice](https://docs.inworld.ai/api-reference/voiceAPI/voiceservice/clone-voice) * Inworld list voices: [https://docs.inworld.ai/api-reference/voiceAPI/voiceservice/list-voices](https://docs.inworld.ai/api-reference/voiceAPI/voiceservice/list-voices) * Inworld delete voice: [https://docs.inworld.ai/api-reference/voiceAPI/voiceservice/delete-voice](https://docs.inworld.ai/api-reference/voiceAPI/voiceservice/delete-voice) * Inworld zero data retention (voice cloning samples excluded): [https://docs.inworld.ai/docs/tts/zero-data-retention](https://docs.inworld.ai/docs/tts/zero-data-retention) [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#pricing) Pricing -------------------------------------------------------------------------------------- Clone runs are charged as a flat per-run fee: * MiniMax voice clone: $1.00 per run * Qwen voice clone (1.7B): $0.25 per run The submit response includes `cost` and `paymentSource` for the run. [​](https://docs.nano-gpt.com/api-reference/endpoint/voice-cloning#limitations) Limitations ---------------------------------------------------------------------------------------------- * MiniMax and Qwen clone endpoints are asynchronous; clients must poll status until completion. * MiniMax `customVoiceId` must match `^[A-Za-z][A-Za-z0-9]{7,}$`. --- # NSFW Image Classification - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/nsfw/image \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "image_urls": "https://example.com/image.jpg", "imageUrls": "https://example.com/image.jpg", "imageUrl": "https://example.com/image.jpg", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": [\ ""\ ], "model": "nsfw-classifier" } ' import requests url = "https://api.nano-gpt.com/api/nsfw/image" payload = { "image_urls": "https://example.com/image.jpg", "imageUrls": "https://example.com/image.jpg", "imageUrl": "https://example.com/image.jpg", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": [""], "model": "nsfw-classifier" } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({ image_urls: 'https://example.com/image.jpg', imageUrls: 'https://example.com/image.jpg', imageUrl: 'https://example.com/image.jpg', imageDataUrl: 'data:image/jpeg;base64,/9j/4AAQ...', imageDataUrls: [''], model: 'nsfw-classifier' }) }; fetch('https://api.nano-gpt.com/api/nsfw/image', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/nsfw/image",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'image_urls' => 'https://example.com/image.jpg',\ 'imageUrls' => 'https://example.com/image.jpg',\ 'imageUrl' => 'https://example.com/image.jpg',\ 'imageDataUrl' => 'data:image/jpeg;base64,/9j/4AAQ...',\ 'imageDataUrls' => [\ ''\ ],\ 'model' => 'nsfw-classifier'\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/nsfw/image" payload := strings.NewReader("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"\"\n ],\n \"model\": \"nsfw-classifier\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/nsfw/image") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"\"\n ],\n \"model\": \"nsfw-classifier\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/nsfw/image") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"\"\n ],\n \"model\": \"nsfw-classifier\"\n}" response = http.request(request) puts response.read_body 200 400 429 { "model": "nsfw-classifier", "requestId": "", "inputCount": 2, "cost": 0.003, "currency": "USD", "truncated": false, "has_nsfw_concepts": [\ false,\ true\ ], "is_nsfw": true } { "error": 123, "message": "" } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / nsfw / image Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/nsfw/image \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "image_urls": "https://example.com/image.jpg", "imageUrls": "https://example.com/image.jpg", "imageUrl": "https://example.com/image.jpg", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": [\ ""\ ], "model": "nsfw-classifier" } ' import requests url = "https://api.nano-gpt.com/api/nsfw/image" payload = { "image_urls": "https://example.com/image.jpg", "imageUrls": "https://example.com/image.jpg", "imageUrl": "https://example.com/image.jpg", "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...", "imageDataUrls": [""], "model": "nsfw-classifier" } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({ image_urls: 'https://example.com/image.jpg', imageUrls: 'https://example.com/image.jpg', imageUrl: 'https://example.com/image.jpg', imageDataUrl: 'data:image/jpeg;base64,/9j/4AAQ...', imageDataUrls: [''], model: 'nsfw-classifier' }) }; fetch('https://api.nano-gpt.com/api/nsfw/image', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/nsfw/image",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'image_urls' => 'https://example.com/image.jpg',\ 'imageUrls' => 'https://example.com/image.jpg',\ 'imageUrl' => 'https://example.com/image.jpg',\ 'imageDataUrl' => 'data:image/jpeg;base64,/9j/4AAQ...',\ 'imageDataUrls' => [\ ''\ ],\ 'model' => 'nsfw-classifier'\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/nsfw/image" payload := strings.NewReader("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"\"\n ],\n \"model\": \"nsfw-classifier\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/nsfw/image") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"\"\n ],\n \"model\": \"nsfw-classifier\"\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/nsfw/image") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"image_urls\": \"https://example.com/image.jpg\",\n \"imageUrls\": \"https://example.com/image.jpg\",\n \"imageUrl\": \"https://example.com/image.jpg\",\n \"imageDataUrl\": \"data:image/jpeg;base64,/9j/4AAQ...\",\n \"imageDataUrls\": [\n \"\"\n ],\n \"model\": \"nsfw-classifier\"\n}" response = http.request(request) puts response.read_body 200 400 429 { "model": "nsfw-classifier", "requestId": "", "inputCount": 2, "cost": 0.003, "currency": "USD", "truncated": false, "has_nsfw_concepts": [\ false,\ true\ ], "is_nsfw": true } { "error": 123, "message": "" } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#overview) Overview ------------------------------------------------------------------------------------- The NSFW Image Classification endpoint performs **binary classification** on image URLs (or base64 data URLs) and returns whether each image contains NSFW concepts. Send up to **10 images per request**. [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#authentication) Authentication ------------------------------------------------------------------------------------------------- Include your API key in the request header: x-api-key: YOUR_API_KEY Alternatively, you can use Bearer token authentication: Authorization: Bearer YOUR_API_KEY [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#request) Request ----------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#headers) Headers Content-Type: application/json x-api-key: YOUR_API_KEY ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#body-parameters) Body parameters You may provide images in **any** of the following fields. The endpoint accepts **up to 10 images per request**. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `image_urls` | string \| string\[\] | No | Primary input field. One URL or an array of URLs. | | `imageUrls` | string \| string\[\] | No | Alias for `image_urls`. | | `imageUrl` | string | No | Alias for a single image URL. | | `imageDataUrl` | string | No | Base64 data URL for a single image. | | `imageDataUrls` | string\[\] | No | Base64 data URLs for multiple images. | | `model` | string | No | Only supported value is `nsfw-classifier` (default). | At least one image field is required. If more than 10 images are provided, only the **first 10** are processed and billed. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#example-request) Example request { "image_urls": [\ "https://example.com/image-1.jpg",\ "https://example.com/image-2.jpg"\ ] } [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response) Response ------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#success-200) Success (200) { "model": "nsfw-classifier", "requestId": "", "inputCount": 2, "cost": 0.003, "currency": "USD", "truncated": false, "has_nsfw_concepts": [false, true], "is_nsfw": true } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-fields) Response fields * `model`: The classifier model used. * `requestId`: Request ID (if available; helpful for support). * `inputCount`: Number of images processed (max 10). * `cost`: Final charged amount (after discounts and currency conversion). * `currency`: `USD` or `XNO` depending on payment source. * `truncated`: `true` if more than 10 images were provided. * `has_nsfw_concepts`: List of booleans (one per image, in input order). * `is_nsfw`: `true` if any image was flagged. [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#errors) Errors --------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#400-%E2%80%93-invalid-or-policy-violation) 400 – Invalid or policy violation * Missing or invalid image URLs * JSON parsing error * Policy violation (returns a safety error message) { "error": "No valid image URLs provided" } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#401-%E2%80%93-unauthorized) 401 – Unauthorized { "error": "Unauthorized" } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#429-%E2%80%93-rate-limit-or-api-key-usage-limits) 429 – Rate limit or API key usage limits { "error": "Rate limit exceeded" } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#500-%E2%80%93-server-or-provider-failure) 500 – Server or provider failure { "error": "NSFW classification failed" } [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#billing-notes) Billing Notes ----------------------------------------------------------------------------------------------- * Charged **$0.0015 per image** actually sent to the classifier. * If more than 10 images are provided, only the **first 10** are billed/processed. * Discounts and referral policies apply as with other endpoints. [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#code-examples) Code Examples ----------------------------------------------------------------------------------------------- cURL Python JavaScript curl -X POST https://api.nano-gpt.com/api/nsfw/image \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "image_urls": [\ "https://example.com/image-1.jpg",\ "https://example.com/image-2.jpg"\ ] }' import requests api_key = "YOUR_API_KEY" payload = { "image_urls": [\ "https://example.com/image-1.jpg",\ "https://example.com/image-2.jpg"\ ] } response = requests.post( "https://api.nano-gpt.com/api/nsfw/image", headers={ "Content-Type": "application/json", "x-api-key": api_key }, json=payload ) print(response.json()) const apiKey = 'YOUR_API_KEY'; const response = await fetch('https://api.nano-gpt.com/api/nsfw/image', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': apiKey }, body: JSON.stringify({ image_urls: [\ 'https://example.com/image-1.jpg',\ 'https://example.com/image-2.jpg'\ ] }) }); const data = await response.json(); console.log(data); #### Authorizations apiKeyAuthbearerAuthapiKeyAuthbearerAuth [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#authorization-x-api-key) x-api-key string header required #### Body application/json NSFW image classification request NSFW image classification request payload [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#body-image-urls-one-of-0) image\_urls stringstring\[\]stringstring\[\] Primary input field. One URL or an array of URLs (only the first 10 are processed). Example: `"https://example.com/image.jpg"` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#body-image-urls-one-of-0) imageUrls stringstring\[\]stringstring\[\] Alias for image\_urls. One URL or an array of URLs (only the first 10 are processed). Example: `"https://example.com/image.jpg"` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#body-image-url) imageUrl string Alias for a single image URL Example: `"https://example.com/image.jpg"` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#body-image-data-url) imageDataUrl string Base64 data URL for a single image (format: data:image/\[type\];base64,\[data\]) Example: `"data:image/jpeg;base64,/9j/4AAQ..."` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#body-image-data-urls) imageDataUrls string\[\] Base64 data URLs for multiple images (only the first 10 are processed) Minimum array length: `1` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#body-model) model string default:nsfw-classifier Only supported value is nsfw-classifier #### Response 200 application/json NSFW classification response [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-model) model string The classifier model used Example: `"nsfw-classifier"` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-request-id) requestId string Request ID (if available; helpful for support) [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-input-count) inputCount integer Number of images processed (max 10) Example: `2` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-cost) cost number Final charged amount (after discounts and currency conversion) Example: `0.003` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-currency) currency string Currency of the charge Example: `"USD"` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-truncated) truncated boolean True if more than 10 images were provided Example: `false` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-has-nsfw-concepts) has\_nsfw\_concepts boolean\[\] Per-image NSFW flags in input order Example: `[false, true]` [​](https://docs.nano-gpt.com/api-reference/endpoint/nsfw-image#response-is-nsfw) is\_nsfw boolean True if any image was flagged Example: `true` --- # Direct Web Search API - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/web-search#content-area) Direct Web Search API cURL curl --request POST \ --url https://api.nano-gpt.com/api/web \ --header 'Content-Type: application/json' \ --data ' { "query": "", "provider": "", "operation": "", "depth": "", "outputType": "", "structuredOutputSchema": "", "includeImages": true, "fromDate": "", "toDate": "", "includeDomains": [\ ""\ ], "excludeDomains": [\ ""\ ] } ' import requests url = "https://api.nano-gpt.com/api/web" payload = { "query": "", "provider": "", "operation": "", "depth": "", "outputType": "", "structuredOutputSchema": "", "includeImages": True, "fromDate": "", "toDate": "", "includeDomains": [""], "excludeDomains": [""] } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ query: '', provider: '', operation: '', depth: '', outputType: '', structuredOutputSchema: '', includeImages: true, fromDate: '', toDate: '', includeDomains: [''], excludeDomains: [''] }) }; fetch('https://api.nano-gpt.com/api/web', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/web",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'query' => '',\ 'provider' => '',\ 'operation' => '',\ 'depth' => '',\ 'outputType' => '',\ 'structuredOutputSchema' => '',\ 'includeImages' => true,\ 'fromDate' => '',\ 'toDate' => '',\ 'includeDomains' => [\ ''\ ],\ 'excludeDomains' => [\ ''\ ]\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/web" payload := strings.NewReader("{\n \"query\": \"\",\n \"provider\": \"\",\n \"operation\": \"\",\n \"depth\": \"\",\n \"outputType\": \"\",\n \"structuredOutputSchema\": \"\",\n \"includeImages\": true,\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"includeDomains\": [\n \"\"\n ],\n \"excludeDomains\": [\n \"\"\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/web") .header("Content-Type", "application/json") .body("{\n \"query\": \"\",\n \"provider\": \"\",\n \"operation\": \"\",\n \"depth\": \"\",\n \"outputType\": \"\",\n \"structuredOutputSchema\": \"\",\n \"includeImages\": true,\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"includeDomains\": [\n \"\"\n ],\n \"excludeDomains\": [\n \"\"\n ]\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/web") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"query\": \"\",\n \"provider\": \"\",\n \"operation\": \"\",\n \"depth\": \"\",\n \"outputType\": \"\",\n \"structuredOutputSchema\": \"\",\n \"includeImages\": true,\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"includeDomains\": [\n \"\"\n ],\n \"excludeDomains\": [\n \"\"\n ]\n}" response = http.request(request) puts response.read_body 200 { "data": [\ {}\ ], "metadata": { "query": "", "provider": "", "operation": "", "depth": "", "outputType": "", "timestamp": "", "cost": 123 } } POST / api / web Try it Direct Web Search API cURL curl --request POST \ --url https://api.nano-gpt.com/api/web \ --header 'Content-Type: application/json' \ --data ' { "query": "", "provider": "", "operation": "", "depth": "", "outputType": "", "structuredOutputSchema": "", "includeImages": true, "fromDate": "", "toDate": "", "includeDomains": [\ ""\ ], "excludeDomains": [\ ""\ ] } ' import requests url = "https://api.nano-gpt.com/api/web" payload = { "query": "", "provider": "", "operation": "", "depth": "", "outputType": "", "structuredOutputSchema": "", "includeImages": True, "fromDate": "", "toDate": "", "includeDomains": [""], "excludeDomains": [""] } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ query: '', provider: '', operation: '', depth: '', outputType: '', structuredOutputSchema: '', includeImages: true, fromDate: '', toDate: '', includeDomains: [''], excludeDomains: [''] }) }; fetch('https://api.nano-gpt.com/api/web', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/web",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'query' => '',\ 'provider' => '',\ 'operation' => '',\ 'depth' => '',\ 'outputType' => '',\ 'structuredOutputSchema' => '',\ 'includeImages' => true,\ 'fromDate' => '',\ 'toDate' => '',\ 'includeDomains' => [\ ''\ ],\ 'excludeDomains' => [\ ''\ ]\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json"\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/web" payload := strings.NewReader("{\n \"query\": \"\",\n \"provider\": \"\",\n \"operation\": \"\",\n \"depth\": \"\",\n \"outputType\": \"\",\n \"structuredOutputSchema\": \"\",\n \"includeImages\": true,\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"includeDomains\": [\n \"\"\n ],\n \"excludeDomains\": [\n \"\"\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/web") .header("Content-Type", "application/json") .body("{\n \"query\": \"\",\n \"provider\": \"\",\n \"operation\": \"\",\n \"depth\": \"\",\n \"outputType\": \"\",\n \"structuredOutputSchema\": \"\",\n \"includeImages\": true,\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"includeDomains\": [\n \"\"\n ],\n \"excludeDomains\": [\n \"\"\n ]\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/web") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"query\": \"\",\n \"provider\": \"\",\n \"operation\": \"\",\n \"depth\": \"\",\n \"outputType\": \"\",\n \"structuredOutputSchema\": \"\",\n \"includeImages\": true,\n \"fromDate\": \"\",\n \"toDate\": \"\",\n \"includeDomains\": [\n \"\"\n ],\n \"excludeDomains\": [\n \"\"\n ]\n}" response = http.request(request) puts response.read_body 200 { "data": [\ {}\ ], "metadata": { "query": "", "provider": "", "operation": "", "depth": "", "outputType": "", "timestamp": "", "cost": 123 } } [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#overview) Overview ------------------------------------------------------------------------------------- Use `POST /api/web` when you want direct control over search requests and output formatting. You can also call this tool through the unified [Data API](https://docs.nano-gpt.com/api-reference/endpoint/data-api) at `POST /api/v1/data/web/search`. The Data API preserves this endpoint’s request body, response body, billing, and provider behavior while adding discovery and dispatch metadata. For chat-first workflows, use `POST /api/v1/chat/completions` with model suffixes like `:online`, `:online/linkup`, or `:online/sofya`, including provider-specific suffixes such as `:online/exa-instant`, `:online/exa-deep-reasoning`, `:online/brave`, and `:online/valyu-web-deep`. See [Model Suffixes](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes#web-search-suffixes) . Sofya can do more than search on this endpoint. Set `provider: "sofya"` and choose the `search`, `fetch`, `extract`, or `research` operation. See [hosted-key pricing](https://docs.nano-gpt.com/api-reference/endpoint/web-search#pricing-hosted-key) before choosing a provider. Chat search also incurs the selected model’s token charges. BYOK uses your own provider account and that provider’s billing; it does not make provider usage free. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#when-to-use-which-endpoint) When to use which endpoint ------------------------------------------------------------------------------------------------------------------------- | Use case | Endpoint | | --- | --- | | You want the model to answer with web context in one call | `POST /api/v1/chat/completions` + `:online...` | | You want one discoverable endpoint family for data tools | `POST /api/v1/data/web/search` | | You need explicit control over `query`, `outputType`, domain/date filters, or structured schema output | `POST /api/web` | | You need OpenAI-native web search | `POST /api/v1/chat/completions` only | [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#authentication) Authentication ------------------------------------------------------------------------------------------------- Either auth header is supported: [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-authorization) Authorization string Bearer `YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-x-api-key) x-api-key string `YOUR_API_KEY` [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#accountless-x402-payment) Accountless x402 Payment --------------------------------------------------------------------------------------------------------------------- For accountless payment, prefer the public Data API path: curl -i https://api.nano-gpt.com/api/v1/data/web/search \ -H "Content-Type: application/json" \ -H "x-x402: true" \ -d '{ "query": "What happened in AI this week?", "provider": "linkup", "depth": "standard", "outputType": "sourcedAnswer" }' To request an accountless x402 quote, send the API request without `Authorization` or `x-api-key`, and include `x-x402: true`. NanoGPT will return `402 Payment Required` with available payment options. This endpoint supports accountless x402 payments where listed by `GET /api/v1/x402/endpoints`, including Lightning L402 when advertised. See [Accountless x402 API Payments](https://docs.nano-gpt.com/api-reference/miscellaneous/x402) for the full flow. If you receive `401 missing_api_key` immediately, check that the initial quote request includes `x-x402: true`. Without that header, NanoGPT does not enter the x402 quote flow. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#request-body) Request body --------------------------------------------------------------------------------------------- [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-query) query string Search or research query. Required for every provider’s search operation and for Sofya research. Not used by Sofya fetch or extract. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-provider) provider string default:"linkup" Search provider: `linkup`, `tavily`, `exa`, `kagi`, `perplexity`, `valyu`, `brave`, `sofya`, or `firecrawl`. `openai-native` is not allowed on `/api/web`. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-operation) operation string default:"search" Sofya operation: `search`, `fetch`, `extract`, or `research`. Other providers support `search` only. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-depth) depth string default:"standard" Search depth. For Linkup: `standard` or `deep`. For Linkup, `depth: "standard"` is executed as Linkup `fast` under the hood. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-output-type) outputType string default:"searchResults" Output mode. Allowed values: `searchResults`, `sourcedAnswer`, `structured`. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-structured-output-schema) structuredOutputSchema string Required when `outputType` is `structured`. Pass a JSON schema string. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-include-images) includeImages boolean default:false Include image results. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-from-date) fromDate string Earliest result date (`YYYY-MM-DD`). [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-to-date) toDate string Latest result date (`YYYY-MM-DD`). [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-include-domains) includeDomains string\[\] Restrict results to these domains. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-exclude-domains) excludeDomains string\[\] Exclude these domains. Linkup supports `outputType: "searchResults"`, `"sourcedAnswer"`, and `"structured"`. Non-Linkup providers currently support only `outputType: "searchResults"`. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#sofya-operations) Sofya operations Sofya Search returns extracted page content instead of snippets alone. The other operations let you fetch known URLs, extract requested information from one page, or produce a cited multi-source research report. #### [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#search) Search Use `operation: "search"` or omit `operation`. * `query` (string, required) * `maxResults` (integer, 1-20; default 10) * `topic` (`general` or `news`) * `freshness` (`day`, `week`, `month`, `year`, or `YYYY-MM-DD:YYYY-MM-DD`) * `includeDomains` / `excludeDomains` (up to 10 strings each) #### [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#fetch) Fetch Use `operation: "fetch"` with: * `urls` (array of 1-10 URL strings, required) * `includeRawHtml` or `include_raw_html` (boolean) #### [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#extract) Extract Use `operation: "extract"` with: * `url` (string, required) * `prompt` (string, required), describing what to extract #### [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#research) Research Use `operation: "research"` with: * `query` (string, required) * `topic` (`general` or `news`) * `freshness` (`day`, `week`, `month`, `year`, or `YYYY-MM-DD:YYYY-MM-DD`) * `maxSources` or `max_sources` (integer, 5-30) [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#response-shape) Response shape ------------------------------------------------------------------------------------------------- [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-data) data array|object Provider-formatted payload. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-metadata) metadata object Show metadata [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-query-1) query string Executed query. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-provider-1) provider string Resolved provider (for example, `linkup`). [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-operation-1) operation string Resolved operation. This is `search` except for Sofya fetch, extract, or research requests. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-depth-1) depth string Resolved depth. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-output-type-1) outputType string Resolved output type. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-timestamp) timestamp string ISO-8601 timestamp. [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#param-cost) cost number Request cost in USD. For `searchResults`, `data` is normally an array of normalized results. Sofya extract and research return an object, while Sofya fetch returns an array. For `sourcedAnswer` and `structured`, `data` is the provider response object. ### [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#example-response) Example response { "data": "... provider-formatted payload ...", "metadata": { "query": "string", "provider": "linkup", "depth": "standard", "outputType": "sourcedAnswer", "timestamp": "ISO-8601", "cost": 0.006 } } [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#pricing-hosted-key) Pricing (hosted key) ----------------------------------------------------------------------------------------------------------- | Mode | Price | | --- | --- | | Linkup standard | $0.006 | | Linkup deep | $0.06 | | Sofya search | $0.01575 | | Sofya fetch | $0.00525 per URL | | Sofya extract | $0.02625 | | Sofya research | $0.13125 | [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#error-codes) Error codes ------------------------------------------------------------------------------------------- | HTTP status | Meaning | | --- | --- | | `400` | Invalid parameters | | `401` | Invalid session or auth | | `402` | Insufficient balance or usage cap | | `429` | Rate limited | | `503` | Provider key missing | | `504` | Search failed or timed out | [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#examples) Examples ------------------------------------------------------------------------------------- cURL (Authorization) cURL (x-api-key) cURL (structured output) cURL (chat completions with Linkup) cURL (chat completions with Sofya) curl -X POST https://api.nano-gpt.com/api/web \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "What happened in AI this week?", "provider": "linkup", "depth": "standard", "outputType": "sourcedAnswer" }' curl -X POST https://api.nano-gpt.com/api/web \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "Latest OpenAI announcements", "provider": "linkup", "depth": "deep", "outputType": "searchResults" }' curl -X POST https://api.nano-gpt.com/api/web \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "Top 5 AI coding tools in 2026 with pricing", "provider": "linkup", "depth": "standard", "outputType": "structured", "structuredOutputSchema": "{\"type\":\"object\",\"properties\":{\"tools\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"price\":{\"type\":\"string\"}},\"required\":[\"name\"]}}},\"required\":[\"tools\"]}" }' curl -X POST https://api.nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o:online/linkup", "messages": [\ { "role": "user", "content": "Summarize today'\''s top AI headlines." }\ ] }' curl -X POST https://api.nano-gpt.com/api/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o:online/sofya", "messages": [\ { "role": "user", "content": "Summarize today'\''s top AI headlines." }\ ] }' ### [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#sofya-examples) Sofya examples cURL (search) cURL (fetch) cURL (extract) cURL (research) curl -X POST https://api.nano-gpt.com/api/web \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "sofya", "operation": "search", "query": "NanoGPT API documentation", "maxResults": 10, "topic": "general" }' curl -X POST https://api.nano-gpt.com/api/web \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "sofya", "operation": "fetch", "urls": ["https://sofya.co/docs"], "includeRawHtml": false }' curl -X POST https://api.nano-gpt.com/api/web \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "sofya", "operation": "extract", "url": "https://sofya.co/pricing", "prompt": "Extract the available plans and their prices." }' curl -X POST https://api.nano-gpt.com/api/web \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "sofya", "operation": "research", "query": "Compare current AI web search APIs", "maxSources": 15 }' [​](https://docs.nano-gpt.com/api-reference/endpoint/web-search#related-docs) Related docs --------------------------------------------------------------------------------------------- * [Chat Completion](https://docs.nano-gpt.com/api-reference/endpoint/chat-completion) * [Data API](https://docs.nano-gpt.com/api-reference/endpoint/data-api) * [Web Search in Text Generation Guide](https://docs.nano-gpt.com/api-reference/text-generation) * [Model Suffixes](https://docs.nano-gpt.com/api-reference/miscellaneous/model-suffixes) --- # Speech-to-Text Status - NanoGPT API Documentation > Documentation Index > ------------------- > > Fetch the complete documentation index at: [/llms.txt](https://docs.nano-gpt.com/llms.txt) > > Use this file to discover all available pages before exploring further. [Skip to main content](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#content-area) cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/transcribe/status \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "runId": "abc123def456", "cost": 123, "paymentSource": "", "isApiRequest": true, "fileName": "", "fileSize": 123, "chargedDuration": 123, "diarize": true } ' import requests url = "https://api.nano-gpt.com/api/transcribe/status" payload = { "runId": "abc123def456", "cost": 123, "paymentSource": "", "isApiRequest": True, "fileName": "", "fileSize": 123, "chargedDuration": 123, "diarize": True } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({ runId: 'abc123def456', cost: 123, paymentSource: '', isApiRequest: true, fileName: '', fileSize: 123, chargedDuration: 123, diarize: true }) }; fetch('https://api.nano-gpt.com/api/transcribe/status', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/transcribe/status",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'runId' => 'abc123def456',\ 'cost' => 123,\ 'paymentSource' => '',\ 'isApiRequest' => true,\ 'fileName' => '',\ 'fileSize' => 123,\ 'chargedDuration' => 123,\ 'diarize' => true\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/transcribe/status" payload := strings.NewReader("{\n \"runId\": \"abc123def456\",\n \"cost\": 123,\n \"paymentSource\": \"\",\n \"isApiRequest\": true,\n \"fileName\": \"\",\n \"fileSize\": 123,\n \"chargedDuration\": 123,\n \"diarize\": true\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/transcribe/status") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"runId\": \"abc123def456\",\n \"cost\": 123,\n \"paymentSource\": \"\",\n \"isApiRequest\": true,\n \"fileName\": \"\",\n \"fileSize\": 123,\n \"chargedDuration\": 123,\n \"diarize\": true\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/transcribe/status") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"runId\": \"abc123def456\",\n \"cost\": 123,\n \"paymentSource\": \"\",\n \"isApiRequest\": true,\n \"fileName\": \"\",\n \"fileSize\": 123,\n \"chargedDuration\": 123,\n \"diarize\": true\n}" response = http.request(request) puts response.read_body 200 400 404 500 { "status": "pending", "transcription": "Speaker 1: Hello everyone. Speaker 2: Hi there!", "metadata": { "fileName": "", "fileSize": 123, "chargedDuration": 123, "actualDuration": 123, "language": "", "cost": 123, "currency": "", "model": "" }, "words": [\ {\ "text": "",\ "start": 123,\ "end": 123,\ "type": "word",\ "speaker_id": ""\ }\ ], "diarization": { "segments": [\ {\ "speaker": "",\ "text": "",\ "start": 123,\ "end": 123\ }\ ] }, "error": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } POST https://api.nano-gpt.com/apihttps://nano-gpt.com/api / transcribe / status Try it cURL cURL curl --request POST \ --url https://api.nano-gpt.com/api/transcribe/status \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data ' { "runId": "abc123def456", "cost": 123, "paymentSource": "", "isApiRequest": true, "fileName": "", "fileSize": 123, "chargedDuration": 123, "diarize": true } ' import requests url = "https://api.nano-gpt.com/api/transcribe/status" payload = { "runId": "abc123def456", "cost": 123, "paymentSource": "", "isApiRequest": True, "fileName": "", "fileSize": 123, "chargedDuration": 123, "diarize": True } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({ runId: 'abc123def456', cost: 123, paymentSource: '', isApiRequest: true, fileName: '', fileSize: 123, chargedDuration: 123, diarize: true }) }; fetch('https://api.nano-gpt.com/api/transcribe/status', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); "https://api.nano-gpt.com/api/transcribe/status",\ CURLOPT_RETURNTRANSFER => true,\ CURLOPT_ENCODING => "",\ CURLOPT_MAXREDIRS => 10,\ CURLOPT_TIMEOUT => 30,\ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\ CURLOPT_CUSTOMREQUEST => "POST",\ CURLOPT_POSTFIELDS => json_encode([\ 'runId' => 'abc123def456',\ 'cost' => 123,\ 'paymentSource' => '',\ 'isApiRequest' => true,\ 'fileName' => '',\ 'fileSize' => 123,\ 'chargedDuration' => 123,\ 'diarize' => true\ ]),\ CURLOPT_HTTPHEADER => [\ "Content-Type: application/json",\ "x-api-key: "\ ],\ ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.nano-gpt.com/api/transcribe/status" payload := strings.NewReader("{\n \"runId\": \"abc123def456\",\n \"cost\": 123,\n \"paymentSource\": \"\",\n \"isApiRequest\": true,\n \"fileName\": \"\",\n \"fileSize\": 123,\n \"chargedDuration\": 123,\n \"diarize\": true\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } HttpResponse response = Unirest.post("https://api.nano-gpt.com/api/transcribe/status") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"runId\": \"abc123def456\",\n \"cost\": 123,\n \"paymentSource\": \"\",\n \"isApiRequest\": true,\n \"fileName\": \"\",\n \"fileSize\": 123,\n \"chargedDuration\": 123,\n \"diarize\": true\n}") .asString(); require 'uri' require 'net/http' url = URI("https://api.nano-gpt.com/api/transcribe/status") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"runId\": \"abc123def456\",\n \"cost\": 123,\n \"paymentSource\": \"\",\n \"isApiRequest\": true,\n \"fileName\": \"\",\n \"fileSize\": 123,\n \"chargedDuration\": 123,\n \"diarize\": true\n}" response = http.request(request) puts response.read_body 200 400 404 500 { "status": "pending", "transcription": "Speaker 1: Hello everyone. Speaker 2: Hi there!", "metadata": { "fileName": "", "fileSize": 123, "chargedDuration": 123, "actualDuration": 123, "language": "", "cost": 123, "currency": "", "model": "" }, "words": [\ {\ "text": "",\ "start": 123,\ "end": 123,\ "type": "word",\ "speaker_id": ""\ }\ ], "diarization": { "segments": [\ {\ "speaker": "",\ "text": "",\ "start": 123,\ "end": 123\ }\ ] }, "error": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } { "error": 123, "message": "" } [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#overview) Overview -------------------------------------------------------------------------------------------- Check the status of an asynchronous transcription job (Elevenlabs-STT). Poll this endpoint to get transcription results when the job is completed. [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#usage) Usage -------------------------------------------------------------------------------------- This endpoint is used with the Elevenlabs-STT model which processes transcriptions asynchronously. After submitting a transcription job, you’ll receive a `runId` that you use to check the status. Python JavaScript cURL import requests import time def check_transcription_status(run_id, job_data): headers = { "x-api-key": "YOUR_API_KEY", "Content-Type": "application/json" } status_data = { "runId": run_id, "cost": job_data.get('cost'), "paymentSource": job_data.get('paymentSource'), "isApiRequest": True, "fileName": job_data.get('fileName'), "fileSize": job_data.get('fileSize'), "chargedDuration": job_data.get('chargedDuration'), "diarize": job_data.get('diarize', False) } response = requests.post( "https://api.nano-gpt.com/api/transcribe/status", headers=headers, json=status_data ) return response.json() def wait_for_completion(run_id, job_data, max_attempts=60): for attempt in range(max_attempts): result = check_transcription_status(run_id, job_data) status = result.get('status') if status == 'completed': return result elif status == 'failed': raise Exception(f"Transcription failed: {result.get('error')}") print(f"Status: {status} (attempt {attempt + 1}/{max_attempts})") time.sleep(5) raise Exception("Transcription timed out") # Usage job_data = {"runId": "abc123", "cost": 0.075, "paymentSource": "USD"} result = wait_for_completion("abc123", job_data) print(result['transcription']) async function checkTranscriptionStatus(runId, jobData) { const response = await fetch('https://api.nano-gpt.com/api/transcribe/status', { method: 'POST', headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ runId: runId, cost: jobData.cost, paymentSource: jobData.paymentSource, isApiRequest: true, fileName: jobData.fileName, fileSize: jobData.fileSize, chargedDuration: jobData.chargedDuration, diarize: jobData.diarize || false }) }); return await response.json(); } async function waitForCompletion(runId, jobData, maxAttempts = 60) { for (let attempt = 0; attempt < maxAttempts; attempt++) { const result = await checkTranscriptionStatus(runId, jobData); const status = result.status; if (status === 'completed') { return result; } else if (status === 'failed') { throw new Error(`Transcription failed: ${result.error}`); } console.log(`Status: ${status} (attempt ${attempt + 1}/${maxAttempts})`); await new Promise(resolve => setTimeout(resolve, 5000)); } throw new Error('Transcription timed out'); } // Usage const jobData = {runId: "abc123", cost: 0.075, paymentSource: "USD"}; const result = await waitForCompletion("abc123", jobData); console.log(result.transcription); # Check status curl -X POST https://api.nano-gpt.com/api/transcribe/status \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "runId": "abc123def456", "cost": 0.075, "paymentSource": "USD", "isApiRequest": true, "fileName": "meeting.mp3", "fileSize": 2345678, "chargedDuration": 2.5, "diarize": true }' [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#status-values) Status Values ------------------------------------------------------------------------------------------------------ * **`pending`**: Job is queued for processing * **`processing`**: Transcription is in progress * **`completed`**: Transcription finished successfully * **`failed`**: Transcription failed (check error field) [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#response-examples) Response Examples -------------------------------------------------------------------------------------------------------------- ### [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#pending/processing) Pending/Processing { "status": "processing" } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#completed) Completed { "status": "completed", "transcription": "Speaker 1: Hello everyone. Speaker 2: Hi there!", "metadata": { "fileName": "meeting.mp3", "fileSize": 2345678, "chargedDuration": 2.5, "actualDuration": 2.47, "language": "en", "cost": 0.075, "currency": "USD", "model": "Elevenlabs-STT" }, "words": [\ {\ "text": "Hello",\ "start": 0.5,\ "end": 0.9,\ "type": "word",\ "speaker_id": "speaker_0"\ }\ ], "diarization": { "segments": [\ {\ "speaker": "Speaker 1",\ "text": "Hello everyone",\ "start": 0.5,\ "end": 1.5\ }\ ] } } ### [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#failed) Failed { "status": "failed", "error": "Audio file could not be processed" } #### Authorizations [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#authorization-x-api-key) x-api-key string header required #### Body application/json Status check parameters including runId from the initial transcription request [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-run-id) runId string required Unique identifier for the transcription job Example: `"abc123def456"` [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-cost) cost number Cost of the transcription (from initial response) [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-payment-source) paymentSource string Payment source used (from initial response) [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-is-api-request) isApiRequest boolean Whether this is an API request (from initial response) [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-file-name) fileName string Original file name (from initial response) [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-file-size) fileSize integer File size in bytes (from initial response) [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-charged-duration) chargedDuration number Duration charged for billing (from initial response) [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#body-diarize) diarize boolean Whether speaker diarization is enabled (from initial response) #### Response 200 application/json Transcription status response [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#response-status) status enum required Current status of the transcription job Available options: `pending`, `processing`, `completed`, `failed` [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#response-transcription) transcription string The transcribed text (available when status is 'completed') Example: `"Speaker 1: Hello everyone. Speaker 2: Hi there!"` [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#response-metadata) metadata object Transcription metadata (available when status is 'completed') Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#response-words) words object\[\] Word-level timestamps and speaker information (Elevenlabs-STT only) Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#response-diarization) diarization object Speaker diarization results (when enabled) Show child attributes [​](https://docs.nano-gpt.com/api-reference/endpoint/transcribe-status#response-error) error string Error message (available when status is 'failed') ---