Create an Anthropic inference endpoint Generally available; Added in 8.16.0
Path parameters
-
The task type. The only valid task type for the model to perform is
completion
.Value is
completion
. -
The unique identifier of the inference endpoint.
PUT /_inference/{task_type}/{anthropic_inference_id}
Console
PUT _inference/completion/anthropic_completion { "service": "anthropic", "service_settings": { "api_key": "Anthropic-Api-Key", "model_id": "Model-ID" }, "task_settings": { "max_tokens": 1024 } }
resp = client.inference.put( task_type="completion", inference_id="anthropic_completion", inference_config={ "service": "anthropic", "service_settings": { "api_key": "Anthropic-Api-Key", "model_id": "Model-ID" }, "task_settings": { "max_tokens": 1024 } }, )
const response = await client.inference.put({ task_type: "completion", inference_id: "anthropic_completion", inference_config: { service: "anthropic", service_settings: { api_key: "Anthropic-Api-Key", model_id: "Model-ID", }, task_settings: { max_tokens: 1024, }, }, });
response = client.inference.put( task_type: "completion", inference_id: "anthropic_completion", body: { "service": "anthropic", "service_settings": { "api_key": "Anthropic-Api-Key", "model_id": "Model-ID" }, "task_settings": { "max_tokens": 1024 } } )
$resp = $client->inference()->put([ "task_type" => "completion", "inference_id" => "anthropic_completion", "body" => [ "service" => "anthropic", "service_settings" => [ "api_key" => "Anthropic-Api-Key", "model_id" => "Model-ID", ], "task_settings" => [ "max_tokens" => 1024, ], ], ]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"service":"anthropic","service_settings":{"api_key":"Anthropic-Api-Key","model_id":"Model-ID"},"task_settings":{"max_tokens":1024}}' "$ELASTICSEARCH_URL/_inference/completion/anthropic_completion"
client.inference().put(p -> p .inferenceId("anthropic_completion") .taskType(TaskType.Completion) .inferenceConfig(i -> i .service("anthropic") .serviceSettings(JsonData.fromJson("{\"api_key\":\"Anthropic-Api-Key\",\"model_id\":\"Model-ID\"}")) .taskSettings(JsonData.fromJson("{\"max_tokens\":1024}")) ) );
Request example
Run `PUT _inference/completion/anthropic_completion` to create an inference endpoint that performs a completion task.
{ "service": "anthropic", "service_settings": { "api_key": "Anthropic-Api-Key", "model_id": "Model-ID" }, "task_settings": { "max_tokens": 1024 } }