From Anthropic
Moving an Anthropic Messages integration onto an OpenAI-shaped API.
This one is not a one-line change
Eterial serves no Anthropic-compatible endpoint. There is no /v1/messages,
and the anthropic SDK cannot be pointed at Eterial by changing a base URL.
Moving over means rewriting the calls against the OpenAI protocol.
The good news is that the OpenAI shape is the one every other provider also speaks, so this is a rewrite you only do once.
Swap the SDK
# pip install openai
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ETERIAL_API_KEY"],
base_url="https://chat.eterial.ai/v1",
)Authentication changes with it: x-api-key and anthropic-version are replaced
by a single Authorization: Bearer header.
The shape differences that actually bite
| Anthropic | OpenAI / Eterial |
|---|---|
system as a top-level field | a {"role": "system"} message, first in messages |
max_tokens required | max_tokens optional |
content as a list of blocks | content as a plain string, or a list of parts |
stop_reason: "end_turn" | finish_reason: "stop" |
stop_reason: "max_tokens" | finish_reason: "length" |
usage.input_tokens / output_tokens | usage.prompt_tokens / completion_tokens |
response content[0].text | choices[0].message.content |
A request, before and after
message = client.messages.create(
model="claude-...",
max_tokens=1024,
system="You are terse.",
messages=[{"role": "user", "content": "Hi! How are you doing today?"}],
)
print(message.content[0].text)Tool calling is the biggest rewrite
Anthropic defines a tool with input_schema and returns a tool_use content
block, which you answer with a tool_result block inside a user message. The
OpenAI protocol defines a tool with function.parameters, returns
message.tool_calls, and expects a separate message with role: "tool" carrying
tool_call_id.
The arguments also differ in kind: Anthropic gives you a parsed object, the OpenAI protocol gives you a JSON string you have to parse yourself. See Tool calling.
Streaming is a different event model
Anthropic emits typed events — message_start, content_block_delta,
message_delta, message_stop. The OpenAI protocol emits one chunk shape
carrying choices[].delta, terminated by [DONE]. If you wrote an event-type
switch, it goes away. See Streaming.
Which model to reach for
There is no Claude here, and no drop-in equivalent to claim there is. Start with
minimax-m2.7 for general work, kimi-k2.6 for simple coding tasks, and
deepseek-v4-flash where the volume is high and the work is simple, then compare
on your own traffic — the catalogue lists what is available and
what each model can do.