Downsizing logodownsizing
Documentation

Inference API

Inference layer compatible with Anthropic and OpenAI SDKs. Requests are automatically compressed and routed. Stay on your provider's models, or let Downsizing swap in open-source equivalents for better performance and cost.


Overview

Point any Anthropic or OpenAI SDK at Downsizing and get automatic prompt compression, cost-optimised model routing, and full usage analytics — without changing a line of application code.

Routing behaviour, model preferences, and compression settings are all configurable in your inference settings.

Three wire formats are supported so you can point any existing SDK or tool at Downsizing without changing your payload:

  • Anthropic Messages/anthropic/v1/messages
  • OpenAI Chat Completions/openai/v1/chat/completions
  • OpenAI Responses/openai/v1/responses

Authentication

Pass your Downsizing key in the Authorization header:

Authorization: Bearer dws_YOUR_API_KEY

Your inference ID appears in the URL path. Find both values in the dashboard.

Endpoints

Anthropic Messages

Compatible with the Anthropic /v1/messages spec including streaming and tool use:

bash
curl -X POST \
  https://api.downsizing.dev/YOUR_INFERENCE_ID/anthropic/v1/messages \
  -H "Authorization: Bearer dws_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Explain tail call optimisation in three sentences." }
    ]
  }'

OpenAI Chat Completions

Compatible with the OpenAI /v1/chat/completions spec including streaming and function calling:

bash
curl -X POST \
  https://api.downsizing.dev/YOUR_INFERENCE_ID/openai/v1/chat/completions \
  -H "Authorization: Bearer dws_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      { "role": "user", "content": "Explain tail call optimisation in three sentences." }
    ]
  }'

OpenAI Responses API

Compatible with the OpenAI /v1/responses spec:

bash
curl -X POST \
  https://api.downsizing.dev/YOUR_INFERENCE_ID/openai/v1/responses \
  -H "Authorization: Bearer dws_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": [
      { "type": "message", "role": "user", "content": "Explain tail call optimisation in three sentences." }
    ]
  }'

Examples

Any tool, agent, or SDK that speaks Anthropic or OpenAI works — just change the base URL. No other code changes needed.

Anthropic SDK

python
import anthropic

client = anthropic.Anthropic(
    api_key="dws_YOUR_API_KEY",
    base_url="https://api.downsizing.dev/YOUR_INFERENCE_ID/anthropic",
)

message = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain tail call optimisation in three sentences."}],
)
print(message.content[0].text)

OpenAI SDK

python
import openai

client = openai.OpenAI(
    api_key="dws_YOUR_API_KEY",
    base_url="https://api.downsizing.dev/YOUR_INFERENCE_ID/openai/v1",
)

completion = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Explain tail call optimisation in three sentences."}],
)
print(completion.choices[0].message.content)

Spot an error or something not working? Tell us on Discord or email docs@downsizing.dev.