Skip to main content

Responses API and Anthropic Messages API

Level: Intermediate · Category: API reference

Tags: OpenAI Responses · Anthropic Messages · Claude-compatible clients

Besides Chat Completions, the LLM API accepts two other request shapes, so tools written for them work with the RC models: OpenAI's Responses API (POST /v1/responses) and Anthropic's Messages API (POST /v1/messages). Both are translated to chat completions, so every chat model is available through them, with the same queuing and limits. Keys and setup are on LLM API Access.

OpenAI Responses API​

from openai import OpenAI

client = OpenAI() # reads OPENAI_API_KEY and OPENAI_BASE_URL
response = client.responses.create(
model="gemma4-31b-it",
instructions="Answer in one sentence.",
input="What does sbatch do?",
)
print(response.output_text)

What is supported:

  • input as a string or a list of messages; instructions; max_output_tokens; temperature; function tools and their function_call / function_call_output items; images as input_image parts.
  • reasoning: {"effort": "none" | "low" | "medium" | "high"}, with the same effect as reasoning_effort on chat.
  • Streaming (stream: true) with the standard events: response.created, response.output_text.delta, response.reasoning_text.delta, response.completed, and response.failed if the model fails mid-reply. Function calls arrive whole at the end, not as argument deltas.

What is not:

  • No stored conversations. store: true, previous_response_id and background: true return 400: send the whole conversation in input on every request.
  • No hosted tools. OpenAI-hosted tools such as web_search and file_search are dropped; use function tools, or a model with the web search add-on.
  • For JSON-schema output, use Chat Completions with response_format.

Anthropic Messages API​

The anthropic SDK works with the base URL without /v1 (the SDK adds /v1/messages) and your RC key:

import os
import anthropic

client = anthropic.Anthropic(base_url="https://openai.rc.asu.edu", api_key=os.environ["OPENAI_API_KEY"])
message = client.messages.create(
model="gemma4-31b-it",
max_tokens=1024,
messages=[{"role": "user", "content": "What does sbatch do? One sentence."}],
)
print(message.content[0].text)
  • The key can be sent as x-api-key (what the SDK does) or Authorization: Bearer.
  • system, tools and tool_choice, tool_use/tool_result blocks, images, stop_sequences and streaming work. Errors use Anthropic's error shape ({"type": "error", "error": {...}}).
  • Thinking: thinking: {"type": "disabled"} is effort none; {"type": "enabled", "budget_tokens": N} is low below 4,096 tokens, medium below 16,384, and high otherwise. Thinking comes back as thinking content blocks.
  • POST /v1/messages/count_tokens returns an estimate of the prompt's tokens.
  • Not supported: prompt caching controls (cache_control is ignored; the models cache prompt prefixes on their own), server tools such as Anthropic's web search, and images inside tool_result blocks (dropped).

Claude-compatible tools​

Tools that speak the Messages API and let you set the base URL, such as Claude Code, can use the RC models. Point them at https://openai.rc.asu.edu (no /v1) with your RC key. For Claude Code:

export ANTHROPIC_BASE_URL="https://openai.rc.asu.edu"
export ANTHROPIC_AUTH_TOKEN="$OPENAI_API_KEY" # your RC key
export ANTHROPIC_MODEL="glm-5-3" # an RC chat model ID

Requests naming a Claude model the gateway doesn't have (such as claude-sonnet-4-5) are answered by a default RC model instead of failing; the reply still reports the name you sent. Set the model explicitly so you know which model you're using. These tools are tuned for Claude models, so expect differences in tool use and long agent runs; OpenCode is set up for the RC models and is the recommended coding assistant.