#Cerebras and Langchain

1 messages · Page 1 of 1 (latest)

teal quartz
#

I can use models fine with other Providers via Langchain using ChatOpenAI. When I try to switch to Cerebras as the provider, I get Error code: 404 - {'error': {'message': 'No endpoints found for qwen/qwen3-32b.', 'code': 404},

My extra_body parameter has the provider details as detailed in the OpenRouter docs.

custom_model = ChatOpenAI(
            model=model_name,
            api_key=config.openrouter_api_key,
            base_url="https://openrouter.ai/api/v1",
            temperature=base_config.get("temperature", 0.7),
            max_tokens=base_config.get("max_tokens", config.max_tokens_per_request),
            default_headers=headers,
            extra_body=extra_body
        )

Has anyone successfully done this?

odd harness
teal quartz
#

@odd harness Sure here is my extra_body variable

{'provider': {'order': ['cerebras'], 'allow_fallbacks': False, 'data_collection': 'deny'}, 'models': ['qwen/qwen3-32b']}

odd harness
teal quartz
#

@odd harness Yeah, I'm stumped. I've tried other models too, just in case it was that. Other providers work fine with the same models. I also tried a curl which poroves it is there

curl -X POST "https://openrouter.ai/api/v1/chat/completions" \
-H "Authorization: Bearer ????”
-H "Content-Type: application/json"
-H "HTTP-Referer: MyApp"
-H "X-Title: MyApp
-d '{
"model": "qwen/qwen3-32b",
"messages": [{"role": "user", "content": "Hello"}],
"provider": {
"order": ["cerebras"],
"allow_fallbacks": false,
"data_collection": "deny"
}
}'

Response:

{"id":"gen-1749588259-N0bY532vFhGcvXe9kISc","provider":"Cerebras","model":"qwen/qwen3-32b","object":"chat.completion","created":1749588259,"choices":[{"logprobs":null,"finish_reason":"stop","native_finish_reason":"stop","index":0,"message":{"role":"assistant","content":"Hello! How can I assist you today? 😊 Whether you have a question, need help with a task, or just want to chat, I'm here for you!","refusal":null,"reasoning":"\nOkay, the user just said "Hello". Let me think about how to respond.\n\nFirst, I sho.....

odd harness