Skip to contentOceanToken

6 min read

Qwen3.8 API: OpenAI-Compatible Base URL

The Qwen3.8 API on an OpenAI-compatible base URL: model ids for Max, Max Prime, Flash, 27B and Omni Flash, a minimal request, streaming, and what to change.

By OceanToken Team

Qwen3.8 API: OpenAI-Compatible Base URL

Editor's note: Pointing an OpenAI client at Qwen3.8 is the easy part. The part that bites is switching between the five Qwen3.8 models later, because they do not all take the same parameters, and a parameter a model does not take is dropped without an error. Keep the model id in config, and check the response, not the request, to see what actually happened.

Short answer: To call the Qwen3.8 API through an OpenAI-compatible base URL, set base_url to https://api.oceantoken.ai/v1, use your API key, and send POST /v1/chat/completions with one of these model ids: qwen/qwen3.8-max, qwen/qwen3.8-max-prime, qwen/qwen3.8-flash, qwen/qwen3.8-27b or qwen/qwen3.8-omni-flash. Streaming works with stream: true.

01 · Qwen3.8 API: OpenAI-compatible base URL and model ids

Every Qwen3.8 model answers on the same OpenAI-compatible base URL, https://api.oceantoken.ai/v1, at POST /v1/chat/completions. What differs is the model id, the inputs each one takes and how long an answer it can write. From the model pages, checked November 17, 2026:

Model Model id Input Context Max output per reply Good for (model page)
Qwen3.8 Max qwen/qwen3.8-max (qwen/qwen3.8-max-0902 also works) Text, image, video 984K 131K Document and codebase analysis, visual understanding, agent workflows
Qwen3.8 Max Prime qwen/qwen3.8-max-prime Text, image, video 984K 131K A higher-throughput variant of Qwen3.8 Max
Qwen3.8 Flash qwen/qwen3.8-flash Text, image, video 984K 131K Coding assistance, chart analysis, video understanding
Qwen3.8 27B qwen/qwen3.8-27b Text, image, video 1.02M 236K An open-weight dense vision-language model
Qwen3.8 Omni Flash qwen/qwen3.8-omni-flash Text, image, audio, video 984K 131K Agentic work with native audio-video understanding

All five output text, and all five list tool calling (tool_choice) and structured outputs (response_format) on their pages.

One detail in the first row trips people up. The Max page's address ends in qwen3.8-max-0902, but the id shown on the page is qwen/qwen3.8-max, with the dated id also accepted. Pick one, put it in config, and do not mix the two across services, or your logs will show two models where you meant one. To see exactly which ids your key can call, GET /v1/models returns the list.

02 · A minimal Qwen3.8 request

Diagram: Which Qwen3.8 model id to start with

With curl, the request is the standard chat completion body:

curl https://api.oceantoken.ai/v1/chat/completions \
  -H "Authorization: Bearer $OCEANTOKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen/qwen3.8-flash", "messages": [{"role": "user", "content": "Write a haiku about the ocean."}]}'

With the OpenAI Python SDK, only the base URL, the key and the model change from code you may already have:

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.oceantoken.ai/v1", api_key=os.environ["OCEANTOKEN_API_KEY"])

reply = client.chat.completions.create(
    model=os.getenv("QWEN_MODEL", "qwen/qwen3.8-max"),
    messages=[{"role": "user", "content": "Summarize the trade-offs of a monorepo in three sentences."}],
)
print(reply.choices[0].message.content)
print(reply.usage)

The base URL must end in /v1 for OpenAI SDKs. The quickstart notes that the Anthropic SDK is the exception: it adds /v1 itself, so it takes https://api.oceantoken.ai. If you see 404s on your first call, the path is the first thing to check.

03 · Streaming

For anything a person waits on, stream. Tokens arrive as they are written. The Limits page  says a synchronous request is held open for at most 240 seconds and then returns 504 timeout, while a stream stays open as long as tokens keep flowing.

