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/v1

Introduction

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:

  1. Get your API key from the Dashboard
  2. Set the base URL to https://api.navy/v1
  3. 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 Header
Authorization: Bearer YOUR_API_KEY

Get 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.

POST/v1/chat/completions

Create chat completions using advanced language models. Supports streaming, multi-turn conversations, vision (image inputs), web search, tool/function calling, 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

ParameterTypeDescription
modelrequired
stringModel ID to use (e.g., gpt-5.2, claude-sonnet-4.5). Append ":search" for web search (e.g., "gpt-4o:search")
messagesrequired
arrayList of message objects with role and content. Content can be a string or an array of parts (text, image_url) for vision models
max_tokensoptional
integerMaximum tokens to generate
temperatureoptional
numberSampling temperature (0.0-2.0)
top_poptional
numberNucleus sampling threshold (0.0-1.0)
top_koptional
integerTop-K sampling parameter (supported by some providers)
streamoptional
booleanEnable streaming responses
stopoptional
string | arrayStop sequence(s) to end generation
seedoptional
integerRandom seed for reproducible outputs (supported by some providers)
frequency_penaltyoptional
numberPenalize repeated tokens based on frequency (-2.0 to 2.0)
presence_penaltyoptional
numberPenalize tokens based on presence (-2.0 to 2.0)
reasoning_effortoptional
stringControl thinking depth: "none", "minimal", "low", "medium", "high", "xhigh" (for thinking-capable models)
response_formatoptional
objectForce output format: { type: "json_object" }, { type: "json_schema", json_schema: {...} }, or { type: "text" }
toolsoptional
arrayList of tool/function definitions for function calling
tool_choiceoptional
string | objectControl tool usage: "auto", "none", "required", or { type: "function", function: { name: "..." } }

Vision Support

Many models support image inputs via the image_url content type in messages:

{
  "role": "user",
  "content": [
    { "type": "text", "text": "What's in this image?" },
    { "type": "image_url", "image_url": { "url": "https://example.com/image.png" } }
  ]
}

Supports both URLs and base64 data URIs (data:image/png;base64,...).

Web Search

Append :search to any model name to enable real-time internet search. Search results are automatically injected into the context. Example: "model": "gpt-4o:search"

Embeddings

Generate vector embeddings for semantic search and similarity.

POST/v1/embeddings

Generate 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

ParameterTypeDescription
modelrequired
stringEmbedding model ID (e.g., text-embedding-3-large)
inputrequired
string | arrayText or array of texts to embed
encoding_formatoptional
stringReturn format: "float" or "base64"

Image Generation

Create stunning images from text descriptions.

POST/v1/images/generations

Generate 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

ParameterTypeDescription
modelrequired
stringImage model ID (e.g., flux.1-schnell, dall-e-3, gpt-image-1.5)
promptrequired
stringText description of the desired image
sizeoptional
stringImage resolution (e.g., "1024x1024") or aspect ratio (e.g., "16:9")
image_urloptional
stringInput/reference image URL or base64 data URI for image editing, kontext, or video start frame
negative_promptoptional
stringText describing what to avoid in the generated image
seedoptional
integerRandom seed for reproducible generation
qualityoptional
stringQuality level: "low" or "medium" (model-dependent)
styleoptional
stringDALL·E 3 style: "vivid" or "natural"
secondsoptional
numberDuration for video models (0-10 seconds)
syncoptional
booleanIf false, returns job ID for async polling. Recommended for video models.

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.

POST/v1/audio/speech

Convert 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.mp3

Parameters

ParameterTypeDescription
modelrequired
stringTTS model ID (e.g., tts-1, tts-1-hd, eleven_v3, gpt-4o-mini-tts, gemini-2.5-flash-preview-tts)
inputrequired
stringText to convert to speech (max 4096 characters for ElevenLabs)
voicerequired
stringVoice preset. OpenAI: alloy, echo, fable, onyx, nova, shimmer. ElevenLabs: alice, aria, brian, etc. Gemini: Puck, Kore, etc.
speedoptional
numberPlayback speed (0.25 to 4.0, OpenAI models only)
response_formatoptional
stringAudio format: mp3, opus, aac, flac (OpenAI models)
with-timestampsoptional
booleanReturn JSON with word-level timestamps (ElevenLabs models only)
stabilityoptional
numberVoice stability (0.0-1.0, ElevenLabs models only)
similarity_boostoptional
numberVoice similarity boost (0.0-1.0, ElevenLabs models only)

Speech-to-Text

Transcribe audio files into accurate text.

POST/v1/audio/transcriptions

Transcribe 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

ParameterTypeDescription
modelrequired
stringTranscription model (e.g., whisper-1, gpt-4o-transcribe, scribe_v2)
filerequired
fileAudio file to transcribe (max 25MB)
languageoptional
stringInput language in ISO-639-1 format
response_formatoptional
stringOutput format: json, text, srt, vtt, verbose_json
timestamp_granularitiesoptional
arrayTimestamp detail level: ["word"], ["segment"], or both. Automatically sets response_format to verbose_json.

Moderations

Check content for policy violations.

POST/v1/moderations

Check 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

ParameterTypeDescription
modeloptional
stringModeration model: text-moderation-stable or text-moderation-latest
inputrequired
string | arrayText to check for policy violations

Create Response

Generate model responses with flexible inputs.

POST/v1/responses

Generate 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

ParameterTypeDescription
modelrequired
stringModel ID to use for response generation
inputrequired
string | objectText, image, or file inputs for the model
streamoptional
booleanStream response as server-sent events
instructionsoptional
stringSystem message for model context
max_output_tokensoptional
integerMaximum tokens to generate
metadataoptional
objectKey-value pairs for storing additional information

List Models

Retrieve available models and their details.

GET/v1/models

Retrieve 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.

GET/v1/usage

Get 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.