Refract

API docs

Refract API docs: an OpenAI- and Anthropic-compatible API for 39 models. Base URL https://refracthub.com/v1, one key, streaming, tools and per-key spending caps.

Quick start

Create a key in your console, then call the API like OpenAI's:

curl https://refracthub.com/v1/chat/completions \
  -H "Authorization: Bearer $REFRACT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-6", "messages": [{"role": "user", "content": "Hello"}]}'

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(base_url="https://refracthub.com/v1", api_key="YOUR_REFRACT_KEY")
reply = client.chat.completions.create(model="claude-sonnet-4-6", messages=[{"role": "user", "content": "Hello"}])
print(reply.choices[0].message.content)

See every model ID on the models page.