[Rspamd-Users] Neural: problem connecting to openai
Michael Durian
durian at boogie.com
Mon Jun 1 19:09:14 UTC 2026
I posted a couple messages on the rspamd discord channel, but didn’t get any response, so I thought I’d try here. I’ll start by noting I use the gpt plugin without any problems.
I’m trying to use the openai provider in the neural plug in, but I always receive 400 / invalid_request_error / "you must provide a model parameter” errors to every request.
My neural.conf contains this for the provider:
providers = [
{
type = "llm";
llm_type = "openai";
url = 'https://api.openai.com/v1/embeddings'
model = "text-embedding-3-small";
api_key = “mykey";
connect_timeout = 1s;
ssl_timeout = 1s;
write_timeout = 1s;
read_timeout = 4s;
}
];
I’ve added additional logging to lualib/plugins/neural/providers/llm.lua to better track what’s going on. When I look at the body of the http request, I see something like:
{"input":"Subject: This is a test\nThis is to test rspamd.","model":"text-embedding-3-small"}
So I know the model is being provided, contrary to what the error message says. For comparison, I made the same request using curl
curl https://api.openai.com/v1/embeddings -H "Content-Type: application/json" -H "Authorization: Bearer mykey" -d '{"input":"Subject: This is a test\nThis is to test rspamd.","model":"text-embedding-3-small"}’
The curl request was successful, so I don’t think my problem is with my key nor a configuration problem on the openai.com side of things.
Initially, I did not have the timeout values specified in the openai provider configuration, but when I checked the values passed in http_params, they were all 0. A tcpdump showed what appeared to be packet retransmits (it was over HTTPS, so I’m not 100% certain), so I added the timeout values. It did not fix the problem, though the retransmits went away.
I further experimented by changing the https request into an http request so I could examine the actual packet contents. I compared to the curl test and they were basically the same (after disabling gzip compression). The User-Agent was different and the header values appeared in a different order, but otherwise they were pretty much the same.
Since the request works with curl and the request contents appear to be the same, it seems like the problem might be at a lower level - how the request is issued as opposed to the request contents.
As I mentioned, the gpt plugin works for me, so I compared the gpt code to the neural code. On notable difference is that gpt supplies an upstream parameter in http_params, whereas neural does not. I made an effort to reproduce the upstream code in llm.lua. I’m not familiar with lua nor the purpose of the upstream parameter and must have had some implementation error. My code didn’t run and I couldn’t find my error.
While digging around, I also noticed that both gpt and neural pass three parameters to ucl.to_format(). I might have missed something, but it looks like to_format() only takes two arguments. I think it is harmless, though. GPT works and the json-compact encoded string appears to be correct.
Can anyone help me track down what is going wrong? Or even confirm that the neural openai provider is working for them?
Thanks,
mike
More information about the Users
mailing list