Anthropic Messages
Create messages using Anthropic Messages API format
Creates a message using Anthropic's native Messages API format. This endpoint provides the same API format as Anthropic's official API, making it easy to migrate existing integrations or use Anthropic-specific features.
Requests can also be routed to other supported providers and converted back to Messages format. Provider-specific fields, thinking signatures and native tools are not universally portable: use the compatible destination provider when you need its native features.
Create a response in Anthropic Messages format. Supports native Anthropic dispatch and conversion to other supported providers; it is not restricted to the Anthropic provider. Native dispatch preserves provider-specific JSON fields when the destination supports the caller’s format. Cross-format routing converts through the Gateway’s shared representation: provider-only features are not guaranteed to survive. Support for reasoning, images, built-in tools and structured outputs depends on the destination model.
https://edgee.io/v1/messagesTry this endpoint
Configure your request, then run the curl command in your terminal or send it from this page.
Comma-separated analytics tags. Trimmed and merged with body tags.
Enable debug capture for this request. Does not add a debug object to the API response.
Turn tool-result trimming on or off. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.
Turn MCP tool surface reduction on or off. The threshold and resolver mode still come from the API key. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.
Turn output brevity on or off. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.
Session identifier used to group request usage.
Anthropic API version header. Forwarded on the native Anthropic path; not a cross-provider capability switch.
Provider beta feature flags for native Anthropic requests. Availability depends on the upstream provider.
Run in your terminal
Set EDGEE_API_KEY to your Gateway API key in your terminal, then copy and run this command. Gateway requests may consume credits.
curl --include --no-buffer --globoff --request POST 'https://edgee.io/v1/messages' \
--header "Authorization: Bearer $EDGEE_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "anthropic/claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}'Send from browser
Your request is relayed through the Edgee documentation server to the Gateway. Your key is used only for this request and is not stored.
Authentication
Use an Edgee Gateway API key. Send it as Authorization: Bearer <key> or x-api-key: <key>.
Parameters
X-Edgee-Tagsheader · stringComma-separated analytics tags. Trimmed and merged with body tags.
X-Edgee-Debugheader · stringEnable debug capture for this request. Does not add a debug object to the API response.
X-Edgee-Compression-Tool-Result-Trimmingheader · stringTurn tool-result trimming on or off. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.
X-Edgee-Compression-Tool-Surface-Reductionheader · stringTurn MCP tool surface reduction on or off. The threshold and resolver mode still come from the API key. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.
X-Edgee-Compression-Brevityheader · stringTurn output brevity on or off. Overrides the API key setting for this request only. Values are case-insensitive, and a missing or invalid value keeps the key's setting.
X-Edgee-Session-Idheader · stringSession identifier used to group request usage.
anthropic-versionheader · stringAnthropic API version header. Forwarded on the native Anthropic path; not a cross-provider capability switch.
anthropic-betaheader · stringProvider beta feature flags for native Anthropic requests. Availability depends on the upstream provider.
Request body
Native dispatch preserves provider-specific JSON fields when the destination supports the caller’s format. Cross-format routing converts through the Gateway’s shared representation: provider-only features are not guaranteed to survive. Support for reasoning, images, built-in tools and structured outputs depends on the destination model.
modelstringrequiredModel identifier from GET /v1/models, in author/model format, or a configured global alias. Append :provider to request a specific provider route. Available models and providers depend on your key and organization policies.
max_tokensintegerrequiredMaximum number of tokens to generate
messagesarrayrequiredArray of message objects
Show schema
rolestringrequiredThe role of the message
contentunionrequiredShow schema
Simple text content
stringArray of content blocks
Common Anthropic content blocks. Native dispatch can carry additional provider-specific blocks; conversion paths only preserve supported content. Cross-provider reasoning is emitted as text, never as forged signed thinking blocks.
typestringrequiredtextstringrequiredcache_controlobjecttypestringrequiredidstringrequirednamestringrequiredinputobjectrequiredtypestringrequiredtool_use_idstringrequiredcontentunionrequiredis_errorbooleancache_controlobjecttypestringrequiredsourceunionrequiredcache_controlobjecttypestringrequiredthinkingstringrequiredsignaturestringPreserve provider-issued signatures when replaying history. Unsigned thinking blocks are stripped before upstream Anthropic calls.
typestringrequireddatastringrequiredsystemunionShow schema
System prompt as a string
stringSystem prompt as content blocks
Common Anthropic content blocks. Native dispatch can carry additional provider-specific blocks; conversion paths only preserve supported content. Cross-provider reasoning is emitted as text, never as forged signed thinking blocks.
typestringrequiredtextstringrequiredcache_controlobjectShow schema
typestringrequiredttlstringtypestringrequiredidstringrequirednamestringrequiredinputobjectrequiredtypestringrequiredtool_use_idstringrequiredcontentunionrequiredShow schema
stringtypestringrequiredtextstringrequiredcache_controlobjecttypestringrequiredsourceunionrequiredis_errorbooleancache_controlobjectShow schema
typestringrequiredttlstringtypestringrequiredsourceunionrequiredShow schema
typestringrequiredurlstringrequiredtypestringrequiredmedia_typestringrequireddatastringrequiredcache_controlobjectShow schema
typestringrequiredttlstringtypestringrequiredthinkingstringrequiredsignaturestringPreserve provider-issued signatures when replaying history. Unsigned thinking blocks are stripped before upstream Anthropic calls.
typestringrequireddatastringrequiredstreambooleanEnable streaming responses
toolsarrayTool definitions
Show schema
namestringrequiredThe name of the tool
descriptionstringDescription of what the tool does
input_schemaobjectJSON Schema describing the tool's input parameters
cache_controlobjectShow schema
typestringrequiredttlstringtool_choiceobjectShow schema
typestringrequiredModel decides whether to use tools
typestringrequiredModel must use one of the provided tools
typestringrequirednamestringrequiredName of the specific tool to use
enable_debugbooleanEnable request debug capture. Gateway-only field; does not add debug information to the response.
tagsarrayOptional tags to categorize and label the request. Useful for filtering and grouping requests in analytics and logs. Can also be sent via the `x-edgee-tags` header as a comma-separated string.
Show schema
stringtemperaturenumbertop_pnumberthinkingobjectShow schema
typestringrequiredadaptive, disabled, or legacy enabled; supported modes depend on the model.
displaystringsummarized or omitted. Default display depends on the model.
budget_tokensintegerRequired for legacy enabled thinking; adaptive models do not use this budget.
output_configobjectOnly effort is portable through the shared representation. Other fields such as format and task_budget are provider-native and are not preserved by every cross-format path.
Show schema
effortstringRequested effort; common values include none, minimal, low, medium, high, xhigh and max. The supported vocabulary is model-specific. Cross-format routing maps supported values and can omit unrepresentable levels.
{
"model": "anthropic/claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}Responses
200Message created successfully
application/json
idstringrequiredUnique identifier for this message
modelstringrequiredThe model that generated the response
contentarrayrequiredArray of content blocks
Show schema
Common Anthropic content blocks. Native dispatch can carry additional provider-specific blocks; conversion paths only preserve supported content. Cross-provider reasoning is emitted as text, never as forged signed thinking blocks.
typestringrequiredtextstringrequiredcache_controlobjectShow schema
typestringrequiredttlstringtypestringrequiredidstringrequirednamestringrequiredinputobjectrequiredtypestringrequiredtool_use_idstringrequiredcontentunionrequiredShow schema
stringtypestringrequiredtextstringrequiredcache_controlobjecttypestringrequiredsourceunionrequiredis_errorbooleancache_controlobjectShow schema
typestringrequiredttlstringtypestringrequiredsourceunionrequiredShow schema
typestringrequiredurlstringrequiredtypestringrequiredmedia_typestringrequireddatastringrequiredcache_controlobjectShow schema
typestringrequiredttlstringtypestringrequiredthinkingstringrequiredsignaturestringPreserve provider-issued signatures when replaying history. Unsigned thinking blocks are stripped before upstream Anthropic calls.
typestringrequireddatastringrequiredusageobjectrequiredShow schema
input_tokensintegerrequiredNumber of input tokens.
output_tokensintegerrequiredNumber of output tokens.
cache_read_input_tokensintegerNumber of input tokens read from the prompt cache.
cache_creation_input_tokensintegerNumber of input tokens written to the prompt cache.
cache_creationobjectShow schema
ephemeral_5m_input_tokensintegerephemeral_1h_input_tokensintegeroutput_tokens_detailsobjectShow schema
thinking_tokensintegerstop_reasonstringStop reason. Native provider responses may include additional reasons.
typestringrequiredrolestringrequiredstop_sequencestringtext/event-stream
Anthropic-style SSE: message_start, content_block_start/delta/stop, message_delta and message_stop; reasoning and tool argument deltas use their corresponding block types. Inspect error events even if HTTP status is 200.
string400Malformed request, invalid/disabled model or provider, or unsupported conversion.
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
401Missing or invalid API credentials.
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
403Key inactive, expired, model restriction or other permission failure.
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
429Usage or routing-strategy budget exhausted, or provider rate limit.
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
500Internal processing error.
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
502Upstream provider failure.
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
503Usage accounting or upstream service temporarily unavailable.
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
529Upstream provider overloaded (when preserved by the request path).
application/json
typestringrequirederrorobjectrequiredShow schema
typestringrequiredmessagestringrequiredrequest_idstringOpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category.
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.