Skip to content

feat(cloud): add tri cloud api-check test in CI — validate model routing #147

Description

@gHashTag

Task

Add a CI step in .github/workflows/agent-spawn.yml that runs tri cloud api-check before spawning.

Acceptance Criteria

  • Add a step before 'Spawn container via Railway API' that validates the API key
  • If api-check fails (model mismatch), abort spawn with clear error message
  • The step should use the same ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL env vars

Files to edit

  • .github/workflows/agent-spawn.yml — add validation step

Concrete implementation

Add this step before the spawn step:

- name: Validate API key
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
    ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}
  run: |
    RESPONSE=$(curl -s "${ANTHROPIC_BASE_URL}/v1/messages" \
      -H "x-api-key: ${ANTHROPIC_API_KEY}" \
      -H "anthropic-version: 2023-06-01" \
      -H "Content-Type: application/json" \
      -d '{"model":"glm-5","max_tokens":10,"messages":[{"role":"user","content":"hi"}]}')
    MODEL=$(echo "$RESPONSE" | jq -r '.model // "error"')
    echo "API returned model: $MODEL"
    if [ "$MODEL" = "error" ]; then
      echo "::error::API key validation failed"
      exit 1
    fi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions