diff --git a/aichat/.config/aichat/.env~ b/aichat/.config/aichat/.env~ new file mode 100644 index 0000000..9832fb9 --- /dev/null +++ b/aichat/.config/aichat/.env~ @@ -0,0 +1 @@ +CLAUDE_API_KEY=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 diff --git a/aichat/.config/aichat/config.yaml b/aichat/.config/aichat/config.yaml index 1a2f496..0f5e624 100644 --- a/aichat/.config/aichat/config.yaml +++ b/aichat/.config/aichat/config.yaml @@ -3,8 +3,9 @@ # set API keys via environment variables, like CLAUDE_API_KEY # environment variables for aichat can be set at ~/.config/aichat/.env -model: claude +model: claude:claude-sonnet-4-5-20250929 keybindings: vi -prelude: role:cloudops +repl_prelude: role:cloudops clients: - type: claude +- type: gemini diff --git a/aichat/.config/aichat/foo b/aichat/.config/aichat/foo new file mode 100644 index 0000000..d7142f8 --- /dev/null +++ b/aichat/.config/aichat/foo @@ -0,0 +1,14 @@ +I have a google spreadsheet with personal contact information (name, phone +number, address, etc) for a group or people. The columns are: + +``` +name first last mobile email street1 street2 city state zip hphone oemail children member exclude inactive +``` + +The last three columns are checkboxes. + +I wish to construct a new tab in the spreadsheet that lists all the contacts who are: +- not inactive +- not excluded + +How can I accomplish this? diff --git a/aichat/.config/aichat/models-override.yaml b/aichat/.config/aichat/models-override.yaml new file mode 100644 index 0000000..28a13e8 --- /dev/null +++ b/aichat/.config/aichat/models-override.yaml @@ -0,0 +1,2477 @@ +version: 0.29.0 +list: +- provider: openai + models: + - name: gpt-5 + type: chat + max_input_tokens: 400000 + input_price: 1.25 + output_price: 10.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-5-chat-latest + type: chat + max_input_tokens: 400000 + input_price: 1.25 + output_price: 10.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-5-mini + type: chat + max_input_tokens: 400000 + input_price: 0.25 + output_price: 2.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-5-nano + type: chat + max_input_tokens: 400000 + input_price: 0.05 + output_price: 0.4 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-5-codex + type: chat + max_input_tokens: 400000 + input_price: 1.25 + output_price: 10.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-4.1 + type: chat + max_input_tokens: 1047576 + input_price: 2.0 + output_price: 8.0 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: gpt-4.1-mini + type: chat + max_input_tokens: 1047576 + input_price: 0.4 + output_price: 1.6 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: gpt-4.1-nano + type: chat + max_input_tokens: 1047576 + input_price: 0.1 + output_price: 0.4 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: gpt-4o + type: chat + max_input_tokens: 128000 + input_price: 2.5 + output_price: 10.0 + max_output_tokens: 16384 + supports_vision: true + supports_function_calling: true + - name: gpt-4o-mini + type: chat + max_input_tokens: 128000 + input_price: 0.15 + output_price: 0.6 + max_output_tokens: 16384 + supports_vision: true + supports_function_calling: true + - name: o4-mini + type: chat + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o4-mini-high + type: chat + real_name: o4-mini + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + reasoning_effort: high + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3 + type: chat + max_input_tokens: 200000 + input_price: 2.0 + output_price: 8.0 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3-high + type: chat + real_name: o3 + max_input_tokens: 200000 + input_price: 2.0 + output_price: 8.0 + patch: + body: + reasoning_effort: high + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3-mini + type: chat + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3-mini-high + type: chat + real_name: o3-mini + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + reasoning_effort: high + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: gpt-4-turbo + type: chat + max_input_tokens: 128000 + input_price: 10.0 + output_price: 30.0 + max_output_tokens: 4096 + supports_vision: true + supports_function_calling: true + - name: gpt-3.5-turbo + type: chat + max_input_tokens: 16385 + input_price: 0.5 + output_price: 1.5 + max_output_tokens: 4096 + supports_function_calling: true + - name: text-embedding-3-large + type: embedding + input_price: 0.13 + max_tokens_per_chunk: 8191 + default_chunk_size: 2000 + max_batch_size: 100 + - name: text-embedding-3-small + type: embedding + input_price: 0.02 + max_tokens_per_chunk: 8191 + default_chunk_size: 2000 + max_batch_size: 100 +- provider: gemini + models: + - name: gemini-2.5-flash + type: chat + max_input_tokens: 1048576 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 65536 + supports_vision: true + supports_function_calling: true + - name: gemini-2.5-pro + type: chat + max_input_tokens: 1048576 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 65536 + supports_vision: true + supports_function_calling: true + - name: gemini-2.5-flash-lite + type: chat + max_input_tokens: 1000000 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 64000 + supports_vision: true + supports_function_calling: true + - name: gemini-2.0-flash + type: chat + max_input_tokens: 1048576 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 8192 + supports_vision: true + supports_function_calling: true + - name: gemini-2.0-flash-lite + type: chat + max_input_tokens: 1048576 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 8192 + supports_vision: true + supports_function_calling: true + - name: gemma-3-27b-it + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 8192 + - name: text-embedding-004 + type: embedding + input_price: 0.0 + max_tokens_per_chunk: 2048 + default_chunk_size: 1500 + max_batch_size: 100 +- provider: claude + models: + - name: claude-sonnet-4-5-20250929 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-sonnet-4-5-20250929:thinking + type: chat + real_name: claude-sonnet-4-5-20250929 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-opus-4-1-20250805 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-opus-4-1-20250805:thinking + type: chat + real_name: claude-opus-4-1-20250805 + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-opus-4-20250514 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-opus-4-20250514:thinking + type: chat + real_name: claude-opus-4-20250514 + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-sonnet-4-20250514 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-sonnet-4-20250514:thinking + type: chat + real_name: claude-sonnet-4-20250514 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-3-7-sonnet-20250219 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-3-7-sonnet-20250219:thinking + type: chat + real_name: claude-3-7-sonnet-20250219 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: claude-3-5-haiku-20241022 + type: chat + max_input_tokens: 200000 + input_price: 0.8 + output_price: 4.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true +- provider: mistral + models: + - name: mistral-medium-latest + type: chat + max_input_tokens: 131072 + input_price: 0.4 + output_price: 2.0 + supports_vision: true + supports_function_calling: true + - name: mistral-small-latest + type: chat + max_input_tokens: 32768 + input_price: 0.1 + output_price: 0.3 + supports_vision: true + supports_function_calling: true + - name: magistral-medium-latest + type: chat + max_input_tokens: 40960 + input_price: 2.0 + output_price: 5.0 + - name: magistral-small-latest + type: chat + max_input_tokens: 40960 + input_price: 0.5 + output_price: 1.5 + - name: devstral-medium-latest + type: chat + max_input_tokens: 256000 + input_price: 0.4 + output_price: 2.0 + supports_function_calling: true + - name: devstral-small-latest + type: chat + max_input_tokens: 256000 + input_price: 0.1 + output_price: 0.3 + supports_function_calling: true + - name: codestral-latest + type: chat + max_input_tokens: 256000 + input_price: 0.3 + output_price: 0.9 + supports_function_calling: true + - name: mistral-embed + type: embedding + max_input_tokens: 8092 + input_price: 0.1 + max_tokens_per_chunk: 8092 + default_chunk_size: 2000 +- provider: ai21 + models: + - name: jamba-large + type: chat + max_input_tokens: 256000 + input_price: 2.0 + output_price: 8.0 + supports_function_calling: true + - name: jamba-mini + type: chat + max_input_tokens: 256000 + input_price: 0.2 + output_price: 0.4 + supports_function_calling: true +- provider: cohere + models: + - name: command-a-03-2025 + type: chat + max_input_tokens: 262144 + input_price: 2.5 + output_price: 10.0 + max_output_tokens: 8192 + supports_function_calling: true + - name: command-a-reasoning-08-2025 + type: chat + max_input_tokens: 262144 + input_price: 2.5 + output_price: 10.0 + max_output_tokens: 32768 + - name: command-a-vision-07-2025 + type: chat + max_input_tokens: 131072 + input_price: 2.5 + output_price: 10.0 + max_output_tokens: 8192 + supports_vision: true + - name: command-r7b-12-2024 + type: chat + max_input_tokens: 131072 + input_price: 0.0375 + output_price: 0.15 + max_output_tokens: 4096 + - name: embed-v4.0 + type: embedding + input_price: 0.12 + max_tokens_per_chunk: 2048 + default_chunk_size: 2000 + max_batch_size: 96 + - name: embed-english-v3.0 + type: embedding + input_price: 0.1 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 96 + - name: embed-multilingual-v3.0 + type: embedding + input_price: 0.1 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 96 + - name: rerank-v3.5 + type: reranker + max_input_tokens: 4096 + - name: rerank-english-v3.0 + type: reranker + max_input_tokens: 4096 + - name: rerank-multilingual-v3.0 + type: reranker + max_input_tokens: 4096 +- provider: xai + models: + - name: grok-4 + type: chat + max_input_tokens: 256000 + input_price: 3.0 + output_price: 15.0 + supports_function_calling: true + - name: grok-4-fast-non-reasoning + type: chat + max_input_tokens: 2000000 + input_price: 0.2 + output_price: 0.5 + supports_function_calling: true + - name: grok-4-fast-reasoning + type: chat + max_input_tokens: 2000000 + input_price: 0.2 + output_price: 0.5 + supports_function_calling: true + - name: grok-code-fast + type: chat + max_input_tokens: 256000 + input_price: 0.2 + output_price: 1.5 + supports_function_calling: true + - name: grok-3 + type: chat + max_input_tokens: 131072 + input_price: 3.0 + output_price: 15.0 + supports_function_calling: true + - name: grok-3-mini + type: chat + max_input_tokens: 131072 + input_price: 0.3 + output_price: 0.5 + supports_function_calling: true +- provider: perplexity + models: + - name: sonar-pro + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + - name: sonar + type: chat + max_input_tokens: 128000 + input_price: 1.0 + output_price: 1.0 + - name: sonar-reasoning-pro + type: chat + max_input_tokens: 128000 + input_price: 2.0 + output_price: 8.0 + - name: sonar-reasoning + type: chat + max_input_tokens: 128000 + input_price: 1.0 + output_price: 5.0 + - name: sonar-deep-research + type: chat + max_input_tokens: 128000 + input_price: 2.0 + output_price: 8.0 +- provider: groq + models: + - name: openai/gpt-oss-120b + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + supports_function_calling: true + - name: openai/gpt-oss-20b + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + supports_function_calling: true + - name: meta-llama/llama-4-maverick-17b-128e-instruct + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + supports_vision: true + supports_function_calling: true + - name: meta-llama/llama-4-scout-17b-16e-instruct + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + supports_vision: true + supports_function_calling: true + - name: llama-3.3-70b-versatile + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + supports_function_calling: true + - name: moonshotai/kimi-k2-instruct-0905 + type: chat + max_input_tokens: 262144 + input_price: 0.0 + output_price: 0.0 + supports_function_calling: true + - name: qwen/qwen3-32b + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + - name: groq/compound + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + - name: groq/compound-mini + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 +- provider: vertexai + models: + - name: gemini-2.5-flash + type: chat + max_input_tokens: 1048576 + input_price: 0.3 + output_price: 2.5 + max_output_tokens: 65536 + supports_vision: true + supports_function_calling: true + - name: gemini-2.5-pro + type: chat + max_input_tokens: 1048576 + input_price: 1.25 + output_price: 10.0 + max_output_tokens: 65536 + supports_vision: true + supports_function_calling: true + - name: gemini-2.5-flash-lite + type: chat + max_input_tokens: 1048576 + input_price: 0.3 + output_price: 0.4 + max_output_tokens: 65536 + supports_vision: true + supports_function_calling: true + - name: gemini-2.0-flash-001 + type: chat + max_input_tokens: 1048576 + input_price: 0.15 + output_price: 0.6 + max_output_tokens: 8192 + supports_vision: true + supports_function_calling: true + - name: gemini-2.0-flash-lite-001 + type: chat + max_input_tokens: 1048576 + input_price: 0.075 + output_price: 0.3 + max_output_tokens: 8192 + supports_vision: true + supports_function_calling: true + - name: claude-sonnet-4-5@20250929 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-sonnet-4-5@20250929:thinking + type: chat + real_name: claude-sonnet-4-5@20250929 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: claude-opus-4-1@20250805 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-opus-4-1@20250805:thinking + type: chat + real_name: claude-opus-4-1@20250805 + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: claude-opus-4@20250514 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-opus-4@20250514:thinking + type: chat + real_name: claude-opus-4@20250514 + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: claude-sonnet-4@20250514 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-sonnet-4@20250514:thinking + type: chat + real_name: claude-sonnet-4@20250514 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: claude-3-7-sonnet@20250219 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: claude-3-7-sonnet@20250219:thinking + type: chat + real_name: claude-3-7-sonnet@20250219 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + temperature: null + top_p: null + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: claude-3-5-haiku@20241022 + type: chat + max_input_tokens: 200000 + input_price: 0.8 + output_price: 4.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: mistral-small-2503 + type: chat + max_input_tokens: 32000 + input_price: 0.1 + output_price: 0.3 + supports_function_calling: true + - name: codestral-2501 + type: chat + max_input_tokens: 256000 + input_price: 0.3 + output_price: 0.9 + supports_function_calling: true + - name: text-embedding-005 + type: embedding + max_input_tokens: 20000 + input_price: 0.025 + max_tokens_per_chunk: 2048 + default_chunk_size: 1500 + max_batch_size: 5 + - name: text-multilingual-embedding-002 + type: embedding + max_input_tokens: 20000 + input_price: 0.2 + max_tokens_per_chunk: 2048 + default_chunk_size: 1500 + max_batch_size: 5 +- provider: bedrock + models: + - name: us.anthropic.claude-sonnet-4-5-20250929-v1:0 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.anthropic.claude-sonnet-4-5-20250929-v1:0:thinking + type: chat + real_name: us.anthropic.claude-sonnet-4-5-20250929-v1:0 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + inferenceConfig: + temperature: null + topP: null + additionalModelRequestFields: + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: us.anthropic.claude-opus-4-1-20250805-v1:0 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.anthropic.claude-opus-4-1-20250805-v1:0:thinking + type: chat + real_name: us.anthropic.claude-opus-4-1-20250805-v1:0 + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + patch: + body: + inferenceConfig: + temperature: null + topP: null + additionalModelRequestFields: + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: us.anthropic.claude-opus-4-20250514-v1:0 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.anthropic.claude-opus-4-20250514-v1:0:thinking + type: chat + real_name: us.anthropic.claude-opus-4-20250514-v1:0 + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + patch: + body: + inferenceConfig: + temperature: null + topP: null + additionalModelRequestFields: + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: us.anthropic.claude-sonnet-4-20250514-v1:0 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.anthropic.claude-sonnet-4-20250514-v1:0:thinking + type: chat + real_name: us.anthropic.claude-sonnet-4-20250514-v1:0 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + inferenceConfig: + temperature: null + topP: null + additionalModelRequestFields: + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: us.anthropic.claude-3-7-sonnet-20250219-v1:0 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.anthropic.claude-3-7-sonnet-20250219-v1:0:thinking + type: chat + real_name: us.anthropic.claude-3-7-sonnet-20250219-v1:0 + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + patch: + body: + inferenceConfig: + temperature: null + topP: null + additionalModelRequestFields: + thinking: + type: enabled + budget_tokens: 16000 + max_output_tokens: 24000 + require_max_tokens: true + supports_vision: true + - name: anthropic.claude-3-5-haiku-20241022-v1:0 + type: chat + max_input_tokens: 200000 + input_price: 0.8 + output_price: 4.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.meta.llama4-maverick-17b-instruct-v1:0 + type: chat + max_input_tokens: 131072 + input_price: 0.24 + output_price: 0.97 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.meta.llama4-scout-17b-instruct-v1:0 + type: chat + max_input_tokens: 131072 + input_price: 0.17 + output_price: 0.66 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: us.meta.llama3-3-70b-instruct-v1:0 + type: chat + max_input_tokens: 131072 + input_price: 0.72 + output_price: 0.72 + max_output_tokens: 8192 + require_max_tokens: true + supports_function_calling: true + - name: us.amazon.nova-premier-v1:0 + type: chat + max_input_tokens: 300000 + input_price: 2.5 + output_price: 12.5 + max_output_tokens: 5120 + - name: us.amazon.nova-pro-v1:0 + type: chat + max_input_tokens: 300000 + input_price: 0.8 + output_price: 3.2 + max_output_tokens: 5120 + supports_vision: true + - name: us.amazon.nova-lite-v1:0 + type: chat + max_input_tokens: 300000 + input_price: 0.06 + output_price: 0.24 + max_output_tokens: 5120 + supports_vision: true + - name: us.amazon.nova-micro-v1:0 + type: chat + max_input_tokens: 128000 + input_price: 0.035 + output_price: 0.14 + max_output_tokens: 5120 + - name: cohere.embed-english-v3 + type: embedding + input_price: 0.1 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 96 + - name: cohere.embed-multilingual-v3 + type: embedding + input_price: 0.1 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 96 + - name: us.deepseek.r1-v1:0 + type: chat + max_input_tokens: 128000 + input_price: 1.35 + output_price: 5.4 +- provider: cloudflare + models: + - name: '@cf/meta/llama-4-scout-17b-16e-instruct' + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 2048 + require_max_tokens: true + - name: '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 2048 + require_max_tokens: true + - name: '@cf/qwen/qwen2.5-coder-32b-instruct' + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 2048 + require_max_tokens: true + - name: '@cf/google/gemma-3-12b-it' + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 2048 + require_max_tokens: true + - name: '@cf/mistralai/mistral-small-3.1-24b-instruct' + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + max_output_tokens: 2048 + require_max_tokens: true + - name: '@cf/baai/bge-large-en-v1.5' + type: embedding + input_price: 0.0 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 100 +- provider: ernie + models: + - name: ernie-4.5-turbo-128k + type: chat + max_input_tokens: 131072 + input_price: 0.112 + output_price: 0.448 + - name: ernie-4.5-turbo-vl-32k + type: chat + max_input_tokens: 32768 + input_price: 0.42 + output_price: 1.26 + supports_vision: true + - name: ernie-x1-turbo-32k + type: chat + max_input_tokens: 32768 + input_price: 0.14 + output_price: 0.56 + - name: bge-large-zh + type: embedding + input_price: 0.07 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 16 + - name: bge-large-en + type: embedding + input_price: 0.07 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 16 + - name: bce-reranker-base + type: reranker + max_input_tokens: 1024 + input_price: 0.07 +- provider: qianwen + models: + - name: qwen-max-latest + type: chat + max_input_tokens: 32678 + input_price: 1.6 + output_price: 6.4 + max_output_tokens: 8192 + supports_function_calling: true + - name: qwen-plus-latest + type: chat + max_input_tokens: 131072 + input_price: 0.112 + output_price: 0.28 + max_output_tokens: 8192 + supports_function_calling: true + - name: qwen-turbo-latest + type: chat + max_input_tokens: 1000000 + input_price: 0.042 + output_price: 0.084 + max_output_tokens: 8192 + supports_function_calling: true + - name: qwen-long + type: chat + max_input_tokens: 1000000 + input_price: 0.07 + output_price: 0.28 + - name: qwen-omni-turbo-latest + type: chat + max_input_tokens: 32768 + max_output_tokens: 2048 + supports_vision: true + - name: qwen-coder-plus-latest + type: chat + max_input_tokens: 131072 + input_price: 0.49 + output_price: 0.98 + max_output_tokens: 8192 + - name: qwen-coder-turbo-latest + type: chat + max_input_tokens: 131072 + input_price: 0.28 + output_price: 0.84 + max_output_tokens: 8192 + - name: qwen-vl-max-latest + type: chat + max_input_tokens: 30720 + input_price: 0.42 + output_price: 1.26 + max_output_tokens: 2048 + supports_vision: true + - name: qwen-vl-plus-latest + type: chat + max_input_tokens: 30000 + input_price: 0.21 + output_price: 0.63 + max_output_tokens: 2048 + supports_vision: true + - name: qwen3-max + type: chat + max_input_tokens: 262144 + input_price: 2.1 + output_price: 8.4 + supports_function_calling: true + - name: qwen3-vl-plus + type: chat + max_input_tokens: 262144 + input_price: 0.42 + output_price: 4.2 + supports_vision: true + - name: qwen3-max-preview + type: chat + max_input_tokens: 262144 + input_price: 1.4 + output_price: 5.6 + max_output_tokens: 32768 + supports_function_calling: true + - name: qwen3-next-80b-a3b-instruct + type: chat + max_input_tokens: 131072 + input_price: 0.14 + output_price: 0.56 + supports_function_calling: true + - name: qwen3-next-80b-a3b-thinking + type: chat + max_input_tokens: 131072 + input_price: 0.14 + output_price: 1.4 + - name: qwen3-235b-a22b-instruct-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.28 + output_price: 1.12 + supports_function_calling: true + - name: qwen3-235b-a22b-thinking-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.28 + output_price: 2.8 + - name: qwen3-30b-a3b-instruct-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.105 + output_price: 0.42 + supports_function_calling: true + - name: qwen3-30b-a3b-thinking-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.105 + output_price: 1.05 + - name: qwen3-coder-480b-a35b-instruct + type: chat + max_input_tokens: 262144 + input_price: 1.26 + output_price: 5.04 + - name: qwen3-coder-30b-a3b-instruct + type: chat + max_input_tokens: 262144 + input_price: 0.315 + output_price: 1.26 + - name: qwen2.5-72b-instruct + type: chat + max_input_tokens: 129024 + input_price: 0.56 + output_price: 1.68 + max_output_tokens: 8192 + supports_function_calling: true + - name: qwen2.5-vl-72b-instruct + type: chat + max_input_tokens: 129024 + input_price: 2.24 + output_price: 6.72 + max_output_tokens: 8192 + supports_vision: true + - name: qwen2.5-coder-32b-instruct + type: chat + max_input_tokens: 129024 + input_price: 0.49 + output_price: 0.98 + max_output_tokens: 8192 + supports_function_calling: true + - name: deepseek-v3.1 + type: chat + max_input_tokens: 131072 + input_price: 0.28 + output_price: 1.12 + - name: deepseek-r1-0528 + type: chat + max_input_tokens: 65536 + input_price: 0.28 + output_price: 1.12 + - name: text-embedding-v4 + type: embedding + input_price: 0.1 + max_tokens_per_chunk: 8192 + default_chunk_size: 2000 + max_batch_size: 10 + - name: text-embedding-v3 + type: embedding + input_price: 0.1 + max_tokens_per_chunk: 8192 + default_chunk_size: 2000 + max_batch_size: 10 +- provider: hunyuan + models: + - name: hunyuan-turbos-latest + type: chat + max_input_tokens: 28000 + input_price: 0.112 + output_price: 0.28 + supports_function_calling: true + - name: hunyuan-t1-latest + type: chat + max_input_tokens: 28000 + input_price: 0.14 + output_price: 0.56 + - name: hunyuan-lite + type: chat + max_input_tokens: 250000 + input_price: 0.0 + output_price: 0.0 + supports_function_calling: true + - name: hunyuan-turbos-vision + type: chat + max_input_tokens: 6144 + input_price: 0.42 + output_price: 0.84 + supports_vision: true + - name: hunyuan-t1-vision + type: chat + max_input_tokens: 24000 + supports_vision: true + - name: hunyuan-embedding + type: embedding + input_price: 0.01 + max_tokens_per_chunk: 1024 + default_chunk_size: 1000 + max_batch_size: 100 +- provider: moonshot + models: + - name: kimi-latest + type: chat + max_input_tokens: 131072 + input_price: 1.4 + output_price: 4.2 + supports_vision: true + supports_function_calling: true + - name: kimi-k2-0905-preview + type: chat + max_input_tokens: 262144 + input_price: 0.56 + output_price: 2.24 + supports_vision: true + supports_function_calling: true + - name: kimi-k2-turbo-preview + type: chat + max_input_tokens: 131072 + input_price: 1.12 + output_price: 4.48 + supports_vision: true + supports_function_calling: true + - name: kimi-thinking-preview + type: chat + max_input_tokens: 131072 + input_price: 28.0 + output_price: 28.0 + supports_vision: true +- provider: deepseek + models: + - name: deepseek-chat + type: chat + max_input_tokens: 64000 + input_price: 0.56 + output_price: 1.68 + max_output_tokens: 8192 + supports_function_calling: true + - name: deepseek-reasoner + type: chat + max_input_tokens: 64000 + input_price: 0.56 + output_price: 1.68 + max_output_tokens: 32768 +- provider: zhipuai + models: + - name: glm-4.5 + type: chat + max_input_tokens: 202752 + input_price: 0.28 + output_price: 1.12 + supports_function_calling: true + - name: glm-4.5 + type: chat + max_input_tokens: 131072 + input_price: 0.28 + output_price: 1.12 + - name: glm-4.5-x + type: chat + max_input_tokens: 131072 + input_price: 1.12 + output_price: 4.48 + supports_function_calling: true + - name: glm-4.5-air + type: chat + max_input_tokens: 131072 + input_price: 0.084 + output_price: 0.56 + - name: glm-4.5-airx + type: chat + max_input_tokens: 131072 + input_price: 0.56 + output_price: 2.24 + supports_function_calling: true + - name: glm-4.5-flash + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + - name: glm-4.5v + type: chat + max_input_tokens: 65536 + input_price: 0.56 + output_price: 1.68 + supports_vision: true + - name: glm-z1-air + type: chat + max_input_tokens: 131072 + input_price: 0.07 + output_price: 0.07 + - name: glm-z1-airx + type: chat + max_input_tokens: 131072 + input_price: 0.7 + output_price: 0.7 + - name: glm-z1-flashx + type: chat + max_input_tokens: 131072 + input_price: 0.014 + output_price: 0.014 + - name: glm-z1-flash + type: chat + max_input_tokens: 131072 + input_price: 0.0 + output_price: 0.0 + - name: embedding-3 + type: embedding + max_input_tokens: 8192 + input_price: 0.07 + max_tokens_per_chunk: 8192 + default_chunk_size: 2000 + - name: rerank + type: reranker + max_input_tokens: 4096 + input_price: 0.112 +- provider: minimax + models: + - name: minimax-text-01 + type: chat + max_input_tokens: 1000192 + input_price: 0.14 + output_price: 1.12 + supports_vision: true + - name: minimax-m1 + type: chat + max_input_tokens: 131072 + input_price: 0.112 + output_price: 1.12 +- provider: openrouter + models: + - name: openai/gpt-5 + type: chat + max_input_tokens: 400000 + input_price: 1.25 + output_price: 10.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-5-chat + type: chat + max_input_tokens: 400000 + input_price: 1.25 + output_price: 10.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-5-mini + type: chat + max_input_tokens: 400000 + input_price: 0.25 + output_price: 2.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-5-nano + type: chat + max_input_tokens: 400000 + input_price: 0.05 + output_price: 0.4 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-5-codex + type: chat + max_input_tokens: 400000 + input_price: 1.25 + output_price: 10.0 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-4.1 + type: chat + max_input_tokens: 1047576 + input_price: 2.0 + output_price: 8.0 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-4.1-mini + type: chat + max_input_tokens: 1047576 + input_price: 0.4 + output_price: 1.6 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-4.1-nano + type: chat + max_input_tokens: 1047576 + input_price: 0.1 + output_price: 0.4 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-4o + type: chat + max_input_tokens: 128000 + input_price: 2.5 + output_price: 10.0 + supports_vision: true + supports_function_calling: true + - name: openai/gpt-4o-mini + type: chat + max_input_tokens: 128000 + input_price: 0.15 + output_price: 0.6 + supports_vision: true + supports_function_calling: true + - name: openai/o4-mini + type: chat + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: openai/o4-mini-high + type: chat + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + reasoning_effort: high + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: openai/o3 + type: chat + max_input_tokens: 200000 + input_price: 2.0 + output_price: 8.0 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: openai/o3-high + type: chat + real_name: openai/o3 + max_input_tokens: 200000 + input_price: 2.0 + output_price: 8.0 + patch: + body: + reasoning_effort: high + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: openai/o3-mini + type: chat + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: openai/o3-mini-high + type: chat + max_input_tokens: 200000 + input_price: 1.1 + output_price: 4.4 + patch: + body: + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: openai/gpt-oss-120b + type: chat + max_input_tokens: 131072 + input_price: 0.09 + output_price: 0.45 + supports_function_calling: true + - name: openai/gpt-oss-20b + type: chat + max_input_tokens: 131072 + input_price: 0.04 + output_price: 0.16 + supports_function_calling: true + - name: google/gemini-2.5-flash + type: chat + max_input_tokens: 1048576 + input_price: 0.3 + output_price: 2.5 + supports_vision: true + supports_function_calling: true + - name: google/gemini-2.5-pro + type: chat + max_input_tokens: 1048576 + input_price: 1.25 + output_price: 10.0 + supports_vision: true + supports_function_calling: true + - name: google/gemini-2.5-flash-lite + type: chat + max_input_tokens: 1048576 + input_price: 0.3 + output_price: 0.4 + supports_vision: true + - name: google/gemini-2.0-flash-001 + type: chat + max_input_tokens: 1000000 + input_price: 0.15 + output_price: 0.6 + supports_vision: true + supports_function_calling: true + - name: google/gemini-2.0-flash-lite-001 + type: chat + max_input_tokens: 1048576 + input_price: 0.075 + output_price: 0.3 + supports_vision: true + supports_function_calling: true + - name: google/gemma-3-27b-it + type: chat + max_input_tokens: 131072 + input_price: 0.1 + output_price: 0.2 + - name: anthropic/claude-sonnet-4.5 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: anthropic/claude-opus-4.1 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: anthropic/claude-opus-4 + type: chat + max_input_tokens: 200000 + input_price: 15.0 + output_price: 75.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: anthropic/claude-sonnet-4 + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: anthropic/claude-3.7-sonnet + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: anthropic/claude-3.5-haiku + type: chat + max_input_tokens: 200000 + input_price: 0.8 + output_price: 4.0 + max_output_tokens: 8192 + require_max_tokens: true + supports_vision: true + supports_function_calling: true + - name: meta-llama/llama-4-maverick + type: chat + max_input_tokens: 1048576 + input_price: 0.18 + output_price: 0.6 + supports_vision: true + supports_function_calling: true + - name: meta-llama/llama-4-scout + type: chat + max_input_tokens: 327680 + input_price: 0.08 + output_price: 0.3 + supports_vision: true + supports_function_calling: true + - name: meta-llama/llama-3.3-70b-instruct + type: chat + max_input_tokens: 131072 + input_price: 0.12 + output_price: 0.3 + - name: mistralai/mistral-medium-3.1 + type: chat + max_input_tokens: 131072 + input_price: 0.4 + output_price: 2.0 + supports_vision: true + supports_function_calling: true + - name: mistralai/mistral-small-3.2-24b-instruct + type: chat + max_input_tokens: 131072 + input_price: 0.1 + output_price: 0.3 + supports_vision: true + - name: mistralai/magistral-medium-2506 + type: chat + max_input_tokens: 40960 + input_price: 2.0 + output_price: 5.0 + - name: mistralai/magistral-medium-2506:thinking + type: chat + max_input_tokens: 40960 + input_price: 2.0 + output_price: 5.0 + - name: mistralai/magistral-small-2506 + type: chat + max_input_tokens: 40960 + input_price: 0.5 + output_price: 1.5 + - name: mistralai/devstral-medium + type: chat + max_input_tokens: 131072 + input_price: 0.4 + output_price: 2.0 + supports_function_calling: true + - name: mistralai/devstral-small + type: chat + max_input_tokens: 131072 + input_price: 0.07 + output_price: 0.28 + supports_function_calling: true + - name: mistralai/codestral-2508 + type: chat + max_input_tokens: 256000 + input_price: 0.3 + output_price: 0.9 + supports_function_calling: true + - name: ai21/jamba-large-1.7 + type: chat + max_input_tokens: 256000 + input_price: 2.0 + output_price: 8.0 + supports_function_calling: true + - name: ai21/jamba-mini-1.7 + type: chat + max_input_tokens: 256000 + input_price: 0.2 + output_price: 0.4 + supports_function_calling: true + - name: cohere/command-a + type: chat + max_input_tokens: 256000 + input_price: 2.5 + output_price: 10.0 + supports_function_calling: true + - name: cohere/command-r7b-12-2024 + type: chat + max_input_tokens: 128000 + input_price: 0.0375 + output_price: 0.15 + max_output_tokens: 4096 + - name: deepseek/deepseek-v3.2-exp + type: chat + max_input_tokens: 163840 + input_price: 0.27 + output_price: 0.4 + - name: deepseek/deepseek-v3.1-terminus + type: chat + max_input_tokens: 163840 + input_price: 0.23 + output_price: 0.9 + - name: deepseek/deepseek-chat-v3.1 + type: chat + max_input_tokens: 163840 + input_price: 0.2 + output_price: 0.8 + - name: deepseek/deepseek-r1-0528 + type: chat + max_input_tokens: 128000 + input_price: 0.5 + output_price: 2.15 + patch: + body: + include_reasoning: true + - name: qwen/qwen-max + type: chat + max_input_tokens: 32768 + input_price: 1.6 + output_price: 6.4 + max_output_tokens: 8192 + supports_function_calling: true + - name: qwen/qwen-plus + type: chat + max_input_tokens: 131072 + input_price: 0.4 + output_price: 1.2 + max_output_tokens: 8192 + supports_function_calling: true + - name: qwen/qwen-turbo + type: chat + max_input_tokens: 1000000 + input_price: 0.05 + output_price: 0.2 + max_output_tokens: 8192 + supports_function_calling: true + - name: qwen/qwen-vl-plus + type: chat + max_input_tokens: 7500 + input_price: 0.21 + output_price: 0.63 + supports_vision: true + - name: qwen/qwen3-max + type: chat + max_input_tokens: 262144 + input_price: 1.2 + output_price: 6.0 + supports_function_calling: true + - name: qwen/qwen3-next-80b-a3b-instruct + type: chat + max_input_tokens: 262144 + input_price: 0.1 + output_price: 0.8 + supports_function_calling: true + - name: qwen/qwen3-next-80b-a3b-thinking + type: chat + max_input_tokens: 262144 + input_price: 0.1 + output_price: 0.8 + - name: qwen/qwen3-235b-a22b-2507 + type: chat + max_input_tokens: 262144 + input_price: 0.12 + output_price: 0.59 + supports_function_calling: true + - name: qwen/qwen3-235b-a22b-thinking-2507 + type: chat + max_input_tokens: 262144 + input_price: 0.118 + output_price: 0.118 + - name: qwen/qwen3-30b-a3b-instruct-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.2 + output_price: 0.8 + - name: qwen/qwen3-30b-a3b-thinking-2507 + type: chat + max_input_tokens: 262144 + input_price: 0.071 + output_price: 0.285 + - name: qwen/qwen3-coder-plus + type: chat + max_input_tokens: 128000 + input_price: 1.0 + output_price: 5.0 + supports_function_calling: true + - name: qwen/qwen3-coder-flash + type: chat + max_input_tokens: 128000 + input_price: 0.3 + output_price: 1.5 + supports_function_calling: true + - name: qwen/qwen3-coder-30b-a3b-instruct + type: chat + max_input_tokens: 262144 + input_price: 0.052 + output_price: 0.207 + supports_function_calling: true + - name: qwen/qwen-2.5-72b-instruct + type: chat + max_input_tokens: 131072 + input_price: 0.35 + output_price: 0.4 + supports_function_calling: true + - name: qwen/qwen2.5-vl-72b-instruct + type: chat + max_input_tokens: 32000 + input_price: 0.7 + output_price: 0.7 + supports_vision: true + - name: qwen/qwen-2.5-coder-32b-instruct + type: chat + max_input_tokens: 32768 + input_price: 0.18 + output_price: 0.18 + - name: moonshotai/kimi-k2-0905 + type: chat + max_input_tokens: 262144 + input_price: 0.296 + output_price: 1.185 + supports_function_calling: true + - name: moonshotai/kimi-dev-72b + type: chat + max_input_tokens: 131072 + input_price: 0.29 + output_price: 1.15 + supports_function_calling: true + - name: x-ai/grok-4 + type: chat + max_input_tokens: 256000 + input_price: 3.0 + output_price: 15.0 + supports_function_calling: true + - name: x-ai/grok-4-fast + type: chat + max_input_tokens: 2000000 + input_price: 0.2 + output_price: 0.5 + supports_function_calling: true + - name: x-ai/grok-code-fast-1 + type: chat + max_input_tokens: 256000 + input_price: 0.2 + output_price: 1.5 + supports_function_calling: true + - name: amazon/nova-pro-v1 + type: chat + max_input_tokens: 300000 + input_price: 0.8 + output_price: 3.2 + max_output_tokens: 5120 + supports_vision: true + - name: amazon/nova-lite-v1 + type: chat + max_input_tokens: 300000 + input_price: 0.06 + output_price: 0.24 + max_output_tokens: 5120 + supports_vision: true + - name: amazon/nova-micro-v1 + type: chat + max_input_tokens: 128000 + input_price: 0.035 + output_price: 0.14 + max_output_tokens: 5120 + - name: perplexity/sonar-pro + type: chat + max_input_tokens: 200000 + input_price: 3.0 + output_price: 15.0 + - name: perplexity/sonar + type: chat + max_input_tokens: 127072 + input_price: 1.0 + output_price: 1.0 + - name: perplexity/sonar-reasoning-pro + type: chat + max_input_tokens: 128000 + input_price: 2.0 + output_price: 8.0 + patch: + body: + include_reasoning: true + - name: perplexity/sonar-reasoning + type: chat + max_input_tokens: 127000 + input_price: 1.0 + output_price: 5.0 + patch: + body: + include_reasoning: true + - name: perplexity/sonar-deep-research + type: chat + max_input_tokens: 200000 + input_price: 2.0 + output_price: 8.0 + patch: + body: + include_reasoning: true + - name: minimax/minimax-01 + type: chat + max_input_tokens: 1000192 + input_price: 0.2 + output_price: 1.1 + - name: z-ai/glm-4.6 + type: chat + max_input_tokens: 202752 + input_price: 0.5 + output_price: 1.75 + supports_function_calling: true + - name: z-ai/glm-4.5 + type: chat + max_input_tokens: 131072 + input_price: 0.2 + output_price: 0.2 + supports_function_calling: true + - name: z-ai/glm-4.5-air + type: chat + max_input_tokens: 131072 + input_price: 0.2 + output_price: 1.1 + - name: z-ai/glm-4.5v + type: chat + max_input_tokens: 65536 + input_price: 0.5 + output_price: 1.7 + supports_vision: true +- provider: github + models: + - name: gpt-5 + type: chat + max_input_tokens: 400000 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-5-chat + type: chat + max_input_tokens: 400000 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-5-mini + type: chat + max_input_tokens: 400000 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-5-nano + type: chat + max_input_tokens: 400000 + max_output_tokens: 128000 + supports_vision: true + supports_function_calling: true + - name: gpt-4.1 + type: chat + max_input_tokens: 1047576 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: gpt-4.1-mini + type: chat + max_input_tokens: 1047576 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: gpt-4.1-nano + type: chat + max_input_tokens: 1047576 + max_output_tokens: 32768 + supports_vision: true + supports_function_calling: true + - name: gpt-4o + type: chat + max_input_tokens: 128000 + max_output_tokens: 16384 + supports_function_calling: true + - name: gpt-4o-mini + type: chat + max_input_tokens: 128000 + max_output_tokens: 16384 + supports_function_calling: true + - name: o4-mini + type: chat + max_input_tokens: 200000 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o4-mini-high + type: chat + real_name: o4-mini + max_input_tokens: 200000 + patch: + body: + reasoning_effort: high + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3 + type: chat + max_input_tokens: 200000 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3-high + type: chat + real_name: o3 + max_input_tokens: 200000 + patch: + body: + reasoning_effort: high + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3-mini + type: chat + max_input_tokens: 200000 + patch: + body: + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: o3-mini-high + type: chat + real_name: o3-mini + max_input_tokens: 200000 + patch: + body: + reasoning_effort: high + max_tokens: null + temperature: null + top_p: null + supports_vision: true + supports_function_calling: true + system_prompt_prefix: Formatting re-enabled + - name: text-embedding-3-large + type: embedding + max_tokens_per_chunk: 8191 + default_chunk_size: 2000 + max_batch_size: 100 + - name: text-embedding-3-small + type: embedding + max_tokens_per_chunk: 8191 + default_chunk_size: 2000 + max_batch_size: 100 + - name: llama-4-maverick-17b-128e-instruct-fp8 + type: chat + max_input_tokens: 1048576 + supports_vision: true + - name: llama-4-scout-17b-16e-instruct + type: chat + max_input_tokens: 327680 + supports_vision: true + - name: llama-3.3-70b-instruct + type: chat + max_input_tokens: 131072 + - name: mistral-medium-2505 + type: chat + max_input_tokens: 131072 + supports_function_calling: true + - name: mistral-small-2503 + type: chat + max_input_tokens: 131072 + supports_function_calling: true + - name: codestral-2501 + type: chat + max_input_tokens: 256000 + supports_function_calling: true + - name: cohere-embed-v3-english + type: embedding + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 96 + - name: cohere-embed-v3-multilingual + type: embedding + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 96 + - name: deepseek-r1-0528 + type: chat + max_input_tokens: 163840 + - name: deepseek-v3-0324 + type: chat + max_input_tokens: 163840 + - name: mai-ds-r1 + type: chat + max_input_tokens: 163840 + - name: phi-4 + type: chat + max_input_tokens: 16384 + - name: phi-4-mini-instruct + type: chat + max_input_tokens: 131072 + - name: phi-4-reasoning + type: chat + max_input_tokens: 33792 + - name: phi-4-mini-reasoning + type: chat + max_input_tokens: 131072 + - name: grok-3 + type: chat + max_input_tokens: 131072 + - name: grok-3-mini + type: chat + max_input_tokens: 131072 +- provider: deepinfra + models: + - name: openai/gpt-oss-120b + type: chat + max_input_tokens: 131072 + input_price: 0.09 + output_price: 0.45 + supports_function_calling: true + - name: openai/gpt-oss-20b + type: chat + max_input_tokens: 131072 + input_price: 0.04 + output_price: 0.16 + supports_function_calling: true + - name: meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8 + type: chat + max_input_tokens: 1048576 + input_price: 0.18 + output_price: 0.6 + supports_vision: true + - name: meta-llama/Llama-4-Scout-17B-16E-Instruct + type: chat + max_input_tokens: 327680 + input_price: 0.08 + output_price: 0.3 + supports_vision: true + - name: meta-llama/Llama-3.3-70B-Instruct + type: chat + max_input_tokens: 131072 + input_price: 0.23 + output_price: 0.4 + - name: Qwen/Qwen3-Next-80B-A3B-Instruct + type: chat + max_input_tokens: 262144 + input_price: 0.14 + output_price: 1.4 + supports_function_calling: true + - name: Qwen/Qwen3-Next-80B-A3B-Thinking + type: chat + max_input_tokens: 262144 + input_price: 0.14 + output_price: 1.4 + - name: Qwen/Qwen3-235B-A22B-Instruct-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.13 + output_price: 0.6 + supports_function_calling: true + - name: Qwen/Qwen3-235B-A22B-Thinking-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.13 + output_price: 0.6 + - name: Qwen/Qwen3-Coder-480B-A35B-Instruct + type: chat + max_input_tokens: 131072 + input_price: 0.4 + output_price: 1.6 + supports_function_calling: true + - name: Qwen/Qwen3-Coder-30B-A3B-Instruct + type: chat + max_input_tokens: 262144 + input_price: 0.07 + output_price: 0.27 + supports_function_calling: true + - name: Qwen/Qwen3-235B-A22B + type: chat + max_input_tokens: 40960 + input_price: 0.15 + output_price: 0.6 + - name: Qwen/Qwen3-30B-A3B + type: chat + max_input_tokens: 40960 + input_price: 0.1 + output_price: 0.3 + - name: Qwen/Qwen3-32B + type: chat + max_input_tokens: 40960 + input_price: 0.1 + output_price: 0.3 + - name: Qwen/Qwen2.5-72B-Instruct + type: chat + max_input_tokens: 32768 + input_price: 0.23 + output_price: 0.4 + supports_function_calling: true + - name: Qwen/Qwen2.5-Coder-32B-Instruct + type: chat + max_input_tokens: 32768 + input_price: 0.07 + output_price: 0.16 + - name: deepseek-ai/DeepSeek-V3.2-Exp + type: chat + max_input_tokens: 163840 + input_price: 0.27 + output_price: 0.4 + - name: deepseek-ai/DeepSeek-V3.1-Terminus + type: chat + max_input_tokens: 163840 + input_price: 0.27 + output_price: 1.0 + - name: deepseek-ai/DeepSeek-V3.1 + type: chat + max_input_tokens: 163840 + input_price: 0.3 + output_price: 1.0 + - name: deepseek-ai/DeepSeek-R1-0528 + type: chat + max_input_tokens: 163840 + input_price: 0.5 + output_price: 2.15 + - name: google/gemma-3-27b-it + type: chat + max_input_tokens: 131072 + input_price: 0.1 + output_price: 0.2 + - name: mistralai/Mistral-Small-3.2-24B-Instruct-2506 + type: chat + max_input_tokens: 32768 + input_price: 0.06 + output_price: 0.12 + - name: mistralai/Devstral-Small-2507 + type: chat + max_input_tokens: 131072 + input_price: 0.07 + output_price: 0.28 + - name: moonshotai/Kimi-K2-Instruct-0905 + type: chat + max_input_tokens: 262144 + input_price: 0.5 + output_price: 2.0 + supports_function_calling: true + - name: zai-org/GLM-4.6 + type: chat + max_input_tokens: 202752 + input_price: 0.6 + output_price: 1.9 + supports_function_calling: true + - name: zai-org/GLM-4.5 + type: chat + max_input_tokens: 131072 + input_price: 0.55 + output_price: 2.0 + supports_function_calling: true + - name: zai-org/GLM-4.5-Air + type: chat + max_input_tokens: 131072 + input_price: 0.2 + output_price: 1.1 + supports_function_calling: true + - name: zai-org/GLM-4.5V + type: chat + max_input_tokens: 65536 + input_price: 0.5 + output_price: 1.7 + supports_vision: true + - name: BAAI/bge-large-en-v1.5 + type: embedding + input_price: 0.01 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 100 + - name: BAAI/bge-m3 + type: embedding + input_price: 0.01 + max_tokens_per_chunk: 8192 + default_chunk_size: 2000 + max_batch_size: 100 + - name: intfloat/e5-large-v2 + type: embedding + input_price: 0.01 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 100 + - name: intfloat/multilingual-e5-large + type: embedding + input_price: 0.01 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 100 + - name: thenlper/gte-large + type: embedding + input_price: 0.01 + max_tokens_per_chunk: 512 + default_chunk_size: 1000 + max_batch_size: 100 +- provider: jina + models: + - name: jina-embeddings-v3 + type: embedding + input_price: 0.0 + max_tokens_per_chunk: 8192 + default_chunk_size: 2000 + max_batch_size: 100 + - name: jina-clip-v2 + type: embedding + input_price: 0.0 + max_tokens_per_chunk: 8192 + default_chunk_size: 1500 + max_batch_size: 100 + - name: jina-colbert-v2 + type: embedding + input_price: 0.0 + max_tokens_per_chunk: 8192 + default_chunk_size: 1500 + max_batch_size: 100 + - name: jina-reranker-v2-base-multilingual + type: reranker + max_input_tokens: 8192 + input_price: 0.0 + - name: jina-colbert-v2 + type: reranker + max_input_tokens: 8192 + input_price: 0.0 +- provider: voyageai + models: + - name: voyage-3-large + type: embedding + max_input_tokens: 120000 + input_price: 0.18 + max_tokens_per_chunk: 32000 + default_chunk_size: 2000 + max_batch_size: 128 + - name: voyage-3 + type: embedding + max_input_tokens: 320000 + input_price: 0.06 + max_tokens_per_chunk: 32000 + default_chunk_size: 2000 + max_batch_size: 128 + - name: voyage-3-lite + type: embedding + max_input_tokens: 1000000 + input_price: 0.02 + max_tokens_per_chunk: 32000 + default_chunk_size: 1000 + max_batch_size: 128 + - name: rerank-2 + type: reranker + max_input_tokens: 16000 + input_price: 0.05 + - name: rerank-2-lite + type: reranker + max_input_tokens: 8000 + input_price: 0.02 diff --git a/aichat/.config/aichat/roles/cloudops.md b/aichat/.config/aichat/roles/cloudops.md index 0e53d07..466794b 100644 --- a/aichat/.config/aichat/roles/cloudops.md +++ b/aichat/.config/aichat/roles/cloudops.md @@ -1,10 +1,12 @@ I want you to act as a UNIX shell expert and senior software engineer. -You are working in an environment with services using Amazon Web Services (AWS), including EKS, ALB, VPC, Transit Gateways. -Tools you are currently using include Terraform, git (Github), the AWS CLI, kubectl, `jq`, `yy`. +You are working in an environment with services using Amazon Web Services +(AWS), including EKS, ALB, VPC, Transit Gateways. Tools you are currently +using include Terraform, git (Github), the AWS CLI, kubectl, `jq`, `yy`. You are a Go program language expert. -Explanations should be terse. +Explanations should be terse. Do not include emojis in responses. + +If relevant, include fenced code blocks as part of your response. -Please include relevant fenced code blocks as part of your response. diff --git a/aichat/.config/aichat/sessions/ec2.yaml b/aichat/.config/aichat/sessions/ec2.yaml new file mode 100644 index 0000000..5d79711 --- /dev/null +++ b/aichat/.config/aichat/sessions/ec2.yaml @@ -0,0 +1,13 @@ +model: claude:claude-sonnet-4-5-20250929 +messages: +- role: user + content: |- + I have an AWS EC2 instance with a web service. I wish to have an ALB communicate with this instance using TLS and a self-signed cert. Please write a cloud-init script which uses openssl to create this certificate and update permissions when the instance boots. Here's an example openssl invocation: `openssl req -x509 -newkey rsa:4096 -nodes -sha256 -keyout ec2.key -out ec2.crt -days 365 \ + -subj "/C=US/ST=State/L=City/O=Org/CN=ec2-1-2-3-4.us-east-1.compute.amazonaws.com" + ` +- role: assistant + content: "Here's a cloud-init script that generates a self-signed certificate with the correct hostname for your EC2 instance:\n\n```yaml\n#cloud-config\n\nwrite_files:\n - path: /usr/local/bin/generate-ssl-cert.sh\n permissions: '0755'\n content: |\n #!/bin/bash\n set -e\n \n # Get instance metadata\n TOKEN=$(curl -X PUT \"http://169.254.169.254/latest/api/token\" -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\")\n INSTANCE_ID=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/instance-id)\n AVAILABILITY_ZONE=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/placement/availability-zone)\n REGION=$(echo $AVAILABILITY_ZONE | sed 's/[a-z]$//')\n PUBLIC_HOSTNAME=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/public-hostname)\n PRIVATE_IP=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/local-ipv4)\n \n # Certificate directory\n CERT_DIR=\"/etc/ssl/private\"\n mkdir -p $CERT_DIR\n \n # Generate certificate\n openssl req -x509 -newkey rsa:4096 -nodes -sha256 \\\n -keyout $CERT_DIR/ec2.key \\\n -out $CERT_DIR/ec2.crt \\\n -days 365 \\\n -subj \"/C=US/ST=State/L=City/O=MyOrg/CN=$PUBLIC_HOSTNAME\" \\\n -addext \"subjectAltName=DNS:$PUBLIC_HOSTNAME,DNS:$INSTANCE_ID,IP:$PRIVATE_IP\"\n \n # Set proper permissions\n chmod 600 $CERT_DIR/ec2.key\n chmod 644 $CERT_DIR/ec2.crt\n chown root:root $CERT_DIR/ec2.key $CERT_DIR/ec2.crt\n \n echo \"Certificate generated successfully:\"\n echo \" Certificate: $CERT_DIR/ec2.crt\"\n echo \" Private Key: $CERT_DIR/ec2.key\"\n echo \" Hostname: $PUBLIC_HOSTNAME\"\n\nruncmd:\n - /usr/local/bin/generate-ssl-cert.sh\n - systemctl restart your-web-service # Replace with your actual service name\n\n```\n\n**Key features:**\n\n1. **Automatic hostname detection** - Uses EC2 instance metadata to get the correct public hostname\n2. **Subject Alternative Names (SAN)** - Includes the public hostname, instance ID, and private IP for flexibility\n3. **Secure permissions** - Private key is readable only by root (600), certificate is world-readable (644)\n4. **Certificate location** - Stores certs in `/etc/ssl/private/`\n\n**To use this:**\n\n1. Replace `your-web-service` with your actual service name (e.g., `nginx`, `apache2`, `httpd`)\n2. Configure your web service to use:\n - Certificate: `/etc/ssl/private/ec2.crt`\n - Private Key: `/etc/ssl/private/ec2.key`\n\n**For ALB target group configuration:**\n\n- Set the protocol to **HTTPS**\n- Set the health check protocol to **HTTPS**\n- The ALB won't validate the self-signed certificate by default when connecting to targets, but ensure your application is listening on the correct port with TLS enabled\n\n**Optional: If you need to restart multiple services:**\n\n```yaml\nruncmd:\n - /usr/local/bin/generate-ssl-cert.sh\n - systemctl restart nginx\n - systemctl restart your-app\n```" +- role: user + content: I wish to use terraform to provision the EC2 instance. Please provide the TF to create the instance and incorporate the cloud-init script.` +- role: assistant + content: "Here's a complete Terraform configuration to provision the EC2 instance with the cloud-init script:\n\n```hcl\n# variables.tf\nvariable \"vpc_id\" {\n description = \"VPC ID where the instance will be launched\"\n type = string\n}\n\nvariable \"subnet_id\" {\n description = \"Subnet ID where the instance will be launched\"\n type = string\n}\n\nvariable \"instance_type\" {\n description = \"EC2 instance type\"\n type = string\n default = \"t3.small\"\n}\n\nvariable \"ami_id\" {\n description = \"AMI ID for the EC2 instance (leave empty for latest Amazon Linux 2023)\"\n type = string\n default = \"\"\n}\n\nvariable \"key_name\" {\n description = \"SSH key pair name\"\n type = string\n default = \"\"\n}\n\nvariable \"allowed_cidr_blocks\" {\n description = \"CIDR blocks allowed to access the instance\"\n type = list(string)\n default = [\"10.0.0.0/8\"] # Adjust for your VPC/ALB security group\n}\n\n# data.tf\ndata \"aws_ami\" \"amazon_linux_2023\" {\n most_recent = true\n owners = [\"amazon\"]\n\n filter {\n name = \"name\"\n values = [\"al2023-ami-*-x86_64\"]\n }\n\n filter {\n name = \"virtualization-type\"\n values = [\"hvm\"]\n }\n}\n\n# cloud-init.yaml (embedded as template)\nlocals {\n cloud_init = <<-EOF\n #cloud-config\n \n write_files:\n - path: /usr/local/bin/generate-ssl-cert.sh\n permissions: '0755'\n content: |\n #!/bin/bash\n set -e\n \n # Get instance metadata\n TOKEN=$(curl -X PUT \"http://169.254.169.254/latest/api/token\" -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\")\n INSTANCE_ID=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/instance-id)\n AVAILABILITY_ZONE=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/placement/availability-zone)\n REGION=$(echo $AVAILABILITY_ZONE | sed 's/[a-z]$//')\n PUBLIC_HOSTNAME=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/public-hostname)\n PRIVATE_IP=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/local-ipv4)\n \n # Certificate directory\n CERT_DIR=\"/etc/ssl/private\"\n mkdir -p $CERT_DIR\n \n # Generate certificate\n openssl req -x509 -newkey rsa:4096 -nodes -sha256 \\\n -keyout $CERT_DIR/ec2.key \\\n -out $CERT_DIR/ec2.crt \\\n -days 365 \\\n -subj \"/C=US/ST=State/L=City/O=MyOrg/CN=$PUBLIC_HOSTNAME\" \\\n -addext \"subjectAltName=DNS:$PUBLIC_HOSTNAME,DNS:$INSTANCE_ID,IP:$PRIVATE_IP\"\n \n # Set proper permissions\n chmod 600 $CERT_DIR/ec2.key\n chmod 644 $CERT_DIR/ec2.crt\n chown root:root $CERT_DIR/ec2.key $CERT_DIR/ec2.crt\n \n echo \"Certificate generated successfully:\"\n echo \" Certificate: $CERT_DIR/ec2.crt\"\n echo \" Private Key: $CERT_DIR/ec2.key\"\n echo \" Hostname: $PUBLIC_HOSTNAME\"\n \n # Log output\n echo \"Certificate generation completed at $(date)\" >> /var/log/ssl-cert-generation.log\n \n runcmd:\n - /usr/local/bin/generate-ssl-cert.sh\n # - systemctl restart your-web-service # Uncomment and replace with your service name\n \n output:\n all: '| tee -a /var/log/cloud-init-output.log'\n EOF\n}\n\n# security_group.tf\nresource \"aws_security_group\" \"web_server\" {\n name_description = \"Security group for web server with TLS\"\n description = \"Allow HTTPS traffic from ALB\"\n vpc_id = var.vpc_id\n\n ingress {\n description = \"HTTPS from ALB\"\n from_port = 443\n to_port = 443\n protocol = \"tcp\"\n cidr_blocks = var.allowed_cidr_blocks\n }\n\n ingress {\n description = \"HTTP from ALB (optional)\"\n from_port = 80\n to_port = 80\n protocol = \"tcp\"\n cidr_blocks = var.allowed_cidr_blocks\n }\n\n ingress {\n description = \"SSH access (optional)\"\n from_port = 22\n to_port = 22\n protocol = \"tcp\"\n cidr_blocks = var.allowed_cidr_blocks\n }\n\n egress {\n description = \"Allow all outbound traffic\"\n from_port = 0\n to_port = 0\n protocol = \"-1\"\n cidr_blocks = [\"0.0.0.0/0\"]\n }\n\n tags = {\n Name = \"web-server-sg\"\n }\n}\n\n# iam.tf\nresource \"aws_iam_role\" \"ec2_role\" {\n name = \"ec2-web-server-role\"\n\n assume_role_policy = jsonencode({\n Version = \"2012-10-17\"\n Statement = [\n {\n Action = \"sts:AssumeRole\"\n Effect = \"Allow\"\n Principal = {\n Service = \"ec2.amazonaws.com\"\n }\n }\n ]\n })\n\n tags = {\n Name = \"ec2-web-server-role\"\n }\n}\n\nresource \"aws_iam_role_policy_attachment\" \"ssm_policy\" {\n role = aws_iam_role.ec2_role.name\n policy_arn = \"arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore\"\n}\n\nresource \"aws_iam_instance_profile\" \"ec2_profile\" {\n name = \"ec2-web-server-profile\"\n role = aws_iam_role.ec2_role.name\n}\n\n# main.tf\nresource \"aws_instance\" \"web_server\" {\n ami = var.ami_id != \"\" ? var.ami_id : data.aws_ami.amazon_linux_2023.id\n instance_type = var.instance_type\n subnet_id = var.subnet_id\n vpc_security_group_ids = [aws_security_group.web_server.id]\n iam_instance_profile = aws_iam_instance_profile.ec2_profile.name\n key_name = var.key_name != \"\" ? var.key_name : null\n\n user_data = local.cloud_init\n\n metadata_options {\n http_endpoint = \"enabled\"\n http_tokens = \"required\" # IMDSv2\n http_put_response_hop_limit = 1\n }\n\n root_block_device {\n volume_type = \"gp3\"\n volume_size = 20\n delete_on_termination = true\n encrypted = true\n }\n\n tags = {\n Name = \"web-server-with-tls\"\n }\n\n lifecycle {\n create_before_destroy = true\n }\n}\n\n# outputs.tf\noutput \"instance_id\" {\n description = \"EC2 instance ID\"\n value = aws_instance.web_server.id\n}\n\noutput \"private_ip\" {\n description = \"Private IP address\"\n value = aws_instance.web_server.private_ip\n}\n\noutput \"public_ip\" {\n description = \"Public IP address\"\n value = aws_instance.web_server.public_ip\n}\n\noutput \"public_dns\" {\n description = \"Public DNS name\"\n value = aws_instance.web_server.public_dns\n}\n\noutput \"security_group_id\" {\n description = \"Security group ID\"\n value = aws_security_group.web_server.id\n}\n\noutput \"certificate_location\" {\n description = \"Location of the generated certificate\"\n value = \"/etc/ssl/private/ec2.crt\"\n}\n\noutput \"private_key_location\" {\n description = \"Location of the generated private key\"\n value = \"/etc/ssl/private/ec2.key\"\n}\n```\n\n**terraform.tfvars example:**\n\n```hcl\nvpc_id = \"vpc-xxxxx\"\nsubnet_id = \"subnet-xxxxx\"\ninstance_type = \"t3.small\"\nkey_name = \"my-key-pair\" # Optional\nallowed_cidr_blocks = [\"10.0.0.0/16\"] # Your VPC CIDR or ALB security group\n```\n\n**Usage:**\n\n```bash\n# Initialize Terraform\nterraform init\n\n# Plan the deployment\nterraform plan\n\n# Apply the configuration\nterraform apply\n\n# Get outputs\nterraform output\n```\n\n**To verify the certificate was generated:**\n\n```bash\n# SSH into the instance\nssh -i your-key.pem ec2-user@\n\n# Check certificate\nsudo ls -la /etc/ssl/private/\nsudo openssl x509 -in /etc/ssl/private/ec2.crt -text -noout\n\n# Check cloud-init logs\nsudo cat /var/log/cloud-init-output.log\nsudo cat /var/log/ssl-cert-generation.log\n```\n\n**Key features:**\n\n- Uses IMDSv2 for enhanced security\n- Includes IAM role for SSM access (optional SSH-less access)\n- Encrypted root volume\n- Outputs all necessary information\n- Security group configured for ALB communication\n- Automatic AMI selection (latest Amazon Linux 2023)\n\n**Next steps:** Configure your ALB target group to point to this instance on port 443 (HTTPS)." diff --git a/aichat/.config/aichat/sessions/temp.yaml b/aichat/.config/aichat/sessions/temp.yaml new file mode 100644 index 0000000..5d79711 --- /dev/null +++ b/aichat/.config/aichat/sessions/temp.yaml @@ -0,0 +1,13 @@ +model: claude:claude-sonnet-4-5-20250929 +messages: +- role: user + content: |- + I have an AWS EC2 instance with a web service. I wish to have an ALB communicate with this instance using TLS and a self-signed cert. Please write a cloud-init script which uses openssl to create this certificate and update permissions when the instance boots. Here's an example openssl invocation: `openssl req -x509 -newkey rsa:4096 -nodes -sha256 -keyout ec2.key -out ec2.crt -days 365 \ + -subj "/C=US/ST=State/L=City/O=Org/CN=ec2-1-2-3-4.us-east-1.compute.amazonaws.com" + ` +- role: assistant + content: "Here's a cloud-init script that generates a self-signed certificate with the correct hostname for your EC2 instance:\n\n```yaml\n#cloud-config\n\nwrite_files:\n - path: /usr/local/bin/generate-ssl-cert.sh\n permissions: '0755'\n content: |\n #!/bin/bash\n set -e\n \n # Get instance metadata\n TOKEN=$(curl -X PUT \"http://169.254.169.254/latest/api/token\" -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\")\n INSTANCE_ID=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/instance-id)\n AVAILABILITY_ZONE=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/placement/availability-zone)\n REGION=$(echo $AVAILABILITY_ZONE | sed 's/[a-z]$//')\n PUBLIC_HOSTNAME=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/public-hostname)\n PRIVATE_IP=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/local-ipv4)\n \n # Certificate directory\n CERT_DIR=\"/etc/ssl/private\"\n mkdir -p $CERT_DIR\n \n # Generate certificate\n openssl req -x509 -newkey rsa:4096 -nodes -sha256 \\\n -keyout $CERT_DIR/ec2.key \\\n -out $CERT_DIR/ec2.crt \\\n -days 365 \\\n -subj \"/C=US/ST=State/L=City/O=MyOrg/CN=$PUBLIC_HOSTNAME\" \\\n -addext \"subjectAltName=DNS:$PUBLIC_HOSTNAME,DNS:$INSTANCE_ID,IP:$PRIVATE_IP\"\n \n # Set proper permissions\n chmod 600 $CERT_DIR/ec2.key\n chmod 644 $CERT_DIR/ec2.crt\n chown root:root $CERT_DIR/ec2.key $CERT_DIR/ec2.crt\n \n echo \"Certificate generated successfully:\"\n echo \" Certificate: $CERT_DIR/ec2.crt\"\n echo \" Private Key: $CERT_DIR/ec2.key\"\n echo \" Hostname: $PUBLIC_HOSTNAME\"\n\nruncmd:\n - /usr/local/bin/generate-ssl-cert.sh\n - systemctl restart your-web-service # Replace with your actual service name\n\n```\n\n**Key features:**\n\n1. **Automatic hostname detection** - Uses EC2 instance metadata to get the correct public hostname\n2. **Subject Alternative Names (SAN)** - Includes the public hostname, instance ID, and private IP for flexibility\n3. **Secure permissions** - Private key is readable only by root (600), certificate is world-readable (644)\n4. **Certificate location** - Stores certs in `/etc/ssl/private/`\n\n**To use this:**\n\n1. Replace `your-web-service` with your actual service name (e.g., `nginx`, `apache2`, `httpd`)\n2. Configure your web service to use:\n - Certificate: `/etc/ssl/private/ec2.crt`\n - Private Key: `/etc/ssl/private/ec2.key`\n\n**For ALB target group configuration:**\n\n- Set the protocol to **HTTPS**\n- Set the health check protocol to **HTTPS**\n- The ALB won't validate the self-signed certificate by default when connecting to targets, but ensure your application is listening on the correct port with TLS enabled\n\n**Optional: If you need to restart multiple services:**\n\n```yaml\nruncmd:\n - /usr/local/bin/generate-ssl-cert.sh\n - systemctl restart nginx\n - systemctl restart your-app\n```" +- role: user + content: I wish to use terraform to provision the EC2 instance. Please provide the TF to create the instance and incorporate the cloud-init script.` +- role: assistant + content: "Here's a complete Terraform configuration to provision the EC2 instance with the cloud-init script:\n\n```hcl\n# variables.tf\nvariable \"vpc_id\" {\n description = \"VPC ID where the instance will be launched\"\n type = string\n}\n\nvariable \"subnet_id\" {\n description = \"Subnet ID where the instance will be launched\"\n type = string\n}\n\nvariable \"instance_type\" {\n description = \"EC2 instance type\"\n type = string\n default = \"t3.small\"\n}\n\nvariable \"ami_id\" {\n description = \"AMI ID for the EC2 instance (leave empty for latest Amazon Linux 2023)\"\n type = string\n default = \"\"\n}\n\nvariable \"key_name\" {\n description = \"SSH key pair name\"\n type = string\n default = \"\"\n}\n\nvariable \"allowed_cidr_blocks\" {\n description = \"CIDR blocks allowed to access the instance\"\n type = list(string)\n default = [\"10.0.0.0/8\"] # Adjust for your VPC/ALB security group\n}\n\n# data.tf\ndata \"aws_ami\" \"amazon_linux_2023\" {\n most_recent = true\n owners = [\"amazon\"]\n\n filter {\n name = \"name\"\n values = [\"al2023-ami-*-x86_64\"]\n }\n\n filter {\n name = \"virtualization-type\"\n values = [\"hvm\"]\n }\n}\n\n# cloud-init.yaml (embedded as template)\nlocals {\n cloud_init = <<-EOF\n #cloud-config\n \n write_files:\n - path: /usr/local/bin/generate-ssl-cert.sh\n permissions: '0755'\n content: |\n #!/bin/bash\n set -e\n \n # Get instance metadata\n TOKEN=$(curl -X PUT \"http://169.254.169.254/latest/api/token\" -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\")\n INSTANCE_ID=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/instance-id)\n AVAILABILITY_ZONE=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/placement/availability-zone)\n REGION=$(echo $AVAILABILITY_ZONE | sed 's/[a-z]$//')\n PUBLIC_HOSTNAME=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/public-hostname)\n PRIVATE_IP=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/local-ipv4)\n \n # Certificate directory\n CERT_DIR=\"/etc/ssl/private\"\n mkdir -p $CERT_DIR\n \n # Generate certificate\n openssl req -x509 -newkey rsa:4096 -nodes -sha256 \\\n -keyout $CERT_DIR/ec2.key \\\n -out $CERT_DIR/ec2.crt \\\n -days 365 \\\n -subj \"/C=US/ST=State/L=City/O=MyOrg/CN=$PUBLIC_HOSTNAME\" \\\n -addext \"subjectAltName=DNS:$PUBLIC_HOSTNAME,DNS:$INSTANCE_ID,IP:$PRIVATE_IP\"\n \n # Set proper permissions\n chmod 600 $CERT_DIR/ec2.key\n chmod 644 $CERT_DIR/ec2.crt\n chown root:root $CERT_DIR/ec2.key $CERT_DIR/ec2.crt\n \n echo \"Certificate generated successfully:\"\n echo \" Certificate: $CERT_DIR/ec2.crt\"\n echo \" Private Key: $CERT_DIR/ec2.key\"\n echo \" Hostname: $PUBLIC_HOSTNAME\"\n \n # Log output\n echo \"Certificate generation completed at $(date)\" >> /var/log/ssl-cert-generation.log\n \n runcmd:\n - /usr/local/bin/generate-ssl-cert.sh\n # - systemctl restart your-web-service # Uncomment and replace with your service name\n \n output:\n all: '| tee -a /var/log/cloud-init-output.log'\n EOF\n}\n\n# security_group.tf\nresource \"aws_security_group\" \"web_server\" {\n name_description = \"Security group for web server with TLS\"\n description = \"Allow HTTPS traffic from ALB\"\n vpc_id = var.vpc_id\n\n ingress {\n description = \"HTTPS from ALB\"\n from_port = 443\n to_port = 443\n protocol = \"tcp\"\n cidr_blocks = var.allowed_cidr_blocks\n }\n\n ingress {\n description = \"HTTP from ALB (optional)\"\n from_port = 80\n to_port = 80\n protocol = \"tcp\"\n cidr_blocks = var.allowed_cidr_blocks\n }\n\n ingress {\n description = \"SSH access (optional)\"\n from_port = 22\n to_port = 22\n protocol = \"tcp\"\n cidr_blocks = var.allowed_cidr_blocks\n }\n\n egress {\n description = \"Allow all outbound traffic\"\n from_port = 0\n to_port = 0\n protocol = \"-1\"\n cidr_blocks = [\"0.0.0.0/0\"]\n }\n\n tags = {\n Name = \"web-server-sg\"\n }\n}\n\n# iam.tf\nresource \"aws_iam_role\" \"ec2_role\" {\n name = \"ec2-web-server-role\"\n\n assume_role_policy = jsonencode({\n Version = \"2012-10-17\"\n Statement = [\n {\n Action = \"sts:AssumeRole\"\n Effect = \"Allow\"\n Principal = {\n Service = \"ec2.amazonaws.com\"\n }\n }\n ]\n })\n\n tags = {\n Name = \"ec2-web-server-role\"\n }\n}\n\nresource \"aws_iam_role_policy_attachment\" \"ssm_policy\" {\n role = aws_iam_role.ec2_role.name\n policy_arn = \"arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore\"\n}\n\nresource \"aws_iam_instance_profile\" \"ec2_profile\" {\n name = \"ec2-web-server-profile\"\n role = aws_iam_role.ec2_role.name\n}\n\n# main.tf\nresource \"aws_instance\" \"web_server\" {\n ami = var.ami_id != \"\" ? var.ami_id : data.aws_ami.amazon_linux_2023.id\n instance_type = var.instance_type\n subnet_id = var.subnet_id\n vpc_security_group_ids = [aws_security_group.web_server.id]\n iam_instance_profile = aws_iam_instance_profile.ec2_profile.name\n key_name = var.key_name != \"\" ? var.key_name : null\n\n user_data = local.cloud_init\n\n metadata_options {\n http_endpoint = \"enabled\"\n http_tokens = \"required\" # IMDSv2\n http_put_response_hop_limit = 1\n }\n\n root_block_device {\n volume_type = \"gp3\"\n volume_size = 20\n delete_on_termination = true\n encrypted = true\n }\n\n tags = {\n Name = \"web-server-with-tls\"\n }\n\n lifecycle {\n create_before_destroy = true\n }\n}\n\n# outputs.tf\noutput \"instance_id\" {\n description = \"EC2 instance ID\"\n value = aws_instance.web_server.id\n}\n\noutput \"private_ip\" {\n description = \"Private IP address\"\n value = aws_instance.web_server.private_ip\n}\n\noutput \"public_ip\" {\n description = \"Public IP address\"\n value = aws_instance.web_server.public_ip\n}\n\noutput \"public_dns\" {\n description = \"Public DNS name\"\n value = aws_instance.web_server.public_dns\n}\n\noutput \"security_group_id\" {\n description = \"Security group ID\"\n value = aws_security_group.web_server.id\n}\n\noutput \"certificate_location\" {\n description = \"Location of the generated certificate\"\n value = \"/etc/ssl/private/ec2.crt\"\n}\n\noutput \"private_key_location\" {\n description = \"Location of the generated private key\"\n value = \"/etc/ssl/private/ec2.key\"\n}\n```\n\n**terraform.tfvars example:**\n\n```hcl\nvpc_id = \"vpc-xxxxx\"\nsubnet_id = \"subnet-xxxxx\"\ninstance_type = \"t3.small\"\nkey_name = \"my-key-pair\" # Optional\nallowed_cidr_blocks = [\"10.0.0.0/16\"] # Your VPC CIDR or ALB security group\n```\n\n**Usage:**\n\n```bash\n# Initialize Terraform\nterraform init\n\n# Plan the deployment\nterraform plan\n\n# Apply the configuration\nterraform apply\n\n# Get outputs\nterraform output\n```\n\n**To verify the certificate was generated:**\n\n```bash\n# SSH into the instance\nssh -i your-key.pem ec2-user@\n\n# Check certificate\nsudo ls -la /etc/ssl/private/\nsudo openssl x509 -in /etc/ssl/private/ec2.crt -text -noout\n\n# Check cloud-init logs\nsudo cat /var/log/cloud-init-output.log\nsudo cat /var/log/ssl-cert-generation.log\n```\n\n**Key features:**\n\n- Uses IMDSv2 for enhanced security\n- Includes IAM role for SSM access (optional SSH-less access)\n- Encrypted root volume\n- Outputs all necessary information\n- Security group configured for ALB communication\n- Automatic AMI selection (latest Amazon Linux 2023)\n\n**Next steps:** Configure your ALB target group to point to this instance on port 443 (HTTPS)."