-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutputs.tf
More file actions
87 lines (73 loc) · 2.89 KB
/
outputs.tf
File metadata and controls
87 lines (73 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# =============================================================================
# Outputs for Team OpenCode Setup
# =============================================================================
output "server_ips" {
description = "Public IP addresses of the vLLM servers"
value = [for ip in openstack_compute_floatingip_associate_v2.fip : ip.floating_ip]
}
output "ssh_commands" {
description = "SSH commands to connect to the servers"
value = [for ip in openstack_compute_floatingip_associate_v2.fip : "ssh -i ./id_rsa ubuntu@${ip.floating_ip} -o IdentitiesOnly=yes"]
}
output "vllm_api_key" {
description = "API key for vLLM authentication (share securely with your team)"
value = local.vllm_api_key
sensitive = true
}
output "vllm_base_url" {
description = "Base URL for the vLLM OpenAI-compatible API"
value = [for ip in openstack_compute_floatingip_associate_v2.fip : "https://${ip.floating_ip}/v1"]
}
output "opencode_config" {
description = "OpenCode configuration snippet for team members"
value = <<-EOT
================================================================================
OPENCODE CONFIGURATION FOR TEAM MEMBERS
================================================================================
Add this to your ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"leafcloud": {
"npm": "@ai-sdk/openai-compatible",
"name": "Leafcloud Team LLM",
"options": {
"baseURL": "https://${openstack_compute_floatingip_associate_v2.fip[0].floating_ip}/v1",
"apiKey": "<RUN: terraform output -raw vllm_api_key>"
},
"models": {
"${var.vllm_model}": {
"name": "${local.model_display_name}",
"limit": {
"context": ${var.vllm_max_model_len},
"output": 16384
}
}
}
}
},
"model": "leafcloud/${var.vllm_model}"
}
================================================================================
QUICK START
================================================================================
1. Get the API key:
terraform output -raw vllm_api_key
2. Test the API:
curl -k https://${openstack_compute_floatingip_associate_v2.fip[0].floating_ip}/v1/models \
-H "Authorization: Bearer $(terraform output -raw vllm_api_key)"
3. Start OpenCode:
opencode
================================================================================
EOT
sensitive = true
}
output "model_info" {
description = "Information about the deployed model"
value = {
model_id = var.vllm_model
display_name = local.model_display_name
max_context = var.vllm_max_model_len
gpu_flavor = var.vm_flavor_name
}
}