Skip to content

Compatibility

Which chat features work with which provider family behind Lykia, how each is translated, what is ignored, and how to use Lykia from the Vercel AI SDK.

Markdown
On this page

Lykia talks to providers directly, through three kinds of adapters. Every request uses the same OpenAI-style body; the adapter translates it to the provider's own API. This page shows, feature by feature, what each adapter does with it. A combination that cannot work either returns 400 or is listed here as ignored: nothing is dropped without being documented.

Provider families

  • OpenAI-compatible: OpenAI, xAI, DeepSeek, Mistral, Groq, Together, Cerebras, DeepInfra, Novita, Moonshot, SambaNova and Nebius. The body is passed on as it is (with Lykia's keys, only the allowed fields).
  • Anthropic: translated to the Messages API.
  • Google AI Studio: translated to the Gemini API.

GET /providers lists the provider ids. Whether a given model supports a feature is in its supported_parameters and input_modalities in GET /models.

Chat features

FeatureOpenAI-compatibleAnthropicGoogle AI Studio
tools and tool-call responses✓ as sent✓ as input_schema (strict passed on)✓ as function declarations
tool_choice✓ as sent✓ none, auto, required and a named function (some newer models reject a forced choice; that is the provider's rule)✓ none, auto, any, or a named function
parallel_tool_calls: false✓ as sent✓ disables parallel tool useignored (no equivalent)
Tool-call pieces in a stream✓✓✓ (each call arrives in one piece)
response_format: json_schema (strict)✓ as sent✓✓
Image input✓ as sent✓ base64 or URL✓
PDF input (file parts)✓ as sent, where the model reads files✓ as a document✓
Streaming with usage in the last chunk✓✓✓
reasoning✓ as reasoning_effort (DeepSeek: its thinking switch); a max_tokens budget is ignored✓ adaptive or budgeted thinking✓ thinking budget or level
reasoning_details sent back in tool loopsDeepSeek; dropped for the others✓ signed thinking blocks✓ thought signatures
cache_control markersremoved (the provider caches implicitly)✓ as sent; cache: "auto" supportedignored (the provider caches implicitly)

Finish reasons are mapped to the OpenAI set (stop, length, tool_calls, content_filter), and thinking text, where the provider returns it, comes back in reasoning. Details of the last three rows are in Reasoning and prompt caching.

Vercel AI SDK

Lykia works with the Vercel AI SDK's OpenAI providers through the Chat Completions API:

PackageUse
@ai-sdk/openai (createOpenAI)provider.chat("…"), not provider("…"), which calls a different OpenAI endpoint that Lykia does not offer
@ai-sdk/openai-compatible (createOpenAICompatible)provider.chatModel("…") (or provider("…"))

With that, streamText and generateText work with tool loops, Output.object (strict JSON schema) and usage in the stream, and an error in the middle of a stream reaches you as an error part rather than a normal finish. Pass maxRetries: 0, so the AI SDK does not resend a request that was already billed.

The AI SDK has no place for Lykia's request cost, tags or cache_control markers. createAiSdkFetch() from the Lykia SDK fills that gap: pass it as the provider's fetch to add tags to every request and get each request's cost and errors in callbacks.

TypeScript
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { streamText } from "ai";
import { createAiSdkFetch, type LykiaError } from "@lykia/sdk";

let streamError: LykiaError | undefined;

const lykia = createOpenAICompatible({
  name: "lykia",
  baseURL: "https://api.getlykia.com/v1",
  apiKey: process.env.LYKIA_API_KEY,
  includeUsage: true,
  fetch: createAiSdkFetch({
    tags: { user: "tenant-42", metadata: { product: "support-bot" } },
    onResult: (r) => console.log(r.generationId, r.cost, r.usage),
    onError: (e) => {
      streamError = e;
    },
    streamErrors: "part", // the default; or "throw"
  }),
});

const result = streamText({ model: lykia.chatModel("openai/gpt-4o-mini"), prompt: "Hello!", maxRetries: 0 });
for await (const part of result.fullStream) {
  if (part.type === "text-delta") process.stdout.write(part.text);
  if (part.type === "error") console.error(streamError?.status, streamError?.code, streamError?.reason);
}

Next steps