Create account
For businesses and self-employed professionals only

Menu

All guides

From Anthropic to FlowModels.

FlowModels speaks the OpenAI format, so you call Claude models with the OpenAI SDK: messages, tools and response fields look different from the Anthropic SDK.

What changes

The base URL, the key and the model name. Everything else stays, as long as you do not use any of the fields in the table below.

Setting Before On FlowModels
SDK anthropic openai
Base URL https://api.anthropic.com https://api.flowmodels.one/v1
Key ANTHROPIC_API_KEY FLOWMODELS_API_KEY
Model name claude-sonnet-5-5 anthropic/claude-sonnet-5-5

The code before and after

- import anthropic
- client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
+ from openai import OpenAI
+ client = OpenAI(
+     base_url="https://api.flowmodels.one/v1",
+     api_key=os.environ["FLOWMODELS_API_KEY"],
+ )
  
- message = client.messages.create(
-     model="claude-sonnet-5-5",
-     max_tokens=1024,
-     system="Keep your answers short.",
-     messages=[{"role": "user", "content": "Hello!"}],
- )
- print(message.content[0].text)
+ response = client.chat.completions.create(
+     model="anthropic/claude-sonnet-5-5",
+     max_tokens=1024,
+     messages=[
+         {"role": "system", "content": "Keep your answers short."},
+         {"role": "user", "content": "Hello!"},
+     ],
+ )
+ print(response.choices[0].message.content)

Fields that behave differently

What the chosen model supports decides. The fields it accepts are listed under supported_parameters in GET /v1/models.

Field Behavior on FlowModels
system Becomes a message with role: "system".
max_tokens Still possible, but not required. Without a value the maximum of the model applies, and the highest possible amount is reserved before the call.
stop_sequences Is called stop here.
tools (input_schema) Is called tools[].function.parameters here, each entry with type: "function".
tool_choice auto, none, required or {"type":"function","function":{"name":"…"}}.
tool_use, tool_result Are called tool_calls on the response and role: "tool" with tool_call_id in the follow-up message.
thinking Through reasoning_effort. The levels a model knows are listed under capabilities.reasoning_levels.
response_format Anthropic models report no JSON shape. The API answers with 400 unsupported_for_model instead of quietly returning plain text.
Image blocks Content of type image becomes an image_url block, only in messages with role: "user".
Streaming Instead of content_block_delta, events arrive in chunk format, and you read the text from choices[0].delta.content.

What to check after the move

  • The new key is in FLOWMODELS_API_KEY, and GET /v1/models lists your model.
  • A call without streaming returns choices[0].message.content as expected.
  • With stream: true the events arrive; with stream_options.include_usage the usage is in the last event.
  • Tool calls and response_format work with exactly the model you use.
  • Your error handling separates 429 insufficient_quota (credit exhausted) from 429 rate_limit_exceeded, 429 concurrent_requests_exceeded and 503 provider_overloaded.
  • The request log in your dashboard shows the model, tokens and cost of the call.
  • Your code reads the response from choices[0].message.content instead of content[0].text.

Create a key, name a model, start building.

FlowModels is aimed exclusively at businesses and self-employed professionals.