thezakuloGet the newsletter
← All setup guides

Setup guide · 5 steps · about 10 minutes

How to start using Baidu: ERNIE-5.5-Flash-Preview (free)

ERNIE-5.5-Flash-Preview is Baidu's latest foundation model (280B total parameters, 14B activated per token, 1M-token context) for coding, agentic tasks, knowledge work, and deep research, callable for free through OpenRouter's API.

Built from the official docs: openrouter.ai · ERNIE-5.5-Flash-Preview (free) - API Pricing & Providers · checked 20 November 2026

Through OpenRouter

  1. 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.

  2. 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.

  3. 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?"
    }'
  4. 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)
  5. 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.

Try these first

Get every issue by email

One email a week with the written issue. Free, one-click unsubscribe

Subscribe