Sage Inference API Reference

Complete API reference for all Sage Inference endpoints. Base URL: https://sage-api.devblocktechnologies.com

Live API Playground

Test Sage Inference API endpoints directly from your browser. Enter your API key, customize the request, and see live responses.

Request

Response

Send a request to see the response here

Authentication

All API requests require authentication via Bearer token. Include your API key in the Authorization header of every request.

Authorization: Bearer sk-sage-your-api-key

API keys start with sk-sage- and can be created and managed through the DevBlock Console.

Available Models

Model IDDescriptionCost
deepseek-v4-flashFast chat0.0004 credits/token
deepseek-v4-proAdvanced reasoning/coding0.002 credits/token
deepseek-reasonerDeep reasoning0.002 credits/token
claude-sonnet-4-20250514Anthropic's most balanced0.006 credits/token
claude-haiku-3.5Fast Claude0.002 credits/token
o3-miniOpenAI reasoning0.004 credits/token
gpt-4oOpenAI multimodal flagship0.01 credits/token
gpt-4o-miniLightweight OpenAI0.0008 credits/token

Quality Modes

ModeDescription
autoAutomatically selects quality based on model and task
lowFaster response, lower quality (suitable for simple tasks)
highHigher quality, slower response (complex reasoning)
ultraMaximum quality, uses multi-pass refinement

Endpoints

GET/v1/models

List all available models and their capabilities.

Response Format

{
  "object": "list",
  "data": [
    {
      "id": "deepseek-v4-flash",
      "object": "model",
      "created": 1700000000,
      "owned_by": "devblock"
    }
  ]
}

Example Request

curl https://sage-api.devblocktechnologies.com/v1/models \
  -H "Authorization: Bearer sk-sage-your-api-key"
POST/v1/chat/completions

Create a chat completion. Supports streaming, vision, and multi-modal inputs.

Request Parameters

ParameterTypeRequiredDescription
modelstringRequiredModel ID to use
messagesarrayRequiredArray of message objects
max_tokensintegerOptionalMaximum tokens (default: 256)
temperaturenumberOptionalSampling temperature 0-2 (default: 1.0)
streambooleanOptionalEnable SSE streaming (default: false)

Response Format

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1700000000,
  "model": "deepseek-v4-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! I'm doing well, thank you!"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 25,
    "total_tokens": 35
  }
}

Example Request

curl https://sage-api.devblocktechnologies.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-sage-your-api-key" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is the capital of France?"}
    ],
    "temperature": 0.7,
    "max_tokens": 256
  }'
POST/v1/images/generations

Generate images from text descriptions.

Request Parameters

ParameterTypeRequiredDescription
modelstringRequiredModel ID to use
promptstringRequiredText description of the image
nintegerOptionalNumber of images (default: 1)
sizestringOptionalImage size (e.g. 1024x1024)

Response Format

{
  "created": 1700000000,
  "data": [
    {
      "url": "https://sage-api.devblocktechnologies.com/v1/images/abc123.png"
    }
  ]
}

Example Request

curl https://sage-api.devblocktechnologies.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-sage-your-api-key" \
  -d '{
    "model": "deepseek-v4-flash",
    "prompt": "A serene mountain landscape at sunset",
    "n": 1,
    "size": "1024x1024"
  }'
POST/v1/audio/transcriptions

Transcribe audio files to text using speech-to-text models.

Request Parameters

ParameterTypeRequiredDescription
modelstringRequiredModel ID to use
filefileRequiredAudio file to transcribe
languagestringOptionalLanguage code (optional)

Response Format

{
  "text": "The transcript of the audio file."
}

Example Request

curl https://sage-api.devblocktechnologies.com/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-sage-your-api-key" \
  -F "model=deepseek-v4-flash" \
  -F "file=@audio.mp3"
POST/v1/audio/speech

Generate speech from text using text-to-speech models.

Request Parameters

ParameterTypeRequiredDescription
modelstringRequiredModel ID to use
inputstringRequiredText to convert to speech
voicestringOptionalVoice ID (default: alloy)

Response Format

Binary audio data (MP3 format)

Example Request

curl https://sage-api.devblocktechnologies.com/v1/audio/speech \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-sage-your-api-key" \
  -d '{
    "model": "deepseek-v4-flash",
    "input": "Hello, welcome to DevBlock Sage Inference.",
    "voice": "alloy"
  }' \
  --output speech.mp3

SDK Examples (Python)

Sage Inference is fully compatible with the OpenAI Python SDK. Simply point the base URL to our endpoint.

from openai import OpenAI

client = OpenAI(
    base_url="https://sage-api.devblocktechnologies.com/v1",
    api_key="sk-sage-your-api-key"
)

response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the capital of France?"}
    ],
    temperature=0.7,
    max_tokens=256
)

print(response.choices[0].message.content)

Error Codes

CodeDescription
400Bad Request - Invalid request parameters
401Unauthorized - Missing or invalid API key
402Payment Required - Insufficient credits
404Not Found - Invalid endpoint or model
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server-side issue

Interactive Examples

Copy these curl commands to test the API directly from your terminal.

List Models

curl https://sage-api.devblocktechnologies.com/v1/models \
  -H "Authorization: Bearer sk-sage-your-api-key"

Chat Completion (Streaming)

curl https://sage-api.devblocktechnologies.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-sage-your-api-key" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Tell me a joke"}],
    "stream": true
  }'

Chat Completion (Non-Streaming)

curl https://sage-api.devblocktechnologies.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-sage-your-api-key" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {"role": "user", "content": "Write a poem about AI"}
    ],
    "temperature": 0.8,
    "max_tokens": 500
  }'