IPWorks LLM Provider Comparison


Requirements:
IPWorks LLM

Introduction

IPWorks LLM provides a common LLMClient API for conversations, tool calls, and streaming across services that use the OpenAI, Anthropic, or Google Gemini APIs. It also supports embeddings and token counting where the selected API provides those operations.

This guide compares the API formats, default endpoints, and differences that matter when choosing or switching services.

Tip: Download the latest version of IPWorks LLM to follow along. For a first request, see Getting Started with IPWorks LLM.

Providers and APIs

Every ServiceProvider value uses one of three APIs: the OpenAI Chat Completions API, the Anthropic Messages API, or the Google Gemini API. The API determines the request format, the authentication header, and most of the behavior described in this article. When ServerURL is empty, the component uses the provider's default endpoint:

ServiceProvider API Default endpoint
spOpenAI OpenAI Chat Completions https://api.openai.com/v1
spAnthropic Anthropic Messages https://api.anthropic.com/v1
spGemini Google Gemini https://generativelanguage.googleapis.com/v1beta
spOllama OpenAI Chat Completions http://localhost:11434/v1
spLMStudio OpenAI Chat Completions http://localhost:1234/v1
spGroq OpenAI Chat Completions https://api.groq.com/openai/v1
spOpenRouter OpenAI Chat Completions https://openrouter.ai/api/v1
spTogetherAI OpenAI Chat Completions https://api.together.ai/v1
spFireworksAI OpenAI Chat Completions https://api.fireworks.ai/inference/v1
spCustomOpenAI OpenAI Chat Completions None; ServerURL is required
spCustomAnthropic Anthropic Messages None; ServerURL is required
spCustomGemini Google Gemini None; ServerURL is required

The rest of this article compares the three API formats. Other services may implement only part of a format, so check the capabilities of the endpoint you use.

Shared Capabilities

LLMClient uses the same methods and events to manage conversations, generate replies, stream text, and handle tool calls across the three API formats. It sends messages, content parts, and tools in the format required by each API.

Capability Matrix

The matrix shows what LLMClient can map to each API. Individual models and endpoints may not support every listed capability, including tool calls.

Capability OpenAI Chat Completions API Anthropic Messages API Google Gemini API
Generate text Yes Yes Yes
Stream replies Yes Yes Yes, through the Gemini streaming endpoint
Tool calls (where supported) Yes; with spOllama, ToolChoice must be empty or auto Yes Yes
Count tokens Not supported by the Chat Completions API Yes Yes
List models Yes; the component reads one response Yes, call again while ModelMarker is not empty Yes, call again while ModelMarker is not empty
Image and file inputs Images and inline PDF files on OpenAI; remote file URLs are not accepted Images and provider-supported content blocks Provider-supported parts through the Gemini format
Structured JSON output ResponseFormat or ResponseSchema configuration setting ResponseSchema configuration setting ResponseFormat or ResponseSchema configuration setting
Embeddings Yes, through the /embeddings endpoint Not available from the Anthropic API; CreateEmbedding fails with error 804 Yes, through batchEmbedContents
Safety settings No generic setting No generic setting GeminiSafetySettings configuration setting

Important Behavioral Differences

Model Names and Endpoints

Model identifiers are provider-specific. Gemini model names are used in the request path and may be returned by ListModels with a models/ prefix; the generic component accepts either form without duplicating the prefix.

The default server URLs are different for each provider, as listed in Providers and APIs. Set ServerURL only when the default does not apply:

  • For an Ollama or LM Studio server on another host or port, keep spOllama or spLMStudio and set ServerURL to that server.
  • For another service that implements one of the APIs, such as vLLM or DeepSeek, select spCustomOpenAI, spCustomAnthropic, or spCustomGemini and set ServerURL. Without ServerURL, Generate, CountTokens, CreateEmbedding, and ListModels fail with error 802.
  • For a gateway or proxy that forwards requests unchanged to OpenAI, Anthropic, or Google, select spOpenAI, spAnthropic, or spGemini and set ServerURL to the gateway.

Changing ServiceProvider preserves the conversation, message parts, and tools but clears provider-specific part data. APIKey, Model, and ServerURL also keep their values, so update them for the new provider. Set ServerURL to an empty string to use its default endpoint.

Output Token Limits

The Anthropic API requires an output-token limit. Set MaxOutputTokens to a positive value before calling Generate with spAnthropic or spCustomAnthropic; otherwise Generate fails with error 802. The other providers use their own defaults when this property is left at zero.

MaxOutputTokens is translated to each provider's request field:

  • spOpenAI and spGroq: max_completion_tokens
  • Other providers that use the OpenAI Chat Completions API: max_tokens, the name these services commonly read. Ollama, for example, reads only max_tokens.
  • Anthropic Messages API: max_tokens
  • Google Gemini API: generationConfig.maxOutputTokens

For another OpenAI-compatible service, use its provider value or spCustomOpenAI rather than changing spOpenAI's ServerURL. This determines which token-limit field is sent.

Token Counts

The generic component exposes InputTokens, OutputTokens, and TotalTokens for generated replies. The values come from the provider's usage response and are not independent estimates.

Provider Token usage handling
OpenAI Uses the reported prompt, completion, and total token counts
Anthropic Includes prompt-cache counts in InputTokens and derives TotalTokens from input plus output
Gemini Includes reasoning tokens in OutputTokens

If a response omits usage, a zero value is not an independent token estimate.

For counting a conversation before generation, CountTokens works with the Anthropic Messages and Google Gemini APIs. The OpenAI Chat Completions API has no token-counting endpoint, so the generic method fails with error 804 for spOpenAI and every other provider that uses that API.

Model Listing

The component treats a Chat Completions provider's model list as one response. It uses ModelMarker to request subsequent Anthropic and Gemini pages. Register a ModelList handler before the first call, then continue while the marker is not empty:


llmclient.ListModels();
while (!String.IsNullOrEmpty(llmclient.ModelMarker))
  llmclient.ListModels();

The ModelList event exposes provider fields through common names. The Chat Completions API has no display name or description, so Name repeats Id; Anthropic has no description, and Gemini supplies a display name and description when the API returns them.

Safety and Finish Reasons

A provider may block a request or reply without a transport error. When the response reports such a block, Generate returns normally and FinishReason is frContentFilter. The provider's original reason is available through Config("ProviderFinishReason"). A blocked prompt may append no assistant message.

Gemini commonly reports a safety block as SAFETY. Anthropic refusals map to frContentFilter, while OpenAI filtering reasons are mapped according to the response returned by the API.

Choosing Between Components

Use the generic LLMClient component when an application needs to:

  • Switch providers without rewriting conversation management.
  • Keep one tool-calling and streaming implementation.
  • Support several providers with the same basic request and response handling.
  • Use provider-neutral messages, parts, token usage, and finish reasons.

Use a direct provider component when the application needs a feature that the generic component does not expose, such as:

  • Provider-specific request fields, response metadata, or content-block types.
  • Operations that do not fit the common conversation API.

Conclusion

Choose the ServiceProvider value for the API and endpoint you use, then check the selected service's supported operations. When switching, update the model, credentials, and endpoint together. For conversation state, see Managing IPWorks LLM Conversations. For tool definitions and results, see Tool Calling with IPWorks LLM.

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.