Skip to content

Latest commit

 

History

History
57 lines (35 loc) · 1.84 KB

File metadata and controls

57 lines (35 loc) · 1.84 KB

Troubleshooting

Set OPENAI_COMPAT_API_KEY

Create .env from .env.example or export the variable in your shell.

HTTP 401 Or HTTP 403

Check that:

  • OPENAI_COMPAT_API_KEY is valid for the provider.
  • OPENAI_COMPAT_BASE_URL points to the same provider as the key.
  • Your account has access to the selected model.

HTTP 404

Most OpenAI-compatible providers expect:

OPENAI_COMPAT_BASE_URL=https://provider.example/v1

The examples append /chat/completions automatically. Do not set the base URL to the full endpoint path.

Streaming Prints Nothing

Possible causes:

  • The provider does not support stream: true for that model.
  • The provider buffers chunks until completion.
  • The response uses SSE but omits delta.content for some chunks.
  • The model is producing a tool-call delta instead of text.

Run the non-streaming example first to confirm basic connectivity.

Tool Calls Are Ignored

This can be normal. OpenAI-compatible providers do not always implement identical tool/function-call semantics. Check:

  • Does the provider document tools support?
  • Does the selected model support tool calls?
  • Does the provider still use legacy functions instead of tools?
  • Are function arguments emitted as a JSON string or as parsed JSON?

JSON Mode Is Rejected

JSON mode is not universal. If your provider rejects response_format, use prompt-based JSON output or choose a model/provider that explicitly supports JSON mode.

TKEN Endpoint

TKEN example base URL:

OPENAI_COMPAT_BASE_URL=https://www.tken.shop/v1

TKEN help/start link: https://www.tken.shop/?utm_source=github&utm_medium=repo&utm_campaign=openai-compatible-streaming-tool-calls&utm_content=troubleshooting