PriyoPriyo Forge

Build with the Priyo Forge API

An OpenAI-compatible LLM gateway at api.priyo.ai. Use any OpenAI, Anthropic, or fetch-based client — just point the base URL at Forge and pass your Forge API key.

Quickstart

Send your first chat request in under a minute. Any OpenAI-compatible SDK works — set the base URL to https://api.priyo.ai/v1 and use your Forge key.

curl https://api.priyo.ai/v1/chat/completions \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "priyo-llama",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain AI in Bangla"}
    ]
  }'

Approved? Find your key on the dashboard. Don't have one yet? Apply for an API key.

Authentication

Every request needs a Authorization: Bearer header. Forge keys start with sk-. Treat them like passwords — never commit them or expose them in client-side code.

Authorization: Bearer sk-priyo-...

Calls that fail authentication return 401 Unauthorized. Revoke or rotate a key any time from your dashboard.

Base URL & SDKs

Forge speaks the OpenAI HTTP spec. Point any OpenAI client at https://api.priyo.ai/v1 and the rest works unchanged. For Claude models, the Anthropic SDK also works — set its base URL to https://api.priyo.ai.

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["PRIYO_API_KEY"],
    base_url="https://api.priyo.ai/v1",
)

The Python and Node OpenAI SDK examples below all assume the client is constructed as above.

Chat completions

OpenAI-compatible

Send a list of messages and receive a model reply. Supports streaming, tool calls, JSON-mode, and vision on capable models.

POST/v1/chat/completions
FieldTypeDescription
modelrequiredstringModel ID. See available models.
messagesrequiredarrayConversation history as system / user / assistant / tool messages.
streambooleanIf true, deltas stream back as Server-Sent Events.
temperaturenumber0–2. Lower = more deterministic. Defaults to 1.
max_tokensintegerCap on response length, in tokens.
toolsarrayFunction/tool definitions the model can call.
response_formatobjectForce structured output, e.g. { type: "json_object" }.
curl https://api.priyo.ai/v1/chat/completions \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "priyo-llama",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain AI in Bangla"}
    ]
  }'
Example response
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1735689600,
  "model": "priyo-llama",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "AI মানে কৃত্রিম বুদ্ধিমত্তা…"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 24, "completion_tokens": 38, "total_tokens": 62 }
}

Streaming

Set stream: true to receive incremental chunks as Server-Sent Events. The stream terminates with a data: [DONE] line.

curl https://api.priyo.ai/v1/chat/completions \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "priyo-llama",
    "messages": [{"role": "user", "content": "Write a haiku about Dhaka"}],
    "stream": true
  }'

Completions (legacy)

Legacy

The text-completion endpoint for single-prompt use cases. Prefer chat completions for new code.

POST/v1/completions
FieldTypeDescription
modelrequiredstringModel ID.
promptrequiredstring | arrayText or array of text to complete.
max_tokensintegerMaximum tokens to generate.
streambooleanStream tokens as they arrive.
curl https://api.priyo.ai/v1/completions \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "priyo-llama",
    "prompt": "Once upon a time in Dhaka,",
    "max_tokens": 64
  }'

Embeddings

OpenAI-compatible

Convert text into a numeric vector for search, clustering, and retrieval-augmented generation.

POST/v1/embeddings
FieldTypeDescription
modelrequiredstringEmbedding model ID.
inputrequiredstring | arrayText or array of text to embed.
encoding_formatstring"float" (default) or "base64".
dimensionsintegerTruncate the vector to this many dims (supported models only).
curl https://api.priyo.ai/v1/embeddings \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "priyo-embed",
    "input": "Bangla is a beautiful language."
  }'
Example response
{
  "object": "list",
  "model": "priyo-embed",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0023, -0.0048, ...] }
  ],
  "usage": { "prompt_tokens": 7, "total_tokens": 7 }
}

Models

List the models your key can call. Returns the same shape as OpenAI's /v1/models.

GET/v1/models
curl https://api.priyo.ai/v1/models \
  -H "Authorization: Bearer $PRIYO_API_KEY"
Example response
{
  "object": "list",
  "data": [
    { "id": "priyo-llama", "object": "model", "owned_by": "priyo" },
    { "id": "priyo-qwen", "object": "model", "owned_by": "priyo" },
    { "id": "claude-sonnet-4-6", "object": "model", "owned_by": "anthropic" }
  ]
}

Moderations

Classify whether text contains sexual, hate, violence, self-harm, or other policy-violating content.

POST/v1/moderations
FieldTypeDescription
modelstringModeration model. Defaults to the latest.
inputrequiredstring | arrayText to classify.
curl https://api.priyo.ai/v1/moderations \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni-moderation-latest",
    "input": "Sample text to classify."
  }'

Text-to-speech

Audio

Synthesise spoken audio from text. The response body is the raw audio file.

POST/v1/audio/speech
FieldTypeDescription
modelrequiredstringTTS model ID.
inputrequiredstringText to synthesise.
voicerequiredstringVoice ID, e.g. alloy, nova, shimmer.
response_formatstringmp3 (default), opus, aac, flac, wav, pcm.
curl https://api.priyo.ai/v1/audio/speech \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "Hello from Priyo Forge.",
    "voice": "alloy"
  }' \
  --output speech.mp3

Speech-to-text

Audio

Transcribe an audio file into text. Send as multipart/form-data.

