Format Translation
Keeptrusts automatically translates between different LLM provider API formats so you can use any provider without changing your application code. Send OpenAI-format requests and Keeptrusts translates them to the target provider's native format.
Use this page when
- You want to send OpenAI-format requests through the gateway to non-OpenAI providers (Gemini, Anthropic, Cohere, Bedrock).
- You need to understand which request/response features translate across providers.
- You are configuring multi-provider fallback and want automatic format translation.
Primary audience
- Primary: AI Agents, Technical Engineers
- Secondary: Technical Leaders
Supported Translations
| Source Format | Target Provider | Translation |
|---|---|---|
| OpenAI Chat Completions | Google Gemini (AI Studio / Vertex) | Messages → generateContent |
| OpenAI Chat Completions | Anthropic Claude | Messages → Anthropic Messages API |
| OpenAI Chat Completions | Cohere | Messages → Cohere Chat |
| OpenAI Chat Completions | AWS Bedrock | Messages → InvokeModel |
| OpenAI Embeddings | Google Gemini | Embeddings → embedContent |
| OpenAI Embeddings | Cohere | Embeddings → Cohere Embed |
| OpenAI Embeddings | Voyage | Embeddings → Voyage Embed |
How It Works
Application Keeptrusts Gateway Provider
(OpenAI format) (Native format)
│ │ │
│── POST /v1/chat ──────► │ │
│ completions │── Translate ──────► │
│ │ to native format │
│ │ │
│ │◄── Native response ── │
│◄── OpenAI-format ────── │ Translate back │
│ response │ │
Configuration
Format translation is automatic based on the target provider. No additional configuration is needed:
pack:
name: format-translation-providers-1
version: 1.0.0
enabled: true
providers:
targets:
- id: gemini
provider: google
model: gemini-2.0-flash
secret_key_ref:
env: GOOGLE_API_KEY
policies:
chain:
- audit-logger
policy:
audit-logger:
immutable: true
retention_days: 365
log_all_access: true
When your application sends an OpenAI-format request, the gateway detects the target is Google and automatically translates.
Feature Mapping
Chat Completions
| OpenAI Feature | Gemini | Anthropic | Cohere |
|---|---|---|---|
messages | contents | messages | message |
system message | systemInstruction | system | preamble |
temperature | generationConfig.temperature | temperature | temperature |
max_tokens | generationConfig.maxOutputTokens | max_tokens | max_tokens |
tools | tools | tools | tools |
tool_choice | toolConfig | tool_choice | — |
stream | streamGenerateContent | stream | stream |
response_format: json | responseMimeType: application/json | — | response_format |
Embeddings
| OpenAI Feature | Gemini | Cohere | Voyage |
|---|---|---|---|
input | content.parts[].text | texts | input |
model | model | model | model |
dimensions | outputDimensionality | — | output_dimension |
Multi-Provider with Automatic Translation
Switch between providers seamlessly using fallback:
pack:
name: format-translation-providers-2
version: 1.0.0
enabled: true
providers:
targets:
- id: primary
provider: openai
model: gpt-4o
secret_key_ref:
env: OPENAI_API_KEY
- id: fallback-1
provider: google
model: gemini-2.0-flash
secret_key_ref:
env: GOOGLE_API_KEY
- id: fallback-2
provider: anthropic
model: claude-sonnet-4-20250514
secret_key_ref:
env: ANTHROPIC_API_KEY
policies:
chain:
- audit-logger
policy:
audit-logger:
immutable: true
retention_days: 365
log_all_access: true
Your application code stays in OpenAI format. Keeptrusts translates to whichever provider serves the request.
For AI systems
- Canonical terms: Keeptrusts, format translation, provider translation, OpenAI-compatible, Gemini, Anthropic, Cohere, Bedrock, Voyage.
- Format translation is automatic based on
providerin the target config. No additional flags or settings are needed. - Supported: Chat Completions and Embeddings from OpenAI format to Google Gemini, Anthropic Claude, Cohere, AWS Bedrock, and Voyage.
For engineers
- No code changes required in your application — send OpenAI-format requests and the gateway translates automatically based on the target provider.
- Configure the target in
policy-config.yamlwith the correctproviderfield; translation is determined by provider type. - Use multi-provider fallback with automatic translation to seamlessly switch between providers without application changes.
For leaders
- Format translation eliminates vendor lock-in — applications maintain a single integration format while switching providers requires only a config change.
- Multi-provider fallback with automatic translation enables cost optimization and availability improvements without engineering effort.
- Feature mapping table shows which provider capabilities are supported, helping evaluate provider migration feasibility.
Next steps
- Multi-Provider Fallback — Ordered failover routing
- Provider Routing — Advanced routing configuration
- Config Providers — Provider target configuration reference
- Declarative Config Reference — Full config schema