The error, verbatim
Jump to the fix ↓TypeError: Responses.create() got an unexpected keyword argument 'max_tokens'
Tested on
- openai (Python)
- 3.37.0 (Responses); 1.40.0, 1.55.2, 1.55.3 (proxies)
- anthropic (Python)
- 0.39.0, 0.40.0
- httpx / httpx2
- 0.27.2, 0.28.1 / 2.16.0
- API
- POST /v1/responses, gpt-5.5 and gpt-4.1-mini
- Python
- 3.14.5
- OS
- Windows 11 Pro
Contents
You moved a call from client.chat.completions.create() to client.responses.create() and kept the old arguments. The Responses API renamed most of them, moved some into nested objects and dropped a few, and the Python SDK checks names before it sends anything. So the TypeError comes from Python, and no request goes out.
From JavaScript, or through extra_body in Python, the same names do reach the API, and it answers with its own 400. I tried twelve Chat Completions arguments both ways (if your error names proxies and comes from creating the client, skip to that section):
| Argument | Python openai 3.37.0 |
API error (400) |
|---|---|---|
messages |
TypeError |
Unsupported parameter: 'messages'. In the Responses API, this parameter has moved to 'input'. |
max_tokens |
TypeError |
Unknown parameter: 'max_tokens'. |
max_completion_tokens |
TypeError |
moved to 'max_output_tokens' |
response_format |
TypeError |
moved to 'text.format' |
verbosity |
TypeError |
moved to 'text.verbosity' |
reasoning_effort |
TypeError |
moved to 'reasoning.effort' |
seed |
TypeError |
Unknown parameter: 'seed'. |
n |
TypeError |
Unknown parameter: 'n'. |
stop |
TypeError (Python 3.14 adds Did you mean ‘store’?) |
Unknown parameter: 'stop'. Did you mean 'store'? |
logprobs |
TypeError |
Unknown parameter: 'logprobs'. |
frequency_penalty, presence_penalty |
TypeError |
on gpt-5.5: is not supported with this model. |
Note what’s missing: the API’s message for max_tokens doesn’t point you to the new name, while the one for max_completion_tokens does.
The renames
| Chat Completions | Responses API |
|---|---|
messages=[...] |
input=[...] (same list of role/content dicts) |
max_tokens=500 or max_completion_tokens=500 |
max_output_tokens=500 |
response_format={"type": "json_object"} |
text={"format": {"type": "json_object"}} |
verbosity="low" |
text={"verbosity": "low"} |
reasoning_effort="low" |
reasoning={"effort": "low"} |
logprobs=True, top_logprobs=2 |
top_logprobs=2, include=["message.output_text.logprobs"] |
A converted call:
response = client.responses.create(
model="gpt-5.5",
input=[{"role": "user", "content": "Hello"}],
max_output_tokens=500,
)
print(response.output_text)If text needs both a format and a verbosity, put both keys in the one dict. text={"format": {"type": "json_object"}, "verbosity": "low"} passed the checks.
Two checks that move with the rename
Both came back as 400s once the names were right:
max_output_tokenshas a floor.max_output_tokens=5returnedInvalid 'max_output_tokens': integer below minimum value. Expected a value >= 16, but got 5 instead.The samemax_tokens=5on Chat Completions got past its checks.- JSON mode still wants the word “json”.
text={"format": {"type": "json_object"}}with the input"hi"returnedResponse input messages must contain the word 'json' in some form to use 'text.format' of type 'json_object'.
For a JSON schema, the shape changed too. The schema sits directly in format, next to a name. Without the name: Missing required parameter: 'text.format.name'. With it, the schema itself was checked as strict, and two more 400s came back:
Invalid schema for response_format 'answer': In context=(), 'additionalProperties' is required to be supplied and to be false.
Invalid schema for response_format 'answer': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'a'.
text={"format": {
"type": "json_schema",
"name": "answer",
"schema": {
"type": "object",
"properties": {"a": {"type": "string"}},
"required": ["a"],
"additionalProperties": False,
},
}}seed, n and stop have no replacement
The Responses API has no seed, no n and no stop. All three failed the same way on gpt-4.1-mini, so it isn’t a model limit.
n: send the request several times, in parallel if you need speed.stop: cut the text yourself after it arrives, or ask for the shape you need in the prompt or a JSON schema.seed: there’s nothing to send. If you depended on repeatable output, keep that call on Chat Completions: there,seedon gpt-4.1-mini got past the checks.
frequency_penalty and presence_penalty depend on the model
These two aren’t in the Python SDK’s responses.create(), so Python raises the TypeError for every model. At the API, they’re a model question: gpt-5.5 rejected both with Unsupported parameter: 'frequency_penalty' is not supported with this model., while on gpt-4.1-mini the same request got past validation. temperature behaved like this too: 'temperature' is not supported with this model. on gpt-5.5.
On a model that still accepts them, send them through extra_body:
client.responses.create(model="gpt-4.1-mini", input="Hello", extra_body={"frequency_penalty": 0.5})Client.__init__() got an unexpected keyword argument 'proxies'
TypeError: Client.__init__() got an unexpected keyword argument 'proxies'
This one has nothing to do with responses.create(). httpx 0.28 removed the proxies argument, and anything that still passes it to httpx.Client() fails before a single request goes out. Older Pythons print the shorter __init__() got an unexpected keyword argument 'proxies'. Since 3.10, Python names the class, so you see Client.__init__().
The traceback tells you who passed proxies:
| Last lines of the traceback | Who passed proxies |
|---|---|
inside openai/_base_client.py or anthropic/_base_client.py, from OpenAI() / Anthropic() |
an old SDK, with your own code doing nothing wrong |
your own file, calling httpx.Client(...) or httpx.post(...) |
your code |
From OpenAI() or Anthropic()
A plain client = openai.OpenAI() was enough to raise it. Old SDK versions built their internal httpx.Client with proxies=, and pip happily installed the newest httpx next to them:
openai.OpenAI() with |
httpx 0.27.2 | httpx 0.28.1 |
|---|---|---|
| openai 1.40.0 | not tested | TypeError |
| openai 1.55.2 | worked | TypeError |
| openai 1.55.3 | not tested | worked |
| openai 3.37.0 | not tested | worked |
anthropic.Anthropic() behaved the same way: 0.39.0 raised the TypeError with httpx 0.28.1, and 0.40.0 worked.
Upgrade the SDK:
pip install -U "openai>=1.55.3"
pip install -U "anthropic>=0.40.0"If you can’t upgrade the SDK yet, hand it a client you built yourself. It then skips building its own, along with the bad argument:
import httpx, openai
client = openai.OpenAI(http_client=httpx.Client())Pinning httpx<0.28 also made 1.55.2 work again. That’s the least good option: it holds back every other package that wants a newer httpx.
openai.OpenAI(proxies=...) was never an argument of the client itself. It failed on every version I tried, and 3.37.0 adds Did you mean ‘provider’?, which isn’t what you want either. The proxy goes on the HTTP client, as below.
From your own httpx code
Here, the argument is yours. httpx.Client(proxies=...) and httpx.post(url, proxies=...) both raised the TypeError on 0.28.1, and both worked on 0.27.2.
Use proxy, singular, for one proxy for everything:
client = httpx.Client(proxy="http://127.0.0.1:8080")If you had a dict of different proxies per scheme, each one becomes a transport under mounts:
client = httpx.Client(mounts={
"http://": httpx.HTTPTransport(proxy="http://127.0.0.1:8080"),
"https://": httpx.HTTPTransport(proxy="http://127.0.0.1:8081"),
})A proxy for the OpenAI client
Give the proxy to the HTTP client and the HTTP client to OpenAI. DefaultHttpxClient keeps the SDK’s own timeouts and connection limits:
client = openai.OpenAI(http_client=openai.DefaultHttpxClient(proxy="http://127.0.0.1:8080"))That request reached my proxy on 1.40.0, 1.55.2, 1.55.3 and 3.37.0. DefaultHttpxClient(proxies=...) raised the same TypeError on all of them except 1.55.2 with httpx 0.27.2.
Current SDKs use httpx2, not httpx
openai 3.37.0 and anthropic 2.1.0 don’t depend on httpx anymore. Both require httpx2 (2.16.0 here), so pip install openai in a fresh venv doesn’t install httpx at all. Two things follow:
httpx2.Client(proxies=...)raised the sameTypeError.proxy=andmounts=worked as above.- If you
import httpxin your own code, install it yourself. Passing a plainhttpx.Client(proxy=...)toopenai.OpenAI(http_client=...)still worked on 3.37.0, with httpx 0.28.1 installed next to httpx2.
These proxies tests ran on Windows 11 Pro, Python 3.14.5, October 23, 2026. Each combination of SDK and httpx ran in its own venv. The script built the clients, then sent requests through a local HTTP server acting as the proxy, which recorded every request that reached it. No real API calls were made. That test script is public too.
How this was tested
Windows 11 Pro, Python 3.14.5, openai 3.37.0, October 23, 2026. Each argument was passed to client.responses.create() against a local server that recorded the request body. The same JSON bodies were then sent with curl to https://api.openai.com/v1/responses with a key that has no credits: the API checks parameters before credits, so wrong parameters came back as 400s and valid requests as credit_balance_exhausted. No response text was generated. The test script is public.
— N.K., end of entry No.088