API Reference
Complete guide to integrating NavyAI's unified API for chat, embeddings, image generation, and more.
OpenAI Compatible
Drop-in replacement
150+ Models
One endpoint
Low Latency
Optimized routing
Base URL
https://api.navy/v1Introduction
Get started with the NavyAI API in minutes.
NavyAI provides a unified API that gives you access to 150+ AI models from multiple providers through a single, OpenAI-compatible interface. Simply swap your base URL and start using any model instantly.
Quick Start
Get started in minutes by using the OpenAI SDK with your NavyAI API key:
- Get your API key from the Dashboard
- Set the base URL to
https://api.navy/v1 - Start making requests!
Authentication
Secure your API requests with authentication.
All API requests require authentication using an API key. Include your API key in the Authorization header of every request.
Authorization: Bearer YOUR_API_KEYGet Your API Key
You can obtain your API key from the NavyAI Dashboard. Keep your API key secure and never share it publicly.
Chat Completions
Create conversational AI interactions with advanced language models.
/v1/chat/completionsCreate chat completions using advanced language models. Supports streaming, multi-turn conversations, and various parameters for controlling output.
Code Examples
curl -X POST "https://api.navy/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Tell me a fun fact."}]
}'Parameters
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Model ID to use (e.g., gpt-5.2, claude-sonnet-4.5) |
messagesrequired | array | List of message objects with role and content |
max_tokensoptional | integer | Maximum tokens to generate |
temperatureoptional | number | Sampling temperature (0.0-2.0) |
top_poptional | number | Nucleus sampling threshold (0.0-1.0) |
streamoptional | boolean | Enable streaming responses |
Embeddings
Generate vector embeddings for semantic search and similarity.
/v1/embeddingsGenerate text embeddings for semantic search, clustering, and similarity comparisons.
Code Examples
curl -X POST "https://api.navy/v1/embeddings" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "text-embedding-ada-002",
"input": "The quick brown fox jumps over the lazy dog"
}'Parameters
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Embedding model ID (e.g., text-embedding-3-large) |
inputrequired | string | array | Text or array of texts to embed |
encoding_formatoptional | string | Return format: "float" or "base64" |
Image Generation
Create stunning images from text descriptions.
/v1/images/generationsGenerate images from text descriptions using state-of-the-art diffusion models. This endpoint also supports video generation models.
Code Examples
curl -X POST "https://api.navy/v1/images/generations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "flux.1-schnell",
"prompt": "A cute cat wearing a wizard hat",
"n": 1,
"size": "1024x1024"
}'Parameters
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Image model ID (e.g., flux.1-schnell, dall-e-3) |
promptrequired | string | Text description of the desired image |
sizeoptional | string | Image resolution (e.g., "1024x1024") |
qualityoptional | string | For DALL·E 3: "standard" or "hd" |
styleoptional | string | DALL·E 3 style: "vivid" or "natural" |
syncoptional | boolean | If false, returns job ID for polling. Recommended for video. |
Asynchronous Generation
For video models or when sync: false, the API returns a job object:
{
"id": "job_123...",
"status": "queued",
"created_at": 1715000000
}Poll /v1/images/generations/{id} to check status.
Text-to-Speech
Convert text into natural-sounding speech audio.
/v1/audio/speechConvert text to natural-sounding speech audio with multiple voice options.
Code Examples
curl -X POST "https://api.navy/v1/audio/speech" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Hello world! This is a text to speech test.",
"voice": "alloy"
}' \
--output speech.mp3Parameters
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | TTS model ID (e.g., tts-1, tts-1-hd) |
inputrequired | string | Text to convert to speech |
voicerequired | string | Voice preset: alloy, echo, fable, onyx, nova, shimmer |
speedoptional | number | Playback speed (0.25 to 4.0) |
response_formatoptional | string | Audio format: mp3, opus, aac, flac |
Speech-to-Text
Transcribe audio files into accurate text.
/v1/audio/transcriptionsTranscribe audio files into text with high accuracy across multiple languages.
Code Examples
curl -X POST "https://api.navy/v1/audio/transcriptions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F file="@/path/to/your/audio.mp3" \
-F model="whisper-1"Parameters
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Transcription model (e.g., whisper-1) |
filerequired | file | Audio file to transcribe (max 25MB) |
languageoptional | string | Input language in ISO-639-1 format |
response_formatoptional | string | Output format: json, text, srt, vtt |
Moderations
Check content for policy violations.
/v1/moderationsCheck text content for policy violations and harmful content.
Code Examples
curl -X POST "https://api.navy/v1/moderations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "text-moderation-stable",
"input": "I want to check if this text is appropriate."
}'Parameters
| Parameter | Type | Description |
|---|---|---|
modeloptional | string | Moderation model: text-moderation-stable or text-moderation-latest |
inputrequired | string | array | Text to check for policy violations |
Create Response
Generate model responses with flexible inputs.
/v1/responsesGenerate model responses with flexible input options and metadata support.
Code Examples
curl -X POST "https://api.navy/v1/responses" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4o",
"input": "Tell me a fun fact."
}'Parameters
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Model ID to use for response generation |
inputrequired | string | object | Text, image, or file inputs for the model |
streamoptional | boolean | Stream response as server-sent events |
instructionsoptional | string | System message for model context |
max_output_tokensoptional | integer | Maximum tokens to generate |
metadataoptional | object | Key-value pairs for storing additional information |
List Models
Retrieve available models and their details.
/v1/modelsRetrieve a list of all available models and their details.
Code Examples
curl "https://api.navy/v1/models"No Parameters Required
This endpoint does not require any parameters or authentication.
Usage Statistics
Track your API usage and token consumption.
/v1/usageGet detailed usage statistics for your API key including request counts and token usage.
Code Examples
curl "https://api.navy/v1/usage" \
-H "Authorization: Bearer YOUR_API_KEY"No Parameters Required
This endpoint does not require any parameters. Your API key determines which usage data is returned.