Skip to content

Messages and Responses

Besides the OpenAI format, RevidAPI accepts two more protocols on the same API key.

POST /v1/messages — Anthropic format

For the anthropic SDK and anything written against Anthropic Messages.

import anthropic

client = anthropic.Anthropic(
    api_key="sk_YOUR_KEY",
    base_url="https://revidapi.com",
)

r = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=1024,
    system="Answer briefly.",
    messages=[{"role": "user", "content": "Hello"}],
)
print(r.content[0].text)

Differences from the OpenAI format:

  • system is its own parameter, not a message.
  • max_tokens is required. Omitting it is rejected — that is the Anthropic protocol's own rule, not ours.
  • content may be a block array (text, image, tool_use, tool_result).

POST /v1/responses — OpenAI Responses format

For Codex CLI, the OpenAI Agents SDK and other Responses-based tools.

Requests are proxied straight through, not translated via Chat Completions. Translating drops tool calls, and an agent that cannot call tools cannot read files or run commands — it is simply broken.

curl https://revidapi.com/v1/responses \
  -H "Authorization: Bearer sk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-astra",
    "input": "Write a Python function that reverses a string."
  }'

Parameters are preserved: tools, tool_choice, reasoning, stream, max_output_tokens, temperature, top_p, parallel_tool_calls.

Which protocol

You are using Call
OpenAI SDK, LangChain, LlamaIndex, n8n, Dify /v1/chat/completions
Anthropic SDK, Claude Code /v1/messages
Codex CLI, OpenAI Agents SDK /v1/responses

All three bill identically, per models.