Thanks to visit codestin.com
Credit goes to api.navy

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, 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)
messagesrequired
arrayList of message objects with role and content
max_tokensoptional
integerMaximum tokens to generate
temperatureoptional
numberSampling temperature (0.0-2.0)
top_poptional
numberNucleus sampling threshold (0.0-1.0)
streamoptional
booleanEnable streaming responses

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)
promptrequired
stringText description of the desired image
sizeoptional
stringImage resolution (e.g., "1024x1024")
qualityoptional
stringFor DALL·E 3: "standard" or "hd"
styleoptional
stringDALL·E 3 style: "vivid" or "natural"
syncoptional
booleanIf 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.

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)
inputrequired
stringText to convert to speech
voicerequired
stringVoice preset: alloy, echo, fable, onyx, nova, shimmer
speedoptional
numberPlayback speed (0.25 to 4.0)
response_formatoptional
stringAudio format: mp3, opus, aac, flac

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)
filerequired
fileAudio file to transcribe (max 25MB)
languageoptional
stringInput language in ISO-639-1 format
response_formatoptional
stringOutput format: json, text, srt, vtt

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.