POST
/api/v1/chat/completionsOpenAI-compatible chat completions ingress (T0-B round-6)
OpenAI-exact wire-format chat-completions endpoint. Drop-in compatible with the openai-node SDK + clients targeting `https://api.openai.com/v1/chat/completions` — point your base URL at EvalGuard and `model` decides which of our 98 providers receives the call. Streaming (SSE) supported. Tools / function calls pass through. Vendor extension `evalguard.dicl.examples` enables prepending pre-retrieved few-shot pairs (1-E). For Anthropic targets, `metadata.cache_control: "ephemeral"` on any message activates prompt caching (1-C).
Authentication
Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.
Request body required
Example
{
"model": "<Model name; supports vendor-prefix (\"ant>",
"messages": [
{}
],
"stream": false,
"temperature": 0,
"max_tokens": 0,
"tools": [],
"response_format": {},
"evalguard": {
"dicl": {
"examples": [
{
"input": "string",
"output": "string"
}
]
}
}
}Schema
{
"application/json": {
"schema": {
"type": "object",
"required": [
"model",
"messages"
],
"properties": {
"model": {
"type": "string",
"description": "Model name; supports vendor-prefix (\"anthropic/claude-3-5-sonnet\") + bare aliases (\"gpt-4o\")."
},
"messages": {
"type": "array",
"items": {
"type": "object"
}
},
"stream": {
"type": "boolean"
},
"temperature": {
"type": "number"
},
"max_tokens": {
"type": "integer"
},
"tools": {
"type": "array"
},
"tool_choice": {},
"response_format": {
"type": "object"
},
"evalguard": {
"type": "object",
"description": "EvalGuard vendor extensions.",
"properties": {
"dicl": {
"type": "object",
"properties": {
"examples": {
"type": "array",
"items": {
"type": "object",
"required": [
"input",
"output"
],
"properties": {
"input": {
"type": "string"
},
"output": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}Response
All status codes
200OpenAI-shape chat completion response (or text/event-stream when stream=true).
400(no description)
401(no description)
422Unknown model or no provider API key configured.
429(no description)
502Upstream provider error.
Code samples
cURL
curl -X POST \
https://evalguard.ai/api/v1/chat/completions \
-H "Authorization: Bearer $EVALGUARD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "<Model name; supports vendor-prefix (\"ant>", "messages": [ {} ], "stream": false, "temperature": 0, "max_tokens": 0, "tools": [], "response_format": {}, "evalguard": { "dicl": { "examples": [ { "input": "string", "output": "string" } ] } } }'TypeScript
import { EvalGuard } from "@evalguard/sdk";
const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });
const response = await client.request({
method: "POST",
path: "/api/v1/chat/completions",
body: {
"model": "<Model name; supports vendor-prefix (\"ant>",
"messages": [
{}
],
"stream": false,
"temperature": 0,
"max_tokens": 0,
"tools": [],
"response_format": {},
"evalguard": {
"dicl": {
"examples": [
{
"input": "string",
"output": "string"
}
]
}
}
},
});
console.log(response);Python
from evalguard import EvalGuard
import os
client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])
response = client.request(
method="POST",
path="/api/v1/chat/completions",
body={
"model": "<Model name; supports vendor-prefix (\"ant>",
"messages": [
{}
],
"stream": False,
"temperature": 0,
"max_tokens": 0,
"tools": [],
"response_format": {},
"evalguard": {
"dicl": {
"examples": [
{
"input": "string",
"output": "string"
}
]
}
}
},
)
print(response)Go
package main
import (
"context"
"fmt"
"os"
"github.com/evalguard/evalguard-go"
)
func main() {
client := evalguard.NewClient(os.Getenv("EVALGUARD_API_KEY"))
resp, err := client.Request(context.Background(), "POST", "/api/v1/chat/completions", map[string]any{"model": "<Model name; supports vendor-prefix (\"ant>", "messages": []any{map[string]any{}}, "stream": false, "temperature": 0, "max_tokens": 0, "tools": []any{}, "response_format": map[string]any{}, "evalguard": map[string]any{"dicl": map[string]any{"examples": []any{map[string]any{"input": "string", "output": "string"}}}}})
if err != nil { panic(err) }
fmt.Println(resp)
}Errors
400401422429502