POST/v1/audio/transcriptions
FieldTypeDescription
filerequiredfileAudio file. mp3, wav, m4a, webm, and more.
modelrequiredstringTranscription model, e.g. whisper-1.
languagestringISO-639-1 hint (e.g. "bn" for Bangla).
response_formatstringjson (default), text, srt, vtt, verbose_json.
curl https://api.priyo.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -F file="@audio.mp3" \
  -F model="whisper-1"

Image generation

Images

Generate an image from a text prompt.

POST/v1/images/generations
FieldTypeDescription
modelrequiredstringImage model ID.
promptrequiredstringDescription of the image to generate.
sizestringPixel dimensions, e.g. 1024x1024.
nintegerNumber of images. Defaults to 1.
response_formatstringurl (default) or b64_json.
curl https://api.priyo.ai/v1/images/generations \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A street vendor in Dhaka at golden hour, watercolor",
    "size": "1024x1024",
    "n": 1
  }'

Image edits

Images

Edit an existing image (or fill a masked region) using a text prompt. Sent as multipart/form-data.

POST/v1/images/edits
FieldTypeDescription
imagerequiredfilePNG to edit. Square images recommended.
promptrequiredstringWhat the edited image should look like.
maskfileOptional PNG mask: transparent pixels = areas to edit.
modelstringImage-edit-capable model.
nintegerNumber of variations.
curl https://api.priyo.ai/v1/images/edits \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -F model="gpt-image-1" \
  -F image="@photo.png" \
  -F mask="@mask.png" \
  -F prompt="Add a rickshaw in the background"

Messages (Anthropic format)

Anthropic-compatible

For Claude models, use the native Anthropic Messages format. Drop-in compatible with the official anthropic Python and Node SDKs.

POST/v1/messages
FieldTypeDescription
modelrequiredstringAnthropic model ID, e.g. claude-sonnet-4-6.
messagesrequiredarrayUser/assistant turns. Tool-use blocks supported.
max_tokensrequiredintegerMaximum tokens to generate. Anthropic requires this.
systemstring | arrayTop-level system prompt (separate from messages).
streambooleanStream blocks as Server-Sent Events.
curl https://api.priyo.ai/v1/messages \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Summarise Bangla literature in 3 lines."}
    ]
  }'

Responses

OpenAI Responses API

The newer OpenAI Responses API for stateful, agent-style conversations with built-in tool execution and reasoning. Use it with the latest OpenAI SDK.

POST/v1/responses
FieldTypeDescription
modelrequiredstringResponses-capable model ID.
inputrequiredstring | arrayPrompt string or structured input items.
instructionsstringTop-level system instructions.
toolsarrayFunction/tool definitions.
streambooleanStream the response as events.
curl https://api.priyo.ai/v1/responses \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "input": "Plan a 3-day Dhaka food tour."
  }'

Rerank

Reorder a set of documents by relevance to a query. Useful as the second stage of a retrieval pipeline.

POST/v1/rerank
FieldTypeDescription
modelrequiredstringRerank model ID.
queryrequiredstringThe search query.
documentsrequiredarrayText snippets to score.
top_nintegerReturn only the top N. Defaults to all.
curl https://api.priyo.ai/v1/rerank \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "rerank-english-v3.0",
    "query": "best mango variety in Bangladesh",
    "documents": [
      "Himsagar is sweet and aromatic.",
      "The Padma river flows through Bangladesh.",
      "Langra mangoes ripen in early summer."
    ],
    "top_n": 2
  }'
Example response
{
  "id": "rerank-abc123",
  "model": "rerank-english-v3.0",
  "results": [
    { "index": 0, "relevance_score": 0.91 },
    { "index": 2, "relevance_score": 0.78 }
  ]
}

Files

Upload files for batch jobs or other workflows that take a file ID as input.

POST/v1/files
GET/v1/files
GET/v1/files/{file_id}
GET/v1/files/{file_id}/content
DELETE/v1/files/{file_id}
FieldTypeDescription
filerequiredfileUploaded file contents (multipart).
purposerequiredstringWhat the file is for, e.g. batch.
curl https://api.priyo.ai/v1/files \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -F purpose="batch" \
  -F file="@batch_input.jsonl"

Batches

Submit a JSONL file of requests and pick up the results asynchronously — useful for large offline jobs at lower cost.

POST/v1/batches
GET/v1/batches
GET/v1/batches/{batch_id}
POST/v1/batches/{batch_id}/cancel
FieldTypeDescription
input_file_idrequiredstringID of a JSONL file uploaded with purpose=batch.
endpointrequiredstringEndpoint the batch targets, e.g. /v1/chat/completions.
completion_windowrequiredstringCurrently only "24h" is supported.
metadataobjectArbitrary key-value labels to attach.
curl https://api.priyo.ai/v1/batches \
  -H "Authorization: Bearer $PRIYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_file_id": "file_abc123",
    "endpoint": "/v1/chat/completions",
    "completion_window": "24h"
  }'

Errors

Errors follow the OpenAI shape — your existing error handling works unchanged.

Example response
{
  "error": {
    "message": "Invalid API key provided.",
    "type": "invalid_request_error",
    "code": "invalid_api_key"
  }
}
StatusMeaningWhat to do
400Bad request — invalid params or body.Check the request shape against this page.
401Missing or invalid API key.Confirm the Authorization header and that the key is still active.
403Key is valid but lacks access to the model.Pick a model your tier can call.
404Unknown model or endpoint.List models via /v1/models to verify the ID.
429Rate or quota limit hit.Back off and retry with exponential delay.
500Upstream provider failure.Retry; if it persists, ping the community.

Need help? Reach out via the builder community.