API Documentation

Welcome to the NavyAI API documentation. Our API provides access to state-of-the-art AI models for chat, embeddings, image generation, audio processing, and more. All endpoints follow OpenAI's API structure for easy integration.

Quick Start
Get started in minutes by using the OpenAI SDK with your NavyAI API key. Simply set the base URL to https://api.navy/v1 and you're ready to go.

Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header.

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

POST /v1/chat/completions

Create chat completions using advanced language models. Supports streaming, multi-turn conversations, and various parameters for controlling output.

Code Examples

Parameters

Parameter Type Description
modelrequired string Model ID to use (e.g., gpt-5, o4-mini, claude-sonnet-4.5)
messagesrequired array List of message objects with role (system/user/assistant) and content
max_tokensoptional integer Maximum tokens to generate in completion
temperatureoptional number Sampling temperature (0.0-2.0). Lower values = more deterministic
top_poptional number Nucleus sampling threshold (0.0-1.0)
streamoptional boolean Enable streaming responses via server-sent events

Embeddings

POST /v1/embeddings

Generate text embeddings for semantic search, clustering, and similarity comparisons.

Code Examples

Parameters

Parameter Type Description
modelrequired string Embedding model ID (e.g., text-embedding-ada-002)
inputrequired string | array Text or array of texts to embed
encoding_formatoptional string Return format: "float" (default) or "base64"

Image Generation

POST /v1/images/generations

Generate images from text descriptions using state-of-the-art diffusion models.

This endpoint is also used for video models - the only difference is that the output URL points to a video file instead of an image.

Code Examples

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", "512x512")
qualityoptional string For DALL·E 3: "standard" or "hd"
styleoptional string DALL·E 3 style: "vivid" or "natural"

Text-to-Speech

POST /v1/audio/speech

Convert text to natural-sounding speech audio with multiple voice options.

Code Examples

Parameters

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, default: 1.0)
response_formatoptional string Audio format: mp3, opus, aac, flac (default: mp3)

Speech-to-Text

POST /v1/audio/transcriptions

Transcribe audio files into text with high accuracy across multiple languages.

Code Examples

Parameters

Parameter Type Description
modelrequired string Transcription model (e.g., whisper-1)
filerequired file Audio file to transcribe (max 25MB): mp3, mp4, mpeg, mpga, wav, webm
languageoptional string Input language in ISO-639-1 format (e.g., "en", "de")
response_formatoptional string Output format: json, text, srt, verbose_json, vtt

Moderations

POST /v1/moderations

Check text content for policy violations and harmful content.

Code Examples

Parameters

Parameter Type Description
modeloptional string Moderation model: text-moderation-stable or text-moderation-latest
inputrequired string | array Text to check for content policy violations

Create Response

POST /v1/responses

Generate model responses with flexible input options and metadata support.

Code Examples

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

GET /v1/models

Retrieve a list of all available models and their details.

Code Examples

No Parameters Required
This endpoint does not require any parameters. Simply include your API key in the Authorization header.

Usage Statistics

GET /v1/usage

Get detailed usage statistics for your API key including request counts and token usage.

Code Examples

No Parameters Required
This endpoint does not require any parameters. Your API key determines which usage data is returned.