Create account
For businesses and self-employed professionals only

Menu

All guides

From xAI to FlowModels.

The xAI API follows the OpenAI format. You swap the base URL and the key and put xai/ in front of the model.

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
Base URL https://api.x.ai/v1 https://api.flowmodels.one/v1
Key XAI_API_KEY FLOWMODELS_API_KEY
Model name grok-4.7 xai/grok-4.7

The code before and after

  client = OpenAI(
-     base_url="https://api.x.ai/v1",
-     api_key=os.environ["XAI_API_KEY"],
+     base_url="https://api.flowmodels.one/v1",
+     api_key=os.environ["FLOWMODELS_API_KEY"],
  )
  
  response = client.chat.completions.create(
-     model="grok-4.7",
+     model="xai/grok-4.7",
      messages=[{"role": "user", "content": "Hello!"}],
  )

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
web_search On models that support it, you turn on web search with web_search: true. On xAI, search_domain_filter takes up to five domains.
reasoning_effort Only on models with reasoning. The levels are listed under capabilities.reasoning_levels; any other level results in 400 unsupported_for_model.
response_format json_object and json_schema, depending on what the model supports. Otherwise you get 400 unsupported_for_model.
tools, tool_choice Type function only. FlowModels does not run your functions; the model reports tool_calls.

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.
  • Plan for extra cost with web search: every search is billed additionally.

Create a key, name a model, start building.

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