stream = client.chat.completions.create(
    model="qwen/qwen3.8-flash",
    messages=[{"role": "user", "content": "Count from one to five, one number per line."}],
    stream=True,
    stream_options={"include_usage": True},
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    if chunk.usage:
        print("\n", chunk.usage)

stream_options={"include_usage": True} adds a final event with the token counts, which is how you log the cost of a streamed call. The stream ends with data: [DONE].

04 · What to change when you switch Qwen3.8 models

Changing the model id is usually the only edit. These are the cases where it is not:

If you move to Check Why
qwen/qwen3.8-27b max_tokens It can write up to 236K tokens per reply; the other four stop at 131K
qwen/qwen3.8-omni-flash Audio parts in messages It is the only Qwen3.8 model here that lists audio input
Any model, from another Your reasoning parameter All five list reasoning; Max, Max Prime and 27B name reasoning_effort as the control, Flash and Omni Flash do not
Any model Parameters it does not take They are left out before the request reaches the model, with no error

The last two rows are the real trap. Flash and Omni Flash do reason; their pages simply do not name reasoning_effort as the control, so check our Qwen thinking mode guide for how to turn thinking on there. If you tune reasoning_effort on Qwen3.8 Max and move the same code to Flash, the request still succeeds. Whether the setting did anything is a separate question.

The API reference  says a parameter the model does not support is dropped without an error, and that the x-oceantoken-dropped-params response header names a parameter dropped on a request even though the model supports it. An empty header does not prove your setting took effect either. So log that header, and read usage.completion_tokens_details.reasoning_tokens and choices[0].message.reasoning_content in the response to see what the model actually did, once per model you ship.

Tool calling and JSON output use the standard OpenAI fields, tools and response_format. For worked examples, see our guides to Qwen tool calling in Python and structured JSON output with Qwen.

How to test this on your workload

We have not benchmarked these five models for this article. Before you pick one, run these checks with your own prompts:

  1. Call GET /v1/models and confirm the Qwen3.8 ids you plan to use are on the list for your key.
  2. Send the same prompt to qwen/qwen3.8-max and qwen/qwen3.8-max-0902 and confirm both answer and how each shows in your logs.
  3. Send a request with your reasoning setting to each model, log the x-oceantoken-dropped-params response header, and compare reasoning_tokens in usage.
  4. Stream a long answer with include_usage and confirm the final event carries the token counts.
  5. On Omni Flash, send one audio input you actually need to handle and check the answer.

Our take: Start with qwen/qwen3.8-flash for high-volume chat and coding help and move to qwen/qwen3.8-max only for the requests that need it, with the id in one setting so the switch is a config change. Then do the one thing most migrations skip: check reasoning_tokens in the response for every model you route to, because a dropped parameter will not tell you it was dropped.

Running it on OceanToken

On OceanToken, all five Qwen3.8 models answer on one OpenAI-compatible base URL, https://api.oceantoken.ai/v1, with one key, so moving from qwen/qwen3.8-flash to qwen/qwen3.8-max or to a model from another publisher is a change of model id. You pay per use from a prepaid balance with no subscription, and every key can carry its own credit limit. The Qwen3.8 docs pages also list /v1/responses and the Anthropic-style /v1/messages, if your code already uses those shapes. See the current rate on /qwen-api.

FAQ

What is the Qwen3.8 API base URL? For OpenAI SDKs and curl, https://api.oceantoken.ai/v1, with requests to /v1/chat/completions.

Should I use qwen/qwen3.8-max or qwen/qwen3.8-max-0902? Both work today, according to the model page. Choose one and use it everywhere so your logs and costs line up.

Which Qwen3.8 model takes audio? Qwen3.8 Omni Flash is the one that lists audio input; the others take text, images and video.

Why did my reasoning setting not change anything? Parameters a model does not take are left out without an error. Check reasoning_tokens in the response to see whether the model reasoned.

How do I stream a Qwen3.8 answer? Send stream: true, and add stream_options with include_usage to get token counts at the end.

Sources

  1. OceanToken docs: Quickstart  (checked 2026-11-17)
  2. OceanToken docs: qwen/qwen3.8-flash  (checked 2026-11-17)
  3. OceanToken docs: qwen/qwen3.8-max-0902  (checked 2026-11-17)
  4. OceanToken: Qwen3.8 Max model page (checked 2026-11-17)
  5. OceanToken: Qwen3.8 Max Prime model page (checked 2026-11-17)
  6. OceanToken: Qwen3.8 Flash model page (checked 2026-11-17)
  7. OceanToken: Qwen3.8 27B model page (checked 2026-11-17)
  8. OceanToken: Qwen3.8 Omni Flash model page (checked 2026-11-17)
  9. OceanToken docs: API reference  (checked 2026-11-17)
  10. OceanToken docs: Limits  (checked 2026-11-17)

Get your OceanToken API key

  1. Create an OceanToken account and an API key.
  2. Copy the snippet below, paste your key, and run it.
  3. Check the current rate on /qwen-api.
curl https://api.oceantoken.ai/v1/chat/completions \
  -H "Authorization: Bearer $OCEANTOKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen/qwen3.8-flash", "messages": [{"role": "user", "content": "Write a haiku about the ocean."}]}'

Get API Key 

  • Qwen
  • LLM API
  • Tutorial
  1. 11 min read

    Veo 3.1 Reference Images API Guide

    How to send reference images to Veo 3.1 through the API: input_references vs first frame, which tiers take them, two-shot Python script and a consistency test.

    • Veo
    • AI video
    • Tutorial
  2. 12 min read

    LLM Function Calling API Across Models

    Write one LLM function calling API loop that works across GPT, Claude, Gemini, Qwen, GLM and DeepSeek: tool_choice, streaming and the silent no-call trap.

    • LLM API
    • Tutorial
  3. 10 min read

    LLM Image Input API: Screenshots and Scans

    Send screenshots, photos and scans to a chat model with one LLM image input API: URL vs base64 data URL, per-model image limits, the 400 error and token costs.

    • LLM API
    • Tutorial