Apply your own routing policies, reduce token costs automatically, and see every routing decision in real time with Merge Gateway.

What Palmyra X4 costs to run
Test Palmyra X4
with Gateway’s Simulator
See a prompt's output, token spend, latency, and more with Palmyra X4.
Route requests to Palmyra X4 in minutes
1$ pip install merge-gateway-sdk1from merge_gateway import MergeGateway
2
3client = MergeGateway(api_key="YOUR_API_KEY")
4
5response = client.responses.create(
6 model="openai/gpt-5.2",
7 input=[
8 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
9 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
10 ],
11)
12
13print(response.output[0].content[0].text)1response = client.responses.create(
2 model="anthropic/claude-sonnet-4-20250514",
3 input=[
4 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/openai",
6)1response = client.chat.completions.create(
2 model="gpt-5.2",
3 messages=[
4 {"role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)
8
9print(response.choices[0].message.content)1npm install merge-gateway-ai-sdk-provider ai1import { createMergeGateway } from "merge-gateway-ai-sdk-provider";
2
3const gateway = createMergeGateway({
4 apiKey: "YOUR_API_KEY",
5});1import { generateText } from "ai";
2
3const { text } = await generateText({
4 model: gateway("openai/gpt-4o"),
5 prompt: "Explain the concept of recursion in programming with a simple set of examples.",
6});
7
8console.log(text);1import { createOpenAI } from "@ai-sdk/openai";
2
3const gateway = createOpenAI({
4 apiKey: "YOUR_API_KEY",
5 baseURL: "https://api-gateway.merge.dev/v1/ai-sdk",
6});
7
8// All generateText/streamText calls work unchanged1from anthropic import Anthropic
2
3client = Anthropic(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/anthropic",
6)
7
8message = client.messages.create(
9 model="claude-sonnet-4-20250514",
10 max_tokens=1024,
11 messages=[
12 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
13 ],
14)
15
16print(message.content[0].text)Explore other models available in Merge Gateway
Palmyra X4 FAQ
Heading
What other models does Writer offer?
Palmyra X4 is one model in a Palmyra family that spans domain-specialized, general-purpose, and multimodal options. Here are some other models Writer supports:
- Palmyra X5: Palmyra X5 is Writer's current flagship enterprise model with a 1M-token context window, priced at $0.60 per 1M input tokens and $6.00 per 1M output tokens. It incorporates adaptive reasoning and is designed to replace multiple earlier Palmyra domain variants in a single, cost-efficient endpoint
- Palmyra Vision 7B: Palmyra Vision 7B is Writer's multimodal model, handling image and text input with a 4K-token context window. It is purpose-built for enterprise visual tasks including chart interpretation, handwritten text extraction, and image-based compliance checking
- Palmyra Med: Palmyra Med is a 32k-token context model designed for healthcare workflows and clinical content, priced at $5.00 per 1M input and $12.00 per 1M output. It is scheduled for deprecation on July 13, 2026
- Palmyra Fin: Palmyra Fin is a 128k-token context model built for financial document analysis, regulatory text, and structured financial reasoning, also priced at $5.00 per 1M input and $12.00 per 1M output. Scheduled for deprecation on July 13, 2026
- Palmyra Creative: Palmyra Creative is a 128k-token context model optimized for long-form content generation and brand voice matching, at $5.00 per 1M input and $12.00 per 1M output. Also deprecating July 13, 2026
How does Palmyra X4 differ from Writer's other models?
Palmyra X4 is Writer's previous-generation general-purpose enterprise model, positioned between the specialized domain models and the newer Palmyra X5 flagship.
- Context window: Palmyra X4 supports a 128K-token context window with a max output of 8K tokens. Palmyra X5 extends this to 1M tokens. For use cases involving long documents or multi-document retrieval, X4 can handle moderate context loads but will hit limits that X5 does not
- Pricing: Palmyra X4 is priced at $2.50 per 1M input tokens and $10.00 per 1M output tokens. Palmyra X5 costs $0.60 input and $6.00 output, making X5 approximately 75% cheaper on input and 40% cheaper on output. Domain-specialized models like Palmyra Med and Fin cost more at $5.00 input and $12.00 output
- Tool calling performance: Palmyra X4 was specifically designed for agentic and tool-calling workflows. It achieves 78.76% accuracy in tool-call identification and execution, which Writer reported as nearly 20 percentage points above competing models at launch
- Capabilities: Palmyra X4 is a text-only input and output model. It does not support image, audio, or video inputs. Palmyra Vision 7B serves those multimodal use cases within the Writer lineup
Palmyra X4 is best suited for teams already built on it that require a reliable tool-calling and agentic model with 128K context, and who are not yet migrating to Palmyra X5.
What models should I consider using alongside Palmyra X4?
No single model is optimal for every task. Here are models worth pairing with Palmyra X4 depending on what your product needs:
- Palmyra X5 (Writer): For tasks that require processing more than 128K tokens of context, large codebase analysis, or very long document workflows, route those requests to Palmyra X5. It is cheaper per token than X4 and eliminates the context limit as a constraint
- Claude Sonnet 4.5 (Anthropic): When you need a high-reliability backstop for complex instruction-following tasks across unpredictable prompt formats, Claude Sonnet 4.5 provides strong cross-provider coverage. Routing to it gives you provider redundancy without rebuilding your integration
- GPT-4.1 mini (OpenAI): For high-volume, lower-complexity requests such as classification, extraction, or templated generation where Palmyra X4's cost tier is overkill, GPT-4.1 mini offers substantially lower per-token costs while maintaining adequate performance for routine tasks
- Palmyra Vision 7B (Writer): For any portion of your pipeline that involves image analysis, chart interpretation, or visual document parsing, route those requests to Palmyra Vision 7B. Palmyra X4 handles text only, so visual inputs require a separate model in your architecture
- Llama 3.3 70B (Meta): For latency-sensitive, cost-driven inference at scale where outputs are straightforward, Llama 3.3 70B running on self-hosted or low-cost managed infrastructure can absorb high-volume traffic without consuming your Palmyra X4 budget
What are the challenges of using Palmyra X4 in my product?
Like any production LLM, Palmyra X4 comes with tradeoffs worth planning for:
- Output cost at scale: At $10.00 per 1M output tokens, Palmyra X4 carries a high output cost. For workloads that generate long completions, such as extended agent sessions or document drafting, output costs compound quickly. Setting per-project budgets and output length controls before scaling is important
- Provider dependency: Relying on Writer as a single provider creates fragility when the provider has an outage or deprecates a model version. Palmyra X4 already has a listed EOL date of no sooner than April 28, 2026, which means migration planning is a near-term requirement for teams using it as a primary model
- No multimodal input: Palmyra X4 accepts only text input and produces only text output. Any pipeline involving images, diagrams, or visual documents requires routing those requests to a separate model, adding conditional logic to your application
- Context window ceiling: The 128K-token context window is meaningful but not top-tier among current models. For applications involving very large documents, long conversation histories, or multi-document retrieval, 128K can become a bottleneck that forces chunking or summarization strategies
- Smaller provider ecosystem: Writer has a narrower set of monitoring tools, SLA documentation, and third-party integrations compared to larger providers like OpenAI or Google. Teams with formal uptime or compliance requirements should verify current SLA terms independently
Why should I use Merge Gateway to route LLM requests with Palmyra X4 and every other model?
Using Palmyra X4 through Merge Gateway gives you access to the model itself and the infrastructure layer around it:
- One API, every provider: Access Palmyra X4 and every other major LLM through a single endpoint and API key. Change providers by swapping the model string, with no application code changes required
- Intelligent routing and automatic failover: Merge routes around Writer outages automatically. Routing policies based on cost, latency, or quality can reduce spend by 40 to 60% without touching your application code
- Cost governance: Set hard or soft project budgets so Palmyra X4 spend stays within plan. Every request is attributed to a model, project, and tag in a unified billing dashboard across all providers
- Build Your Own Router: Define what "best" means for your traffic by selecting from curated ML benchmarks or adding your own eval scores. The router scores each available model against your weights and picks the winner per request, with a plain-language explanation of every decision
- Security and compliance controls: Apply DLP rules and prompt injection protection before every request reaches Writer. Enforce per-project model and region policies without adding that logic to your application
How can I start routing requests to Palmyra X4 via Merge Gateway?
Getting Palmyra X4 running through Merge Gateway takes a few minutes:
1. Create an account and get your API key from the dashboard.
2. Install the Merge Gateway SDK: run pip install merge-gateway-sdk (Python) or npm install merge-gateway-sdk (Node). Alternatively, if you're already using the OpenAI SDK, set base_url = "https://api-gateway.merge.dev/v1/openai" and your existing code works as-is.
3. Make your first request using the provider/model format. For Palmyra X4, the model string is writer/palmyra-x4. Swap the model string to route to any other provider without changing anything else.
4. Configure a routing policy in the dashboard to set failover behavior, cost limits, and optimization strategy. Your first policy can be as simple as naming Palmyra X4 as primary with one fallback.
Full setup instructions and SDK references are in the Merge Gateway docs.
Try Palmyra X4 through Merge Gateway
Route, observe, and control AI requests across providers from one API.





