> ## Documentation Index
> Fetch the complete documentation index at: https://docs.valarhq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI API compatibility

> What to set for an agent loop, and which request fields Valar ignores

Valar speaks the OpenAI **Responses** and **Chat Completions** APIs, so your SDK works unchanged. Two things to know.

## Set `store: false` for an agent loop

<CodeGroup>
  ```ts Vercel AI SDK {13} theme={"system"}
  import { createOpenAI } from "@ai-sdk/openai";
  import { generateText } from "ai";

  const valar = createOpenAI({
    baseURL: "https://api.valarhq.ai/v1",
    apiKey: process.env.VALAR_API_KEY,
  });

  const result = await generateText({
    model: valar.responses("deepseek-ai/DeepSeek-V4.1-Flash"),
    messages,
    tools,
    providerOptions: { openai: { store: false } },
  });
  ```

  ```ts OpenAI SDK {11} theme={"system"}
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "https://api.valarhq.ai/v1",
    apiKey: process.env.VALAR_API_KEY,
  });

  const response = await client.responses.create({
    model: "deepseek-ai/DeepSeek-V4.1-Flash",
    input: conversation,
    store: false,
  });
  ```

  ```python Python {13} theme={"system"}
  import os

  from openai import OpenAI

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

  response = client.responses.create(
      model="deepseek-ai/DeepSeek-V4.1-Flash",
      input=conversation,
      store=False,
  )
  ```
</CodeGroup>

Reasoning then comes back with `encrypted_content`, your SDK replays it on the next turn, and the model keeps the thinking it already did. Leave `store` unset and that thinking is lost from the second step onward — the usual cause of "my agent forgets what it was doing".

Pass `encrypted_content` back unchanged and do not parse it. `store` is not a retention control.

## Fields Valar ignores

Every request is answered from the content you send in `input` — there is no server-side thread to point at. These fields are removed rather than rejected, so your request still runs; it just does not see the turn they name:

| Field | Effect |
| - | - |
| `{"type": "item_reference", "id": "rs_…"}` input item | The item it names is not added to the prompt |
| `previous_response_id` | The previous turn is not prepended |
| `conversation` | No stored conversation is loaded |

Send the conversation on every turn instead — every OpenAI-compatible SDK does this by default.
