Skip to content

Commit

Permalink
GenAI: Add Anthropic API Key Endpoints (#975)
Browse files Browse the repository at this point in the history
* [PS-4661] docs: add documentation for public Anthropic API endpoints

* [PS-4661] docs: add CURL examples

* [PS-4661] fix: add missing descriptions

* [PS-4661] fix: address feedback and tidy up
  • Loading branch information
jdigitalocean authored Feb 3, 2025
1 parent d6e44c3 commit 25f2388
Show file tree
Hide file tree
Showing 14 changed files with 469 additions and 27 deletions.
84 changes: 57 additions & 27 deletions specification/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ tags:
create, or delete CDN Endpoints as well as purge cached content. To use a
custom subdomain to access the CDN Endpoint, provide the ID of a
DigitalOcean managed TLS certificate and the fully qualified domain name
for the custom subdomain.
for the custom subdomain.
CDN endpoints have a rate limit of five requests per 10 seconds.
Expand Down Expand Up @@ -146,7 +146,7 @@ tags:
simplifies the creation and management of highly available database clusters. Currently, it
offers support for [PostgreSQL](http://docs.digitalocean.com/products/databases/postgresql/),
[Redis](https://docs.digitalocean.com/products/databases/redis/),
[MySQL](https://docs.digitalocean.com/products/databases/mysql/),
[MySQL](https://docs.digitalocean.com/products/databases/mysql/),
[MongoDB](https://docs.digitalocean.com/products/databases/mongodb/), and
[OpenSearch](https://docs.digitalocean.com/products/databases/opensearch/).
Expand All @@ -162,7 +162,7 @@ tags:
which is used in some of the following requests. Each slug denotes the node's identifier,
CPU count, and amount of RAM, in that order.
For a list of currently available database slugs and options, use the `/v2/databases/options` endpoint or use the
For a list of currently available database slugs and options, use the `/v2/databases/options` endpoint or use the
`doctl databases options` [command](https://docs.digitalocean.com/reference/doctl/reference/databases/options).
- name: Domain Records
Expand Down Expand Up @@ -295,7 +295,7 @@ tags:
- name: GenAI Platform (Public Preview)
description: |-
**The GenAI Platform API is in [public preview](https://docs.digitalocean.com/platform/product-lifecycle/#public-preview) for select customers.**
The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
Expand Down Expand Up @@ -494,9 +494,9 @@ tags:
- name: VPC Peerings
description: |-
[VPC Peerings](https://docs.digitalocean.com/products/networking/vpc/how-to/create-peering/)
join two VPC networks with a secure, private connection. This allows
resources in those networks to connect to each other's private IP addresses
[VPC Peerings](https://docs.digitalocean.com/products/networking/vpc/how-to/create-peering/)
join two VPC networks with a secure, private connection. This allows
resources in those networks to connect to each other's private IP addresses
as if they were in the same network.
- name: VPCs
Expand Down Expand Up @@ -781,7 +781,7 @@ paths:
$ref: 'resources/databases/databases_list_replicas.yml'
post:
$ref: 'resources/databases/databases_create_replica.yml'

/v2/databases/{database_cluster_uuid}/events:
get:
$ref: 'resources/databases/databases_events_logs.yml'
Expand Down Expand Up @@ -869,7 +869,7 @@ paths:
$ref: 'resources/databases/databases_update_kafka_topic.yml'
delete:
$ref: 'resources/databases/databases_delete_kafka_topic.yml'

/v2/databases/{database_cluster_uuid}/logsink:
get:
$ref: 'resources/databases/databases_list_logsink.yml'
Expand All @@ -890,15 +890,15 @@ paths:
$ref: 'resources/databases/databases_get_cluster_metrics_credentials.yml'
put:
$ref: 'resources/databases/databases_update_cluster_metrics_credentials.yml'

/v2/databases/{database_cluster_uuid}/indexes:
get:
$ref: 'resources/databases/databases_list_opensearch_indexes.yml'

/v2/databases/{database_cluster_uuid}/indexes/{index_name}:
delete:
$ref: 'resources/databases/databases_delete_opensearch_index.yml'

/v2/domains:
get:
$ref: 'resources/domains/domains_list.yml'
Expand Down Expand Up @@ -1816,13 +1816,15 @@ paths:



/v2/gen-ai/agents:
get:
$ref: 'resources/gen-ai/genai_list_agents.yml'


/v2/gen-ai/agents:
post:
$ref: 'resources/gen-ai/genai_create_agent.yml'

get:
$ref: 'resources/gen-ai/genai_list_agents.yml'


/v2/gen-ai/agents/{agent_uuid}/api_keys:
get:
Expand All @@ -1833,12 +1835,12 @@ paths:


/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}:
put:
$ref: 'resources/gen-ai/genai_update_agent_api_key.yml'

delete:
$ref: 'resources/gen-ai/genai_delete_agent_api_key.yml'

put:
$ref: 'resources/gen-ai/genai_update_agent_api_key.yml'


/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}/regenerate:
put:
Expand All @@ -1851,12 +1853,12 @@ paths:


/v2/gen-ai/agents/{agent_uuid}/functions/{function_uuid}:
delete:
$ref: 'resources/gen-ai/genai_detach_agent_function.yml'

put:
$ref: 'resources/gen-ai/genai_update_agent_function.yml'

delete:
$ref: 'resources/gen-ai/genai_detach_agent_function.yml'


/v2/gen-ai/agents/{agent_uuid}/knowledge_bases/{knowledge_base_uuid}:
delete:
Expand Down Expand Up @@ -1898,6 +1900,30 @@ paths:
$ref: 'resources/gen-ai/genai_update_agent_deployment_visibility.yml'


/v2/gen-ai/anthropic/keys:
get:
$ref: 'resources/gen-ai/genai_list_anthropic_api_keys.yml'

post:
$ref: 'resources/gen-ai/genai_create_anthropic_api_key.yml'


/v2/gen-ai/anthropic/keys/{api_key_uuid}:
delete:
$ref: 'resources/gen-ai/genai_delete_anthropic_api_key.yml'

get:
$ref: 'resources/gen-ai/genai_get_anthropic_api_key.yml'

put:
$ref: 'resources/gen-ai/genai_update_anthropic_api_key.yml'


/v2/gen-ai/anthropic/keys/{uuid}/agents:
get:
$ref: 'resources/gen-ai/genai_list_agents_by_anthropic_key.yml'


/v2/gen-ai/indexing_jobs:
get:
$ref: 'resources/gen-ai/genai_list_indexing_jobs.yml'
Expand Down Expand Up @@ -1930,28 +1956,28 @@ paths:


/v2/gen-ai/knowledge_bases/{knowledge_base_uuid}/data_sources:
post:
$ref: 'resources/gen-ai/genai_create_knowledge_base_data_source.yml'

get:
$ref: 'resources/gen-ai/genai_list_knowledge_base_data_sources.yml'

post:
$ref: 'resources/gen-ai/genai_create_knowledge_base_data_source.yml'


/v2/gen-ai/knowledge_bases/{knowledge_base_uuid}/data_sources/{data_source_uuid}:
delete:
$ref: 'resources/gen-ai/genai_delete_knowledge_base_data_source.yml'


/v2/gen-ai/knowledge_bases/{uuid}:
get:
$ref: 'resources/gen-ai/genai_get_knowledge_base.yml'

put:
$ref: 'resources/gen-ai/genai_update_knowledge_base.yml'

delete:
$ref: 'resources/gen-ai/genai_delete_knowledge_base.yml'

get:
$ref: 'resources/gen-ai/genai_get_knowledge_base.yml'


/v2/gen-ai/models:
get:
Expand All @@ -1964,6 +1990,10 @@ paths:







components:
securitySchemes:
bearer_auth:
Expand Down
97 changes: 97 additions & 0 deletions specification/resources/gen-ai/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ apiCreateAgentFromTemplateOutput:
apiCreateAgentInputPublic:
description: Parameters for Agent Creation
properties:
anthropic_key_uuid:
description: Optional Anthropic API key ID to use with Anthropic models
example: '"12345678-1234-1234-1234-123456789012"'
type: string
description:
description: A text description of the agent, not used in inference
example: '"My Agent Description"'
Expand Down Expand Up @@ -714,6 +718,19 @@ apiCreateAgentOutput:
agent:
$ref: '#/apiAgent'
type: object
apiCreateAnthropicAPIKeyInputPublic:
description: CreateAnthropicAPIKeyInputPublic is used to create a new Anthropic
API key for a specific agent.
properties:
api_key:
description: Anthropic API key
example: '"sk-ant-12345678901234567890123456789012"'
type: string
name:
description: Name of the key
example: '"Production Key"'
type: string
type: object
apiCreateAnthropicAPIKeyOutput:
description: CreateAnthropicAPIKeyOutput is used to return the newly created Anthropic
API key.
Expand Down Expand Up @@ -848,6 +865,10 @@ apiDeleteAgentOutput:
agent:
$ref: '#/apiAgent'
type: object
apiDeleteAnthropicAPIKeyInputPublic:
properties:
api_key_uuid:
example: '"12345678-1234-1234-1234-123456789012"'
apiDeleteAnthropicAPIKeyOutput:
description: DeleteAnthropicAPIKeyOutput is used to return the deleted Anthropic
API key.
Expand Down Expand Up @@ -1042,6 +1063,10 @@ apiGetAgentUsageOutput:
usage:
$ref: '#/apiResourceUsage'
type: object
apiGetAnthropicAPIKeyInputPublic:
properties:
api_key_uuid:
example: '"12345678-1234-1234-1234-123456789012"'
apiGetAnthropicAPIKeyOutput:
properties:
api_key_info:
Expand Down Expand Up @@ -1192,6 +1217,40 @@ apiGetResourceLimitsOutput:
format: int64
type: integer
type: object
apiGetResourceUsageOutput:
description: Resource usage output
properties:
agent_count:
description: Total agents used
example: 123
format: int64
type: integer
agent_usage:
description: Agent usage
items:
$ref: '#/apiResourceUsage'
type: array
guardrail_count:
description: Total guardrails used
example: 123
format: int64
type: integer
guardrail_usage:
description: Guardrail usage
items:
$ref: '#/apiResourceUsage'
type: array
indexing_job_usage:
description: Indexing job usage
items:
$ref: '#/apiResourceUsage'
type: array
knowledge_base_count:
description: Total knowledge bases used
example: 123
format: int64
type: integer
type: object
apiGetTeamAgreementOutput:
description: GetTeamAgreementOutput Output
properties:
Expand Down Expand Up @@ -1686,6 +1745,14 @@ apiListAgentTemplatesOutput:
$ref: '#/apiAgentTemplate'
type: array
type: object
apiListAgentsByAnthropicKeyInputPublic:
properties:
page:
example: "1"
per_page:
example: "20"
uuid:
example: '"12345678-1234-1234-1234-123456789012"'
apiListAgentsByAnthropicKeyOutput:
description: List of Agents that linked to a specific Anthropic Key
properties:
Expand Down Expand Up @@ -1732,6 +1799,12 @@ apiListAgentsOutputPublic:
meta:
$ref: '#/apiMeta'
type: object
apiListAnthropicAPIKeysInputPublic:
properties:
page:
example: "1"
per_page:
example: "20"
apiListAnthropicAPIKeysOutput:
description: ListAnthropicAPIKeysOutput is used to return the list of Anthropic
API keys for a specific agent.
Expand Down Expand Up @@ -2214,6 +2287,9 @@ apiResourceUsage:
items:
$ref: '#/apiUsageMeasurement'
type: array
resource_uuid:
example: '"123e4567-e89b-12d3-a456-426614174000"'
type: string
start:
example: "2023-01-01T00:00:00Z"
format: date-time
Expand Down Expand Up @@ -2409,6 +2485,10 @@ apiUpdateAgentFunctionOutput:
apiUpdateAgentInputPublic:
description: Data to modify an existing Agent
properties:
anthropic_key_uuid:
description: Optional anthropic key uuid for use with anthropic models
example: '"12345678-1234-1234-1234-123456789012"'
type: string
description:
description: Agent description
example: '"My Agent Description"'
Expand Down Expand Up @@ -2477,6 +2557,23 @@ apiUpdateAgentOutput:
agent:
$ref: '#/apiAgent'
type: object
apiUpdateAnthropicAPIKeyInputPublic:
description: UpdateAnthropicAPIKeyInputPublic is used to update an existing Anthropic
API key for a specific agent.
properties:
api_key:
description: Anthropic API key
example: '"sk-ant-12345678901234567890123456789012"'
type: string
api_key_uuid:
description: API key ID
example: '"12345678-1234-1234-1234-123456789012"'
type: string
name:
description: Name of the key
example: '"Production Key"'
type: string
type: object
apiUpdateAnthropicAPIKeyOutput:
description: UpdateAnthropicAPIKeyOutput is used to return the updated Anthropic
API key.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
lang: cURL
source: |-
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $PREVIEW_API_TOKEN" \
"https://api.digitalocean.com/v2/gen-ai/anthropic/keys" \
-d '{
"api_key": "sk-ant-12345678901234567890123456789012",
"name": "test-key"
}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lang: cURL
source: |-
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $PREVIEW_API_TOKEN" \
"https://api.digitalocean.com/v2/gen-ai/anthropic/keys/11efb7d6-cdb5-6388-bf8f-4e013e2ddde4"
Loading

0 comments on commit 25f2388

Please sign in to comment.