Opennan

Chat API

Live

Chat models behind one OpenAI-compatible endpoint. Swap the base URL and keep your code.

From $0.039 in / $0.182 out per 1M tokens across 14 modelsCheapestgpt-oss-20b
from $0.039/1M tokens

Output

Ready
Example output
Explain in two short sentences why the sky is blue.

gpt-oss-20b

The air in the atmosphere scatters sunlight, and Rayleigh scattering is far more efficient at bending short‑wavelength (blue) light than longer wavelengths. As a result, the blue component is scattered in all directions, filling the sky with a blue hue.

Or start with

Enter to send · Shift + Enter for a new line

max 1,024 tokens out

Compare Chat API models

Every model behind this endpoint, with live prices. Try one in the playground or open its page.

  • gpt-oss-20bOpenAI$0.039 in / $0.182 out per 1M tokens
    Cheapest
    Page
  • gpt-oss-120bOpenAI$0.0481 in / $0.221 out per 1M tokens
    Page
  • DeepSeek V4 FlashDeepSeek$0.078 in / $0.234 out per 1M tokens
    Page
  • DeepSeek V4.1 FlashDeepSeek$0.102 in / $0.3058 out per 1M tokens
    Same as the maker's price
    Page
  • Nemotron 3 SuperNVIDIA$0.1105 in / $0.52 out per 1M tokens
    Page
  • Qwen3 235B A22B Instruct 2507Alibaba (Qwen)$0.117 in / $0.715 out per 1M tokens
    Page
  • Llama 3.3 70BMeta$0.13 in / $0.416 out per 1M tokens
    Page
  • Llama 4 ScoutMeta$0.13 in / $0.39 out per 1M tokens
    Page
  • Qwen3.6 35B A3BAlibaba (Qwen)$0.13 in / $1.235 out per 1M tokens
    $0.248 in / $1.485 out per 1M tokens-16%
    Page
  • Nemotron 3.5 Super VLNVIDIA$0.195 in / $0.65 out per 1M tokens
    Page
  • Qwen3.8 27BAlibaba (Qwen)$0.195 in / $2.438 out per 1M tokens
    Below the maker's price
    Page
  • Gemma 4 31BGoogle$0.26 in / $0.52 out per 1M tokens
    Page
  • DeepSeek V3.2DeepSeek$0.338 in / $0.494 out per 1M tokens
    Page
  • GLM-4.7Z.ai$0.52 in / $2.20 out per 1M tokens
    Same as the maker's price
    Page

Call Chat API from your code

One endpoint for every model above. Change the model field to switch.

POSThttps://api.opennan.com/v1/chat/completions
  • GET/v1/models?category=textEvery model of this endpoint, with prices
  1. Get an API key

    Create a key in the console. It uses the same balance as the playground.

    Create a key
  2. Send your first request

    The same request the playground sends. Set OPENNAN_KEY to your key.

    curl -N https://api.opennan.com/v1/chat/completions \
      -H "Authorization: Bearer $OPENNAN_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model":"gpt-oss-20b","messages":[{"role":"user","content":"Write a haiku about a city at night."}],"max_tokens":1024,"temperature":1,"top_p":1,"stream":true,"stream_options":{"include_usage":true}}'
  3. Read the result

    The result comes back in the same response. The X-Usage-Cost-Usd header says what the call cost.

Parameters

Built from the live catalog: every value listed here is one the API accepts.

Parameters
NameTypeAllowed valuesDefaultEffect on price
modelrequiredWhich model runs the call.string———
messagesrequiredThe conversation so far, as role and content pairs.list of messages———
max_tokensoptionalThe longest answer, in tokens.integer1–131,072—Billed per token written
temperatureoptionalHigher gives more varied answers.number———
streamoptionalSend the answer piece by piece as it is written.boolean———
toolsoptionalFunctions the model may call.list———

Errors and how to fix them

  • 401Missing or wrong key

    Send the header Authorization: Bearer with a key from the console.

  • 402Balance too low

    Add credit in Billing, then send the same call again.

  • 400A value is not accepted

    Read error.message: it names the field. Use a value from the parameter table.

  • 429Too many requests

    Wait a few seconds and try again, waiting longer after each 429.

Add Opennan to your AI app

One install gives your AI every Opennan tool: video, images, chat, voice, music, sound effects, 3D, captions and dubbing. Pick your app and follow the steps.

MCP serverhttps://api.opennan.com/v1/mcp

Works in the Codex CLI, the Codex app and the Codex IDE extension: they share ~/.codex/config.toml. If the app or IDE does not see OPENNAN_KEY, use the config.toml option with your key in it. Codex asks before each tool call: approve it to go on.

  1. Get an API key

    Create a key in the console. It starts with sk- and uses the same balance as the website.

    Create a key
  2. Save your key as OPENNAN_KEY

    # macOS / Linux (zsh shown; bash: ~/.bashrc)
    echo 'export OPENNAN_KEY="sk-..."' >> ~/.zshrc
    source ~/.zshrc
    
    # Windows (PowerShell), then open a new terminal
    setx OPENNAN_KEY "sk-..."
  3. Install the Opennan plugin: the server plus a skill that teaches your AI to pick models, confirm prices and wait for results

    codex plugin marketplace add Opennan/opennan-ai-plugin
    codex plugin add opennan@opennan
  4. Or add only the server

    codex mcp add opennan --url https://api.opennan.com/v1/mcp --bearer-token-env-var OPENNAN_KEY
  5. Or add this to ~/.codex/config.toml

    [mcp_servers.opennan]
    url = "https://api.opennan.com/v1/mcp"
    http_headers = { Authorization = "Bearer sk-..." }
  6. Check that opennan is listed

    codex mcp list
  7. Restart Codex, then ask for anything

    “Make a 5 second video of rain on a neon street, a song to go with it and a poster image.”

Replace sk-... with your own key and keep it private: anyone who has it can spend your balance. Your app can list the tools before you add a key; making anything needs one.

This tool from your AI

Once Opennan is added, your AI calls this tool with arguments like these.

Tool
chat
Example arguments
{
  "model": "gpt-oss-20b",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about a city at night."
    }
  ]
}

Chat API: questions

Every model and price
How much does Chat API cost?

From $0.039 in / $0.182 out per 1M tokens with gpt-oss-20b, the cheapest of 14 models here. You see the price before you run.

How do I call it from my code?

Send POST https://api.opennan.com/v1/chat/completions with your API key. The result comes back in the same response.

Can I switch models without changing my code?

Yes. Change the model field and keep the rest of the request, the same key and the same balance.

Can my AI agent use it?

Yes. Add the MCP server https://api.opennan.com/v1/mcp and call the chat tool, or point your agent at https://api.opennan.com/llms.txt.

What happens if a run fails?

A request that fails is not charged. You pay only for the tokens used.

We only use the cookies the site needs, such as your language and a referral code. No ads. We count page visits with cookie-free analytics. See our Cookie Policy for details.