Built from the official docs: openrouter.ai · ERNIE-5.5-Flash-Preview (free) - API Pricing & Providers · checked 20 November 2026
Through OpenRouter
Get an OpenRouter API key
Create an OpenRouter account and generate an API key at https://openrouter.ai, then keep it as <OPENROUTER_API_KEY>. Requests authenticate with an Authorization: Bearer header.
Choose how to call it
OpenRouter's API is OpenAI-compatible, so most SDKs work by swapping the base URL; the only thing that changes per model is the model slug. The slug for this model is baidu/ernie-5.5-flash-preview:free.
Call it with curl
Send a POST to the responses endpoint with your key and the model slug. Set OPENROUTER_API_KEY in your environment first.
curl https://openrouter.ai/api/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ -d '{ "model": "baidu/ernie-5.5-flash-preview:free", "input": "What is the meaning of life?" }'Or use the OpenAI SDK (Python)
Point the OpenAI SDK at OpenRouter's base URL as a drop-in replacement and pass the model slug. Install with pip install openai.
from openai import OpenAI client = OpenAI( base_url="https://openrouter.ai/api/v1", api_key="<OPENROUTER_API_KEY>", ) response = client.responses.create( model="baidu/ernie-5.5-flash-preview:free", input="What is the meaning of life?" ) print(response.output_text)Or use the OpenAI SDK (TypeScript)
The same drop-in approach works in TypeScript by setting baseURL to OpenRouter and reading output_text from the response.
import OpenAI from 'openai'; const openai = new OpenAI({ baseURL: 'https://openrouter.ai/api/v1', apiKey: '<OPENROUTER_API_KEY>', }); async function main() { const response = await openai.responses.create({ model: 'baidu/ernie-5.5-flash-preview:free', input: 'What is the meaning of life?', }); console.log(response.output_text); } main();
Check it worked
You get a JSON response with status "completed" and an output message containing output_text; with the SDK examples, response.output_text prints the model's reply.